2018-11-12 21:09:39 +01:00
|
|
|
/* Copyright 2018 Conny Duck
|
|
|
|
*
|
|
|
|
* This file is a part of Tusky.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
|
|
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Tusky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
|
|
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
|
|
* Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with Tusky; if not,
|
|
|
|
* see <http://www.gnu.org/licenses>. */
|
|
|
|
|
2020-09-02 12:27:51 +02:00
|
|
|
package com.keylesspalace.tusky.components.preference
|
2018-11-12 21:09:39 +01:00
|
|
|
|
|
|
|
import android.content.Intent
|
2022-12-31 13:01:35 +01:00
|
|
|
import android.graphics.Color
|
2018-11-12 21:09:39 +01:00
|
|
|
import android.os.Build
|
|
|
|
import android.os.Bundle
|
|
|
|
import android.util.Log
|
2020-12-09 19:08:16 +01:00
|
|
|
import androidx.annotation.DrawableRes
|
2020-06-08 09:21:12 +02:00
|
|
|
import androidx.preference.PreferenceFragmentCompat
|
2022-12-31 13:01:35 +01:00
|
|
|
import com.google.android.material.color.MaterialColors
|
2020-06-08 09:21:12 +02:00
|
|
|
import com.google.android.material.snackbar.Snackbar
|
2022-05-17 19:32:09 +02:00
|
|
|
import com.keylesspalace.tusky.BaseActivity
|
2021-06-28 21:13:24 +02:00
|
|
|
import com.keylesspalace.tusky.BuildConfig
|
|
|
|
import com.keylesspalace.tusky.R
|
|
|
|
import com.keylesspalace.tusky.TabPreferenceActivity
|
2018-11-12 21:09:39 +01:00
|
|
|
import com.keylesspalace.tusky.appstore.EventHub
|
2023-02-04 20:29:13 +01:00
|
|
|
import com.keylesspalace.tusky.components.accountlist.AccountListActivity
|
2023-07-04 19:41:36 +02:00
|
|
|
import com.keylesspalace.tusky.components.domainblocks.DomainBlocksActivity
|
2023-03-11 13:12:50 +01:00
|
|
|
import com.keylesspalace.tusky.components.filters.FiltersActivity
|
2022-12-01 19:24:27 +01:00
|
|
|
import com.keylesspalace.tusky.components.followedtags.FollowedTagsActivity
|
2022-05-17 19:32:09 +02:00
|
|
|
import com.keylesspalace.tusky.components.login.LoginActivity
|
|
|
|
import com.keylesspalace.tusky.components.notifications.currentAccountNeedsMigration
|
2018-11-12 21:09:39 +01:00
|
|
|
import com.keylesspalace.tusky.db.AccountManager
|
|
|
|
import com.keylesspalace.tusky.di.Injectable
|
|
|
|
import com.keylesspalace.tusky.entity.Account
|
|
|
|
import com.keylesspalace.tusky.entity.Status
|
|
|
|
import com.keylesspalace.tusky.network.MastodonApi
|
2023-06-11 15:34:58 +02:00
|
|
|
import com.keylesspalace.tusky.settings.AccountPreferenceDataStore
|
2021-06-28 21:13:24 +02:00
|
|
|
import com.keylesspalace.tusky.settings.PrefKeys
|
|
|
|
import com.keylesspalace.tusky.settings.listPreference
|
|
|
|
import com.keylesspalace.tusky.settings.makePreferenceScreen
|
|
|
|
import com.keylesspalace.tusky.settings.preference
|
|
|
|
import com.keylesspalace.tusky.settings.preferenceCategory
|
|
|
|
import com.keylesspalace.tusky.settings.switchPreference
|
2023-02-25 21:15:21 +01:00
|
|
|
import com.keylesspalace.tusky.util.getInitialLanguages
|
2022-12-02 19:19:17 +01:00
|
|
|
import com.keylesspalace.tusky.util.getLocaleList
|
|
|
|
import com.keylesspalace.tusky.util.getTuskyDisplayName
|
|
|
|
import com.keylesspalace.tusky.util.makeIcon
|
2023-02-20 20:14:54 +01:00
|
|
|
import com.keylesspalace.tusky.util.unsafeLazy
|
2018-11-12 21:09:39 +01:00
|
|
|
import com.mikepenz.iconics.IconicsDrawable
|
2020-04-15 18:57:53 +02:00
|
|
|
import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
|
|
|
|
import com.mikepenz.iconics.utils.colorInt
|
|
|
|
import com.mikepenz.iconics.utils.sizeRes
|
2024-01-04 17:00:55 +01:00
|
|
|
import javax.inject.Inject
|
2018-11-12 21:09:39 +01:00
|
|
|
import retrofit2.Call
|
|
|
|
import retrofit2.Callback
|
|
|
|
import retrofit2.Response
|
|
|
|
|
2020-06-08 09:21:12 +02:00
|
|
|
class AccountPreferencesFragment : PreferenceFragmentCompat(), Injectable {
|
2018-11-12 21:09:39 +01:00
|
|
|
@Inject
|
|
|
|
lateinit var accountManager: AccountManager
|
|
|
|
|
|
|
|
@Inject
|
|
|
|
lateinit var mastodonApi: MastodonApi
|
|
|
|
|
|
|
|
@Inject
|
|
|
|
lateinit var eventHub: EventHub
|
|
|
|
|
2023-06-11 15:34:58 +02:00
|
|
|
@Inject
|
|
|
|
lateinit var accountPreferenceDataStore: AccountPreferenceDataStore
|
|
|
|
|
2024-01-04 17:00:55 +01:00
|
|
|
private val iconSize by unsafeLazy {
|
|
|
|
resources.getDimensionPixelSize(
|
|
|
|
R.dimen.preference_icon_size
|
|
|
|
)
|
|
|
|
}
|
2022-12-02 19:19:17 +01:00
|
|
|
|
2018-11-12 21:09:39 +01:00
|
|
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
2020-06-08 09:21:12 +02:00
|
|
|
val context = requireContext()
|
|
|
|
makePreferenceScreen {
|
|
|
|
preference {
|
|
|
|
setTitle(R.string.pref_title_edit_notification_settings)
|
|
|
|
icon = IconicsDrawable(context, GoogleMaterial.Icon.gmd_notifications).apply {
|
|
|
|
sizeRes = R.dimen.preference_icon_size
|
2022-12-31 13:01:35 +01:00
|
|
|
colorInt = MaterialColors.getColor(context, R.attr.iconColor, Color.BLACK)
|
2020-06-08 09:21:12 +02:00
|
|
|
}
|
|
|
|
setOnPreferenceClickListener {
|
2023-02-27 14:07:28 +01:00
|
|
|
openNotificationSystemPrefs()
|
2020-06-08 09:21:12 +02:00
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
2018-11-12 21:09:39 +01:00
|
|
|
|
2020-06-08 09:21:12 +02:00
|
|
|
preference {
|
|
|
|
setTitle(R.string.title_tab_preferences)
|
2020-12-09 19:08:16 +01:00
|
|
|
setIcon(R.drawable.ic_tabs)
|
2020-06-08 09:21:12 +02:00
|
|
|
setOnPreferenceClickListener {
|
|
|
|
val intent = Intent(context, TabPreferenceActivity::class.java)
|
|
|
|
activity?.startActivity(intent)
|
2021-06-28 21:13:24 +02:00
|
|
|
activity?.overridePendingTransition(
|
|
|
|
R.anim.slide_from_right,
|
|
|
|
R.anim.slide_to_left
|
|
|
|
)
|
2020-06-08 09:21:12 +02:00
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
2018-11-12 21:09:39 +01:00
|
|
|
|
2022-12-01 19:24:27 +01:00
|
|
|
preference {
|
|
|
|
setTitle(R.string.title_followed_hashtags)
|
|
|
|
setIcon(R.drawable.ic_hashtag)
|
|
|
|
setOnPreferenceClickListener {
|
|
|
|
val intent = Intent(context, FollowedTagsActivity::class.java)
|
|
|
|
activity?.startActivity(intent)
|
|
|
|
activity?.overridePendingTransition(
|
|
|
|
R.anim.slide_from_right,
|
|
|
|
R.anim.slide_to_left
|
|
|
|
)
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-08 09:21:12 +02:00
|
|
|
preference {
|
|
|
|
setTitle(R.string.action_view_mutes)
|
2020-12-09 19:08:16 +01:00
|
|
|
setIcon(R.drawable.ic_mute_24dp)
|
2020-06-08 09:21:12 +02:00
|
|
|
setOnPreferenceClickListener {
|
|
|
|
val intent = Intent(context, AccountListActivity::class.java)
|
|
|
|
intent.putExtra("type", AccountListActivity.Type.MUTES)
|
|
|
|
activity?.startActivity(intent)
|
2021-06-28 21:13:24 +02:00
|
|
|
activity?.overridePendingTransition(
|
|
|
|
R.anim.slide_from_right,
|
|
|
|
R.anim.slide_to_left
|
|
|
|
)
|
2020-06-08 09:21:12 +02:00
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
2018-11-12 21:09:39 +01:00
|
|
|
|
2020-06-08 09:21:12 +02:00
|
|
|
preference {
|
|
|
|
setTitle(R.string.action_view_blocks)
|
|
|
|
icon = IconicsDrawable(context, GoogleMaterial.Icon.gmd_block).apply {
|
|
|
|
sizeRes = R.dimen.preference_icon_size
|
2022-12-31 13:01:35 +01:00
|
|
|
colorInt = MaterialColors.getColor(context, R.attr.iconColor, Color.BLACK)
|
2020-06-08 09:21:12 +02:00
|
|
|
}
|
|
|
|
setOnPreferenceClickListener {
|
|
|
|
val intent = Intent(context, AccountListActivity::class.java)
|
|
|
|
intent.putExtra("type", AccountListActivity.Type.BLOCKS)
|
|
|
|
activity?.startActivity(intent)
|
2021-06-28 21:13:24 +02:00
|
|
|
activity?.overridePendingTransition(
|
|
|
|
R.anim.slide_from_right,
|
|
|
|
R.anim.slide_to_left
|
|
|
|
)
|
2020-06-08 09:21:12 +02:00
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
2018-11-12 21:09:39 +01:00
|
|
|
|
2020-06-08 09:21:12 +02:00
|
|
|
preference {
|
|
|
|
setTitle(R.string.title_domain_mutes)
|
2020-12-09 19:08:16 +01:00
|
|
|
setIcon(R.drawable.ic_mute_24dp)
|
2020-06-08 09:21:12 +02:00
|
|
|
setOnPreferenceClickListener {
|
2023-07-04 19:41:36 +02:00
|
|
|
val intent = Intent(context, DomainBlocksActivity::class.java)
|
2020-06-08 09:21:12 +02:00
|
|
|
activity?.startActivity(intent)
|
2021-06-28 21:13:24 +02:00
|
|
|
activity?.overridePendingTransition(
|
|
|
|
R.anim.slide_from_right,
|
|
|
|
R.anim.slide_to_left
|
|
|
|
)
|
2020-06-08 09:21:12 +02:00
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
2018-11-12 21:09:39 +01:00
|
|
|
|
2022-05-17 19:32:09 +02:00
|
|
|
if (currentAccountNeedsMigration(accountManager)) {
|
|
|
|
preference {
|
|
|
|
setTitle(R.string.title_migration_relogin)
|
|
|
|
setIcon(R.drawable.ic_logout)
|
|
|
|
setOnPreferenceClickListener {
|
|
|
|
val intent = LoginActivity.getIntent(context, LoginActivity.MODE_MIGRATION)
|
|
|
|
(activity as BaseActivity).startActivityWithSlideInAnimation(intent)
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-11 13:12:50 +01:00
|
|
|
preference {
|
|
|
|
setTitle(R.string.pref_title_timeline_filters)
|
|
|
|
setIcon(R.drawable.ic_filter_24dp)
|
|
|
|
setOnPreferenceClickListener {
|
|
|
|
launchFilterActivity()
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-08 09:21:12 +02:00
|
|
|
preferenceCategory(R.string.pref_publishing) {
|
|
|
|
listPreference {
|
|
|
|
setTitle(R.string.pref_default_post_privacy)
|
|
|
|
setEntries(R.array.post_privacy_names)
|
|
|
|
setEntryValues(R.array.post_privacy_values)
|
|
|
|
key = PrefKeys.DEFAULT_POST_PRIVACY
|
|
|
|
setSummaryProvider { entry }
|
2023-02-27 14:07:28 +01:00
|
|
|
val visibility = accountManager.activeAccount?.defaultPostPrivacy ?: Status.Visibility.PUBLIC
|
2020-06-08 09:21:12 +02:00
|
|
|
value = visibility.serverString()
|
2020-12-09 19:08:16 +01:00
|
|
|
setIcon(getIconForVisibility(visibility))
|
2020-06-08 09:21:12 +02:00
|
|
|
setOnPreferenceChangeListener { _, newValue ->
|
2024-01-04 17:00:55 +01:00
|
|
|
setIcon(
|
|
|
|
getIconForVisibility(Status.Visibility.byString(newValue as String))
|
|
|
|
)
|
2020-06-08 09:21:12 +02:00
|
|
|
syncWithServer(visibility = newValue)
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
2018-11-12 21:09:39 +01:00
|
|
|
|
2022-12-02 19:19:17 +01:00
|
|
|
listPreference {
|
2024-01-04 17:00:55 +01:00
|
|
|
val locales =
|
|
|
|
getLocaleList(getInitialLanguages(null, accountManager.activeAccount))
|
2022-12-02 19:19:17 +01:00
|
|
|
setTitle(R.string.pref_default_post_language)
|
|
|
|
// Explicitly add "System default" to the start of the list
|
|
|
|
entries = (
|
|
|
|
listOf(context.getString(R.string.system_default)) + locales.map {
|
|
|
|
it.getTuskyDisplayName(context)
|
|
|
|
}
|
|
|
|
).toTypedArray()
|
|
|
|
entryValues = (listOf("") + locales.map { it.language }).toTypedArray()
|
|
|
|
key = PrefKeys.DEFAULT_POST_LANGUAGE
|
|
|
|
icon = makeIcon(requireContext(), GoogleMaterial.Icon.gmd_translate, iconSize)
|
2023-03-01 21:06:55 +01:00
|
|
|
value = accountManager.activeAccount?.defaultPostLanguage.orEmpty()
|
2022-12-02 19:19:17 +01:00
|
|
|
isPersistent = false // This will be entirely server-driven
|
|
|
|
setSummaryProvider { entry }
|
|
|
|
|
|
|
|
setOnPreferenceChangeListener { _, newValue ->
|
|
|
|
syncWithServer(language = (newValue as String))
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-08 09:21:12 +02:00
|
|
|
switchPreference {
|
|
|
|
setTitle(R.string.pref_default_media_sensitivity)
|
|
|
|
setIcon(R.drawable.ic_eye_24dp)
|
|
|
|
key = PrefKeys.DEFAULT_MEDIA_SENSITIVITY
|
|
|
|
isSingleLineTitle = false
|
2023-02-27 14:07:28 +01:00
|
|
|
val sensitivity = accountManager.activeAccount?.defaultMediaSensitivity ?: false
|
2020-06-08 09:21:12 +02:00
|
|
|
setDefaultValue(sensitivity)
|
2020-12-09 19:08:16 +01:00
|
|
|
setIcon(getIconForSensitivity(sensitivity))
|
2020-06-08 09:21:12 +02:00
|
|
|
setOnPreferenceChangeListener { _, newValue ->
|
2020-12-09 19:08:16 +01:00
|
|
|
setIcon(getIconForSensitivity(newValue as Boolean))
|
2020-06-08 09:21:12 +02:00
|
|
|
syncWithServer(sensitive = newValue)
|
|
|
|
true
|
|
|
|
}
|
2018-11-12 21:09:39 +01:00
|
|
|
}
|
|
|
|
}
|
2020-06-08 09:21:12 +02:00
|
|
|
|
|
|
|
preferenceCategory(R.string.pref_title_timelines) {
|
2023-02-27 14:07:28 +01:00
|
|
|
// TODO having no activeAccount in this fragment does not really make sense, enforce it?
|
|
|
|
// All other locations here make it optional, however.
|
|
|
|
|
2020-06-08 09:21:12 +02:00
|
|
|
switchPreference {
|
|
|
|
key = PrefKeys.MEDIA_PREVIEW_ENABLED
|
|
|
|
setTitle(R.string.pref_title_show_media_preview)
|
|
|
|
isSingleLineTitle = false
|
2023-06-11 15:34:58 +02:00
|
|
|
preferenceDataStore = accountPreferenceDataStore
|
2018-11-12 21:09:39 +01:00
|
|
|
}
|
2020-06-08 09:21:12 +02:00
|
|
|
|
|
|
|
switchPreference {
|
|
|
|
key = PrefKeys.ALWAYS_SHOW_SENSITIVE_MEDIA
|
|
|
|
setTitle(R.string.pref_title_alway_show_sensitive_media)
|
|
|
|
isSingleLineTitle = false
|
2023-06-11 15:34:58 +02:00
|
|
|
preferenceDataStore = accountPreferenceDataStore
|
2020-06-08 09:21:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
switchPreference {
|
|
|
|
key = PrefKeys.ALWAYS_OPEN_SPOILER
|
|
|
|
setTitle(R.string.pref_title_alway_open_spoiler)
|
|
|
|
isSingleLineTitle = false
|
2023-06-11 15:34:58 +02:00
|
|
|
preferenceDataStore = accountPreferenceDataStore
|
2019-07-28 19:59:52 +02:00
|
|
|
}
|
2018-11-12 21:09:39 +01:00
|
|
|
}
|
2024-01-03 21:14:13 +01:00
|
|
|
preferenceCategory(R.string.pref_title_per_timeline_preferences) {
|
|
|
|
preference {
|
|
|
|
setTitle(R.string.pref_title_post_tabs)
|
|
|
|
fragment = TabFilterPreferencesFragment::class.qualifiedName
|
|
|
|
}
|
|
|
|
}
|
2020-06-08 09:21:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-31 13:02:23 +01:00
|
|
|
override fun onResume() {
|
|
|
|
super.onResume()
|
|
|
|
requireActivity().setTitle(R.string.action_view_account_preferences)
|
|
|
|
}
|
|
|
|
|
2023-02-27 14:07:28 +01:00
|
|
|
private fun openNotificationSystemPrefs() {
|
2020-06-08 09:21:12 +02:00
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
|
|
val intent = Intent()
|
|
|
|
intent.action = "android.settings.APP_NOTIFICATION_SETTINGS"
|
|
|
|
intent.putExtra("android.provider.extra.APP_PACKAGE", BuildConfig.APPLICATION_ID)
|
|
|
|
startActivity(intent)
|
|
|
|
} else {
|
|
|
|
activity?.let {
|
2024-01-04 17:00:55 +01:00
|
|
|
val intent = PreferencesActivity.newIntent(
|
|
|
|
it,
|
|
|
|
PreferencesActivity.NOTIFICATION_PREFERENCES
|
|
|
|
)
|
2020-06-08 09:21:12 +02:00
|
|
|
it.startActivity(intent)
|
|
|
|
it.overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left)
|
2020-05-08 19:17:02 +02:00
|
|
|
}
|
2018-11-12 21:09:39 +01:00
|
|
|
}
|
2020-06-08 09:21:12 +02:00
|
|
|
}
|
2018-11-12 21:09:39 +01:00
|
|
|
|
2024-01-04 17:00:55 +01:00
|
|
|
private fun syncWithServer(
|
|
|
|
visibility: String? = null,
|
|
|
|
sensitive: Boolean? = null,
|
|
|
|
language: String? = null
|
|
|
|
) {
|
2023-02-27 14:07:28 +01:00
|
|
|
// TODO these could also be "datastore backed" preferences (a ServerPreferenceDataStore); follow-up of issue #3204
|
|
|
|
|
2022-12-02 19:19:17 +01:00
|
|
|
mastodonApi.accountUpdateSource(visibility, sensitive, language)
|
2021-06-28 21:13:24 +02:00
|
|
|
.enqueue(object : Callback<Account> {
|
|
|
|
override fun onResponse(call: Call<Account>, response: Response<Account>) {
|
|
|
|
val account = response.body()
|
|
|
|
if (response.isSuccessful && account != null) {
|
|
|
|
accountManager.activeAccount?.let {
|
|
|
|
it.defaultPostPrivacy = account.source?.privacy
|
|
|
|
?: Status.Visibility.PUBLIC
|
|
|
|
it.defaultMediaSensitivity = account.source?.sensitive ?: false
|
2023-03-01 21:06:55 +01:00
|
|
|
it.defaultPostLanguage = language.orEmpty()
|
2021-06-28 21:13:24 +02:00
|
|
|
accountManager.saveAccount(it)
|
2018-11-12 21:09:39 +01:00
|
|
|
}
|
2021-06-28 21:13:24 +02:00
|
|
|
} else {
|
|
|
|
Log.e("AccountPreferences", "failed updating settings on server")
|
2018-11-12 21:09:39 +01:00
|
|
|
showErrorSnackbar(visibility, sensitive)
|
|
|
|
}
|
2021-06-28 21:13:24 +02:00
|
|
|
}
|
2018-11-12 21:09:39 +01:00
|
|
|
|
2021-06-28 21:13:24 +02:00
|
|
|
override fun onFailure(call: Call<Account>, t: Throwable) {
|
|
|
|
Log.e("AccountPreferences", "failed updating settings on server", t)
|
|
|
|
showErrorSnackbar(visibility, sensitive)
|
|
|
|
}
|
|
|
|
})
|
2018-11-12 21:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private fun showErrorSnackbar(visibility: String?, sensitive: Boolean?) {
|
2019-05-09 19:21:22 +02:00
|
|
|
view?.let { view ->
|
2018-11-12 21:09:39 +01:00
|
|
|
Snackbar.make(view, R.string.pref_failed_to_sync, Snackbar.LENGTH_LONG)
|
2021-06-28 21:13:24 +02:00
|
|
|
.setAction(R.string.action_retry) { syncWithServer(visibility, sensitive) }
|
|
|
|
.show()
|
2018-11-12 21:09:39 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-09 19:08:16 +01:00
|
|
|
@DrawableRes
|
|
|
|
private fun getIconForVisibility(visibility: Status.Visibility): Int {
|
|
|
|
return when (visibility) {
|
2018-11-12 21:09:39 +01:00
|
|
|
Status.Visibility.PRIVATE -> R.drawable.ic_lock_outline_24dp
|
|
|
|
|
|
|
|
Status.Visibility.UNLISTED -> R.drawable.ic_lock_open_24dp
|
|
|
|
|
|
|
|
else -> R.drawable.ic_public_24dp
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-09 19:08:16 +01:00
|
|
|
@DrawableRes
|
|
|
|
private fun getIconForSensitivity(sensitive: Boolean): Int {
|
|
|
|
return if (sensitive) {
|
2018-11-12 21:09:39 +01:00
|
|
|
R.drawable.ic_hide_media_24dp
|
|
|
|
} else {
|
|
|
|
R.drawable.ic_eye_24dp
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-11 13:12:50 +01:00
|
|
|
private fun launchFilterActivity() {
|
2019-03-20 19:25:26 +01:00
|
|
|
val intent = Intent(context, FiltersActivity::class.java)
|
|
|
|
activity?.startActivity(intent)
|
|
|
|
activity?.overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left)
|
|
|
|
}
|
|
|
|
|
2018-11-12 21:09:39 +01:00
|
|
|
companion object {
|
2020-01-30 21:37:28 +01:00
|
|
|
fun newInstance() = AccountPreferencesFragment()
|
2018-11-12 21:09:39 +01:00
|
|
|
}
|
|
|
|
}
|