Preyea Regmi
4 years ago
15 changed files with 800 additions and 137 deletions
-
BIN.idea/caches/build_file_checksums.ser
-
214app/src/main/AndroidManifest.xml
-
2app/src/main/java/com/swifttech/remit/android/features/changepassword/presenter/ChangePasswordV2Presenter.java
-
28app/src/main/java/com/swifttech/remit/android/features/changetxnpin/ChangePinViewModelFactory.java
-
28app/src/main/java/com/swifttech/remit/android/features/changetxnpin/gateway/ChangePinGateway.java
-
52app/src/main/java/com/swifttech/remit/android/features/changetxnpin/model/ChangePinV2APIResponse.java
-
19app/src/main/java/com/swifttech/remit/android/features/changetxnpin/model/ChangeSuccessModel.java
-
80app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinLiveData.java
-
20app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinV2InteractorInterface.java
-
183app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinV2Presenter.java
-
22app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinV2PresenterInterface.java
-
146app/src/main/java/com/swifttech/remit/android/features/changetxnpin/view/ChangeTxnPinActivity.java
-
7app/src/main/java/com/swifttech/remit/android/features/settings/view/SettingsView.java
-
86app/src/main/res/layout/activity_change_txn_pin.xml
-
50app/src/main/res/layout/activity_settings.xml
@ -0,0 +1,28 @@ |
|||
package com.swifttech.remit.android.features.changetxnpin; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.lifecycle.ViewModel; |
|||
import androidx.lifecycle.ViewModelProvider; |
|||
|
|||
import com.swifttech.remit.android.features.changepassword.gateway.ChangePasswordV2Gateway; |
|||
import com.swifttech.remit.android.features.changepassword.presenter.ChangePasswordV2Presenter; |
|||
import com.swifttech.remit.android.features.changepassword.presenter.ChangePasswordV2PresenterInterface; |
|||
import com.swifttech.remit.android.features.changetxnpin.gateway.ChangePinGateway; |
|||
import com.swifttech.remit.android.features.changetxnpin.presenter.ChangePinV2Presenter; |
|||
import com.swifttech.remit.android.features.changetxnpin.presenter.ChangePinV2PresenterInterface; |
|||
|
|||
public class ChangePinViewModelFactory implements ViewModelProvider.Factory { |
|||
|
|||
private final ChangePinV2PresenterInterface.ChangePinV2ContractInterface view; |
|||
|
|||
public ChangePinViewModelFactory(ChangePinV2PresenterInterface.ChangePinV2ContractInterface view) { |
|||
this.view=view; |
|||
} |
|||
|
|||
@SuppressWarnings("unchecked") |
|||
@NonNull |
|||
@Override |
|||
public <T extends ViewModel> T create(@NonNull Class<T> modelClass) { |
|||
return (T) new ChangePinV2Presenter(view,new ChangePinGateway()); |
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.swifttech.remit.android.features.changetxnpin.gateway; |
|||
|
|||
import com.swifttech.remit.android.base.PrivilegedGateway; |
|||
import com.swifttech.remit.android.features.changepassword.model.ChangePasswordActivityV2APIResponse; |
|||
import com.swifttech.remit.android.features.changepassword.presenter.ChangePasswordV2InteractorInterface; |
|||
import com.swifttech.remit.android.features.changetxnpin.presenter.ChangePinV2InteractorInterface; |
|||
import com.swifttech.remit.android.utils.https.HttpClientV2; |
|||
import com.google.gson.JsonObject; |
|||
|
|||
import io.reactivex.Observable; |
|||
|
|||
public class ChangePinGateway extends PrivilegedGateway implements ChangePinV2InteractorInterface.ChangePinV2GatewayInterface { |
|||
|
|||
|
|||
|
|||
@Override |
|||
public Observable<ChangePasswordActivityV2APIResponse> performChangePassRequest(String auth, String userId, String oldPass, String newPass,String confirmPass) { |
|||
JsonObject jsonObject=new JsonObject(); |
|||
|
|||
jsonObject.addProperty("UserId",userId); |
|||
jsonObject.addProperty("OldPassword",oldPass); |
|||
jsonObject.addProperty("NewPassword",newPass); |
|||
jsonObject.addProperty("ConfirmPassword",confirmPass); |
|||
return HttpClientV2.getInstance().performChangePasswordV2(auth,jsonObject); |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,52 @@ |
|||
package com.swifttech.remit.android.features.changetxnpin.model; |
|||
|
|||
import com.google.gson.annotations.Expose; |
|||
import com.google.gson.annotations.SerializedName; |
|||
|
|||
public class ChangePinV2APIResponse { |
|||
|
|||
@SerializedName("ErrorCode") |
|||
@Expose |
|||
private String errorCode; |
|||
@SerializedName("Msg") |
|||
@Expose |
|||
private String msg; |
|||
@SerializedName("Id") |
|||
@Expose |
|||
private String id; |
|||
@SerializedName("Data") |
|||
@Expose |
|||
private ChangeSuccessModel data; |
|||
|
|||
public String getErrorCode() { |
|||
return errorCode; |
|||
} |
|||
|
|||
public void setErrorCode(String errorCode) { |
|||
this.errorCode = errorCode; |
|||
} |
|||
|
|||
public String getMsg() { |
|||
return msg; |
|||
} |
|||
|
|||
public void setMsg(String msg) { |
|||
this.msg = msg; |
|||
} |
|||
|
|||
public String getId() { |
|||
return id; |
|||
} |
|||
|
|||
public void setId(String id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public ChangeSuccessModel getData() { |
|||
return data; |
|||
} |
|||
|
|||
public void setData(ChangeSuccessModel data) { |
|||
this.data = data; |
|||
} |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.swifttech.remit.android.features.changetxnpin.model; |
|||
|
|||
import com.google.gson.annotations.Expose; |
|||
import com.google.gson.annotations.SerializedName; |
|||
|
|||
public class ChangeSuccessModel { |
|||
|
|||
@Expose |
|||
@SerializedName("Message") |
|||
private String message; |
|||
|
|||
public String getMessage() { |
|||
return message; |
|||
} |
|||
|
|||
public void setMessage(String message) { |
|||
this.message = message; |
|||
} |
|||
} |
@ -0,0 +1,80 @@ |
|||
package com.swifttech.remit.android.features.changetxnpin.presenter; |
|||
|
|||
import androidx.lifecycle.LiveData; |
|||
import androidx.lifecycle.MutableLiveData; |
|||
|
|||
import com.swifttech.remit.android.common.model.FormInputStateDTO; |
|||
|
|||
import io.reactivex.Observable; |
|||
|
|||
public class ChangePinLiveData { |
|||
|
|||
private MutableLiveData<FormInputStateDTO<String>> currentPinInputLiveData; |
|||
private MutableLiveData<FormInputStateDTO<String>> newPinInputLiveData; |
|||
private MutableLiveData<FormInputStateDTO<String>> confirmPinInputLiveData; |
|||
private MutableLiveData<FormInputStateDTO> allFormValidLiveData; |
|||
|
|||
public ChangePinLiveData() { |
|||
currentPinInputLiveData = new MutableLiveData<>(); |
|||
newPinInputLiveData = new MutableLiveData<>(); |
|||
confirmPinInputLiveData = new MutableLiveData<>(); |
|||
allFormValidLiveData = new MutableLiveData<>(); |
|||
} |
|||
|
|||
|
|||
public LiveData<FormInputStateDTO<String>> getCurrentPinInputLiveData() { |
|||
return currentPinInputLiveData; |
|||
} |
|||
|
|||
public void setCurrentPinInputLiveData(FormInputStateDTO<String> currentPinInputLiveData) { |
|||
this.currentPinInputLiveData.setValue(currentPinInputLiveData); |
|||
} |
|||
|
|||
public LiveData<FormInputStateDTO<String>> getNewPinInputLiveData() { |
|||
return newPinInputLiveData; |
|||
} |
|||
|
|||
public void setNewPinInputLiveData(FormInputStateDTO<String> newPinInputLiveData) { |
|||
this.newPinInputLiveData.setValue(newPinInputLiveData); |
|||
} |
|||
|
|||
public LiveData<FormInputStateDTO<String>> getConfirmPinInputLiveData() { |
|||
return confirmPinInputLiveData; |
|||
} |
|||
|
|||
public void setConfirmPinInputLiveData(FormInputStateDTO<String> confirmPinInputLiveData) { |
|||
this.confirmPinInputLiveData.setValue(confirmPinInputLiveData); |
|||
} |
|||
|
|||
public LiveData<FormInputStateDTO> getAllFormValidLiveData() { |
|||
return allFormValidLiveData; |
|||
} |
|||
|
|||
public void setAllFormValidLiveData(FormInputStateDTO allFormValidLiveData) { |
|||
this.allFormValidLiveData.setValue(allFormValidLiveData); |
|||
} |
|||
|
|||
public static class ChangePinViewBindings { |
|||
private Observable<CharSequence> currentPinInputLiveData; |
|||
private Observable<CharSequence> newPinInputLiveData; |
|||
private Observable<CharSequence> confirmPinInputLiveData; |
|||
|
|||
public ChangePinViewBindings(Observable<CharSequence> currentPasswordInputLiveData, Observable<CharSequence> newPasswordInputLiveData, Observable<CharSequence> confirmPasswordInputLiveData) { |
|||
this.currentPinInputLiveData = currentPasswordInputLiveData; |
|||
this.newPinInputLiveData = newPasswordInputLiveData; |
|||
this.confirmPinInputLiveData = confirmPasswordInputLiveData; |
|||
} |
|||
|
|||
public Observable<CharSequence> getCurrentPinInputLiveData() { |
|||
return currentPinInputLiveData; |
|||
} |
|||
|
|||
public Observable<CharSequence> getNewPinInputLiveData() { |
|||
return newPinInputLiveData; |
|||
} |
|||
|
|||
public Observable<CharSequence> getConfirmPinInputLiveData() { |
|||
return confirmPinInputLiveData; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.swifttech.remit.android.features.changetxnpin.presenter; |
|||
|
|||
import com.swifttech.remit.android.base.BaseInteractorInterface; |
|||
import com.swifttech.remit.android.base.PrivilegedGatewayInterface; |
|||
import com.swifttech.remit.android.features.changepassword.model.ChangePasswordActivityV2APIResponse; |
|||
|
|||
import io.reactivex.Observable; |
|||
|
|||
public interface ChangePinV2InteractorInterface extends BaseInteractorInterface { |
|||
|
|||
|
|||
interface ChangePinV2GatewayInterface extends PrivilegedGatewayInterface |
|||
{ |
|||
Observable<ChangePasswordActivityV2APIResponse> performChangePassRequest(String auth, String userId, String oldPass, String newPass,String confirmPass); |
|||
|
|||
void persistUserPwdForBiometric(String encrypted); |
|||
|
|||
void turnOffFingerprintAuth(boolean b); |
|||
} |
|||
} |
@ -0,0 +1,183 @@ |
|||
package com.swifttech.remit.android.features.changetxnpin.presenter; |
|||
|
|||
import com.swifttech.remit.android.R; |
|||
import com.swifttech.remit.android.base.BaseViewModel; |
|||
import com.swifttech.remit.android.common.customwidgets.CustomAlertDialog; |
|||
import com.swifttech.remit.android.common.model.FormInputStateDTO; |
|||
import com.swifttech.remit.android.features.changepassword.model.ChangePasswordActivityV2APIResponse; |
|||
import com.swifttech.remit.android.utils.Constants; |
|||
import com.swifttech.remit.android.utils.https.GenericApiObserverResponse; |
|||
|
|||
import io.reactivex.Observable; |
|||
import io.reactivex.android.schedulers.AndroidSchedulers; |
|||
import io.reactivex.disposables.CompositeDisposable; |
|||
import io.reactivex.observers.DisposableObserver; |
|||
import io.reactivex.schedulers.Schedulers; |
|||
|
|||
public class ChangePinV2Presenter extends BaseViewModel implements ChangePinV2InteractorInterface, ChangePinV2PresenterInterface { |
|||
|
|||
private static final int PIN_LENGTH = 5; |
|||
private final ChangePinV2ContractInterface view; |
|||
private final ChangePinV2GatewayInterface gateway; |
|||
|
|||
private final ChangePinLiveData changePinLiveData; |
|||
private final CompositeDisposable useCaseCompositeDisposable; |
|||
private final CompositeDisposable viewEventCompositeDisposable; |
|||
private final ChangePinValidator changePinValidator; |
|||
|
|||
public ChangePinV2Presenter(ChangePinV2ContractInterface view, ChangePinV2InteractorInterface.ChangePinV2GatewayInterface gateway) { |
|||
this.view = view; |
|||
this.gateway = gateway; |
|||
this.changePinValidator = new ChangePinValidator(); |
|||
changePinLiveData = new ChangePinLiveData(); |
|||
useCaseCompositeDisposable = new CompositeDisposable(); |
|||
viewEventCompositeDisposable = new CompositeDisposable(); |
|||
} |
|||
|
|||
@Override |
|||
public ChangePinLiveData getChangePasswordRelatedViewEvents(ChangePinLiveData.ChangePinViewBindings viewBindings) { |
|||
bindView(viewBindings); |
|||
return changePinLiveData; |
|||
} |
|||
|
|||
private void bindView(ChangePinLiveData.ChangePinViewBindings viewBindings) { |
|||
viewEventCompositeDisposable.add( |
|||
Observable.combineLatest( |
|||
viewBindings.getCurrentPinInputLiveData().map(this.changePinValidator::isCurrentPasswordValid), |
|||
viewBindings.getNewPinInputLiveData().map(this.changePinValidator::isNewPasswordValid), |
|||
viewBindings.getConfirmPinInputLiveData().map(this.changePinValidator::isConfirmPasswordValid), |
|||
(isCurrentPassValid, isNewPasswordValid, isConfirmPasswordValid) -> |
|||
isCurrentPassValid && isNewPasswordValid && isConfirmPasswordValid) |
|||
.subscribeWith(new DisposableObserver<Boolean>() { |
|||
@Override |
|||
public void onNext(Boolean result) { |
|||
changePinLiveData.setAllFormValidLiveData(new FormInputStateDTO(result, "")); |
|||
} |
|||
|
|||
@Override |
|||
public void onError(Throwable e) { |
|||
changePinLiveData.setAllFormValidLiveData(new FormInputStateDTO(false, "")); |
|||
} |
|||
|
|||
@Override |
|||
public void onComplete() { |
|||
|
|||
} |
|||
})); |
|||
} |
|||
|
|||
@Override |
|||
public void onViewReady() { |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void onViewNotReady() { |
|||
|
|||
} |
|||
|
|||
|
|||
@Override |
|||
public void changePin() { |
|||
if (changePinValidator.doesConfirmPasswordMatchWithNewPassword()) { |
|||
useCaseCompositeDisposable.add( |
|||
this.gateway.performChangePassRequest(this.gateway.getAuth(), this.gateway.getUserID(), this.changePinValidator.currentPin, this.changePinValidator.newPin, this.changePinValidator.confirmPin) |
|||
.doOnSubscribe(d -> view.showProgressBar(true, getStringfromStringId(R.string.processing_request_text))) |
|||
.subscribeOn(Schedulers.io()) |
|||
.observeOn(AndroidSchedulers.mainThread()) |
|||
.doFinally(() -> view.showProgressBar(false, "")) |
|||
.subscribeWith(new ChangePinObserver())); |
|||
} |
|||
} |
|||
|
|||
|
|||
private class ChangePinValidator { |
|||
|
|||
private String currentPin; |
|||
private String newPin; |
|||
private String confirmPin; |
|||
|
|||
boolean isCurrentPasswordValid(CharSequence password) { |
|||
if (password != null && password.length() ==PIN_LENGTH) { |
|||
this.currentPin = password.toString(); |
|||
changePinLiveData.setCurrentPinInputLiveData(new FormInputStateDTO<>(true, null)); |
|||
return true; |
|||
} else { |
|||
this.currentPin = null; |
|||
changePinLiveData.setCurrentPinInputLiveData(new FormInputStateDTO<>(false, "Pin must be of 5 digit")); |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
boolean isNewPasswordValid(CharSequence password) { |
|||
if (password != null && password.length() ==PIN_LENGTH) { |
|||
this.newPin = password.toString(); |
|||
changePinLiveData.setNewPinInputLiveData(new FormInputStateDTO<>(true, null)); |
|||
return true; |
|||
} else { |
|||
this.newPin = null; |
|||
changePinLiveData.setNewPinInputLiveData(new FormInputStateDTO<>(false, "Pin must be of 5 digit")); |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
|
|||
public boolean doesConfirmPasswordMatchWithNewPassword() { |
|||
boolean result = (confirmPin != null && confirmPin.equalsIgnoreCase(newPin)); |
|||
changePinLiveData.setConfirmPinInputLiveData(new FormInputStateDTO<>(result, "Confirmed pin doesn't match with entered pin")); |
|||
return result; |
|||
} |
|||
|
|||
|
|||
boolean isConfirmPasswordValid(CharSequence password) { |
|||
if (password != null && password.length() ==PIN_LENGTH) { |
|||
this.confirmPin = password.toString(); |
|||
changePinLiveData.setConfirmPinInputLiveData(new FormInputStateDTO<>(true, null)); |
|||
return true; |
|||
|
|||
} else { |
|||
this.confirmPin = null; |
|||
changePinLiveData.setConfirmPinInputLiveData(new FormInputStateDTO<>(false, "Pin must be of 5 digit")); |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
public class ChangePinObserver extends GenericApiObserverResponse<ChangePasswordActivityV2APIResponse> { |
|||
|
|||
|
|||
@Override |
|||
protected void onSuccess(ChangePasswordActivityV2APIResponse changePasswordActivityV2APIResponse) { |
|||
if (changePasswordActivityV2APIResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { |
|||
view.showPopUpMessage(changePasswordActivityV2APIResponse.getMsg(), CustomAlertDialog.AlertType.SUCCESS, alertType -> view.exitView()); |
|||
} else |
|||
view.showPopUpMessage(changePasswordActivityV2APIResponse.getMsg(), CustomAlertDialog.AlertType.FAILED, null); |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public void onFailed(String message) { |
|||
view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); |
|||
} |
|||
|
|||
@Override |
|||
protected void onConnectionNotEstablished(String message) { |
|||
view.showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET, null); |
|||
} |
|||
|
|||
@Override |
|||
protected void unauthorizedAccess(String message) { |
|||
gateway.clearAllUserData(); |
|||
view.showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT, alertType -> view.logout()); |
|||
|
|||
} |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.swifttech.remit.android.features.changetxnpin.presenter; |
|||
|
|||
import com.swifttech.remit.android.base.BaseContractInterface; |
|||
import com.swifttech.remit.android.base.BasePresenterInterface; |
|||
|
|||
|
|||
public interface ChangePinV2PresenterInterface extends BasePresenterInterface { |
|||
|
|||
|
|||
|
|||
|
|||
void changePin(); |
|||
|
|||
ChangePinLiveData getChangePasswordRelatedViewEvents(ChangePinLiveData.ChangePinViewBindings viewBindings); |
|||
|
|||
|
|||
interface ChangePinV2ContractInterface extends BaseContractInterface |
|||
{ |
|||
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,146 @@ |
|||
package com.swifttech.remit.android.features.changetxnpin.view; |
|||
|
|||
import androidx.lifecycle.ViewModelProvider; |
|||
|
|||
import android.os.Bundle; |
|||
import android.view.View; |
|||
import android.widget.Button; |
|||
import android.widget.TextView; |
|||
|
|||
import com.google.android.material.textfield.TextInputEditText; |
|||
import com.google.android.material.textfield.TextInputLayout; |
|||
import com.jakewharton.rxbinding3.widget.RxTextView; |
|||
import com.swifttech.remit.android.R; |
|||
import com.swifttech.remit.android.base.BaseActivity; |
|||
import com.swifttech.remit.android.common.model.FormInputStateDTO; |
|||
import com.swifttech.remit.android.features.changetxnpin.ChangePinViewModelFactory; |
|||
import com.swifttech.remit.android.features.changetxnpin.presenter.ChangePinLiveData; |
|||
import com.swifttech.remit.android.features.changetxnpin.presenter.ChangePinV2Presenter; |
|||
import com.swifttech.remit.android.features.changetxnpin.presenter.ChangePinV2PresenterInterface; |
|||
|
|||
import butterknife.BindView; |
|||
import butterknife.ButterKnife; |
|||
import butterknife.OnClick; |
|||
|
|||
public class ChangeTxnPinActivity extends BaseActivity implements ChangePinV2PresenterInterface.ChangePinV2ContractInterface { |
|||
|
|||
|
|||
@BindView(R.id.toolbar_title) |
|||
TextView toolbarTitle; |
|||
|
|||
@BindView(R.id.iv_cancel) |
|||
View iv_cancel; |
|||
@BindView(R.id.iv_back) |
|||
View iv_back; |
|||
|
|||
@BindView(R.id.currentPin_edTxt) |
|||
TextInputEditText currentPin_edTxt; |
|||
|
|||
@BindView(R.id.currentPin_TxtInputLayout) |
|||
TextInputLayout currentPin_TxtInputLayout; |
|||
|
|||
@BindView(R.id.newPin_edTxt) |
|||
TextInputEditText newPin_edTxt; |
|||
|
|||
@BindView(R.id.newPin_TxtInputLayout) |
|||
TextInputLayout newPin_TxtInputLayout; |
|||
|
|||
@BindView(R.id.confirmPin_edTxt) |
|||
TextInputEditText confirmPin_edTxt; |
|||
|
|||
@BindView(R.id.confirmPin_TxtInputLayout) |
|||
TextInputLayout confirmPin_TxtInputLayout; |
|||
|
|||
@BindView(R.id.btn_submit) |
|||
Button btn_submit; |
|||
|
|||
private ChangePinV2Presenter viewModel; |
|||
|
|||
@Override |
|||
protected void onCreate(Bundle savedInstanceState) { |
|||
super.onCreate(savedInstanceState); |
|||
setContentView(R.layout.activity_change_txn_pin); |
|||
ButterKnife.bind(this); |
|||
initialize(); |
|||
performDefaultAction(savedInstanceState); |
|||
} |
|||
|
|||
|
|||
|
|||
private void initialize() { |
|||
this.viewModel=new ViewModelProvider(this,new ChangePinViewModelFactory(this)).get(ChangePinV2Presenter.class); |
|||
|
|||
ChangePinLiveData changePinLiveData = viewModel.getChangePasswordRelatedViewEvents(new ChangePinLiveData.ChangePinViewBindings( |
|||
RxTextView.textChanges(currentPin_edTxt).skipInitialValue(), |
|||
RxTextView.textChanges(newPin_edTxt).skipInitialValue(), |
|||
RxTextView.textChanges(confirmPin_edTxt).skipInitialValue() |
|||
)); |
|||
|
|||
changePinLiveData.getCurrentPinInputLiveData().observe(this,this::onCurrentPasswordStateChanged); |
|||
changePinLiveData.getNewPinInputLiveData().observe(this,this::onNewPasswordStateChanged); |
|||
changePinLiveData.getConfirmPinInputLiveData().observe(this,this::onConfirmPasswordStateChanged); |
|||
changePinLiveData.getAllFormValidLiveData().observe(this, result->btn_submit.setEnabled(result.isValid())); |
|||
} |
|||
|
|||
private void onConfirmPasswordStateChanged(FormInputStateDTO<String> state) { |
|||
if(state.isValid()) |
|||
{ |
|||
confirmPin_TxtInputLayout.setError(null); |
|||
if(state.hasData()) |
|||
{ |
|||
confirmPin_edTxt.setText(state.getData()); |
|||
} |
|||
} |
|||
else |
|||
confirmPin_TxtInputLayout.setError(state.getErrorMessage()); |
|||
} |
|||
|
|||
private void onNewPasswordStateChanged(FormInputStateDTO<String> state) { |
|||
if(state.isValid()) |
|||
{ |
|||
newPin_TxtInputLayout.setError(null); |
|||
if(state.hasData()) |
|||
{ |
|||
newPin_edTxt.setText(state.getData()); |
|||
} |
|||
} |
|||
else |
|||
newPin_TxtInputLayout.setError(state.getErrorMessage()); |
|||
} |
|||
|
|||
private void onCurrentPasswordStateChanged(FormInputStateDTO<String> state) { |
|||
if(state.isValid()) |
|||
{ |
|||
currentPin_TxtInputLayout.setError(null); |
|||
if(state.hasData()) |
|||
{ |
|||
currentPin_edTxt.setText(state.getData()); |
|||
} |
|||
} |
|||
else |
|||
currentPin_TxtInputLayout.setError(state.getErrorMessage()); |
|||
} |
|||
|
|||
private void performDefaultAction(Bundle savedInstanceState) { |
|||
if(savedInstanceState==null) |
|||
{ |
|||
toolbarTitle.setText("Change Pin"); |
|||
iv_cancel.setVisibility(View.INVISIBLE); |
|||
} |
|||
} |
|||
|
|||
@OnClick(R.id.iv_back) |
|||
public void onBackButtonClicked(View v) |
|||
{ |
|||
onBackPressed(); |
|||
} |
|||
|
|||
|
|||
|
|||
@OnClick(R.id.btn_submit) |
|||
public void onBtnSubmitClicked() |
|||
{ |
|||
viewModel.changePin(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,86 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
|
|||
<LinearLayout |
|||
xmlns:android="http://schemas.android.com/apk/res/android" |
|||
xmlns:app="http://schemas.android.com/apk/res-auto" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="match_parent" |
|||
android:orientation="vertical" |
|||
android:background="@color/background_gray"> |
|||
<include layout="@layout/layout_sendmoney_toolbar"/> |
|||
|
|||
<ScrollView |
|||
android:id="@+id/scrollView" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:scrollbars="none"> |
|||
<LinearLayout |
|||
style="@style/MFormBoundWithCornerRadius" |
|||
android:orientation="vertical"> |
|||
|
|||
|
|||
<com.swifttech.remit.android.common.view.MTextInputLayout |
|||
android:id="@+id/currentPin_TxtInputLayout" |
|||
app:errorEnabled="true" |
|||
style="@style/MTextInputLayoutForm" |
|||
app:endIconMode="password_toggle" |
|||
android:hint="Current Pin" |
|||
app:startIconDrawable="@drawable/vd_lock" |
|||
> |
|||
<com.swifttech.remit.android.common.view.MTextInputEditText |
|||
android:inputType="numberPassword" |
|||
android:maxLength="5" |
|||
android:id="@+id/currentPin_edTxt" |
|||
style="@style/MTextInputEditText"/> |
|||
|
|||
</com.swifttech.remit.android.common.view.MTextInputLayout> |
|||
|
|||
|
|||
<com.swifttech.remit.android.common.view.MTextInputLayout |
|||
android:id="@+id/newPin_TxtInputLayout" |
|||
app:errorEnabled="true" |
|||
style="@style/MTextInputLayoutForm" |
|||
app:endIconMode="password_toggle" |
|||
android:hint="New Pin" |
|||
app:startIconDrawable="@drawable/vd_lock" |
|||
> |
|||
<com.swifttech.remit.android.common.view.MTextInputEditText |
|||
android:inputType="numberPassword" |
|||
android:maxLength="5" |
|||
android:id="@+id/newPin_edTxt" |
|||
style="@style/MTextInputEditText"/> |
|||
|
|||
</com.swifttech.remit.android.common.view.MTextInputLayout> |
|||
|
|||
|
|||
|
|||
|
|||
<com.swifttech.remit.android.common.view.MTextInputLayout |
|||
android:id="@+id/confirmPin_TxtInputLayout" |
|||
app:errorEnabled="true" |
|||
style="@style/MTextInputLayoutForm" |
|||
app:endIconMode="password_toggle" |
|||
android:hint="Confirm New Pin" |
|||
app:startIconDrawable="@drawable/vd_lock" |
|||
> |
|||
<com.swifttech.remit.android.common.view.MTextInputEditText |
|||
android:inputType="numberPassword" |
|||
android:maxLength="5" |
|||
android:id="@+id/confirmPin_edTxt" |
|||
style="@style/MTextInputEditText"/> |
|||
|
|||
</com.swifttech.remit.android.common.view.MTextInputLayout> |
|||
|
|||
<com.swifttech.remit.android.common.customwidgets.GmeButton |
|||
style="@style/MButton" |
|||
android:id="@+id/btn_submit" |
|||
android:text="@string/save_password_text" |
|||
android:layout_gravity="center" |
|||
android:layout_marginTop="20dp"/> |
|||
|
|||
</LinearLayout> |
|||
</ScrollView> |
|||
|
|||
</LinearLayout> |
|||
|
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue