@@ -44,10 +44,11 @@ public class SignalClusterView
4444 private boolean mMobileVisible = false ;
4545 private int mMobileStrengthId = 0 , mMobileActivityId = 0 , mMobileTypeId = 0 ;
4646 private boolean mIsAirplaneMode = false ;
47+ private int mAirplaneIconId = 0 ;
4748 private String mWifiDescription , mMobileDescription , mMobileTypeDescription ;
4849
4950 ViewGroup mWifiGroup , mMobileGroup ;
50- ImageView mWifi , mMobile , mWifiActivity , mMobileActivity , mMobileType ;
51+ ImageView mWifi , mMobile , mWifiActivity , mMobileActivity , mMobileType , mAirplane ;
5152 View mSpacer ;
5253
5354 public SignalClusterView (Context context ) {
@@ -79,6 +80,7 @@ protected void onAttachedToWindow() {
7980 mMobileActivity = (ImageView ) findViewById (R .id .mobile_inout );
8081 mMobileType = (ImageView ) findViewById (R .id .mobile_type );
8182 mSpacer = findViewById (R .id .spacer );
83+ mAirplane = (ImageView ) findViewById (R .id .airplane );
8284
8385 apply ();
8486 }
@@ -92,10 +94,13 @@ protected void onDetachedFromWindow() {
9294 mMobile = null ;
9395 mMobileActivity = null ;
9496 mMobileType = null ;
97+ mSpacer = null ;
98+ mAirplane = null ;
9599
96100 super .onDetachedFromWindow ();
97101 }
98102
103+ @ Override
99104 public void setWifiIndicators (boolean visible , int strengthIcon , int activityIcon ,
100105 String contentDescription ) {
101106 mWifiVisible = visible ;
@@ -106,6 +111,7 @@ public void setWifiIndicators(boolean visible, int strengthIcon, int activityIco
106111 apply ();
107112 }
108113
114+ @ Override
109115 public void setMobileDataIndicators (boolean visible , int strengthIcon , int activityIcon ,
110116 int typeIcon , String contentDescription , String typeContentDescription ) {
111117 mMobileVisible = visible ;
@@ -118,8 +124,12 @@ public void setMobileDataIndicators(boolean visible, int strengthIcon, int activ
118124 apply ();
119125 }
120126
121- public void setIsAirplaneMode (boolean is ) {
127+ @ Override
128+ public void setIsAirplaneMode (boolean is , int airplaneIconId ) {
122129 mIsAirplaneMode = is ;
130+ mAirplaneIconId = airplaneIconId ;
131+
132+ apply ();
123133 }
124134
125135 // Run after each indicator change.
@@ -140,7 +150,7 @@ private void apply() {
140150 (mWifiVisible ? "VISIBLE" : "GONE" ),
141151 mWifiStrengthId , mWifiActivityId ));
142152
143- if (mMobileVisible ) {
153+ if (mMobileVisible && ! mIsAirplaneMode ) {
144154 mMobileGroup .setVisibility (View .VISIBLE );
145155 mMobile .setImageResource (mMobileStrengthId );
146156 mMobileActivity .setImageResource (mMobileActivityId );
@@ -150,6 +160,13 @@ private void apply() {
150160 mMobileGroup .setVisibility (View .GONE );
151161 }
152162
163+ if (mIsAirplaneMode ) {
164+ mAirplane .setVisibility (View .VISIBLE );
165+ mAirplane .setImageResource (mAirplaneIconId );
166+ } else {
167+ mAirplane .setVisibility (View .GONE );
168+ }
169+
153170 if (mMobileVisible && mWifiVisible && mIsAirplaneMode ) {
154171 mSpacer .setVisibility (View .INVISIBLE );
155172 } else {
0 commit comments