|
@ -2,13 +2,17 @@ package com.gmeremit.online.gmeremittance_native.transactionpasspromt; |
|
|
|
|
|
|
|
|
import android.content.Intent; |
|
|
import android.content.Intent; |
|
|
import android.content.pm.ActivityInfo; |
|
|
import android.content.pm.ActivityInfo; |
|
|
|
|
|
import android.graphics.Rect; |
|
|
import android.os.Build; |
|
|
import android.os.Build; |
|
|
import android.os.Bundle; |
|
|
import android.os.Bundle; |
|
|
|
|
|
import android.support.v4.view.GestureDetectorCompat; |
|
|
import android.util.Log; |
|
|
import android.util.Log; |
|
|
|
|
|
import android.view.GestureDetector; |
|
|
import android.view.MotionEvent; |
|
|
import android.view.MotionEvent; |
|
|
import android.view.ViewGroup; |
|
|
import android.view.ViewGroup; |
|
|
import android.view.Window; |
|
|
import android.view.Window; |
|
|
import android.widget.FrameLayout; |
|
|
import android.widget.FrameLayout; |
|
|
|
|
|
import android.widget.LinearLayout; |
|
|
import android.widget.RelativeLayout; |
|
|
import android.widget.RelativeLayout; |
|
|
|
|
|
|
|
|
import com.gmeremit.online.gmeremittance_native.R; |
|
|
import com.gmeremit.online.gmeremittance_native.R; |
|
@ -36,10 +40,15 @@ public class TransactionPasswordPromptActivity extends BaseActivity implements S |
|
|
@BindView(R.id.keypadBallon) |
|
|
@BindView(R.id.keypadBallon) |
|
|
RelativeLayout ballonView; |
|
|
RelativeLayout ballonView; |
|
|
|
|
|
|
|
|
|
|
|
@BindView(R.id.rootView) |
|
|
|
|
|
LinearLayout rootView; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@BindView(R.id.passwordErrorTxt) |
|
|
@BindView(R.id.passwordErrorTxt) |
|
|
GmeErrorTextView passwordErrorTxt; |
|
|
GmeErrorTextView passwordErrorTxt; |
|
|
private SecurityKeypadListener securityKeypadListener; |
|
|
private SecurityKeypadListener securityKeypadListener; |
|
|
|
|
|
private GestureDetectorCompat gestureDetector; |
|
|
|
|
|
private TransactionPasswordPromptActivityGestureDetector myViewGestureDetector; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -70,6 +79,8 @@ public class TransactionPasswordPromptActivity extends BaseActivity implements S |
|
|
securityKeyboardView.setKeyboardContainerView(keypadContainer); |
|
|
securityKeyboardView.setKeyboardContainerView(keypadContainer); |
|
|
securityKeyboardView.setKeyboardBallonView(ballonView); |
|
|
securityKeyboardView.setKeyboardBallonView(ballonView); |
|
|
securityKeypadListener=new SecurityKeypadListener(); |
|
|
securityKeypadListener=new SecurityKeypadListener(); |
|
|
|
|
|
myViewGestureDetector = new TransactionPasswordPromptActivityGestureDetector(); |
|
|
|
|
|
gestureDetector = new GestureDetectorCompat(this, myViewGestureDetector); |
|
|
try { |
|
|
try { |
|
|
securityKeyboardManager = new SecurityKeyboardManager(this); |
|
|
securityKeyboardManager = new SecurityKeyboardManager(this); |
|
|
SecurityKeypadRequestParamBuilder request = new SecurityKeypadRequestParamBuilder(this); |
|
|
SecurityKeypadRequestParamBuilder request = new SecurityKeypadRequestParamBuilder(this); |
|
@ -96,8 +107,25 @@ public class TransactionPasswordPromptActivity extends BaseActivity implements S |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public boolean dispatchTouchEvent(MotionEvent ev) { |
|
|
public boolean dispatchTouchEvent(MotionEvent ev) { |
|
|
return ( securityKeyboardView.checkIfTouchIntersectKeypadLayout(ev) || super.dispatchTouchEvent(ev)); |
|
|
|
|
|
|
|
|
return ( securityKeyboardView.checkIfTouchIntersectKeypadLayout(ev) ||gestureDetector.onTouchEvent(ev)|| super.dispatchTouchEvent(ev)); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean checkIfTouchOutsiedRootView(float x,float y) { |
|
|
|
|
|
int posX = (int) x; |
|
|
|
|
|
int posY = (int) y; |
|
|
|
|
|
|
|
|
|
|
|
int[] rootViewLeftAndTopCoordinates = new int[2]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rootView.getLocationOnScreen(rootViewLeftAndTopCoordinates); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rect rootViewBoundRect = new Rect(rootViewLeftAndTopCoordinates[0], rootViewLeftAndTopCoordinates[1], |
|
|
|
|
|
rootViewLeftAndTopCoordinates[0] + rootView.getMeasuredWidth(), |
|
|
|
|
|
rootViewLeftAndTopCoordinates[1] + rootView.getMeasuredHeight()); |
|
|
|
|
|
|
|
|
|
|
|
return !rootViewBoundRect.contains(posX, posY); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -135,7 +163,7 @@ public class TransactionPasswordPromptActivity extends BaseActivity implements S |
|
|
@Override |
|
|
@Override |
|
|
public void cancel(Intent intent) { |
|
|
public void cancel(Intent intent) { |
|
|
Log.d("SecurityKeypad","done"); |
|
|
Log.d("SecurityKeypad","done"); |
|
|
|
|
|
|
|
|
|
|
|
finish(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -168,4 +196,20 @@ public class TransactionPasswordPromptActivity extends BaseActivity implements S |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class TransactionPasswordPromptActivityGestureDetector extends GestureDetector.SimpleOnGestureListener { |
|
|
|
|
|
@Override |
|
|
|
|
|
public boolean onSingleTapUp(MotionEvent e) { |
|
|
|
|
|
if (e.getAction() == MotionEvent.ACTION_UP) { |
|
|
|
|
|
|
|
|
|
|
|
boolean hasToucheOutsideTheView= checkIfTouchOutsiedRootView(e.getX(),e.getY()); |
|
|
|
|
|
if(hasToucheOutsideTheView) |
|
|
|
|
|
finish(); |
|
|
|
|
|
return hasToucheOutsideTheView; |
|
|
|
|
|
} |
|
|
|
|
|
return super.onSingleTapUp(e); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |