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:
parent
dcdbe2e7fd
commit
b7e6000393
1 changed files with 5 additions and 1 deletions
|
@ -87,6 +87,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
||||||
private static final String TAG = "NetGuard.Main";
|
private static final String TAG = "NetGuard.Main";
|
||||||
|
|
||||||
private boolean running = false;
|
private boolean running = false;
|
||||||
|
private View actionView;
|
||||||
private ImageView ivInteractive;
|
private ImageView ivInteractive;
|
||||||
private ImageView ivWifi;
|
private ImageView ivWifi;
|
||||||
private ImageView ivOther;
|
private ImageView ivOther;
|
||||||
|
@ -125,7 +126,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
||||||
boolean enabled = prefs.getBoolean("enabled", false);
|
boolean enabled = prefs.getBoolean("enabled", false);
|
||||||
|
|
||||||
// Action bar
|
// 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);
|
SwitchCompat swEnabled = (SwitchCompat) actionView.findViewById(R.id.swEnabled);
|
||||||
ivInteractive = (ImageView) actionView.findViewById(R.id.ivInteractive);
|
ivInteractive = (ImageView) actionView.findViewById(R.id.ivInteractive);
|
||||||
ivWifi = (ImageView) actionView.findViewById(R.id.ivWifi);
|
ivWifi = (ImageView) actionView.findViewById(R.id.ivWifi);
|
||||||
|
@ -311,6 +312,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
||||||
Util.logExtras(TAG, intent);
|
Util.logExtras(TAG, intent);
|
||||||
|
|
||||||
ivInteractive.setVisibility(Intent.ACTION_SCREEN_ON.equals(intent.getAction()) ? View.VISIBLE : View.INVISIBLE);
|
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);
|
ivRoaming.setVisibility(View.VISIBLE);
|
||||||
else
|
else
|
||||||
ivOther.setVisibility(View.VISIBLE);
|
ivOther.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
actionView.postInvalidate();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue