Browse Source

Splash Gesture Detector fixes for language selection text and buttons

master
Preyea Regmi 5 years ago
parent
commit
2f8039fac0
  1. 38
      app/src/main/java/com/gmeremit/online/gmeremittance_native/splash_screen/view/SplashScreen.java

38
app/src/main/java/com/gmeremit/online/gmeremittance_native/splash_screen/view/SplashScreen.java

@ -47,7 +47,6 @@ import com.gmeremit.online.gmeremittance_native.loginV2.view.LoginV2Activity;
import com.gmeremit.online.gmeremittance_native.registerV2.view.RegisterV2Activity;
import com.gmeremit.online.gmeremittance_native.splash_screen.adapter.LanguageSelectionRVAdapter;
import com.gmeremit.online.gmeremittance_native.splash_screen.adapter.PayoutModeSelectionRVAdapter;
import com.gmeremit.online.gmeremittance_native.splash_screen.adapter.ViewPagerAVDSplashAdapter;
import com.gmeremit.online.gmeremittance_native.splash_screen.model.LanguageModel;
import com.gmeremit.online.gmeremittance_native.splash_screen.presenter.SplashScreenPresenter;
import com.gmeremit.online.gmeremittance_native.splash_screen.presenter.SplashScreenPresenterInterface;
@ -664,7 +663,7 @@ public class SplashScreen extends BaseActivity implements View.OnClickListener,
if (!languageViewTransitionManager.isExrateViewVisible())
return super.onSingleTapUp(e);
if (e.getAction() == MotionEvent.ACTION_UP) {
if (hasValidOutsideAmountWidgetTouch(e.getX(), e.getY())) {
if (hasTouchOutsideTheAmountInputWidget(e.getX(), e.getY())) {
presenter.calcExrate();
return true;
@ -673,7 +672,7 @@ public class SplashScreen extends BaseActivity implements View.OnClickListener,
return super.onSingleTapUp(e);
}
private boolean hasValidOutsideAmountWidgetTouch(float x, float y) {
private boolean hasTouchOutsideTheAmountInputWidget(float x, float y) {
int posX = (int) x;
int posY = (int) y;
@ -683,10 +682,21 @@ public class SplashScreen extends BaseActivity implements View.OnClickListener,
int[] backButtonLeftAndTopCoordinates = new int[2];
int[] languageTextLeftAndTopCoordinates = new int[2];
int[] languageImageLeftAndTopCoordinates = new int[2];
int[] btnLoginLeftAndTopCoordinates= new int[2];
int[] btnRegisterLeftAndTopCoordinates= new int[2];
sendMoneyViewContainer.getLocationOnScreen(sendMoneyLeftAndTopCoordinates);
receiveMoneyViewContainer.getLocationOnScreen(receiveMoneyLeftAndTopCoordinates);
iv_back.getLocationOnScreen(backButtonLeftAndTopCoordinates);
selectedLanguageIcon.getLocationOnScreen(languageImageLeftAndTopCoordinates);
selectedLanguageText.getLocationOnScreen(languageTextLeftAndTopCoordinates);
btn_login.getLocationOnScreen(btnLoginLeftAndTopCoordinates);
btn_new_user.getLocationOnScreen(btnRegisterLeftAndTopCoordinates);
Rect sendMoneyBoundRect = new Rect(sendMoneyLeftAndTopCoordinates[0], sendMoneyLeftAndTopCoordinates[1],
sendMoneyLeftAndTopCoordinates[0] + sendMoneyViewContainer.getMeasuredWidth(),
sendMoneyLeftAndTopCoordinates[1] + sendMoneyViewContainer.getMeasuredHeight());
@ -699,11 +709,31 @@ public class SplashScreen extends BaseActivity implements View.OnClickListener,
backButtonLeftAndTopCoordinates[0] + iv_back.getMeasuredWidth(),
backButtonLeftAndTopCoordinates[1] + iv_back.getMeasuredHeight());
Rect selectedLanguageIconRect = new Rect(languageImageLeftAndTopCoordinates[0], languageImageLeftAndTopCoordinates[1],
languageImageLeftAndTopCoordinates[0] + selectedLanguageIcon.getMeasuredWidth(),
languageImageLeftAndTopCoordinates[1] + selectedLanguageIcon.getMeasuredHeight());
Rect selectedLanguageTextRect = new Rect(languageTextLeftAndTopCoordinates[0], languageTextLeftAndTopCoordinates[1],
languageTextLeftAndTopCoordinates[0] + selectedLanguageText.getMeasuredWidth(),
languageTextLeftAndTopCoordinates[1] + selectedLanguageText.getMeasuredHeight());
Rect btn_loginRect = new Rect(btnLoginLeftAndTopCoordinates[0], btnLoginLeftAndTopCoordinates[1],
btnLoginLeftAndTopCoordinates[0] + btn_login.getMeasuredWidth(),
btnLoginLeftAndTopCoordinates[1] + btn_login.getMeasuredHeight());
Rect btn_new_userRect = new Rect(btnRegisterLeftAndTopCoordinates[0], btnRegisterLeftAndTopCoordinates[1],
btnRegisterLeftAndTopCoordinates[0] + btn_new_user.getMeasuredWidth(),
btnRegisterLeftAndTopCoordinates[1] + btn_new_user.getMeasuredHeight());
return (receiveAmountEdTxt.hasFocus() || sendAmountEdTxt.hasFocus())
&& !sendMoneyBoundRect.contains(posX, posY)
&& !receiveMoneyBoundRect.contains(posX, posY)
&& !backButtonBoundRect.contains(posX, posY);
&& !backButtonBoundRect.contains(posX, posY)
&& !selectedLanguageTextRect.contains(posX,posY)
&& !selectedLanguageIconRect.contains(posX,posY)
&& !btn_loginRect.contains(posX,posY)
&& !btn_new_userRect.contains(posX,posY);
}

Loading…
Cancel
Save