-
-
Notifications
You must be signed in to change notification settings - Fork 737
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
25 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright 2012 - 2021 Anton Tananaev ([email protected]) | ||
* Copyright 2012 - 2022 Anton Tananaev ([email protected]) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
|
@@ -62,7 +62,7 @@ class MainFragment : PreferenceFragmentCompat(), OnSharedPreferenceChangeListene | |
removeLauncherIcon() | ||
} | ||
setHasOptionsMenu(true) | ||
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) | ||
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext()) | ||
setPreferencesFromResource(R.xml.preferences, rootKey) | ||
initPreferences() | ||
|
||
|
@@ -126,6 +126,7 @@ class MainFragment : PreferenceFragmentCompat(), OnSharedPreferenceChangeListene | |
} | ||
} | ||
|
||
@Suppress("DEPRECATION") | ||
override fun onDisplayPreferenceDialog(preference: Preference) { | ||
if (listOf(KEY_INTERVAL, KEY_DISTANCE, KEY_ANGLE).contains(preference.key)) { | ||
val f: EditTextPreferenceDialogFragmentCompat = | ||
|
@@ -213,7 +214,7 @@ class MainFragment : PreferenceFragmentCompat(), OnSharedPreferenceChangeListene | |
} | ||
|
||
private fun initPreferences() { | ||
PreferenceManager.setDefaultValues(activity, R.xml.preferences, false) | ||
PreferenceManager.setDefaultValues(requireActivity(), R.xml.preferences, false) | ||
if (!sharedPreferences.contains(KEY_DEVICE)) { | ||
val id = (Random().nextInt(900000) + 100000).toString() | ||
sharedPreferences.edit().putString(KEY_DEVICE, id).apply() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters