Added reset button but not working as intended.
This commit is contained in:
parent
e2de83188a
commit
5d101e7b88
7 changed files with 50 additions and 5 deletions
|
|
@ -80,4 +80,22 @@ public class AppearanceSettingsFragment extends BasePreferenceFragment {
|
|||
ActivityCompat.recreate(getActivity());
|
||||
}
|
||||
}
|
||||
|
||||
public void resetToDefault() {
|
||||
final String themeKey = getString(R.string.theme_key);
|
||||
final String startThemeKey = defaultPreferences
|
||||
.getString(themeKey, getString(R.string.default_theme_value));
|
||||
final String autoDeviceThemeKey = getString(R.string.auto_device_theme_key);
|
||||
if (startThemeKey.equals(autoDeviceThemeKey)) {
|
||||
applyThemeChange(startThemeKey, themeKey, autoDeviceThemeKey);
|
||||
} else {
|
||||
if (startThemeKey.equals(R.string.light_theme_key)) {
|
||||
removePreference(getString(R.string.light_theme_key));
|
||||
} else if (startThemeKey.equals(R.string.dark_theme_key)) {
|
||||
removePreference(getString(R.string.dark_theme_key));
|
||||
} else {
|
||||
removePreference(getString(R.string.black_theme_key));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package org.schabi.newpipe.settings;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
public class ResetSettingsFragment extends BasePreferenceFragment {
|
||||
|
||||
private AppearanceSettingsFragment appearanceSettings;
|
||||
@Override
|
||||
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
|
||||
addPreferencesFromResourceRegistry();
|
||||
|
||||
appearanceSettings.resetToDefault();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue