1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-11-26 12:10:09 +01:00

Added reset button but not working as intended.

This commit is contained in:
Vincent Tanumihardja 2022-10-24 09:54:22 +11:00 committed by TobiGr
parent e2de83188a
commit 5d101e7b88
7 changed files with 50 additions and 5 deletions

View File

@ -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));
}
}
}
}

View File

@ -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();
}
}

View File

@ -222,6 +222,8 @@
<string name="prefer_original_audio_key">prefer_original_audio</string>
<string name="prefer_descriptive_audio_key">prefer_descriptive_audio</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 -->
<string name="debug_pref_screen_key">debug_pref_screen_key</string>

View File

@ -151,6 +151,7 @@
<string name="settings_category_history_title">History and cache</string>
<string name="settings_category_appearance_title">Appearance</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_player_notification_title">Player notification</string>
<string name="settings_category_player_notification_summary">Configure current playing stream notification</string>

View File

@ -53,4 +53,12 @@
android:key="@string/debug_pref_screen_key"
android:title="@string/settings_category_debug_title"
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>

View File

@ -1,3 +1,4 @@
#Fri Oct 21 13:32:17 AEDT 2022
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=e111cb9948407e26351227dabce49822fb88c37ee72f1d1582a69c68af2e702f
@ -5,3 +6,4 @@ distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

View File

@ -4,8 +4,8 @@ include ':app'
// We assume, that NewPipe and NewPipe Extractor have the same parent directory.
// If this is not the case, please change the path in includeBuild().
//includeBuild('../NewPipeExtractor') {
// dependencySubstitution {
// substitute module('com.github.TeamNewPipe:NewPipeExtractor') using project(':extractor')
// }
//}
includeBuild('../NewPipeExtractor') {
dependencySubstitution {
substitute module('com.github.TeamNewPipe:NewPipeExtractor') using project(':extractor')
}
}