diff options
author | Steven Davies <github@steev.me.uk> | 2013-06-27 20:53:31 +0100 |
---|---|---|
committer | jackmu95 <jacob.mueller.elz@gmail.com> | 2013-08-11 19:11:45 +0200 |
commit | a92c2e689de1d66817736726b6043f2125826bc3 (patch) | |
tree | 762b55d10a9b40902e81e4835f51656f0fbc761c /packages | |
parent | 28ae2a3e0339d5288d0e9b25f9867cf0106800cb (diff) | |
download | frameworks_base-a92c2e689de1d66817736726b6043f2125826bc3.zip frameworks_base-a92c2e689de1d66817736726b6043f2125826bc3.tar.gz frameworks_base-a92c2e689de1d66817736726b6043f2125826bc3.tar.bz2 |
SystemUI: Add ethernet network icon
Add an ethernet network icon to the statusbar network area.
Change-Id: I019740f360b5f9cc85f404f75d38e38896182a81
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/res/drawable-hdpi/stat_sys_ether.png | bin | 0 -> 557 bytes | |||
-rw-r--r-- | packages/SystemUI/res/drawable-hdpi/stat_sys_ether_fully.png | bin | 0 -> 603 bytes | |||
-rw-r--r-- | packages/SystemUI/res/drawable-mdpi/stat_sys_ether.png | bin | 0 -> 313 bytes | |||
-rw-r--r-- | packages/SystemUI/res/drawable-mdpi/stat_sys_ether_fully.png | bin | 0 -> 302 bytes | |||
-rw-r--r-- | packages/SystemUI/res/drawable-xhdpi/stat_sys_ether.png | bin | 0 -> 660 bytes | |||
-rw-r--r-- | packages/SystemUI/res/drawable-xhdpi/stat_sys_ether_fully.png | bin | 0 -> 670 bytes | |||
-rw-r--r-- | packages/SystemUI/res/layout/signal_cluster_view.xml | 5 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java | 25 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java | 48 |
9 files changed, 66 insertions, 12 deletions
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_ether.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_ether.png Binary files differnew file mode 100644 index 0000000..6f6d36a --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_ether.png diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_ether_fully.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_ether_fully.png Binary files differnew file mode 100644 index 0000000..320caeb --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/stat_sys_ether_fully.png diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_ether.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_ether.png Binary files differnew file mode 100644 index 0000000..ddb82ee --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_ether.png diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_ether_fully.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_ether_fully.png Binary files differnew file mode 100644 index 0000000..e64cfa8 --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/stat_sys_ether_fully.png diff --git a/packages/SystemUI/res/drawable-xhdpi/stat_sys_ether.png b/packages/SystemUI/res/drawable-xhdpi/stat_sys_ether.png Binary files differnew file mode 100644 index 0000000..f78f93c --- /dev/null +++ b/packages/SystemUI/res/drawable-xhdpi/stat_sys_ether.png diff --git a/packages/SystemUI/res/drawable-xhdpi/stat_sys_ether_fully.png b/packages/SystemUI/res/drawable-xhdpi/stat_sys_ether_fully.png Binary files differnew file mode 100644 index 0000000..648a46e --- /dev/null +++ b/packages/SystemUI/res/drawable-xhdpi/stat_sys_ether_fully.png diff --git a/packages/SystemUI/res/layout/signal_cluster_view.xml b/packages/SystemUI/res/layout/signal_cluster_view.xml index 66c64c4..29ce1fb 100644 --- a/packages/SystemUI/res/layout/signal_cluster_view.xml +++ b/packages/SystemUI/res/layout/signal_cluster_view.xml @@ -110,4 +110,9 @@ android:layout_height="wrap_content" android:layout_width="wrap_content" /> + <ImageView + android:id="@+id/ethernet" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + /> </com.android.systemui.statusbar.SignalClusterView> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java index 8558762..61ac45b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java @@ -54,10 +54,12 @@ public class SignalClusterView private int mMobileStrengthId = 0, mMobileActivityId = 0, mMobileTypeId = 0; private boolean mIsAirplaneMode = false; private int mAirplaneIconId = 0; - private String mWifiDescription, mMobileDescription, mMobileTypeDescription; + private boolean mEtherVisible = false; + private int mEtherIconId = 0; + private String mWifiDescription, mMobileDescription, mMobileTypeDescription, mEtherDescription; ViewGroup mWifiGroup, mMobileGroup; - ImageView mWifi, mMobile, mWifiActivity, mMobileActivity, mMobileType, mAirplane; + ImageView mWifi, mMobile, mWifiActivity, mMobileActivity, mMobileType, mAirplane, mEther; View mSpacer; Handler mHandler; @@ -119,6 +121,7 @@ public class SignalClusterView mMobileType = (ImageView) findViewById(R.id.mobile_type); mSpacer = findViewById(R.id.spacer); mAirplane = (ImageView) findViewById(R.id.airplane); + mEther = (ImageView) findViewById(R.id.ethernet); apply(); } @@ -136,6 +139,7 @@ public class SignalClusterView mMobileType = null; mSpacer = null; mAirplane = null; + mEther = null; super.onDetachedFromWindow(); } @@ -173,6 +177,15 @@ public class SignalClusterView } @Override + public void setEtherIndicators(boolean visible, int etherIcon, String contentDescription) { + mEtherVisible = visible; + mEtherIconId = etherIcon; + mEtherDescription = contentDescription; + + apply(); + } + + @Override public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { // Standard group layout onPopulateAccessibilityEvent() implementations // ignore content description, so populate manually @@ -218,6 +231,14 @@ public class SignalClusterView mAirplane.setVisibility(View.GONE); } + if (mEtherVisible) { + mEther.setVisibility(View.VISIBLE); + mEther.setImageResource(mEtherIconId); + mEther.setContentDescription(mEtherDescription); + } else { + mEther.setVisibility(View.GONE); + } + if (mMobileVisible && mWifiVisible && mIsAirplaneMode) { mSpacer.setVisibility(View.INVISIBLE); } else { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java index 6a823fa..5966890 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java @@ -95,6 +95,7 @@ public class NetworkController extends BroadcastReceiver { String mContentDescriptionWimax; String mContentDescriptionCombinedSignal; String mContentDescriptionDataType; + String mContentDescriptionEther; // wifi final WifiManager mWifiManager; @@ -133,6 +134,12 @@ public class NetworkController extends BroadcastReceiver { private boolean mAirplaneMode = false; private boolean mLastAirplaneMode = true; + //ethernet + private boolean mEtherConnected = false; + private int mEtherIconId = 0; + private int mLastEtherIconId = 0; + + // our ui Context mContext; ArrayList<ImageView> mPhoneSignalIconViews = new ArrayList<ImageView>(); @@ -171,6 +178,7 @@ public class NetworkController extends BroadcastReceiver { void setMobileDataIndicators(boolean visible, int strengthIcon, int activityIcon, int typeIcon, String contentDescription, String typeContentDescription); void setIsAirplaneMode(boolean is, int airplaneIcon); + void setEtherIndicators(boolean visible, int etherIcon, String contentDescription); } public interface NetworkSignalChangedCallback { @@ -203,7 +211,7 @@ public class NetworkController extends BroadcastReceiver { updateWimaxIcons(); // telephony - mPhone = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); + mPhone = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); mPhone.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SERVICE_STATE | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS @@ -218,7 +226,7 @@ public class NetworkController extends BroadcastReceiver { mNetworkName = mNetworkNameDefault; // wifi - mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); + mWifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE); Handler handler = new WifiHandler(); mWifiChannel = new AsyncChannel(); Messenger wifiMessenger = mWifiManager.getWifiServiceMessenger(); @@ -244,7 +252,7 @@ public class NetworkController extends BroadcastReceiver { filter.addAction(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION); filter.addAction(WimaxManagerConstants.NET_4G_STATE_CHANGED_ACTION); } - context.registerReceiver(this, filter); + mContext.registerReceiver(this, filter); // AIRPLANE_MODE_CHANGED is sent at boot; we've probably already missed it updateAirplaneMode(); @@ -326,6 +334,12 @@ public class NetworkController extends BroadcastReceiver { mWifiActivityIconId, mContentDescriptionWifi); + cluster.setEtherIndicators( + // only show ethernet in the cluster if connected + mEtherConnected, + mEtherIconId, + mContentDescriptionEther); + if (mIsWimaxEnabled && mWimaxConnected) { // wimax is special cluster.setMobileDataIndicators( @@ -995,6 +1009,16 @@ public class NetworkController extends BroadcastReceiver { mBluetoothTethered = false; } + if (info != null && info.getType() == ConnectivityManager.TYPE_ETHERNET) { + mEtherConnected = info.isConnected(); + mEtherIconId = (mInetCondition == 1 + ? R.drawable.stat_sys_ether_fully + : R.drawable.stat_sys_ether); + } else { + mEtherConnected = false; + mEtherIconId = 0; + } + // We want to update all the icons, all at once, for any condition change updateDataNetType(); updateWimaxIcons(); @@ -1007,8 +1031,6 @@ public class NetworkController extends BroadcastReceiver { // ===== Update the views ======================================================= void refreshViews() { - Context context = mContext; - int combinedSignalIconId = 0; int combinedActivityIconId = 0; String combinedLabel = ""; @@ -1116,9 +1138,9 @@ public class NetworkController extends BroadcastReceiver { R.string.accessibility_bluetooth_tether); } - final boolean ethernetConnected = (mConnectedNetworkType == ConnectivityManager.TYPE_ETHERNET); - if (ethernetConnected) { - combinedLabel = context.getString(R.string.ethernet_label); + mEtherConnected = (mConnectedNetworkType == ConnectivityManager.TYPE_ETHERNET); + if (mEtherConnected) { + mContentDescriptionEther = combinedLabel = mContext.getString(R.string.ethernet_label); } if (mAirplaneMode && @@ -1147,8 +1169,8 @@ public class NetworkController extends BroadcastReceiver { mContentDescriptionCombinedSignal = mContentDescriptionPhoneSignal; combinedSignalIconId = mDataSignalIconId; } - } - else if (!mDataConnected && !mWifiConnected && !mBluetoothTethered && !mWimaxConnected && !ethernetConnected) { + } else if (!mDataConnected && !mWifiConnected && !mBluetoothTethered + && !mWimaxConnected && !mEtherConnected) { // pretty much totally disconnected combinedLabel = context.getString(R.string.status_bar_settings_signal_meter_disconnected); @@ -1203,6 +1225,7 @@ public class NetworkController extends BroadcastReceiver { || mLastWifiIconId != mWifiIconId || mLastWimaxIconId != mWimaxIconId || mLastDataTypeIconId != mDataTypeIconId + || mLastEtherIconId != mEtherIconId || mLastAirplaneMode != mAirplaneMode) { // NB: the mLast*s will be updated later @@ -1287,6 +1310,11 @@ public class NetworkController extends BroadcastReceiver { } } + // the ethernet icon + if (mLastEtherIconId != mEtherIconId) { + mLastEtherIconId = mEtherIconId; + } + // the data network type overlay if (mLastDataTypeIconId != mDataTypeIconId) { mLastDataTypeIconId = mDataTypeIconId; |