From 99bdc317accdece6e3dd0b909e81ede49853f1e7 Mon Sep 17 00:00:00 2001 From: DrKLO Date: Tue, 17 Jun 2014 19:10:02 +0400 Subject: [PATCH] Disable swipe back in google map view --- .../src/main/java/org/telegram/ui/LocationActivity.java | 1 + .../org/telegram/ui/Views/ActionBar/ActionBarActivity.java | 4 ++++ .../java/org/telegram/ui/Views/ActionBar/BaseFragment.java | 1 + 3 files changed, 6 insertions(+) diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LocationActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LocationActivity.java index aacb381f4..ddaa34639 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LocationActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LocationActivity.java @@ -60,6 +60,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter @Override public boolean onFragmentCreate() { super.onFragmentCreate(); + swipeBackEnabled = false; NotificationCenter.getInstance().addObserver(this, MessagesController.closeChats); if (messageObject != null) { NotificationCenter.getInstance().addObserver(this, MessagesController.updateInterfaces); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBarActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBarActivity.java index a047a6e53..1daa7005c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBarActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBarActivity.java @@ -265,6 +265,10 @@ public class ActionBarActivity extends Activity { public boolean onTouchEvent(MotionEvent ev) { if(android.os.Build.VERSION.SDK_INT >= 11 && !checkTransitionAnimation() && !inActionMode && fragmentsStack.size() > 1 && !animationInProgress) { if (ev != null && ev.getAction() == MotionEvent.ACTION_DOWN && !startedTracking && !maybeStartTracking) { + BaseFragment currentFragment = fragmentsStack.get(fragmentsStack.size() - 1); + if (!currentFragment.swipeBackEnabled) { + return false; + } startedTrackingPointerId = ev.getPointerId(0); maybeStartTracking = true; startedTrackingX = (int) ev.getX(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/BaseFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/BaseFragment.java index 2082c2e52..8ffc9c4ef 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/BaseFragment.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/BaseFragment.java @@ -28,6 +28,7 @@ public class BaseFragment { protected int classGuid = 0; protected Bundle arguments; private AlertDialog visibleDialog = null; + protected boolean swipeBackEnabled = true; public BaseFragment() { classGuid = ConnectionsManager.getInstance().generateClassGuid();