-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVerifyOtpActivity.java
More file actions
130 lines (103 loc) · 3.82 KB
/
Copy pathVerifyOtpActivity.java
File metadata and controls
130 lines (103 loc) · 3.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package com.example.trip_packer;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import android.widget.TextView;
public class VerifyOtpActivity extends AppCompatActivity {
private EditText inputcode1,inputcode2,inputcode3,inputcode4,inputcode5,inputcode6;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_verify_otp);
TextView textMobile=findViewById(R.id.textMobile);
textMobile.setText(String.format("+91-%s",getIntent().getStringExtra("mobile")
));
inputcode1=findViewById(R.id.inputcode1);
inputcode2=findViewById(R.id.inputcode2);
inputcode3=findViewById(R.id.inputcode3);
inputcode4=findViewById(R.id.inputcode4);
inputcode5=findViewById(R.id.inputcode5);
inputcode6=findViewById(R.id.inputcode6);
setupOTPInputs();
}
private void setupOTPInputs()
{
inputcode1.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if(!charSequence.toString().trim().isEmpty())
{
inputcode2.requestFocus();
}
}
@Override
public void afterTextChanged(Editable editable) {
}
});
inputcode2.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if(!charSequence.toString().trim().isEmpty())
{
inputcode3.requestFocus();
}
}
@Override
public void afterTextChanged(Editable editable) {
}
});
inputcode3.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if(!charSequence.toString().trim().isEmpty())
{
inputcode4.requestFocus();
}
}
@Override
public void afterTextChanged(Editable editable) {
}
});
inputcode4.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if(!charSequence.toString().trim().isEmpty())
{
inputcode5.requestFocus();
}
}
@Override
public void afterTextChanged(Editable editable) {
}
});
inputcode5.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if(!charSequence.toString().trim().isEmpty())
{
inputcode6.requestFocus();
}
}
@Override
public void afterTextChanged(Editable editable) {
}
});
}
}