Merge "StatusBar: Add new icon slot for cast status." into lmp-dev

This commit is contained in:
John Spurlock
2014-08-27 13:58:13 +00:00
committed by Android (Google) Code Review
14 changed files with 70 additions and 2 deletions

View File

@@ -26,6 +26,7 @@
<item><xliff:g id="id">ime</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">cast</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">nfc</xliff:g></item>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 959 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1012 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 802 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1,25 @@
<!--
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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="18dp"
android:height="18dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M2.0,36.0l0.0,6.0l6.0,0.0C8.0,38.7 5.3,36.0 2.0,36.0zM2.0,28.0l0.0,4.0c5.5,0.0 10.0,4.5 10.0,10.0l4.0,0.0C16.0,34.3 9.7,28.0 2.0,28.0zM38.0,14.0L10.0,14.0l0.0,3.3c7.9,2.6 14.2,8.8 16.7,16.7L38.0,34.0L38.0,14.0zM2.0,20.0l0.0,4.0c9.9,0.0 18.0,8.1 18.0,18.0l4.0,0.0C24.0,29.8 14.1,20.0 2.0,20.0zM42.0,6.0L6.0,6.0c-2.2,0.0 -4.0,1.8 -4.0,4.0l0.0,6.0l4.0,0.0l0.0,-6.0l36.0,0.0l0.0,28.0L28.0,38.0l0.0,4.0l14.0,0.0c2.2,0.0 4.0,-1.8 4.0,-4.0L46.0,10.0C46.0,7.8 44.2,6.0 42.0,6.0z"/>
</vector>

View File

@@ -392,6 +392,9 @@
<!-- Content description of the ringer silent icon in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_ringer_silent">Ringer silent.</string>
<!-- Content description of the cast icon in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_casting">@string/quick_settings_casting</string>
<!-- Content description to tell the user that this button will remove an application from recents -->
<string name="accessibility_recents_item_will_be_dismissed">Dismiss <xliff:g id="app" example="Calendar">%s</xliff:g>.</string>
<!-- Content description to tell the user an application has been removed from recents -->

View File

@@ -120,6 +120,11 @@ public class DemoStatusIcons extends LinearLayout implements DemoMode {
: 0;
updateSlot("speakerphone", null, iconId);
}
String cast = args.getString("cast");
if (cast != null) {
int iconId = cast.equals("cast") ? R.drawable.stat_sys_cast : 0;
updateSlot("cast", null, iconId);
}
}
}

View File

@@ -562,7 +562,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
addNavigationBar();
// Lastly, call to the icon policy to install/update all the icons.
mIconPolicy = new PhoneStatusBarPolicy(mContext);
mIconPolicy = new PhoneStatusBarPolicy(mContext, mCastController);
mSettingsObserver.onChange(false); // set up
mHeadsUpObserver.onChange(true); // set up

View File

@@ -33,6 +33,8 @@ import android.util.Log;
import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.TelephonyIntents;
import com.android.systemui.R;
import com.android.systemui.statusbar.policy.CastController;
import com.android.systemui.statusbar.policy.CastController.CastDevice;
/**
* This class contains all of the policy about which icons are installed in the status
@@ -46,6 +48,7 @@ public class PhoneStatusBarPolicy {
private static final boolean SHOW_SYNC_ICON = false;
private static final String SLOT_SYNC_ACTIVE = "sync_active";
private static final String SLOT_CAST = "cast";
private static final String SLOT_BLUETOOTH = "bluetooth";
private static final String SLOT_TTY = "tty";
private static final String SLOT_ZEN = "zen";
@@ -56,6 +59,7 @@ public class PhoneStatusBarPolicy {
private final Context mContext;
private final StatusBarManager mService;
private final Handler mHandler = new Handler();
private final CastController mCast;
// Assume it's all good unless we hear otherwise. We don't always seem
// to get broadcasts that it *is* there.
@@ -98,8 +102,9 @@ public class PhoneStatusBarPolicy {
}
};
public PhoneStatusBarPolicy(Context context) {
public PhoneStatusBarPolicy(Context context, CastController cast) {
mContext = context;
mCast = cast;
mService = (StatusBarManager)context.getSystemService(Context.STATUS_BAR_SERVICE);
// listen for broadcasts
@@ -151,6 +156,11 @@ public class PhoneStatusBarPolicy {
mService.setIcon(SLOT_VOLUME, R.drawable.stat_sys_ringer_vibrate, 0, null);
mService.setIconVisibility(SLOT_VOLUME, false);
updateVolumeZen();
// cast
mService.setIcon(SLOT_CAST, R.drawable.stat_sys_cast, 0, null);
mService.setIconVisibility(SLOT_CAST, false);
mCast.addCallback(mCastCallback);
}
public void setZenMode(int zen) {
@@ -287,4 +297,28 @@ public class PhoneStatusBarPolicy {
mService.setIconVisibility(SLOT_TTY, false);
}
}
private void updateCast() {
boolean isCasting = false;
for (CastDevice device : mCast.getCastDevices()) {
if (device.state == CastDevice.STATE_CONNECTING
|| device.state == CastDevice.STATE_CONNECTED) {
isCasting = true;
break;
}
}
if (DEBUG) Log.v(TAG, "updateCast: isCasting: " + isCasting);
if (isCasting) {
mService.setIcon(SLOT_CAST, R.drawable.stat_sys_cast, 0,
mContext.getString(R.string.accessibility_casting));
}
mService.setIconVisibility(SLOT_CAST, isCasting);
}
private final CastController.Callback mCastCallback = new CastController.Callback() {
@Override
public void onCastDevicesChanged() {
updateCast();
}
};
}