Merge "Resurface inet problems in status bar icons."
This commit is contained in:
committed by
Android (Google) Code Review
commit
35dec44394
@@ -17,6 +17,8 @@
|
||||
package com.android.systemui.statusbar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@@ -35,11 +37,14 @@ public class SignalClusterView
|
||||
|
||||
static final boolean DEBUG = false;
|
||||
static final String TAG = "SignalClusterView";
|
||||
static final PorterDuffColorFilter PROBLEM_FILTER
|
||||
= new PorterDuffColorFilter(0xffab653b, PorterDuff.Mode.SRC_ATOP);
|
||||
|
||||
NetworkController mNC;
|
||||
|
||||
private boolean mWifiVisible = false;
|
||||
private int mWifiStrengthId = 0;
|
||||
private boolean mInetProblem;
|
||||
private boolean mMobileVisible = false;
|
||||
private int mMobileStrengthId = 0, mMobileTypeId = 0;
|
||||
private boolean mIsAirplaneMode = false;
|
||||
@@ -96,19 +101,22 @@ public class SignalClusterView
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWifiIndicators(boolean visible, int strengthIcon, String contentDescription) {
|
||||
public void setWifiIndicators(boolean visible, int strengthIcon, boolean problem,
|
||||
String contentDescription) {
|
||||
mWifiVisible = visible;
|
||||
mWifiStrengthId = strengthIcon;
|
||||
mInetProblem = problem;
|
||||
mWifiDescription = contentDescription;
|
||||
|
||||
apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMobileDataIndicators(boolean visible, int strengthIcon,
|
||||
public void setMobileDataIndicators(boolean visible, int strengthIcon, boolean problem,
|
||||
int typeIcon, String contentDescription, String typeContentDescription) {
|
||||
mMobileVisible = visible;
|
||||
mMobileStrengthId = strengthIcon;
|
||||
mInetProblem = problem;
|
||||
mMobileTypeId = typeIcon;
|
||||
mMobileDescription = contentDescription;
|
||||
mMobileTypeDescription = typeContentDescription;
|
||||
@@ -158,13 +166,17 @@ public class SignalClusterView
|
||||
apply();
|
||||
}
|
||||
|
||||
private void applyInetProblem(ImageView iv) {
|
||||
iv.setColorFilter(mInetProblem ? PROBLEM_FILTER : null);
|
||||
}
|
||||
|
||||
// Run after each indicator change.
|
||||
private void apply() {
|
||||
if (mWifiGroup == null) return;
|
||||
|
||||
if (mWifiVisible) {
|
||||
mWifi.setImageResource(mWifiStrengthId);
|
||||
|
||||
applyInetProblem(mWifi);
|
||||
mWifiGroup.setContentDescription(mWifiDescription);
|
||||
mWifiGroup.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
@@ -179,7 +191,7 @@ public class SignalClusterView
|
||||
if (mMobileVisible && !mIsAirplaneMode) {
|
||||
mMobile.setImageResource(mMobileStrengthId);
|
||||
mMobileType.setImageResource(mMobileTypeId);
|
||||
|
||||
applyInetProblem(mMobile);
|
||||
mMobileGroup.setContentDescription(mMobileTypeDescription + " " + mMobileDescription);
|
||||
mMobileGroup.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
|
||||
@@ -126,6 +126,7 @@ public class NetworkController extends BroadcastReceiver implements DemoMode {
|
||||
private int mConnectedNetworkType = ConnectivityManager.TYPE_NONE;
|
||||
private String mConnectedNetworkTypeName;
|
||||
private int mInetCondition = 0;
|
||||
private int mLastInetCondition = 0;
|
||||
private static final int INET_CONDITION_THRESHOLD = 50;
|
||||
|
||||
private boolean mAirplaneMode = false;
|
||||
@@ -156,9 +157,9 @@ public class NetworkController extends BroadcastReceiver implements DemoMode {
|
||||
boolean mDataAndWifiStacked = false;
|
||||
|
||||
public interface SignalCluster {
|
||||
void setWifiIndicators(boolean visible, int strengthIcon,
|
||||
void setWifiIndicators(boolean visible, int strengthIcon, boolean problem,
|
||||
String contentDescription);
|
||||
void setMobileDataIndicators(boolean visible, int strengthIcon,
|
||||
void setMobileDataIndicators(boolean visible, int strengthIcon, boolean problem,
|
||||
int typeIcon, String contentDescription, String typeContentDescription);
|
||||
void setIsAirplaneMode(boolean is, int airplaneIcon);
|
||||
}
|
||||
@@ -288,6 +289,7 @@ public class NetworkController extends BroadcastReceiver implements DemoMode {
|
||||
// only show wifi in the cluster if connected or if wifi-only
|
||||
mWifiEnabled && (mWifiConnected || !mHasMobileDataFeature),
|
||||
mWifiIconId,
|
||||
mInetCondition == 0,
|
||||
mContentDescriptionWifi);
|
||||
|
||||
if (mIsWimaxEnabled && mWimaxConnected) {
|
||||
@@ -295,6 +297,7 @@ public class NetworkController extends BroadcastReceiver implements DemoMode {
|
||||
cluster.setMobileDataIndicators(
|
||||
true,
|
||||
mAlwaysShowCdmaRssi ? mPhoneSignalIconId : mWimaxIconId,
|
||||
mInetCondition == 0,
|
||||
mDataTypeIconId,
|
||||
mContentDescriptionWimax,
|
||||
mContentDescriptionDataType);
|
||||
@@ -303,6 +306,7 @@ public class NetworkController extends BroadcastReceiver implements DemoMode {
|
||||
cluster.setMobileDataIndicators(
|
||||
mHasMobileDataFeature,
|
||||
mShowPhoneRSSIForData ? mPhoneSignalIconId : mDataSignalIconId,
|
||||
mInetCondition == 0,
|
||||
mDataTypeIconId,
|
||||
mContentDescriptionPhoneSignal,
|
||||
mContentDescriptionDataType);
|
||||
@@ -1145,6 +1149,7 @@ public class NetworkController extends BroadcastReceiver implements DemoMode {
|
||||
|
||||
if (mLastPhoneSignalIconId != mPhoneSignalIconId
|
||||
|| mLastWifiIconId != mWifiIconId
|
||||
|| mLastInetCondition != mInetCondition
|
||||
|| mLastWimaxIconId != mWimaxIconId
|
||||
|| mLastDataTypeIconId != mDataTypeIconId
|
||||
|| mLastAirplaneMode != mAirplaneMode
|
||||
@@ -1179,6 +1184,10 @@ public class NetworkController extends BroadcastReceiver implements DemoMode {
|
||||
mLastWifiIconId = mWifiIconId;
|
||||
}
|
||||
|
||||
if (mLastInetCondition != mInetCondition) {
|
||||
mLastInetCondition = mInetCondition;
|
||||
}
|
||||
|
||||
// the wimax icon on phones
|
||||
if (mLastWimaxIconId != mWimaxIconId) {
|
||||
mLastWimaxIconId = mWimaxIconId;
|
||||
@@ -1424,6 +1433,7 @@ public class NetworkController extends BroadcastReceiver implements DemoMode {
|
||||
cluster.setWifiIndicators(
|
||||
show,
|
||||
iconId,
|
||||
mDemoInetCondition == 0,
|
||||
"Demo");
|
||||
}
|
||||
}
|
||||
@@ -1456,6 +1466,7 @@ public class NetworkController extends BroadcastReceiver implements DemoMode {
|
||||
cluster.setMobileDataIndicators(
|
||||
show,
|
||||
iconId,
|
||||
mDemoInetCondition == 0,
|
||||
mDemoDataTypeIconId,
|
||||
"Demo",
|
||||
"Demo");
|
||||
|
||||
Reference in New Issue
Block a user