Skip to content

Commit

Permalink
chore(settings): make checkbox update UI
Browse files Browse the repository at this point in the history
  • Loading branch information
EdricChan03 committed Mar 21, 2018
1 parent 635cd94 commit c9c06af
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/src/main/java/com/edricchan/studybuddy/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@ protected void onCreate(Bundle savedInstanceState) {
setupActionBar();
}

/**
* Restarts the fragment specified
*
* @param preferenceRes The resource name of the xml preference file
*/
public void restartLayout(int preferenceRes) {
setPreferenceScreen(null);
addPreferencesFromResource(preferenceRes);
}

/**
* Set up the {@link android.app.ActionBar}, if the API is available.
*/
Expand Down Expand Up @@ -398,6 +408,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
.putBoolean("enable_pre_oreo_explicit", true)
.apply();
}
setPreferenceScreen(null);
onCreate(null);
if (sharedPreferences.getBoolean("enable_pre_oreo_explicit", false) || Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
showPreOreoSettings();
} else {
showOreoSettings();
}
return true;
}
return super.onOptionsItemSelected(item);
Expand Down

0 comments on commit c9c06af

Please sign in to comment.