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());
|
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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -222,6 +222,8 @@
|
||||||
<string name="prefer_original_audio_key">prefer_original_audio</string>
|
<string name="prefer_original_audio_key">prefer_original_audio</string>
|
||||||
<string name="prefer_descriptive_audio_key">prefer_descriptive_audio</string>
|
<string name="prefer_descriptive_audio_key">prefer_descriptive_audio</string>
|
||||||
<string name="last_resize_mode">last_resize_mode</string>
|
<string name="last_resize_mode">last_resize_mode</string>
|
||||||
|
<!-- RESET ONLY -->
|
||||||
|
<string name="reset_pref_screen_key">reset_pref_screen_key</string>
|
||||||
|
|
||||||
<!-- DEBUG ONLY -->
|
<!-- DEBUG ONLY -->
|
||||||
<string name="debug_pref_screen_key">debug_pref_screen_key</string>
|
<string name="debug_pref_screen_key">debug_pref_screen_key</string>
|
||||||
|
|
|
@ -151,6 +151,7 @@
|
||||||
<string name="settings_category_history_title">History and cache</string>
|
<string name="settings_category_history_title">History and cache</string>
|
||||||
<string name="settings_category_appearance_title">Appearance</string>
|
<string name="settings_category_appearance_title">Appearance</string>
|
||||||
<string name="settings_category_debug_title">Debug</string>
|
<string name="settings_category_debug_title">Debug</string>
|
||||||
|
<string name="settings_category_reset_title">Reset All Settings</string>
|
||||||
<string name="settings_category_updates_title">Updates</string>
|
<string name="settings_category_updates_title">Updates</string>
|
||||||
<string name="settings_category_player_notification_title">Player notification</string>
|
<string name="settings_category_player_notification_title">Player notification</string>
|
||||||
<string name="settings_category_player_notification_summary">Configure current playing stream notification</string>
|
<string name="settings_category_player_notification_summary">Configure current playing stream notification</string>
|
||||||
|
|
|
@ -53,4 +53,12 @@
|
||||||
android:key="@string/debug_pref_screen_key"
|
android:key="@string/debug_pref_screen_key"
|
||||||
android:title="@string/settings_category_debug_title"
|
android:title="@string/settings_category_debug_title"
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
|
<PreferenceScreen
|
||||||
|
android:fragment="org.schabi.newpipe.settings.ResetSettingsFragment"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:icon="@drawable/ic_replay"
|
||||||
|
android:key="@string/reset_pref_screen_key"
|
||||||
|
android:title="@string/settings_category_reset_title"
|
||||||
|
app:iconSpaceReserved="false" />
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,3 +1,4 @@
|
||||||
|
#Fri Oct 21 13:32:17 AEDT 2022
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionSha256Sum=e111cb9948407e26351227dabce49822fb88c37ee72f1d1582a69c68af2e702f
|
distributionSha256Sum=e111cb9948407e26351227dabce49822fb88c37ee72f1d1582a69c68af2e702f
|
||||||
|
@ -5,3 +6,4 @@ distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|
|
@ -4,8 +4,8 @@ include ':app'
|
||||||
// We assume, that NewPipe and NewPipe Extractor have the same parent directory.
|
// We assume, that NewPipe and NewPipe Extractor have the same parent directory.
|
||||||
// If this is not the case, please change the path in includeBuild().
|
// If this is not the case, please change the path in includeBuild().
|
||||||
|
|
||||||
//includeBuild('../NewPipeExtractor') {
|
includeBuild('../NewPipeExtractor') {
|
||||||
// dependencySubstitution {
|
dependencySubstitution {
|
||||||
// substitute module('com.github.TeamNewPipe:NewPipeExtractor') using project(':extractor')
|
substitute module('com.github.TeamNewPipe:NewPipeExtractor') using project(':extractor')
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|
Loading…
Reference in a new issue