1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2024-12-24 08:45:53 +00:00

Force update custom action view

This commit is contained in:
M66B 2015-11-04 09:57:38 +01:00
parent dcdbe2e7fd
commit b7e6000393

View file

@ -87,6 +87,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
private static final String TAG = "NetGuard.Main";
private boolean running = false;
private View actionView;
private ImageView ivInteractive;
private ImageView ivWifi;
private ImageView ivOther;
@ -125,7 +126,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
boolean enabled = prefs.getBoolean("enabled", false);
// Action bar
View actionView = getLayoutInflater().inflate(R.layout.action, null);
actionView = getLayoutInflater().inflate(R.layout.action, null);
SwitchCompat swEnabled = (SwitchCompat) actionView.findViewById(R.id.swEnabled);
ivInteractive = (ImageView) actionView.findViewById(R.id.ivInteractive);
ivWifi = (ImageView) actionView.findViewById(R.id.ivWifi);
@ -311,6 +312,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
Util.logExtras(TAG, intent);
ivInteractive.setVisibility(Intent.ACTION_SCREEN_ON.equals(intent.getAction()) ? View.VISIBLE : View.INVISIBLE);
actionView.postInvalidate();
}
};
@ -330,6 +332,8 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
ivRoaming.setVisibility(View.VISIBLE);
else
ivOther.setVisibility(View.VISIBLE);
actionView.postInvalidate();
}
};