OSDN Git Service

LocationTile: Behave like other tiles
authorMichael W <baddaemon87@gmail.com>
Mon, 12 Jun 2017 17:13:09 +0000 (19:13 +0200)
committerHarry Youd <harry@harryyoud.co.uk>
Wed, 14 Jun 2017 07:04:00 +0000 (07:04 +0000)
* Behave equal to WiFi and Bluetooth Tiles:
  Secondary click enables and disables location

Change-Id: I9767b9f2e812f85c664ff7721ff3d8dc9ba54aca

packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java

index a7c9e9c..0d8910b 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
  * Copyright (C) 2016 The ParanoidAndroid Project
+ * Copyright (C) 2017 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -110,6 +111,13 @@ public class LocationTile extends QSTile<QSTile.BooleanState> {
     }
 
     @Override
+    protected void handleSecondaryClick() {
+        final boolean wasEnabled = mState.value;
+        MetricsLogger.action(mContext, getMetricsCategory(), !wasEnabled);
+        mController.setLocationEnabled(!wasEnabled);
+    }
+
+    @Override
     public CharSequence getTileLabel() {
         return mContext.getString(R.string.quick_settings_location_label);
     }