am e9dea7b7
: Merge "Add a bluetooth icon and data direction to the status bar." into honeycomb
* commit 'e9dea7b735fb0fdb1956d96a6e78b1c5cd666316': Add a bluetooth icon and data direction to the status bar.
Before Width: | Height: | Size: 700 B After Width: | Height: | Size: 944 B |
Before Width: | Height: | Size: 826 B After Width: | Height: | Size: 1.4 KiB |
BIN
packages/SystemUI/res/drawable-hdpi/stat_sys_signal_in.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
packages/SystemUI/res/drawable-hdpi/stat_sys_signal_out.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_in.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_inout.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
packages/SystemUI/res/drawable-hdpi/stat_sys_wifi_out.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 484 B After Width: | Height: | Size: 677 B |
Before Width: | Height: | Size: 550 B After Width: | Height: | Size: 988 B |
BIN
packages/SystemUI/res/drawable-mdpi/stat_sys_signal_in.png
Normal file
After Width: | Height: | Size: 1015 B |
BIN
packages/SystemUI/res/drawable-mdpi/stat_sys_signal_inout.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
packages/SystemUI/res/drawable-mdpi/stat_sys_signal_out.png
Normal file
After Width: | Height: | Size: 992 B |
BIN
packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_in.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_inout.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
packages/SystemUI/res/drawable-mdpi/stat_sys_wifi_out.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
@ -108,6 +108,12 @@
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
>
|
||||
<ImageView
|
||||
android:id="@+id/bluetooth"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<FrameLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
@ -123,6 +129,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
/>
|
||||
<ImageView
|
||||
android:id="@+id/network_direction"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
/>
|
||||
</FrameLayout>
|
||||
<ImageView
|
||||
android:id="@+id/battery"
|
||||
|
@ -23,34 +23,55 @@
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/notify_panel_clock_bg"
|
||||
>
|
||||
<ImageView
|
||||
android:id="@+id/network_signal"
|
||||
android:layout_height="32dp"
|
||||
android:layout_width="32dp"
|
||||
android:scaleType="centerInside"
|
||||
<LinearLayout
|
||||
android:id="@+id/icons"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:baseline="22dp"
|
||||
android:baselineAlignedChildIndex="0"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
>
|
||||
<ImageView
|
||||
android:id="@+id/bluetooth"
|
||||
android:layout_height="32dp"
|
||||
android:layout_width="32dp"
|
||||
android:scaleType="centerInside"
|
||||
android:baseline="22dp"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/netwerk"
|
||||
android:layout_height="32dp"
|
||||
android:layout_width="32dp"
|
||||
android:layout_marginRight="4dp"
|
||||
>
|
||||
<ImageView
|
||||
android:id="@+id/network_signal"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
/>
|
||||
<ImageView
|
||||
android:id="@+id/network_type"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_alignLeft="@id/network_signal"
|
||||
android:layout_alignBottom="@id/network_signal"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
/>
|
||||
<ImageView
|
||||
android:id="@+id/network_direction"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/network_text"
|
||||
style="@style/StatusBarNotificationText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/network_signal"
|
||||
android:layout_toRightOf="@id/netwerk"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_alignBaseline="@id/network_signal"
|
||||
android:singleLine="true"
|
||||
@ -78,12 +99,13 @@
|
||||
android:singleLine="true"
|
||||
android:text="@string/status_bar_settings_settings_button"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/settings_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@id/battery"
|
||||
android:layout_alignBaseline="@id/icons"
|
||||
android:layout_alignParentRight="true"
|
||||
android:paddingRight="16dp"
|
||||
android:src="@drawable/ic_sysbar_quicksettings"
|
||||
|
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (C) 2008 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.
|
||||
*/
|
||||
|
||||
package com.android.systemui.statusbar.policy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.util.Slog;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.android.systemui.R;
|
||||
|
||||
public class BluetoothController extends BroadcastReceiver {
|
||||
private static final String TAG = "StatusBar.BluetoothController";
|
||||
|
||||
private Context mContext;
|
||||
private ArrayList<ImageView> mIconViews = new ArrayList<ImageView>();
|
||||
|
||||
private int mIconId = R.drawable.stat_sys_data_bluetooth;
|
||||
private boolean mEnabled;
|
||||
|
||||
public BluetoothController(Context context) {
|
||||
mContext = context;
|
||||
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
|
||||
filter.addAction(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED);
|
||||
context.registerReceiver(this, filter);
|
||||
}
|
||||
|
||||
public void addIconView(ImageView v) {
|
||||
mIconViews.add(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
|
||||
int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
|
||||
mEnabled = state == BluetoothAdapter.STATE_ON;
|
||||
} else if (action.equals(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED)) {
|
||||
int state = intent.getIntExtra(BluetoothAdapter.EXTRA_CONNECTION_STATE,
|
||||
BluetoothAdapter.STATE_DISCONNECTED);
|
||||
if (state == BluetoothAdapter.STATE_CONNECTED) {
|
||||
mIconId = R.drawable.stat_sys_data_bluetooth_connected;
|
||||
} else {
|
||||
mIconId = R.drawable.stat_sys_data_bluetooth;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int N = mIconViews.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
ImageView v = mIconViews.get(i);
|
||||
v.setImageResource(mIconId);
|
||||
v.setVisibility(mEnabled ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
@ -75,8 +75,8 @@ public class NetworkController extends BroadcastReceiver {
|
||||
String mNetworkNameSeparator;
|
||||
int mPhoneSignalIconId;
|
||||
int mDataDirectionIconId;
|
||||
int mDataDirectionOverlayIconId;
|
||||
int mDataSignalIconId;
|
||||
int mDataActiveSignalIconId;
|
||||
int mDataTypeIconId;
|
||||
boolean mDataActive;
|
||||
|
||||
@ -101,12 +101,14 @@ public class NetworkController extends BroadcastReceiver {
|
||||
Context mContext;
|
||||
ArrayList<ImageView> mPhoneSignalIconViews = new ArrayList<ImageView>();
|
||||
ArrayList<ImageView> mDataDirectionIconViews = new ArrayList<ImageView>();
|
||||
ArrayList<ImageView> mDataDirectionOverlayIconViews = new ArrayList<ImageView>();
|
||||
ArrayList<ImageView> mWifiIconViews = new ArrayList<ImageView>();
|
||||
ArrayList<ImageView> mCombinedSignalIconViews = new ArrayList<ImageView>();
|
||||
ArrayList<ImageView> mDataTypeIconViews = new ArrayList<ImageView>();
|
||||
ArrayList<TextView> mLabelViews = new ArrayList<TextView>();
|
||||
int mLastPhoneSignalIconId = -1;
|
||||
int mLastDataDirectionIconId = -1;
|
||||
int mLastDataDirectionOverlayIconId = -1;
|
||||
int mLastWifiIconId = -1;
|
||||
int mLastCombinedSignalIconId = -1;
|
||||
int mLastDataTypeIconId = -1;
|
||||
@ -163,6 +165,10 @@ public class NetworkController extends BroadcastReceiver {
|
||||
mDataDirectionIconViews.add(v);
|
||||
}
|
||||
|
||||
public void addDataDirectionOverlayIconView(ImageView v) {
|
||||
mDataDirectionOverlayIconViews.add(v);
|
||||
}
|
||||
|
||||
public void addWifiIconView(ImageView v) {
|
||||
mWifiIconViews.add(v);
|
||||
}
|
||||
@ -367,17 +373,15 @@ public class NetworkController extends BroadcastReceiver {
|
||||
if (Settings.System.getInt(mContext.getContentResolver(),
|
||||
Settings.System.AIRPLANE_MODE_ON, 0) == 1) {
|
||||
mPhoneSignalIconId = R.drawable.stat_sys_signal_flightmode;
|
||||
mDataActiveSignalIconId = mDataSignalIconId = R.drawable.stat_sys_signal_flightmode;
|
||||
mDataSignalIconId = R.drawable.stat_sys_signal_flightmode;
|
||||
} else {
|
||||
mPhoneSignalIconId = R.drawable.stat_sys_signal_null;
|
||||
// note we use 0 instead of null
|
||||
mDataActiveSignalIconId = mDataSignalIconId = R.drawable.stat_sys_signal_0;
|
||||
mDataSignalIconId = R.drawable.stat_sys_signal_0; // note we use 0 instead of null
|
||||
}
|
||||
} else {
|
||||
if (mSignalStrength == null) {
|
||||
mPhoneSignalIconId = R.drawable.stat_sys_signal_null;
|
||||
// note we use 0 instead of null
|
||||
mDataActiveSignalIconId = mDataSignalIconId = R.drawable.stat_sys_signal_0;
|
||||
mDataSignalIconId = R.drawable.stat_sys_signal_0; // note we use 0 instead of null
|
||||
} else if (isCdma()) {
|
||||
// If 3G(EV) and 1x network are available than 3G should be
|
||||
// displayed, displayed RSSI should be from the EV side.
|
||||
@ -396,8 +400,6 @@ public class NetworkController extends BroadcastReceiver {
|
||||
}
|
||||
mPhoneSignalIconId = iconList[iconLevel];
|
||||
mDataSignalIconId = TelephonyIcons.DATA_SIGNAL_STRENGTH[mInetCondition][iconLevel];
|
||||
mDataActiveSignalIconId
|
||||
= TelephonyIcons.DATA_SIGNAL_STRENGTH_ACTIVE[mInetCondition][iconLevel];
|
||||
} else {
|
||||
int asu = mSignalStrength.getGsmSignalStrength();
|
||||
|
||||
@ -421,8 +423,6 @@ public class NetworkController extends BroadcastReceiver {
|
||||
}
|
||||
mPhoneSignalIconId = iconList[iconLevel];
|
||||
mDataSignalIconId = TelephonyIcons.DATA_SIGNAL_STRENGTH[mInetCondition][iconLevel];
|
||||
mDataActiveSignalIconId
|
||||
= TelephonyIcons.DATA_SIGNAL_STRENGTH_ACTIVE[mInetCondition][iconLevel];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -685,6 +685,7 @@ public class NetworkController extends BroadcastReceiver {
|
||||
Context context = mContext;
|
||||
|
||||
int combinedSignalIconId;
|
||||
int dataDirectionOverlayIconId = 0;
|
||||
int dataTypeIconId;
|
||||
String label;
|
||||
int N;
|
||||
@ -699,16 +700,22 @@ public class NetworkController extends BroadcastReceiver {
|
||||
dataTypeIconId = 0;
|
||||
} else if (mDataConnected) {
|
||||
label = mNetworkName;
|
||||
combinedSignalIconId = mDataSignalIconId;
|
||||
switch (mDataActivity) {
|
||||
case TelephonyManager.DATA_ACTIVITY_IN:
|
||||
dataDirectionOverlayIconId = R.drawable.stat_sys_signal_in;
|
||||
break;
|
||||
case TelephonyManager.DATA_ACTIVITY_OUT:
|
||||
dataDirectionOverlayIconId = R.drawable.stat_sys_signal_out;
|
||||
break;
|
||||
case TelephonyManager.DATA_ACTIVITY_INOUT:
|
||||
combinedSignalIconId = mDataActiveSignalIconId;
|
||||
dataDirectionOverlayIconId = R.drawable.stat_sys_signal_inout;
|
||||
break;
|
||||
default:
|
||||
combinedSignalIconId = mDataSignalIconId;
|
||||
dataDirectionOverlayIconId = 0;
|
||||
break;
|
||||
}
|
||||
combinedSignalIconId = mDataSignalIconId;
|
||||
dataTypeIconId = mDataTypeIconId;
|
||||
} else if (mBluetoothTethered) {
|
||||
label = mContext.getString(R.string.bluetooth_tethered);
|
||||
@ -724,11 +731,11 @@ public class NetworkController extends BroadcastReceiver {
|
||||
Slog.d(TAG, "refreshViews combinedSignalIconId=0x"
|
||||
+ Integer.toHexString(combinedSignalIconId)
|
||||
+ "/" + getResourceName(combinedSignalIconId)
|
||||
+ " dataDirectionOverlayIconId=0x" + Integer.toHexString(dataDirectionOverlayIconId)
|
||||
+ " mDataActivity=" + mDataActivity
|
||||
+ " mPhoneSignalIconId=0x" + Integer.toHexString(mPhoneSignalIconId)
|
||||
+ " mDataDirectionIconId=0x" + Integer.toHexString(mDataDirectionIconId)
|
||||
+ " mDataSignalIconId=0x" + Integer.toHexString(mDataSignalIconId)
|
||||
+ " mDataActiveSignalIconId=0x" + Integer.toHexString(mDataActiveSignalIconId)
|
||||
+ " mDataTypeIconId=0x" + Integer.toHexString(mDataTypeIconId)
|
||||
+ " mWifiIconId=0x" + Integer.toHexString(mWifiIconId)
|
||||
+ " mBluetoothTetherIconId=0x" + Integer.toHexString(mBluetoothTetherIconId));
|
||||
@ -789,6 +796,22 @@ public class NetworkController extends BroadcastReceiver {
|
||||
}
|
||||
}
|
||||
|
||||
// the data direction overlay
|
||||
if (mLastDataDirectionOverlayIconId != dataDirectionOverlayIconId) {
|
||||
Slog.d(TAG, "changing data overlay icon id to " + dataDirectionOverlayIconId);
|
||||
mLastDataDirectionOverlayIconId = dataDirectionOverlayIconId;
|
||||
N = mDataDirectionOverlayIconViews.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
final ImageView v = mDataDirectionOverlayIconViews.get(i);
|
||||
if (dataDirectionOverlayIconId == 0) {
|
||||
v.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
v.setVisibility(View.VISIBLE);
|
||||
v.setImageResource(dataDirectionOverlayIconId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the label in the notification panel
|
||||
if (!mLastLabel.equals(label)) {
|
||||
mLastLabel = label;
|
||||
@ -834,10 +857,6 @@ public class NetworkController extends BroadcastReceiver {
|
||||
pw.print(Integer.toHexString(mDataSignalIconId));
|
||||
pw.print("/");
|
||||
pw.println(getResourceName(mDataSignalIconId));
|
||||
pw.print(" mDataActiveSignalIconId=");
|
||||
pw.print(Integer.toHexString(mDataActiveSignalIconId));
|
||||
pw.print("/");
|
||||
pw.println(getResourceName(mDataActiveSignalIconId));
|
||||
pw.print(" mDataTypeIconId=");
|
||||
pw.print(Integer.toHexString(mDataTypeIconId));
|
||||
pw.print("/");
|
||||
@ -872,6 +891,10 @@ public class NetworkController extends BroadcastReceiver {
|
||||
pw.print(Integer.toHexString(mLastDataDirectionIconId));
|
||||
pw.print("/");
|
||||
pw.println(getResourceName(mLastDataDirectionIconId));
|
||||
pw.print(" mLastDataDirectionOverlayIconId=0x");
|
||||
pw.print(Integer.toHexString(mLastDataDirectionOverlayIconId));
|
||||
pw.print("/");
|
||||
pw.println(getResourceName(mLastDataDirectionOverlayIconId));
|
||||
pw.print(" mLastWifiIconId=0x");
|
||||
pw.print(Integer.toHexString(mLastWifiIconId));
|
||||
pw.print("/");
|
||||
|
@ -64,6 +64,7 @@ import com.android.internal.statusbar.StatusBarNotification;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.statusbar.*;
|
||||
import com.android.systemui.statusbar.policy.BatteryController;
|
||||
import com.android.systemui.statusbar.policy.BluetoothController;
|
||||
import com.android.systemui.statusbar.policy.NetworkController;
|
||||
import com.android.systemui.recent.RecentApplicationsActivity;
|
||||
|
||||
@ -133,6 +134,7 @@ public class TabletStatusBar extends StatusBar implements
|
||||
|
||||
HeightReceiver mHeightReceiver;
|
||||
BatteryController mBatteryController;
|
||||
BluetoothController mBluetoothController;
|
||||
NetworkController mNetworkController;
|
||||
|
||||
View mBarContents;
|
||||
@ -170,10 +172,14 @@ public class TabletStatusBar extends StatusBar implements
|
||||
mBatteryController.addIconView((ImageView)mNotificationPanel.findViewById(R.id.battery));
|
||||
mBatteryController.addLabelView(
|
||||
(TextView)mNotificationPanel.findViewById(R.id.battery_text));
|
||||
mBluetoothController.addIconView(
|
||||
(ImageView)mNotificationPanel.findViewById(R.id.bluetooth));
|
||||
mNetworkController.addCombinedSignalIconView(
|
||||
(ImageView)mNotificationPanel.findViewById(R.id.network_signal));
|
||||
mNetworkController.addDataTypeIconView(
|
||||
(ImageView)mNotificationPanel.findViewById(R.id.network_type));
|
||||
mNetworkController.addDataDirectionOverlayIconView(
|
||||
(ImageView)mNotificationPanel.findViewById(R.id.network_direction));
|
||||
mNetworkController.addLabelView(
|
||||
(TextView)mNotificationPanel.findViewById(R.id.network_text));
|
||||
mNetworkController.addLabelView(
|
||||
@ -355,11 +361,15 @@ public class TabletStatusBar extends StatusBar implements
|
||||
// The icons
|
||||
mBatteryController = new BatteryController(mContext);
|
||||
mBatteryController.addIconView((ImageView)sb.findViewById(R.id.battery));
|
||||
mBluetoothController = new BluetoothController(mContext);
|
||||
mBluetoothController.addIconView((ImageView)sb.findViewById(R.id.bluetooth));
|
||||
mNetworkController = new NetworkController(mContext);
|
||||
mNetworkController.addCombinedSignalIconView(
|
||||
(ImageView)sb.findViewById(R.id.network_signal));
|
||||
mNetworkController.addDataTypeIconView(
|
||||
(ImageView)sb.findViewById(R.id.network_type));
|
||||
mNetworkController.addDataDirectionOverlayIconView(
|
||||
(ImageView)sb.findViewById(R.id.network_direction));
|
||||
|
||||
// The navigation buttons
|
||||
mBackButton = (ImageView)sb.findViewById(R.id.back);
|
||||
|