Skip to content

Commit

Permalink
clear user preferences in main activity onCreate
Browse files Browse the repository at this point in the history
  • Loading branch information
Todd Blose committed Mar 29, 2016
1 parent 29c5f03 commit 383b88d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ protected void onCreate(Bundle savedInstanceState) {
mPrefs = Utils.getSharedPrefs(context);

LanternUI = new UI(this, mPrefs);
// since onCreate is only called when the main activity
// is first created, we clear shared preferences in case
// Lantern was forcibly stopped during a previous run
LanternUI.clearPreferences();

// the ACTION_SHUTDOWN intent is broadcast when the phone is
// about to be shutdown. We register a receiver to make sure we
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,10 @@ public boolean useVpn() {
return mPrefs.getBoolean(LanternConfig.PREF_USE_VPN, false);
}

public void clearPreferences() {
mPrefs.edit().putBoolean(LanternConfig.PREF_USE_VPN, false).commit();
}

// update START/STOP power Lantern button
// according to our stored preference
public void setBtnStatus() {
Expand Down

0 comments on commit 383b88d

Please sign in to comment.