|
|
@ -3,7 +3,6 @@ package com.gmeremit.online.gmeremittance_native.transactionpasspromt.view; |
|
|
|
import android.app.Activity; |
|
|
|
import android.content.Intent; |
|
|
|
import android.content.pm.ActivityInfo; |
|
|
|
import android.graphics.Color; |
|
|
|
import android.graphics.Rect; |
|
|
|
import android.os.Build; |
|
|
|
import android.os.Bundle; |
|
|
@ -29,7 +28,6 @@ import com.gmeremit.online.gmeremittance_native.base.BaseActivity; |
|
|
|
import com.gmeremit.online.gmeremittance_native.customwidgets.GmeErrorTextView; |
|
|
|
import com.gmeremit.online.gmeremittance_native.transactionpasspromt.presenter.TransactionPasswordPromptV2Presenter; |
|
|
|
import com.gmeremit.online.gmeremittance_native.transactionpasspromt.presenter.TransactionPasswordPromptV2PresenterInterface; |
|
|
|
import com.gmeremit.online.gmeremittance_native.utils.security.securitykeypad.EncryptionManager; |
|
|
|
import com.gmeremit.online.gmeremittance_native.utils.security.securitykeypad.SecurityKeyboardManager; |
|
|
|
import com.gmeremit.online.gmeremittance_native.utils.security.securitykeypad.SecurityKeyboardView; |
|
|
|
import com.gmeremit.online.gmeremittance_native.utils.security.securitykeypad.SecurityKeypadRequestParamBuilder; |
|
|
@ -42,6 +40,7 @@ import butterknife.ButterKnife; |
|
|
|
|
|
|
|
public class TransactionPasswordPromptActivity extends BaseActivity implements SecurityKeyboardView.SecurityKeyboardFocusStateListener, TransactionPasswordPromptV2PresenterInterface.TransactionPasswordPromptV2ContractInterface, View.OnClickListener { |
|
|
|
|
|
|
|
public static final String OTP_COUNTDOWN_VALUE = "bundleCountdownValue"; |
|
|
|
SecurityKeyboardManager securityKeyboardManager; |
|
|
|
|
|
|
|
@BindView(R.id.securityKeyboard) |
|
|
@ -93,13 +92,16 @@ public class TransactionPasswordPromptActivity extends BaseActivity implements S |
|
|
|
window.setBackgroundDrawableResource(R.drawable.ic_rounded_password_prompt); |
|
|
|
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); |
|
|
|
} |
|
|
|
presenter = new TransactionPasswordPromptV2Presenter(this); |
|
|
|
paymentType = getIntent().getStringExtra(PAYMENT_TYPE_BUNDLE_KEY); |
|
|
|
if (checkIfRequiredOTPScreen()) |
|
|
|
presenter.updateCountdown(getIntent().getLongExtra(OTP_COUNTDOWN_VALUE, -1)); |
|
|
|
init(); |
|
|
|
performDefaultAction(savedInstanceState); |
|
|
|
} |
|
|
|
|
|
|
|
private void init() { |
|
|
|
presenter = new TransactionPasswordPromptV2Presenter(this); |
|
|
|
|
|
|
|
securityKeyboardView.setKeyboardContainerView(keypadContainer); |
|
|
|
securityKeyboardView.setKeyboardBallonView(ballonView); |
|
|
|
securityKeypadListener = new SecurityKeypadListener(); |
|
|
@ -115,11 +117,12 @@ public class TransactionPasswordPromptActivity extends BaseActivity implements S |
|
|
|
title.setText(getString(R.string.enter_otp_password_text)); |
|
|
|
request.setMaxLength(4); |
|
|
|
ballonView.setVisibility(View.INVISIBLE); |
|
|
|
resendRequest.setVisibility(View.VISIBLE); |
|
|
|
|
|
|
|
} else { |
|
|
|
request.setHintString(getString(R.string.password_text)); |
|
|
|
title.setText(getString(R.string.enter_login_password_text)); |
|
|
|
resendRequest.setVisibility(View.INVISIBLE); |
|
|
|
|
|
|
|
} |
|
|
|
securityKeyboardManager.bindWithSecurityWidgetView(securityKeyboardView) |
|
|
|
.setBallonView(ballonView) |
|
|
@ -137,9 +140,9 @@ public class TransactionPasswordPromptActivity extends BaseActivity implements S |
|
|
|
private void performDefaultAction(Bundle savedInstanceState) { |
|
|
|
securityKeyboardManager.showKeyboard(); |
|
|
|
if (checkIfRequiredOTPScreen()) |
|
|
|
new Handler().postDelayed(()->{ |
|
|
|
new Handler().postDelayed(() -> { |
|
|
|
presenter.getOtp(); |
|
|
|
},400); |
|
|
|
}, 400); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -175,7 +178,7 @@ public class TransactionPasswordPromptActivity extends BaseActivity implements S |
|
|
|
protected void onStart() { |
|
|
|
super.onStart(); |
|
|
|
securityKeyboardView.setSecurityKeyboardFocusStateListener(this); |
|
|
|
if(checkIfRequiredOTPScreen()) |
|
|
|
if (checkIfRequiredOTPScreen()) |
|
|
|
resendRequest.setOnClickListener(this); |
|
|
|
} |
|
|
|
|
|
|
@ -183,7 +186,7 @@ public class TransactionPasswordPromptActivity extends BaseActivity implements S |
|
|
|
protected void onStop() { |
|
|
|
super.onStop(); |
|
|
|
securityKeyboardView.setSecurityKeyboardFocusStateListener(null); |
|
|
|
if(checkIfRequiredOTPScreen()) |
|
|
|
if (checkIfRequiredOTPScreen()) |
|
|
|
resendRequest.setOnClickListener(null); |
|
|
|
|
|
|
|
} |
|
|
@ -200,13 +203,15 @@ public class TransactionPasswordPromptActivity extends BaseActivity implements S |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void startCountdownView(int durationMillisecond) { |
|
|
|
public void startCountdownView(long durationMillisecond) { |
|
|
|
countDownTimer = new CountDownTimer(durationMillisecond, 1000) { |
|
|
|
|
|
|
|
int redColor=ContextCompat.getColor(TransactionPasswordPromptActivity.this, R.color.colorPrimary); |
|
|
|
int grayColor=ContextCompat.getColor(TransactionPasswordPromptActivity.this, R.color.darkgray2); |
|
|
|
int redColor = ContextCompat.getColor(TransactionPasswordPromptActivity.this, R.color.colorPrimary); |
|
|
|
int grayColor = ContextCompat.getColor(TransactionPasswordPromptActivity.this, R.color.darkgray2); |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onTick(long millisUntilFinished) { |
|
|
|
presenter.updateCountdown(millisUntilFinished); |
|
|
|
int seconds = (int) (millisUntilFinished / 1000); |
|
|
|
|
|
|
|
int hours = seconds / (60 * 60); |
|
|
@ -221,7 +226,7 @@ public class TransactionPasswordPromptActivity extends BaseActivity implements S |
|
|
|
tryInText.setSpan(new ForegroundColorSpan(grayColor), 0, tryInText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); |
|
|
|
resendRequest.setText(tryInText); |
|
|
|
|
|
|
|
Spannable timeText = new SpannableString(" "+timeRemaining); |
|
|
|
Spannable timeText = new SpannableString(" " + timeRemaining); |
|
|
|
timeText.setSpan(new ForegroundColorSpan(redColor), 0, timeText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); |
|
|
|
|
|
|
|
resendRequest.append(timeText); |
|
|
@ -230,11 +235,24 @@ public class TransactionPasswordPromptActivity extends BaseActivity implements S |
|
|
|
@Override |
|
|
|
public void onFinish() { |
|
|
|
showResendRequestView(true); |
|
|
|
presenter.updateCountdown(-1); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
countDownTimer.start(); |
|
|
|
} |
|
|
|
|
|
|
|
private void updateIntentOnCanellationAndFinish() { |
|
|
|
boolean result = checkIfRequiredOTPScreen(); |
|
|
|
if (result) { |
|
|
|
Intent backIntent = new Intent(); |
|
|
|
setResult(RESULT_CANCELED, backIntent); |
|
|
|
backIntent.putExtra(OTP_COUNTDOWN_VALUE, presenter.getLatestCountDownValue()); |
|
|
|
} |
|
|
|
finish(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void showResendRequestView(boolean action) { |
|
|
|
if (resendRequest.getVisibility() != View.VISIBLE) |
|
|
@ -242,6 +260,7 @@ public class TransactionPasswordPromptActivity extends BaseActivity implements S |
|
|
|
if (action) { |
|
|
|
if (countDownTimer != null) |
|
|
|
countDownTimer.cancel(); |
|
|
|
presenter.updateCountdown(-1); |
|
|
|
resendRequest.setText(getString(R.string.resend_request_text)); |
|
|
|
resendRequest.setOnClickListener(this); |
|
|
|
|
|
|
@ -251,6 +270,12 @@ public class TransactionPasswordPromptActivity extends BaseActivity implements S |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void onBackPressed() { |
|
|
|
updateIntentOnCanellationAndFinish(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onClick(View v) { |
|
|
|
switch (v.getId()) { |
|
|
@ -284,7 +309,7 @@ public class TransactionPasswordPromptActivity extends BaseActivity implements S |
|
|
|
|
|
|
|
@Override |
|
|
|
public void cancel(Intent intent) { |
|
|
|
finish(); |
|
|
|
updateIntentOnCanellationAndFinish(); |
|
|
|
} |
|
|
|
|
|
|
|
private boolean validateStringNotEmpty(String data) { |
|
|
@ -315,7 +340,7 @@ public class TransactionPasswordPromptActivity extends BaseActivity implements S |
|
|
|
|
|
|
|
boolean hasToucheOutsideTheView = checkIfTouchOutsiedRootView(e.getX(), e.getY()); |
|
|
|
if (hasToucheOutsideTheView) |
|
|
|
finish(); |
|
|
|
updateIntentOnCanellationAndFinish(); |
|
|
|
return hasToucheOutsideTheView; |
|
|
|
} |
|
|
|
return super.onSingleTapUp(e); |
|
|
|