Add "account" filter context
This commit is contained in:
parent
5b0e4bec51
commit
e6089ebb84
|
@ -30,6 +30,7 @@ data class Filter (
|
||||||
const val NOTIFICATIONS = "notifications"
|
const val NOTIFICATIONS = "notifications"
|
||||||
const val PUBLIC = "public"
|
const val PUBLIC = "public"
|
||||||
const val THREAD = "thread"
|
const val THREAD = "thread"
|
||||||
|
const val ACCOUNT = "account"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
|
|
|
@ -449,6 +449,10 @@ public class TimelineFragment extends SFragment implements
|
||||||
return filterContext.contains(Filter.PUBLIC);
|
return filterContext.contains(Filter.PUBLIC);
|
||||||
case FAVOURITES:
|
case FAVOURITES:
|
||||||
return (filterContext.contains(Filter.PUBLIC) || filterContext.contains(Filter.NOTIFICATIONS));
|
return (filterContext.contains(Filter.PUBLIC) || filterContext.contains(Filter.NOTIFICATIONS));
|
||||||
|
case USER:
|
||||||
|
case USER_WITH_REPLIES:
|
||||||
|
case USER_PINNED:
|
||||||
|
return filterContext.contains(Filter.ACCOUNT);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -967,7 +971,8 @@ public class TimelineFragment extends SFragment implements
|
||||||
case Filter.HOME:
|
case Filter.HOME:
|
||||||
case Filter.NOTIFICATIONS:
|
case Filter.NOTIFICATIONS:
|
||||||
case Filter.THREAD:
|
case Filter.THREAD:
|
||||||
case Filter.PUBLIC: {
|
case Filter.PUBLIC:
|
||||||
|
case Filter.ACCOUNT: {
|
||||||
if (filterContextMatchesKind(kind, Collections.singletonList(key))) {
|
if (filterContextMatchesKind(kind, Collections.singletonList(key))) {
|
||||||
reloadFilters(true);
|
reloadFilters(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,7 @@ class AccountPreferencesFragment : PreferenceFragmentCompat(),
|
||||||
private lateinit var notificationFiltersPreference: Preference
|
private lateinit var notificationFiltersPreference: Preference
|
||||||
private lateinit var publicFiltersPreference: Preference
|
private lateinit var publicFiltersPreference: Preference
|
||||||
private lateinit var threadFiltersPreference: Preference
|
private lateinit var threadFiltersPreference: Preference
|
||||||
|
private lateinit var accountFiltersPreference: Preference
|
||||||
|
|
||||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||||
addPreferencesFromResource(R.xml.account_preferences)
|
addPreferencesFromResource(R.xml.account_preferences)
|
||||||
|
@ -91,6 +92,7 @@ class AccountPreferencesFragment : PreferenceFragmentCompat(),
|
||||||
notificationFiltersPreference = requirePreference("notificationFilters")
|
notificationFiltersPreference = requirePreference("notificationFilters")
|
||||||
publicFiltersPreference = requirePreference("publicFilters")
|
publicFiltersPreference = requirePreference("publicFilters")
|
||||||
threadFiltersPreference = requirePreference("threadFilters")
|
threadFiltersPreference = requirePreference("threadFilters")
|
||||||
|
accountFiltersPreference = requirePreference("accountFilters")
|
||||||
|
|
||||||
notificationPreference.icon = IconicsDrawable(notificationPreference.context, GoogleMaterial.Icon.gmd_notifications).apply { sizeRes = R.dimen.preference_icon_size; colorInt = ThemeUtils.getColor(notificationPreference.context, R.attr.iconColor) }
|
notificationPreference.icon = IconicsDrawable(notificationPreference.context, GoogleMaterial.Icon.gmd_notifications).apply { sizeRes = R.dimen.preference_icon_size; colorInt = ThemeUtils.getColor(notificationPreference.context, R.attr.iconColor) }
|
||||||
mutedUsersPreference.icon = getTintedIcon(R.drawable.ic_mute_24dp)
|
mutedUsersPreference.icon = getTintedIcon(R.drawable.ic_mute_24dp)
|
||||||
|
@ -106,6 +108,7 @@ class AccountPreferencesFragment : PreferenceFragmentCompat(),
|
||||||
notificationFiltersPreference.onPreferenceClickListener = this
|
notificationFiltersPreference.onPreferenceClickListener = this
|
||||||
publicFiltersPreference.onPreferenceClickListener = this
|
publicFiltersPreference.onPreferenceClickListener = this
|
||||||
threadFiltersPreference.onPreferenceClickListener = this
|
threadFiltersPreference.onPreferenceClickListener = this
|
||||||
|
accountFiltersPreference.onPreferenceClickListener = this
|
||||||
|
|
||||||
defaultPostPrivacyPreference.onPreferenceChangeListener = this
|
defaultPostPrivacyPreference.onPreferenceChangeListener = this
|
||||||
defaultMediaSensitivityPreference.onPreferenceChangeListener = this
|
defaultMediaSensitivityPreference.onPreferenceChangeListener = this
|
||||||
|
@ -224,6 +227,9 @@ class AccountPreferencesFragment : PreferenceFragmentCompat(),
|
||||||
threadFiltersPreference -> {
|
threadFiltersPreference -> {
|
||||||
launchFilterActivity(Filter.THREAD, R.string.pref_title_thread_filter_keywords)
|
launchFilterActivity(Filter.THREAD, R.string.pref_title_thread_filter_keywords)
|
||||||
}
|
}
|
||||||
|
accountFiltersPreference -> {
|
||||||
|
launchFilterActivity(Filter.ACCOUNT, R.string.title_accounts)
|
||||||
|
}
|
||||||
|
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,5 +73,9 @@
|
||||||
<Preference
|
<Preference
|
||||||
android:key="threadFilters"
|
android:key="threadFilters"
|
||||||
android:title="@string/pref_title_thread_filter_keywords" />
|
android:title="@string/pref_title_thread_filter_keywords" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="accountFilters"
|
||||||
|
android:title="@string/title_accounts" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</androidx.preference.PreferenceScreen>
|
</androidx.preference.PreferenceScreen>
|
||||||
|
|
Loading…
Reference in New Issue