mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 15:23:00 +00:00 
			
		
		
		
	clear shared preference xmls
This commit is contained in:
		| @@ -3,9 +3,11 @@ package org.schabi.newpipe.settings; | |||||||
| import android.app.AlertDialog; | import android.app.AlertDialog; | ||||||
| import android.content.DialogInterface; | import android.content.DialogInterface; | ||||||
| import android.content.Intent; | import android.content.Intent; | ||||||
|  | import android.content.SharedPreferences; | ||||||
| import android.os.Bundle; | import android.os.Bundle; | ||||||
|  |  | ||||||
| import androidx.preference.Preference; | import androidx.preference.Preference; | ||||||
|  | import androidx.preference.PreferenceManager; | ||||||
|  |  | ||||||
| import org.schabi.newpipe.R; | import org.schabi.newpipe.R; | ||||||
| import org.schabi.newpipe.error.ErrorInfo; | import org.schabi.newpipe.error.ErrorInfo; | ||||||
| @@ -94,6 +96,7 @@ public class DebugSettingsFragment extends BasePreferenceFragment { | |||||||
|  |  | ||||||
|         // Resets all settings by deleting shared preference and restarting the app |         // Resets all settings by deleting shared preference and restarting the app | ||||||
|         // A dialogue will pop up to confirm if user intends to reset all settings |         // A dialogue will pop up to confirm if user intends to reset all settings | ||||||
|  |         assert resetSettings != null; | ||||||
|         resetSettings.setOnPreferenceClickListener(preference -> { |         resetSettings.setOnPreferenceClickListener(preference -> { | ||||||
|             final AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); |             final AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); | ||||||
|             builder.setMessage("Resetting all settings will discard " |             builder.setMessage("Resetting all settings will discard " | ||||||
| @@ -113,9 +116,13 @@ public class DebugSettingsFragment extends BasePreferenceFragment { | |||||||
|             }); |             }); | ||||||
|             final AlertDialog alertDialog = builder.create(); |             final AlertDialog alertDialog = builder.create(); | ||||||
|             alertDialog.show(); |             alertDialog.show(); | ||||||
| //            SharedPreferences sharedPreferences = |  | ||||||
| //                    PreferenceManager.getDefaultSharedPreferences(requireContext()); |             // delete all shared preferences xml files. | ||||||
| //            sharedPreferences = null; |             final SharedPreferences sharedPreferences = | ||||||
|  |                     PreferenceManager.getDefaultSharedPreferences(requireContext()); | ||||||
|  |             sharedPreferences.edit().clear().apply(); | ||||||
|  |  | ||||||
|  |  | ||||||
|             return true; |             return true; | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zhidong Piao
					Zhidong Piao