summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI
diff options
context:
space:
mode:
authorstofstik <verstegen.daan@gmail.com>2015-08-17 17:42:53 +0200
committerDanesh M <daneshm90@gmail.com>2015-12-09 17:22:48 -0800
commitdbe722280e24de322b68e4645d22331ceed09616 (patch)
tree458a0532d080fe098984deb67b6c07512db514ae /packages/SystemUI
parentc7a735cc66541b89b50babe8fdae28e47d3e2c11 (diff)
downloadframeworks_base-dbe722280e24de322b68e4645d22331ceed09616.zip
frameworks_base-dbe722280e24de322b68e4645d22331ceed09616.tar.gz
frameworks_base-dbe722280e24de322b68e4645d22331ceed09616.tar.bz2
Added show volume panel tile to QS
Change-Id: Ic583c24e304d1edc903127237fc9eb5c7eeb7e4d JIRA: CYAN-6721
Diffstat (limited to 'packages/SystemUI')
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_volume_panel.xml26
-rw-r--r--packages/SystemUI/res/values/cm_strings.xml1
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/VolumeTile.java68
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java3
4 files changed, 98 insertions, 0 deletions
diff --git a/packages/SystemUI/res/drawable/ic_qs_volume_panel.xml b/packages/SystemUI/res/drawable/ic_qs_volume_panel.xml
new file mode 100644
index 0000000..4b818a5
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_qs_volume_panel.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2015 The CyanogenMod Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="64dp"
+ android:height="64dp"
+ android:viewportWidth="48"
+ android:viewportHeight="48">
+
+ <path
+ android:fillColor="#FFFFFF"
+ android:pathData="M6.0,18.0l0.0,12.0l8.0,0.0l10.0,10.0L24.0,8.0L14.0,18.0L6.0,18.0zm27.0,6.0c0.0,-3.53 -2.04,-6.58 -5.0,-8.05l0.0,16.11c2.96,-1.48 5.0,-4.53 5.0,-8.06zM28.0,6.46l0.0,4.13c5.78,1.72 10.0,7.07 10.0,13.41s-4.22,11.69 -10.0,13.41l0.0,4.13c8.01,-1.82 14.0,-8.97 14.0,-17.54S36.01,8.28 28.0,6.46z"/> <!--TODO Needs own icon-->
+</vector>
diff --git a/packages/SystemUI/res/values/cm_strings.xml b/packages/SystemUI/res/values/cm_strings.xml
index e360c95..ac8e7e2 100644
--- a/packages/SystemUI/res/values/cm_strings.xml
+++ b/packages/SystemUI/res/values/cm_strings.xml
@@ -108,4 +108,5 @@
<!-- Announcement made when sync changes to on (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_quick_settings_sync_changed_on">Sync turned on.</string>
<string name="quick_settings_sync_label">Sync</string>
+ <string name="quick_settings_volume_panel_label">Volume panel</string>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/VolumeTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/VolumeTile.java
new file mode 100644
index 0000000..ff254f0
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/VolumeTile.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2015 The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.qs.tiles;
+
+import android.content.Context;
+import android.content.Intent;
+import android.media.AudioManager;
+import android.provider.Settings;
+
+import com.android.internal.logging.MetricsConstants;
+import com.android.systemui.R;
+import com.android.systemui.qs.QSTile;
+
+public class VolumeTile extends QSTile<QSTile.BooleanState> {
+
+ private static final Intent SOUND_SETTINGS = new Intent("android.settings.SOUND_SETTINGS");
+
+ public VolumeTile(Host host) {
+ super(host);
+ }
+
+ @Override
+ protected void handleClick() {
+ AudioManager am = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
+ am.adjustVolume(AudioManager.ADJUST_SAME, AudioManager.FLAG_SHOW_UI);
+ }
+
+ @Override
+ protected void handleLongClick() {
+ mHost.startActivityDismissingKeyguard(SOUND_SETTINGS);
+ }
+
+ @Override
+ protected void handleUpdateState(BooleanState state, Object arg) {
+ state.visible = true;
+ state.label = mContext.getString(R.string.quick_settings_volume_panel_label);
+ state.icon = ResourceIcon.get(R.drawable.ic_qs_volume_panel); // TODO needs own icon
+ }
+
+ @Override
+ public int getMetricsCategory() {
+ return MetricsConstants.DONT_TRACK_ME_BRO;
+ }
+
+ @Override
+ protected BooleanState newTileState() {
+ return new BooleanState();
+ }
+
+ @Override
+ public void setListening(boolean listening) {
+ // Do nothing
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java
index d953367..1938325 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java
@@ -53,6 +53,7 @@ import com.android.systemui.qs.tiles.LocationTile;
import com.android.systemui.qs.tiles.NfcTile;
import com.android.systemui.qs.tiles.RotationLockTile;
import com.android.systemui.qs.tiles.SyncTile;
+import com.android.systemui.qs.tiles.VolumeTile;
import com.android.systemui.qs.tiles.WifiTile;
import com.android.systemui.statusbar.CustomTileData;
import com.android.systemui.statusbar.policy.BluetoothController;
@@ -336,6 +337,7 @@ public class QSTileHost implements QSTile.Host, Tunable {
else if (tileSpec.equals("compass")) return new CompassTile(this);
else if (tileSpec.equals("nfc")) return new NfcTile(this);
else if (tileSpec.equals("sync")) return new SyncTile(this);
+ else if (tileSpec.equals("volume_panel")) return new VolumeTile(this);
else if (tileSpec.startsWith(IntentTile.PREFIX)) return IntentTile.create(this,tileSpec);
else throw new IllegalArgumentException("Bad tile spec: " + tileSpec);
}
@@ -410,6 +412,7 @@ public class QSTileHost implements QSTile.Host, Tunable {
else if (spec.equals("compass")) return R.string.qs_tile_compass;
else if (spec.equals("nfc")) return R.string.quick_settings_nfc;
else if (spec.equals("sync")) return R.string.quick_settings_sync_label;
+ else if (spec.equals("volume_panel")) return R.string.quick_settings_volume_panel_label;
return 0;
}