[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] When log is open, the back btn closes it



commit 87401d04fe4072ae53c32c1a7c88a632bc120c86
Author: lexi <bird.s.lex@xxxxxxxxx>
Date:   Sat Apr 7 23:22:24 2018 -0400

    When log is open, the back btn closes it
---
 .../java/org/torproject/android/OrbotMainActivity.java   | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
index cbc7349e..1a2b177f 100644
--- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java
+++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
@@ -126,6 +126,8 @@ public class OrbotMainActivity extends AppCompatActivity
     private final static int REQUEST_SETTINGS = 0x9874;
     private final static int REQUEST_VPN_APPS_SELECT = 8889;
 
+    private final static int LOG_DRAWER_GRAVITY = Gravity.END;
+
     // message types for mStatusUpdateHandler
     private final static int STATUS_UPDATE = 1;
     private static final int MESSAGE_TRAFFIC_COUNT = 2;
@@ -284,7 +286,7 @@ public class OrbotMainActivity extends AppCompatActivity
         lblStatus.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                mDrawer.openDrawer(Gravity.END);
+                mDrawer.openDrawer(LOG_DRAWER_GRAVITY);
             }
         });
 
@@ -564,6 +566,18 @@ public class OrbotMainActivity extends AppCompatActivity
 		}
 	}
 
+
+    @Override
+    public void onBackPressed() {
+        // check to see if the log is open, if so close it
+        if (mDrawer.isDrawerOpen(LOG_DRAWER_GRAVITY)) {
+            mDrawer.closeDrawers();
+        }
+        else {
+            super.onBackPressed();
+        }
+    }
+
 	private void refreshVPNApps ()
     {
         stopVpnService();



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits