|
|
|
|
@ -16,28 +16,49 @@
|
|
|
|
|
package com.keylesspalace.tusky.components.preference |
|
|
|
|
|
|
|
|
|
import android.content.Intent |
|
|
|
|
import android.graphics.drawable.Drawable |
|
|
|
|
import android.os.Build |
|
|
|
|
import android.os.Bundle |
|
|
|
|
import android.util.Log |
|
|
|
|
import android.view.LayoutInflater |
|
|
|
|
import android.view.View |
|
|
|
|
import android.view.ViewGroup |
|
|
|
|
import android.widget.LinearLayout |
|
|
|
|
import android.widget.ScrollView |
|
|
|
|
import androidx.annotation.DrawableRes |
|
|
|
|
import androidx.fragment.app.Fragment |
|
|
|
|
import androidx.preference.PreferenceFragmentCompat |
|
|
|
|
import com.google.android.material.snackbar.Snackbar |
|
|
|
|
import com.keylesspalace.tusky.AccountListActivity |
|
|
|
|
import com.keylesspalace.tusky.BaseActivity |
|
|
|
|
import com.keylesspalace.tusky.BuildConfig |
|
|
|
|
import com.keylesspalace.tusky.FiltersActivity |
|
|
|
|
import com.keylesspalace.tusky.R |
|
|
|
|
import com.keylesspalace.tusky.TabPreferenceActivity |
|
|
|
|
import com.keylesspalace.tusky.appstore.EventHub |
|
|
|
|
import com.keylesspalace.tusky.appstore.PreferenceChangedEvent |
|
|
|
|
import com.keylesspalace.tusky.components.instancemute.InstanceListActivity |
|
|
|
|
import com.keylesspalace.tusky.db.AccountEntity |
|
|
|
|
import com.keylesspalace.tusky.db.AccountManager |
|
|
|
|
import com.keylesspalace.tusky.di.Injectable |
|
|
|
|
import com.keylesspalace.tusky.entity.Account |
|
|
|
|
import com.keylesspalace.tusky.entity.Filter |
|
|
|
|
import com.keylesspalace.tusky.entity.Status |
|
|
|
|
import com.keylesspalace.tusky.network.MastodonApi |
|
|
|
|
import com.keylesspalace.tusky.settings.PrefKeys |
|
|
|
|
import com.keylesspalace.tusky.settings.PreferenceOption |
|
|
|
|
import com.keylesspalace.tusky.settings.clickPreference |
|
|
|
|
import com.keylesspalace.tusky.settings.listPreference |
|
|
|
|
import com.keylesspalace.tusky.settings.makePreferenceScreen |
|
|
|
|
import com.keylesspalace.tusky.settings.preferenceCategory |
|
|
|
|
import com.keylesspalace.tusky.settings.switchPreference |
|
|
|
|
import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial |
|
|
|
|
import retrofit2.Call |
|
|
|
|
import retrofit2.Callback |
|
|
|
|
import retrofit2.Response |
|
|
|
|
import javax.inject.Inject |
|
|
|
|
|
|
|
|
|
class AccountPreferencesFragment : PreferenceFragmentCompat(), Injectable { |
|
|
|
|
class AccountPreferencesFragment : Fragment(), Injectable { |
|
|
|
|
@Inject |
|
|
|
|
lateinit var accountManager: AccountManager |
|
|
|
|
|
|
|
|
|
@ -47,207 +68,141 @@ class AccountPreferencesFragment : PreferenceFragmentCompat(), Injectable {
|
|
|
|
|
@Inject |
|
|
|
|
lateinit var eventHub: EventHub |
|
|
|
|
|
|
|
|
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { |
|
|
|
|
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 |
|
|
|
|
// colorInt = ThemeUtils.getColor(context, R.attr.iconColor) |
|
|
|
|
// } |
|
|
|
|
// setOnPreferenceClickListener { |
|
|
|
|
// openNotificationPrefs() |
|
|
|
|
// true |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// preference { |
|
|
|
|
// setTitle(R.string.title_tab_preferences) |
|
|
|
|
// setIcon(R.drawable.ic_tabs) |
|
|
|
|
// setOnPreferenceClickListener { |
|
|
|
|
// val intent = Intent(context, TabPreferenceActivity::class.java) |
|
|
|
|
// activity?.startActivity(intent) |
|
|
|
|
// activity?.overridePendingTransition( |
|
|
|
|
// R.anim.slide_from_right, |
|
|
|
|
// R.anim.slide_to_left |
|
|
|
|
// ) |
|
|
|
|
// true |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// preference { |
|
|
|
|
// setTitle(R.string.action_view_mutes) |
|
|
|
|
// setIcon(R.drawable.ic_mute_24dp) |
|
|
|
|
// setOnPreferenceClickListener { |
|
|
|
|
// val intent = Intent(context, AccountListActivity::class.java) |
|
|
|
|
// intent.putExtra("type", AccountListActivity.Type.MUTES) |
|
|
|
|
// activity?.startActivity(intent) |
|
|
|
|
// activity?.overridePendingTransition( |
|
|
|
|
// R.anim.slide_from_right, |
|
|
|
|
// R.anim.slide_to_left |
|
|
|
|
// ) |
|
|
|
|
// true |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// preference { |
|
|
|
|
// setTitle(R.string.action_view_blocks) |
|
|
|
|
// icon = IconicsDrawable(context, GoogleMaterial.Icon.gmd_block).apply { |
|
|
|
|
// sizeRes = R.dimen.preference_icon_size |
|
|
|
|
// colorInt = ThemeUtils.getColor(context, R.attr.iconColor) |
|
|
|
|
// } |
|
|
|
|
// setOnPreferenceClickListener { |
|
|
|
|
// val intent = Intent(context, AccountListActivity::class.java) |
|
|
|
|
// intent.putExtra("type", AccountListActivity.Type.BLOCKS) |
|
|
|
|
// activity?.startActivity(intent) |
|
|
|
|
// activity?.overridePendingTransition( |
|
|
|
|
// R.anim.slide_from_right, |
|
|
|
|
// R.anim.slide_to_left |
|
|
|
|
// ) |
|
|
|
|
// true |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// preference { |
|
|
|
|
// setTitle(R.string.title_domain_mutes) |
|
|
|
|
// setIcon(R.drawable.ic_mute_24dp) |
|
|
|
|
// setOnPreferenceClickListener { |
|
|
|
|
// val intent = Intent(context, InstanceListActivity::class.java) |
|
|
|
|
// activity?.startActivity(intent) |
|
|
|
|
// activity?.overridePendingTransition( |
|
|
|
|
// R.anim.slide_from_right, |
|
|
|
|
// R.anim.slide_to_left |
|
|
|
|
// ) |
|
|
|
|
// true |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// 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 } |
|
|
|
|
// val visibility = accountManager.activeAccount?.defaultPostPrivacy |
|
|
|
|
// ?: Status.Visibility.PUBLIC |
|
|
|
|
// value = visibility.serverString() |
|
|
|
|
// setIcon(getIconForVisibility(visibility)) |
|
|
|
|
// setOnPreferenceChangeListener { _, newValue -> |
|
|
|
|
// setIcon(getIconForVisibility(Status.Visibility.byString(newValue as String))) |
|
|
|
|
// syncWithServer(visibility = newValue) |
|
|
|
|
// eventHub.dispatch(PreferenceChangedEvent(key)) |
|
|
|
|
// true |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// switchPreference { |
|
|
|
|
// setTitle(R.string.pref_default_media_sensitivity) |
|
|
|
|
// setIcon(R.drawable.ic_eye_24dp) |
|
|
|
|
// key = PrefKeys.DEFAULT_MEDIA_SENSITIVITY |
|
|
|
|
// isSingleLineTitle = false |
|
|
|
|
// val sensitivity = accountManager.activeAccount?.defaultMediaSensitivity |
|
|
|
|
// ?: false |
|
|
|
|
// setDefaultValue(sensitivity) |
|
|
|
|
// setIcon(getIconForSensitivity(sensitivity)) |
|
|
|
|
// setOnPreferenceChangeListener { _, newValue -> |
|
|
|
|
// setIcon(getIconForSensitivity(newValue as Boolean)) |
|
|
|
|
// syncWithServer(sensitive = newValue) |
|
|
|
|
// eventHub.dispatch(PreferenceChangedEvent(key)) |
|
|
|
|
// true |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// preferenceCategory(R.string.pref_title_timelines) { |
|
|
|
|
// switchPreference { |
|
|
|
|
// key = PrefKeys.MEDIA_PREVIEW_ENABLED |
|
|
|
|
// setTitle(R.string.pref_title_show_media_preview) |
|
|
|
|
// isSingleLineTitle = false |
|
|
|
|
// isChecked = accountManager.activeAccount?.mediaPreviewEnabled ?: true |
|
|
|
|
// setOnPreferenceChangeListener { _, newValue -> |
|
|
|
|
// updateAccount { it.mediaPreviewEnabled = newValue as Boolean } |
|
|
|
|
// eventHub.dispatch(PreferenceChangedEvent(key)) |
|
|
|
|
// true |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// switchPreference { |
|
|
|
|
// key = PrefKeys.ALWAYS_SHOW_SENSITIVE_MEDIA |
|
|
|
|
// setTitle(R.string.pref_title_alway_show_sensitive_media) |
|
|
|
|
// isSingleLineTitle = false |
|
|
|
|
// isChecked = accountManager.activeAccount?.alwaysShowSensitiveMedia ?: false |
|
|
|
|
// setOnPreferenceChangeListener { _, newValue -> |
|
|
|
|
// updateAccount { it.alwaysShowSensitiveMedia = newValue as Boolean } |
|
|
|
|
// eventHub.dispatch(PreferenceChangedEvent(key)) |
|
|
|
|
// true |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// switchPreference { |
|
|
|
|
// key = PrefKeys.ALWAYS_OPEN_SPOILER |
|
|
|
|
// setTitle(R.string.pref_title_alway_open_spoiler) |
|
|
|
|
// isSingleLineTitle = false |
|
|
|
|
// isChecked = accountManager.activeAccount?.alwaysOpenSpoiler ?: false |
|
|
|
|
// setOnPreferenceChangeListener { _, newValue -> |
|
|
|
|
// updateAccount { it.alwaysOpenSpoiler = newValue as Boolean } |
|
|
|
|
// eventHub.dispatch(PreferenceChangedEvent(key)) |
|
|
|
|
// true |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// preferenceCategory(R.string.pref_title_timeline_filters) { |
|
|
|
|
// preference { |
|
|
|
|
// setTitle(R.string.pref_title_public_filter_keywords) |
|
|
|
|
// setOnPreferenceClickListener { |
|
|
|
|
// launchFilterActivity( |
|
|
|
|
// Filter.PUBLIC, |
|
|
|
|
// R.string.pref_title_public_filter_keywords |
|
|
|
|
// ) |
|
|
|
|
// true |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// preference { |
|
|
|
|
// setTitle(R.string.title_notifications) |
|
|
|
|
// setOnPreferenceClickListener { |
|
|
|
|
// launchFilterActivity(Filter.NOTIFICATIONS, R.string.title_notifications) |
|
|
|
|
// true |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// preference { |
|
|
|
|
// setTitle(R.string.title_home) |
|
|
|
|
// setOnPreferenceClickListener { |
|
|
|
|
// launchFilterActivity(Filter.HOME, R.string.title_home) |
|
|
|
|
// true |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// preference { |
|
|
|
|
// setTitle(R.string.pref_title_thread_filter_keywords) |
|
|
|
|
// setOnPreferenceClickListener { |
|
|
|
|
// launchFilterActivity( |
|
|
|
|
// Filter.THREAD, |
|
|
|
|
// R.string.pref_title_thread_filter_keywords |
|
|
|
|
// ) |
|
|
|
|
// true |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// preference { |
|
|
|
|
// setTitle(R.string.title_accounts) |
|
|
|
|
// setOnPreferenceClickListener { |
|
|
|
|
// launchFilterActivity(Filter.ACCOUNT, R.string.title_accounts) |
|
|
|
|
// true |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
private var updateTrigger: (() -> Unit)? = null |
|
|
|
|
|
|
|
|
|
override fun onCreateView( |
|
|
|
|
inflater: LayoutInflater, |
|
|
|
|
container: ViewGroup?, |
|
|
|
|
savedInstanceState: Bundle? |
|
|
|
|
): View { |
|
|
|
|
val viewRoot = ScrollView(inflater.context) |
|
|
|
|
val rootLayout = LinearLayout(inflater.context).apply { |
|
|
|
|
orientation = LinearLayout.VERTICAL |
|
|
|
|
viewRoot.addView(this) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
updateTrigger = makePreferenceScreen(rootLayout) { |
|
|
|
|
clickPreference( |
|
|
|
|
getString(R.string.pref_title_edit_notification_settings), |
|
|
|
|
{ makeIcon(GoogleMaterial.Icon.gmd_notifications) } |
|
|
|
|
) { |
|
|
|
|
openNotificationPrefs() |
|
|
|
|
} |
|
|
|
|
clickPreference( |
|
|
|
|
getString(R.string.title_tab_preferences), |
|
|
|
|
{ makeIcon(R.drawable.ic_tabs) } |
|
|
|
|
) { |
|
|
|
|
val activity = requireActivity() as BaseActivity |
|
|
|
|
val intent = Intent(context, TabPreferenceActivity::class.java) |
|
|
|
|
activity.startActivityWithSlideInAnimation(intent) |
|
|
|
|
} |
|
|
|
|
clickPreference( |
|
|
|
|
getString(R.string.action_view_mutes), |
|
|
|
|
{ makeIcon(R.drawable.ic_mute_24dp) } |
|
|
|
|
) { |
|
|
|
|
val activity = requireActivity() as BaseActivity |
|
|
|
|
val intent = AccountListActivity.newIntent(context, AccountListActivity.Type.MUTES) |
|
|
|
|
|
|
|
|
|
activity.startActivityWithSlideInAnimation(intent) |
|
|
|
|
} |
|
|
|
|
clickPreference( |
|
|
|
|
getString(R.string.action_view_blocks), |
|
|
|
|
{ makeIcon(GoogleMaterial.Icon.gmd_block) } |
|
|
|
|
) { |
|
|
|
|
val activity = requireActivity() as BaseActivity |
|
|
|
|
val intent = AccountListActivity.newIntent(context, AccountListActivity.Type.BLOCKS) |
|
|
|
|
|
|
|
|
|
activity.startActivityWithSlideInAnimation(intent) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
clickPreference( |
|
|
|
|
getString(R.string.title_domain_mutes), |
|
|
|
|
{ makeIcon(R.drawable.ic_mute_24dp) } |
|
|
|
|
) { |
|
|
|
|
val activity = requireActivity() as BaseActivity |
|
|
|
|
val intent = Intent(context, InstanceListActivity::class.java) |
|
|
|
|
|
|
|
|
|
activity.startActivityWithSlideInAnimation(intent) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
preferenceCategory(R.string.pref_publishing) { |
|
|
|
|
val privacyOptions = listOf( |
|
|
|
|
"public" to R.string.post_privacy_public, |
|
|
|
|
"unlisted" to R.string.post_privacy_unlisted, |
|
|
|
|
"private" to R.string.post_privacy_followers_only |
|
|
|
|
).map(::PreferenceOption) |
|
|
|
|
listPreference( |
|
|
|
|
getString(R.string.pref_default_post_privacy), |
|
|
|
|
privacyOptions, |
|
|
|
|
{ activeAccount.defaultPostPrivacy.serverString() }, |
|
|
|
|
{ getIconForVisibility(activeAccount.defaultPostPrivacy) } |
|
|
|
|
) { newValue -> |
|
|
|
|
syncWithServer(visibility = newValue) |
|
|
|
|
eventHub.dispatch(PreferenceChangedEvent(PrefKeys.DEFAULT_POST_PRIVACY)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switchPreference( |
|
|
|
|
getString(R.string.pref_default_media_sensitivity), |
|
|
|
|
{ activeAccount.defaultMediaSensitivity }, |
|
|
|
|
{ getIconForSensitivity(activeAccount.defaultMediaSensitivity) } |
|
|
|
|
) { |
|
|
|
|
updateAccount { account -> account.mediaPreviewEnabled = it } |
|
|
|
|
eventHub.dispatch(PreferenceChangedEvent(PrefKeys.DEFAULT_MEDIA_SENSITIVITY)) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
preferenceCategory(R.string.pref_title_timelines) { |
|
|
|
|
switchPreference( |
|
|
|
|
getString(R.string.pref_title_timelines), |
|
|
|
|
{ activeAccount.mediaPreviewEnabled }, |
|
|
|
|
) { |
|
|
|
|
updateAccount { account -> account.mediaPreviewEnabled = it } |
|
|
|
|
eventHub.dispatch(PreferenceChangedEvent(PrefKeys.MEDIA_PREVIEW_ENABLED)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switchPreference( |
|
|
|
|
getString(R.string.pref_title_alway_show_sensitive_media), |
|
|
|
|
{ activeAccount.alwaysShowSensitiveMedia } |
|
|
|
|
) { |
|
|
|
|
updateAccount { account -> account.alwaysShowSensitiveMedia = it } |
|
|
|
|
eventHub.dispatch(PreferenceChangedEvent(PrefKeys.ALWAYS_SHOW_SENSITIVE_MEDIA)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switchPreference( |
|
|
|
|
getString(R.string.pref_title_alway_open_spoiler), |
|
|
|
|
{ activeAccount.alwaysOpenSpoiler } |
|
|
|
|
) { |
|
|
|
|
updateAccount { account -> account.alwaysOpenSpoiler = it } |
|
|
|
|
eventHub.dispatch(PreferenceChangedEvent(PrefKeys.ALWAYS_OPEN_SPOILER)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
preferenceCategory(R.string.pref_title_timeline_filters) { |
|
|
|
|
clickPreference(getString(R.string.pref_title_public_filter_keywords)) { |
|
|
|
|
launchFilterActivity(Filter.PUBLIC, R.string.pref_title_public_filter_keywords) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
clickPreference(getString(R.string.title_notifications)) { |
|
|
|
|
launchFilterActivity(Filter.NOTIFICATIONS, R.string.title_notifications) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
clickPreference(getString(R.string.pref_title_thread_filter_keywords)) { |
|
|
|
|
launchFilterActivity(Filter.THREAD, R.string.pref_title_thread_filter_keywords) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
clickPreference(getString(R.string.title_accounts)) { |
|
|
|
|
launchFilterActivity(Filter.ACCOUNT, R.string.title_accounts) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return viewRoot |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private val activeAccount: AccountEntity |
|
|
|
|
get() = accountManager.activeAccount!! |
|
|
|
|
|
|
|
|
|
private fun openNotificationPrefs() { |
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
|
|
|
|
val intent = Intent() |
|
|
|
|
@ -256,7 +211,8 @@ class AccountPreferencesFragment : PreferenceFragmentCompat(), Injectable {
|
|
|
|
|
startActivity(intent) |
|
|
|
|
} else { |
|
|
|
|
activity?.let { |
|
|
|
|
val intent = PreferencesActivity.newIntent(it, PreferencesActivity.NOTIFICATION_PREFERENCES) |
|
|
|
|
val intent = |
|
|
|
|
PreferencesActivity.newIntent(it, PreferencesActivity.NOTIFICATION_PREFERENCES) |
|
|
|
|
it.startActivity(intent) |
|
|
|
|
it.overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left) |
|
|
|
|
} |
|
|
|
|
@ -267,6 +223,7 @@ class AccountPreferencesFragment : PreferenceFragmentCompat(), Injectable {
|
|
|
|
|
accountManager.activeAccount?.let { account -> |
|
|
|
|
changer(account) |
|
|
|
|
accountManager.saveAccount(account) |
|
|
|
|
updateTrigger?.invoke() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -276,12 +233,10 @@ class AccountPreferencesFragment : PreferenceFragmentCompat(), Injectable {
|
|
|
|
|
override fun onResponse(call: Call<Account>, response: Response<Account>) { |
|
|
|
|
val account = response.body() |
|
|
|
|
if (response.isSuccessful && account != null) { |
|
|
|
|
|
|
|
|
|
accountManager.activeAccount?.let { |
|
|
|
|
updateAccount { |
|
|
|
|
it.defaultPostPrivacy = account.source?.privacy |
|
|
|
|
?: Status.Visibility.PUBLIC |
|
|
|
|
it.defaultMediaSensitivity = account.source?.sensitive ?: false |
|
|
|
|
accountManager.saveAccount(it) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
Log.e("AccountPreferences", "failed updating settings on server") |
|
|
|
|
@ -304,24 +259,24 @@ class AccountPreferencesFragment : PreferenceFragmentCompat(), Injectable {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@DrawableRes |
|
|
|
|
private fun getIconForVisibility(visibility: Status.Visibility): Int { |
|
|
|
|
return when (visibility) { |
|
|
|
|
private fun getIconForVisibility(visibility: Status.Visibility): Drawable { |
|
|
|
|
@DrawableRes |
|
|
|
|
val res = when (visibility) { |
|
|
|
|
Status.Visibility.PRIVATE -> R.drawable.ic_lock_outline_24dp |
|
|
|
|
|
|
|
|
|
Status.Visibility.UNLISTED -> R.drawable.ic_lock_open_24dp |
|
|
|
|
|
|
|
|
|
else -> R.drawable.ic_public_24dp |
|
|
|
|
} |
|
|
|
|
return makeIcon(res) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@DrawableRes |
|
|
|
|
private fun getIconForSensitivity(sensitive: Boolean): Int { |
|
|
|
|
return if (sensitive) { |
|
|
|
|
private fun getIconForSensitivity(sensitive: Boolean): Drawable { |
|
|
|
|
@DrawableRes |
|
|
|
|
val res = if (sensitive) { |
|
|
|
|
R.drawable.ic_hide_media_24dp |
|
|
|
|
} else { |
|
|
|
|
R.drawable.ic_eye_24dp |
|
|
|
|
} |
|
|
|
|
return makeIcon(res) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun launchFilterActivity(filterContext: String, titleResource: Int) { |
|
|
|
|
|