Merge "Add hotspot icon to status bar" into lmp-mr1-dev
automerge: 09895be
* commit '09895be87e327a7e2090c88cb4a5fc997f33103c':
Add hotspot icon to status bar
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
<item><xliff:g id="id">sync_failing</xliff:g></item>
|
<item><xliff:g id="id">sync_failing</xliff:g></item>
|
||||||
<item><xliff:g id="id">sync_active</xliff:g></item>
|
<item><xliff:g id="id">sync_active</xliff:g></item>
|
||||||
<item><xliff:g id="id">cast</xliff:g></item>
|
<item><xliff:g id="id">cast</xliff:g></item>
|
||||||
|
<item><xliff:g id="id">hotspot</xliff:g></item>
|
||||||
<item><xliff:g id="id">location</xliff:g></item>
|
<item><xliff:g id="id">location</xliff:g></item>
|
||||||
<item><xliff:g id="id">bluetooth</xliff:g></item>
|
<item><xliff:g id="id">bluetooth</xliff:g></item>
|
||||||
<item><xliff:g id="id">nfc</xliff:g></item>
|
<item><xliff:g id="id">nfc</xliff:g></item>
|
||||||
|
|||||||
29
packages/SystemUI/res/drawable/stat_sys_hotspot.xml
Normal file
29
packages/SystemUI/res/drawable/stat_sys_hotspot.xml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<!--
|
||||||
|
Copyright (C) 2014 The Android Open Source 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.
|
||||||
|
-->
|
||||||
|
<inset xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:insetLeft="2.5dp"
|
||||||
|
android:insetRight="2.5dp">
|
||||||
|
<vector
|
||||||
|
android:width="17.0dp"
|
||||||
|
android:height="17.0dp"
|
||||||
|
android:viewportWidth="48.0"
|
||||||
|
android:viewportHeight="48.0">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M24.000000,22.000000c-2.200000,0.000000 -4.000000,1.800000 -4.000000,4.000000c0.000000,2.200000 1.800000,4.000000 4.000000,4.000000c2.200000,0.000000 4.000000,-1.800000 4.000000,-4.000000C28.000000,23.799999 26.200001,22.000000 24.000000,22.000000zM36.000000,26.000000c0.000000,-6.600000 -5.400000,-12.000000 -12.000000,-12.000000c-6.600000,0.000000 -12.000000,5.400000 -12.000000,12.000000c0.000000,4.400000 2.400000,8.300000 6.000000,10.400000l2.000000,-3.500000c-2.400000,-1.400000 -4.000000,-3.900000 -4.000000,-6.900000c0.000000,-4.400000 3.600000,-8.000000 8.000000,-8.000000s8.000000,3.600000 8.000000,8.000000c0.000000,3.000000 -1.600000,5.500000 -4.000000,6.900000l2.000000,3.500000C33.599998,34.299999 36.000000,30.400000 36.000000,26.000000zM24.000000,6.000000C13.000000,6.000000 4.000000,15.000000 4.000000,26.000000c0.000000,7.400000 4.000000,13.800000 10.000000,17.299999l2.000000,-3.500000c-4.800000,-2.800000 -8.000000,-7.900000 -8.000000,-13.800000c0.000000,-8.800000 7.200000,-16.000000 16.000000,-16.000000s16.000000,7.200000 16.000000,16.000000c0.000000,5.900000 -3.200000,11.100000 -8.000000,13.800000l2.000000,3.500000c6.000000,-3.500000 10.000000,-9.900000 10.000000,-17.299999C44.000000,15.000000 35.000000,6.000000 24.000000,6.000000z"/>
|
||||||
|
</vector>
|
||||||
|
</inset>
|
||||||
@@ -122,9 +122,14 @@ public class DemoStatusIcons extends LinearLayout implements DemoMode {
|
|||||||
}
|
}
|
||||||
String cast = args.getString("cast");
|
String cast = args.getString("cast");
|
||||||
if (cast != null) {
|
if (cast != null) {
|
||||||
int iconId = cast.equals("cast") ? R.drawable.stat_sys_cast : 0;
|
int iconId = cast.equals("show") ? R.drawable.stat_sys_cast : 0;
|
||||||
updateSlot("cast", null, iconId);
|
updateSlot("cast", null, iconId);
|
||||||
}
|
}
|
||||||
|
String hotspot = args.getString("hotspot");
|
||||||
|
if (hotspot != null) {
|
||||||
|
int iconId = hotspot.equals("show") ? R.drawable.stat_sys_hotspot : 0;
|
||||||
|
updateSlot("hotspot", null, iconId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -584,7 +584,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
|||||||
addNavigationBar();
|
addNavigationBar();
|
||||||
|
|
||||||
// Lastly, call to the icon policy to install/update all the icons.
|
// Lastly, call to the icon policy to install/update all the icons.
|
||||||
mIconPolicy = new PhoneStatusBarPolicy(mContext, mCastController);
|
mIconPolicy = new PhoneStatusBarPolicy(mContext, mCastController, mHotspotController);
|
||||||
mSettingsObserver.onChange(false); // set up
|
mSettingsObserver.onChange(false); // set up
|
||||||
|
|
||||||
mHeadsUpObserver.onChange(true); // set up
|
mHeadsUpObserver.onChange(true); // set up
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import com.android.internal.telephony.TelephonyIntents;
|
|||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.statusbar.policy.CastController;
|
import com.android.systemui.statusbar.policy.CastController;
|
||||||
import com.android.systemui.statusbar.policy.CastController.CastDevice;
|
import com.android.systemui.statusbar.policy.CastController.CastDevice;
|
||||||
|
import com.android.systemui.statusbar.policy.HotspotController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class contains all of the policy about which icons are installed in the status
|
* This class contains all of the policy about which icons are installed in the status
|
||||||
@@ -49,6 +50,7 @@ public class PhoneStatusBarPolicy {
|
|||||||
|
|
||||||
private static final String SLOT_SYNC_ACTIVE = "sync_active";
|
private static final String SLOT_SYNC_ACTIVE = "sync_active";
|
||||||
private static final String SLOT_CAST = "cast";
|
private static final String SLOT_CAST = "cast";
|
||||||
|
private static final String SLOT_HOTSPOT = "hotspot";
|
||||||
private static final String SLOT_BLUETOOTH = "bluetooth";
|
private static final String SLOT_BLUETOOTH = "bluetooth";
|
||||||
private static final String SLOT_TTY = "tty";
|
private static final String SLOT_TTY = "tty";
|
||||||
private static final String SLOT_ZEN = "zen";
|
private static final String SLOT_ZEN = "zen";
|
||||||
@@ -60,6 +62,7 @@ public class PhoneStatusBarPolicy {
|
|||||||
private final StatusBarManager mService;
|
private final StatusBarManager mService;
|
||||||
private final Handler mHandler = new Handler();
|
private final Handler mHandler = new Handler();
|
||||||
private final CastController mCast;
|
private final CastController mCast;
|
||||||
|
private final HotspotController mHotspot;
|
||||||
|
|
||||||
// Assume it's all good unless we hear otherwise. We don't always seem
|
// Assume it's all good unless we hear otherwise. We don't always seem
|
||||||
// to get broadcasts that it *is* there.
|
// to get broadcasts that it *is* there.
|
||||||
@@ -102,9 +105,10 @@ public class PhoneStatusBarPolicy {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public PhoneStatusBarPolicy(Context context, CastController cast) {
|
public PhoneStatusBarPolicy(Context context, CastController cast, HotspotController hotspot) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mCast = cast;
|
mCast = cast;
|
||||||
|
mHotspot = hotspot;
|
||||||
mService = (StatusBarManager)context.getSystemService(Context.STATUS_BAR_SERVICE);
|
mService = (StatusBarManager)context.getSystemService(Context.STATUS_BAR_SERVICE);
|
||||||
|
|
||||||
// listen for broadcasts
|
// listen for broadcasts
|
||||||
@@ -152,6 +156,11 @@ public class PhoneStatusBarPolicy {
|
|||||||
mService.setIcon(SLOT_CAST, R.drawable.stat_sys_cast, 0, null);
|
mService.setIcon(SLOT_CAST, R.drawable.stat_sys_cast, 0, null);
|
||||||
mService.setIconVisibility(SLOT_CAST, false);
|
mService.setIconVisibility(SLOT_CAST, false);
|
||||||
mCast.addCallback(mCastCallback);
|
mCast.addCallback(mCastCallback);
|
||||||
|
|
||||||
|
// hotspot
|
||||||
|
mService.setIcon(SLOT_HOTSPOT, R.drawable.stat_sys_hotspot, 0, null);
|
||||||
|
mService.setIconVisibility(SLOT_HOTSPOT, mHotspot.isHotspotEnabled());
|
||||||
|
mHotspot.addCallback(mHotspotCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setZenMode(int zen) {
|
public void setZenMode(int zen) {
|
||||||
@@ -300,6 +309,13 @@ public class PhoneStatusBarPolicy {
|
|||||||
mService.setIconVisibility(SLOT_CAST, isCasting);
|
mService.setIconVisibility(SLOT_CAST, isCasting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final HotspotController.Callback mHotspotCallback = new HotspotController.Callback() {
|
||||||
|
@Override
|
||||||
|
public void onHotspotChanged(boolean enabled) {
|
||||||
|
mService.setIconVisibility(SLOT_HOTSPOT, enabled);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private final CastController.Callback mCastCallback = new CastController.Callback() {
|
private final CastController.Callback mCastCallback = new CastController.Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onCastDevicesChanged() {
|
public void onCastDevicesChanged() {
|
||||||
|
|||||||
Reference in New Issue
Block a user