Merge "Move airplane icon to its own view" into jb-dev
This commit is contained in:
@@ -105,4 +105,9 @@
|
|||||||
/>
|
/>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/airplane"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
/>
|
||||||
</com.android.systemui.statusbar.SignalClusterView>
|
</com.android.systemui.statusbar.SignalClusterView>
|
||||||
|
|||||||
@@ -44,10 +44,11 @@ public class SignalClusterView
|
|||||||
private boolean mMobileVisible = false;
|
private boolean mMobileVisible = false;
|
||||||
private int mMobileStrengthId = 0, mMobileActivityId = 0, mMobileTypeId = 0;
|
private int mMobileStrengthId = 0, mMobileActivityId = 0, mMobileTypeId = 0;
|
||||||
private boolean mIsAirplaneMode = false;
|
private boolean mIsAirplaneMode = false;
|
||||||
|
private int mAirplaneIconId = 0;
|
||||||
private String mWifiDescription, mMobileDescription, mMobileTypeDescription;
|
private String mWifiDescription, mMobileDescription, mMobileTypeDescription;
|
||||||
|
|
||||||
ViewGroup mWifiGroup, mMobileGroup;
|
ViewGroup mWifiGroup, mMobileGroup;
|
||||||
ImageView mWifi, mMobile, mWifiActivity, mMobileActivity, mMobileType;
|
ImageView mWifi, mMobile, mWifiActivity, mMobileActivity, mMobileType, mAirplane;
|
||||||
View mSpacer;
|
View mSpacer;
|
||||||
|
|
||||||
public SignalClusterView(Context context) {
|
public SignalClusterView(Context context) {
|
||||||
@@ -79,6 +80,7 @@ public class SignalClusterView
|
|||||||
mMobileActivity = (ImageView) findViewById(R.id.mobile_inout);
|
mMobileActivity = (ImageView) findViewById(R.id.mobile_inout);
|
||||||
mMobileType = (ImageView) findViewById(R.id.mobile_type);
|
mMobileType = (ImageView) findViewById(R.id.mobile_type);
|
||||||
mSpacer = findViewById(R.id.spacer);
|
mSpacer = findViewById(R.id.spacer);
|
||||||
|
mAirplane = (ImageView) findViewById(R.id.airplane);
|
||||||
|
|
||||||
apply();
|
apply();
|
||||||
}
|
}
|
||||||
@@ -92,10 +94,13 @@ public class SignalClusterView
|
|||||||
mMobile = null;
|
mMobile = null;
|
||||||
mMobileActivity = null;
|
mMobileActivity = null;
|
||||||
mMobileType = null;
|
mMobileType = null;
|
||||||
|
mSpacer = null;
|
||||||
|
mAirplane = null;
|
||||||
|
|
||||||
super.onDetachedFromWindow();
|
super.onDetachedFromWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setWifiIndicators(boolean visible, int strengthIcon, int activityIcon,
|
public void setWifiIndicators(boolean visible, int strengthIcon, int activityIcon,
|
||||||
String contentDescription) {
|
String contentDescription) {
|
||||||
mWifiVisible = visible;
|
mWifiVisible = visible;
|
||||||
@@ -106,6 +111,7 @@ public class SignalClusterView
|
|||||||
apply();
|
apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMobileDataIndicators(boolean visible, int strengthIcon, int activityIcon,
|
public void setMobileDataIndicators(boolean visible, int strengthIcon, int activityIcon,
|
||||||
int typeIcon, String contentDescription, String typeContentDescription) {
|
int typeIcon, String contentDescription, String typeContentDescription) {
|
||||||
mMobileVisible = visible;
|
mMobileVisible = visible;
|
||||||
@@ -118,8 +124,12 @@ public class SignalClusterView
|
|||||||
apply();
|
apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsAirplaneMode(boolean is) {
|
@Override
|
||||||
|
public void setIsAirplaneMode(boolean is, int airplaneIconId) {
|
||||||
mIsAirplaneMode = is;
|
mIsAirplaneMode = is;
|
||||||
|
mAirplaneIconId = airplaneIconId;
|
||||||
|
|
||||||
|
apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run after each indicator change.
|
// Run after each indicator change.
|
||||||
@@ -140,7 +150,7 @@ public class SignalClusterView
|
|||||||
(mWifiVisible ? "VISIBLE" : "GONE"),
|
(mWifiVisible ? "VISIBLE" : "GONE"),
|
||||||
mWifiStrengthId, mWifiActivityId));
|
mWifiStrengthId, mWifiActivityId));
|
||||||
|
|
||||||
if (mMobileVisible) {
|
if (mMobileVisible && !mIsAirplaneMode) {
|
||||||
mMobileGroup.setVisibility(View.VISIBLE);
|
mMobileGroup.setVisibility(View.VISIBLE);
|
||||||
mMobile.setImageResource(mMobileStrengthId);
|
mMobile.setImageResource(mMobileStrengthId);
|
||||||
mMobileActivity.setImageResource(mMobileActivityId);
|
mMobileActivity.setImageResource(mMobileActivityId);
|
||||||
@@ -150,6 +160,13 @@ public class SignalClusterView
|
|||||||
mMobileGroup.setVisibility(View.GONE);
|
mMobileGroup.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mIsAirplaneMode) {
|
||||||
|
mAirplane.setVisibility(View.VISIBLE);
|
||||||
|
mAirplane.setImageResource(mAirplaneIconId);
|
||||||
|
} else {
|
||||||
|
mAirplane.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
if (mMobileVisible && mWifiVisible && mIsAirplaneMode) {
|
if (mMobileVisible && mWifiVisible && mIsAirplaneMode) {
|
||||||
mSpacer.setVisibility(View.INVISIBLE);
|
mSpacer.setVisibility(View.INVISIBLE);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
int mDataDirectionIconId; // data + data direction on phones
|
int mDataDirectionIconId; // data + data direction on phones
|
||||||
int mDataSignalIconId;
|
int mDataSignalIconId;
|
||||||
int mDataTypeIconId;
|
int mDataTypeIconId;
|
||||||
|
int mAirplaneIconId;
|
||||||
boolean mDataActive;
|
boolean mDataActive;
|
||||||
int mMobileActivityIconId; // overlay arrows for data direction
|
int mMobileActivityIconId; // overlay arrows for data direction
|
||||||
int mLastSignalLevel;
|
int mLastSignalLevel;
|
||||||
@@ -161,7 +162,7 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
String contentDescription);
|
String contentDescription);
|
||||||
void setMobileDataIndicators(boolean visible, int strengthIcon, int activityIcon,
|
void setMobileDataIndicators(boolean visible, int strengthIcon, int activityIcon,
|
||||||
int typeIcon, String contentDescription, String typeContentDescription);
|
int typeIcon, String contentDescription, String typeContentDescription);
|
||||||
void setIsAirplaneMode(boolean is);
|
void setIsAirplaneMode(boolean is, int airplaneIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -305,7 +306,7 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
mContentDescriptionPhoneSignal,
|
mContentDescriptionPhoneSignal,
|
||||||
mContentDescriptionDataType);
|
mContentDescriptionDataType);
|
||||||
}
|
}
|
||||||
cluster.setIsAirplaneMode(mAirplaneMode);
|
cluster.setIsAirplaneMode(mAirplaneMode, mAirplaneIconId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStackedMode(boolean stacked) {
|
public void setStackedMode(boolean stacked) {
|
||||||
@@ -997,7 +998,7 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
// look again; your radios are now airplanes
|
// look again; your radios are now airplanes
|
||||||
mContentDescriptionPhoneSignal = mContext.getString(
|
mContentDescriptionPhoneSignal = mContext.getString(
|
||||||
R.string.accessibility_airplane_mode);
|
R.string.accessibility_airplane_mode);
|
||||||
mPhoneSignalIconId = mDataSignalIconId = R.drawable.stat_sys_signal_flightmode;
|
mAirplaneIconId = R.drawable.stat_sys_signal_flightmode;
|
||||||
mDataTypeIconId = 0;
|
mDataTypeIconId = 0;
|
||||||
|
|
||||||
// combined values from connected wifi take precedence over airplane mode
|
// combined values from connected wifi take precedence over airplane mode
|
||||||
|
|||||||
Reference in New Issue
Block a user