mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] No issue: update Androidx dependencies
This commit is contained in:
parent
8d0e949d0b
commit
e6a4b4c227
@ -44,13 +44,14 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), CoroutineScope {
|
|||||||
setPreferencesFromResource(R.xml.account_settings_preferences, rootKey)
|
setPreferencesFromResource(R.xml.account_settings_preferences, rootKey)
|
||||||
|
|
||||||
// Sign out
|
// Sign out
|
||||||
val signOut = context?.getPreferenceKey(R.string.pref_key_sign_out)
|
val signOut = context!!.getPreferenceKey(R.string.pref_key_sign_out)
|
||||||
val preferenceSignOut = findPreference<Preference>(signOut)
|
val preferenceSignOut = findPreference<Preference>(signOut)
|
||||||
preferenceSignOut.onPreferenceClickListener = getClickListenerForSignOut()
|
preferenceSignOut?.onPreferenceClickListener = getClickListenerForSignOut()
|
||||||
|
|
||||||
// Sync now
|
// Sync now
|
||||||
val syncNow = context?.getPreferenceKey(R.string.pref_key_sync_now)
|
val syncNow = context!!.getPreferenceKey(R.string.pref_key_sync_now)
|
||||||
val preferenceSyncNow = findPreference<Preference>(syncNow)
|
val preferenceSyncNow = findPreference<Preference>(syncNow)
|
||||||
|
preferenceSyncNow?.let {
|
||||||
preferenceSyncNow.onPreferenceClickListener = getClickListenerForSyncNow()
|
preferenceSyncNow.onPreferenceClickListener = getClickListenerForSyncNow()
|
||||||
|
|
||||||
// Current sync state
|
// Current sync state
|
||||||
@ -61,6 +62,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), CoroutineScope {
|
|||||||
} else {
|
} else {
|
||||||
preferenceSyncNow.isEnabled = true
|
preferenceSyncNow.isEnabled = true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NB: ObserverRegistry will take care of cleaning up internal references to 'observer' and
|
// NB: ObserverRegistry will take care of cleaning up internal references to 'observer' and
|
||||||
// 'owner' when appropriate.
|
// 'owner' when appropriate.
|
||||||
@ -87,33 +89,37 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), CoroutineScope {
|
|||||||
private val syncStatusObserver = object : SyncStatusObserver {
|
private val syncStatusObserver = object : SyncStatusObserver {
|
||||||
override fun onStarted() {
|
override fun onStarted() {
|
||||||
CoroutineScope(Dispatchers.Main).launch {
|
CoroutineScope(Dispatchers.Main).launch {
|
||||||
val pref = findPreference<Preference>(context?.getPreferenceKey(R.string.pref_key_sync_now))
|
val pref = findPreference<Preference>(context!!.getPreferenceKey(R.string.pref_key_sync_now))
|
||||||
|
|
||||||
pref.title = getString(R.string.sync_syncing)
|
pref?.title = getString(R.string.sync_syncing)
|
||||||
pref.isEnabled = false
|
pref?.isEnabled = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sync stopped successfully.
|
// Sync stopped successfully.
|
||||||
override fun onIdle() {
|
override fun onIdle() {
|
||||||
CoroutineScope(Dispatchers.Main).launch {
|
CoroutineScope(Dispatchers.Main).launch {
|
||||||
val pref = findPreference<Preference>(context?.getPreferenceKey(R.string.pref_key_sync_now))
|
val pref = findPreference<Preference>(context!!.getPreferenceKey(R.string.pref_key_sync_now))
|
||||||
|
pref?.let {
|
||||||
pref.title = getString(R.string.preferences_sync_now)
|
pref.title = getString(R.string.preferences_sync_now)
|
||||||
pref.isEnabled = true
|
pref.isEnabled = true
|
||||||
updateLastSyncedTimePref(context!!, pref, failed = false)
|
updateLastSyncedTimePref(context!!, pref, failed = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Sync stopped after encountering a problem.
|
// Sync stopped after encountering a problem.
|
||||||
override fun onError(error: Exception?) {
|
override fun onError(error: Exception?) {
|
||||||
CoroutineScope(Dispatchers.Main).launch {
|
CoroutineScope(Dispatchers.Main).launch {
|
||||||
val pref = findPreference<Preference>(context?.getPreferenceKey(R.string.pref_key_sync_now))
|
val pref = findPreference<Preference>(context!!.getPreferenceKey(R.string.pref_key_sync_now))
|
||||||
|
pref?.let {
|
||||||
pref.title = getString(R.string.preferences_sync_now)
|
pref.title = getString(R.string.preferences_sync_now)
|
||||||
pref.isEnabled = true
|
pref.isEnabled = true
|
||||||
updateLastSyncedTimePref(context!!, pref, failed = true)
|
updateLastSyncedTimePref(context!!, pref, failed = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun updateLastSyncedTimePref(context: Context, pref: Preference, failed: Boolean = false) {
|
fun updateLastSyncedTimePref(context: Context, pref: Preference, failed: Boolean = false) {
|
||||||
val lastSyncTime = getLastSynced(context)
|
val lastSyncTime = getLastSynced(context)
|
||||||
|
@ -22,7 +22,7 @@ class DataChoicesFragment : PreferenceFragmentCompat() {
|
|||||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||||
setPreferencesFromResource(R.xml.data_choices_preferences, rootKey)
|
setPreferencesFromResource(R.xml.data_choices_preferences, rootKey)
|
||||||
|
|
||||||
findPreference<SwitchPreference>(getString(R.string.pref_key_telemetry)).apply {
|
findPreference<SwitchPreference>(getString(R.string.pref_key_telemetry))?.apply {
|
||||||
isChecked = Settings.getInstance(context).isTelemetryEnabled
|
isChecked = Settings.getInstance(context).isTelemetryEnabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,9 +70,9 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse
|
|||||||
|
|
||||||
(activity as AppCompatActivity).supportActionBar?.show()
|
(activity as AppCompatActivity).supportActionBar?.show()
|
||||||
val preference =
|
val preference =
|
||||||
findPreference(getString(R.string.pref_key_make_default_browser)) as DefaultBrowserPreference
|
findPreference<DefaultBrowserPreference>(getString(R.string.pref_key_make_default_browser))
|
||||||
|
|
||||||
preference.updateSwitch()
|
preference?.updateSwitch()
|
||||||
generateWordmark()
|
generateWordmark()
|
||||||
setupPreferences()
|
setupPreferences()
|
||||||
setupAccountUI()
|
setupAccountUI()
|
||||||
@ -176,18 +176,18 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setupPreferences() {
|
private fun setupPreferences() {
|
||||||
val makeDefaultBrowserKey = context?.getPreferenceKey(pref_key_make_default_browser)
|
val makeDefaultBrowserKey = context!!.getPreferenceKey(pref_key_make_default_browser)
|
||||||
val leakKey = context?.getPreferenceKey(pref_key_leakcanary)
|
val leakKey = context!!.getPreferenceKey(pref_key_leakcanary)
|
||||||
|
|
||||||
val preferenceMakeDefaultBrowser = findPreference<Preference>(makeDefaultBrowserKey)
|
val preferenceMakeDefaultBrowser = findPreference<Preference>(makeDefaultBrowserKey)
|
||||||
val preferenceLeakCanary = findPreference<Preference>(leakKey)
|
val preferenceLeakCanary = findPreference<Preference>(leakKey)
|
||||||
|
|
||||||
preferenceMakeDefaultBrowser.onPreferenceClickListener =
|
preferenceMakeDefaultBrowser?.onPreferenceClickListener =
|
||||||
getClickListenerForMakeDefaultBrowser()
|
getClickListenerForMakeDefaultBrowser()
|
||||||
|
|
||||||
preferenceLeakCanary.isVisible = BuildConfig.DEBUG
|
preferenceLeakCanary?.isVisible = BuildConfig.DEBUG
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
preferenceLeakCanary.onPreferenceChangeListener =
|
preferenceLeakCanary?.onPreferenceChangeListener =
|
||||||
Preference.OnPreferenceChangeListener { _, newValue ->
|
Preference.OnPreferenceChangeListener { _, newValue ->
|
||||||
(context?.applicationContext as FenixApplication).toggleLeakCanary(newValue as Boolean)
|
(context?.applicationContext as FenixApplication).toggleLeakCanary(newValue as Boolean)
|
||||||
true
|
true
|
||||||
@ -220,7 +220,8 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun navigateToSitePermissions() {
|
private fun navigateToSitePermissions() {
|
||||||
val directions = SettingsFragmentDirections.actionSettingsFragmentToSitePermissionsFragment()
|
val directions =
|
||||||
|
SettingsFragmentDirections.actionSettingsFragmentToSitePermissionsFragment()
|
||||||
Navigation.findNavController(view!!).navigate(directions)
|
Navigation.findNavController(view!!).navigate(directions)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +243,8 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun navigateToAccountSettings() {
|
private fun navigateToAccountSettings() {
|
||||||
val directions = SettingsFragmentDirections.actionSettingsFragmentToAccountSettingsFragment()
|
val directions =
|
||||||
|
SettingsFragmentDirections.actionSettingsFragmentToAccountSettingsFragment()
|
||||||
Navigation.findNavController(view!!).navigate(directions)
|
Navigation.findNavController(view!!).navigate(directions)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,29 +269,32 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse
|
|||||||
|
|
||||||
// --- Account UI helpers ---
|
// --- Account UI helpers ---
|
||||||
private fun updateAuthState(account: OAuthAccount? = null) {
|
private fun updateAuthState(account: OAuthAccount? = null) {
|
||||||
val preferenceSignIn = findPreference<Preference>(context?.getPreferenceKey(pref_key_sign_in))
|
val preferenceSignIn =
|
||||||
val preferenceFirefoxAccount = findPreference<Preference>(context?.getPreferenceKey(pref_key_account))
|
findPreference<Preference>(context!!.getPreferenceKey(pref_key_sign_in))
|
||||||
|
val preferenceFirefoxAccount =
|
||||||
|
findPreference<Preference>(context!!.getPreferenceKey(pref_key_account))
|
||||||
val accountPreferenceCategory =
|
val accountPreferenceCategory =
|
||||||
findPreference<PreferenceCategory>(context?.getPreferenceKey(pref_key_account_category))
|
findPreference<PreferenceCategory>(context!!.getPreferenceKey(pref_key_account_category))
|
||||||
|
|
||||||
if (account != null) {
|
if (account != null) {
|
||||||
preferenceSignIn.isVisible = false
|
preferenceSignIn?.isVisible = false
|
||||||
preferenceSignIn.onPreferenceClickListener = null
|
preferenceSignIn?.onPreferenceClickListener = null
|
||||||
preferenceFirefoxAccount.isVisible = true
|
preferenceFirefoxAccount?.isVisible = true
|
||||||
accountPreferenceCategory.isVisible = true
|
accountPreferenceCategory?.isVisible = true
|
||||||
} else {
|
} else {
|
||||||
preferenceSignIn.isVisible = true
|
preferenceSignIn?.isVisible = true
|
||||||
preferenceSignIn.onPreferenceClickListener = getClickListenerForSignIn()
|
preferenceSignIn?.onPreferenceClickListener = getClickListenerForSignIn()
|
||||||
preferenceFirefoxAccount.isVisible = false
|
preferenceFirefoxAccount?.isVisible = false
|
||||||
accountPreferenceCategory.isVisible = false
|
accountPreferenceCategory?.isVisible = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateAccountProfile(profile: Profile) {
|
private fun updateAccountProfile(profile: Profile) {
|
||||||
launch {
|
launch {
|
||||||
val preferenceFirefoxAccount = findPreference<Preference>(context?.getPreferenceKey(pref_key_account))
|
val preferenceFirefoxAccount =
|
||||||
preferenceFirefoxAccount.title = profile.displayName.orEmpty()
|
findPreference<Preference>(context!!.getPreferenceKey(pref_key_account))
|
||||||
preferenceFirefoxAccount.summary = profile.email.orEmpty()
|
preferenceFirefoxAccount?.title = profile.displayName.orEmpty()
|
||||||
|
preferenceFirefoxAccount?.summary = profile.email.orEmpty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,13 +13,13 @@ private object Versions {
|
|||||||
const val leakcanary = "1.6.3"
|
const val leakcanary = "1.6.3"
|
||||||
const val leanplum = "4.3.1"
|
const val leanplum = "4.3.1"
|
||||||
|
|
||||||
const val androidx_appcompat = "1.1.0-alpha02"
|
const val androidx_appcompat = "1.1.0-alpha03"
|
||||||
const val androidx_constraint_layout = "2.0.0-alpha2"
|
const val androidx_constraint_layout = "2.0.0-alpha2"
|
||||||
const val androidx_preference = "1.1.0-alpha03"
|
const val androidx_preference = "1.1.0-alpha04"
|
||||||
const val androidx_legacy = "1.0.0"
|
const val androidx_legacy = "1.0.0"
|
||||||
const val androidx_annotation = "1.0.1"
|
const val androidx_annotation = "1.1.0-alpha02"
|
||||||
const val androidx_lifecycle = "2.0.0"
|
const val androidx_lifecycle = "2.1.0-alpha03"
|
||||||
const val androidx_fragment = "1.1.0-alpha04"
|
const val androidx_fragment = "1.1.0-alpha05"
|
||||||
const val androidx_safeargs = "1.0.0-beta01"
|
const val androidx_safeargs = "1.0.0-beta01"
|
||||||
const val androidx_navigation = "2.0.0-rc02"
|
const val androidx_navigation = "2.0.0-rc02"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user