Mobile number and otp validation changes

parent d46aa5a5
...@@ -81,18 +81,16 @@ public class OtpValidationActivity extends Activity { ...@@ -81,18 +81,16 @@ public class OtpValidationActivity extends Activity {
ButterKnife.bind(this); ButterKnife.bind(this);
mApplication = (CatalogueApplication) getApplication(); mApplication = (CatalogueApplication) getApplication();
// new LoginDetailsSendToServer().execute(); // new LoginDetailsSendToServer().execute();
} }
@OnClick(R.id.otp_screen_text_view) @OnClick(R.id.otp_screen_text_view)
void onLoginClicked() { void onLoginClicked() {
callOtpAPI(); callOtpAPI();
} }
@OnClick(R.id.otp_screen_validate_text_view) @OnClick(R.id.otp_screen_validate_text_view)
void onValidateClicked(){ void onValidateClicked(){
callValidateOtpAPI(); callValidateOtpAPI();
} }
...@@ -101,7 +99,7 @@ public class OtpValidationActivity extends Activity { ...@@ -101,7 +99,7 @@ public class OtpValidationActivity extends Activity {
phoneString = mPhoneEditText.getText().toString().trim(); phoneString = mPhoneEditText.getText().toString().trim();
if (TextUtils.isEmpty(phoneString)) { if (TextUtils.isEmpty(phoneString)) {
mPhoneEditText.setError(getResources().getString(R.string.phone_error)); mPhoneEditText.setError(getResources().getString(R.string.phone_no_error));
} else if (!TextUtils.isEmpty(phoneString) && phoneString.length() >= 10 && phoneString.length() <=20) { } else if (!TextUtils.isEmpty(phoneString) && phoneString.length() >= 10 && phoneString.length() <=20) {
KeyboardUtil.hideKeyboard(OtpValidationActivity.this); KeyboardUtil.hideKeyboard(OtpValidationActivity.this);
if (mApplication.isNetConnected()) { if (mApplication.isNetConnected()) {
...@@ -153,12 +151,10 @@ public class OtpValidationActivity extends Activity { ...@@ -153,12 +151,10 @@ public class OtpValidationActivity extends Activity {
public void onDoneApiCall(String message) { public void onDoneApiCall(String message) {
apiMessage = message; apiMessage = message;
apiStatus = 1; apiStatus = 1;
} }
@Override @Override
public void onFailApiCall(String message) { public void onFailApiCall(String message) {
apiMessage = message; apiMessage = message;
apiStatus = 0; apiStatus = 0;
} }
...@@ -180,7 +176,6 @@ public class OtpValidationActivity extends Activity { ...@@ -180,7 +176,6 @@ public class OtpValidationActivity extends Activity {
} }
if(apiStatus==1){ // success if(apiStatus==1){ // success
showPhoneLayout(false); showPhoneLayout(false);
}else{ }else{
showPhoneLayout(true); showPhoneLayout(true);
...@@ -221,18 +216,14 @@ public class OtpValidationActivity extends Activity { ...@@ -221,18 +216,14 @@ public class OtpValidationActivity extends Activity {
OtpApiManager.validateOTP(phoneString, otpCode,new GetValidateOtpApiListener() { OtpApiManager.validateOTP(phoneString, otpCode,new GetValidateOtpApiListener() {
@Override @Override
public void onDoneApiCall(String message) { public void onDoneApiCall(String message) {
apiMessage = message; apiMessage = message;
apiStatus = 1; apiStatus = 1;
} }
@Override @Override
public void onFailApiCall(String message) { public void onFailApiCall(String message) {
apiMessage = message; apiMessage = message;
apiStatus = 0; apiStatus = 0;
} }
}); });
return apiMessage; return apiMessage;
......
...@@ -59,9 +59,10 @@ ...@@ -59,9 +59,10 @@
android:layout_marginLeft="@dimen/extra_large_margin" android:layout_marginLeft="@dimen/extra_large_margin"
android:layout_marginRight="@dimen/extra_large_margin" android:layout_marginRight="@dimen/extra_large_margin"
android:background="@drawable/username_under_bg_box" android:background="@drawable/username_under_bg_box"
android:hint="Please enter mobile number" android:hint="@string/phone_number"
android:lines="1" android:lines="1"
android:inputType="number" android:maxLength="20"
android:inputType="phone"
android:padding="@dimen/normal_margin" android:padding="@dimen/normal_margin"
android:singleLine="true" /> android:singleLine="true" />
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
...@@ -109,6 +110,7 @@ ...@@ -109,6 +110,7 @@
android:background="@drawable/username_under_bg_box" android:background="@drawable/username_under_bg_box"
android:hint="@string/enter_otp" android:hint="@string/enter_otp"
android:lines="1" android:lines="1"
android:maxLength="8"
android:inputType="number" android:inputType="number"
android:padding="@dimen/normal_margin" android:padding="@dimen/normal_margin"
android:singleLine="true" /> android:singleLine="true" />
......
...@@ -64,7 +64,8 @@ ...@@ -64,7 +64,8 @@
<string name="user_error">Please enter username</string> <string name="user_error">Please enter username</string>
<string name="pasw_error">Please enter password</string> <string name="pasw_error">Please enter password</string>
<string name="phone_error">Please enter mobile number</string> <string name="phone_number">Please enter mobile number</string>
<string name="phone_no_error">Please enter valid mobile number</string>
<string name="otp_error">Please enter OTP</string> <string name="otp_error">Please enter OTP</string>
<string name="username_string">Username</string> <string name="username_string">Username</string>
<string name="password_string">Password</string> <string name="password_string">Password</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment