mirror of https://github.com/M66B/NetGuard.git
Fixed resetting state on stop
This commit is contained in:
parent
c58c4bacdf
commit
bb2b9a9d44
|
@ -496,15 +496,16 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
|
||||
if (adapter != null)
|
||||
if (intent.hasExtra(EXTRA_CONNECTED) && intent.hasExtra(EXTRA_METERED)) {
|
||||
ivMetered.setVisibility(Util.isMeteredNetwork(ActivityMain.this) ? View.VISIBLE : View.INVISIBLE);
|
||||
|
||||
if (intent.getBooleanExtra(EXTRA_CONNECTED, false))
|
||||
if (intent.getBooleanExtra(EXTRA_CONNECTED, false)) {
|
||||
if (intent.getBooleanExtra(EXTRA_METERED, false))
|
||||
adapter.setMobileActive();
|
||||
else
|
||||
adapter.setWifiActive();
|
||||
else
|
||||
ivMetered.setVisibility(Util.isMeteredNetwork(ActivityMain.this) ? View.VISIBLE : View.INVISIBLE);
|
||||
} else {
|
||||
adapter.setDisconnected();
|
||||
ivMetered.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
} else
|
||||
updateApplicationList(null);
|
||||
}
|
||||
|
|
|
@ -318,8 +318,8 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
|
|||
|
||||
// Update main view
|
||||
Intent ruleset = new Intent(ActivityMain.ACTION_RULES_CHANGED);
|
||||
ruleset.putExtra(ActivityMain.EXTRA_CONNECTED, last_connected);
|
||||
ruleset.putExtra(ActivityMain.EXTRA_METERED, last_metered);
|
||||
ruleset.putExtra(ActivityMain.EXTRA_CONNECTED, cmd == Command.stop ? false : last_connected);
|
||||
ruleset.putExtra(ActivityMain.EXTRA_METERED, cmd == Command.stop ? false : last_metered);
|
||||
LocalBroadcastManager.getInstance(SinkholeService.this).sendBroadcast(ruleset);
|
||||
|
||||
// Update widgets
|
||||
|
|
Loading…
Reference in New Issue