feat: Support adding "Favourites" to a tab (#578)
This commit is contained in:
parent
64fae0ceb6
commit
53fa56bbb4
|
@ -369,6 +369,14 @@ class TabPreferenceActivity : BaseActivity(), ItemInteractionListener {
|
|||
if (!currentTabs.contains(directMessagesTab)) {
|
||||
addableTabs.add(directMessagesTab)
|
||||
}
|
||||
val bookmarksTab = TabViewData.from(Timeline.Bookmarks)
|
||||
if (!currentTabs.contains(bookmarksTab)) {
|
||||
addableTabs.add(bookmarksTab)
|
||||
}
|
||||
val favouritesTab = TabViewData.from(Timeline.Favourites)
|
||||
if (!currentTabs.contains(favouritesTab)) {
|
||||
addableTabs.add(favouritesTab)
|
||||
}
|
||||
val trendingTagsTab = TabViewData.from(Timeline.TrendingHashtags)
|
||||
if (!currentTabs.contains(trendingTagsTab)) {
|
||||
addableTabs.add(trendingTagsTab)
|
||||
|
@ -381,10 +389,6 @@ class TabPreferenceActivity : BaseActivity(), ItemInteractionListener {
|
|||
if (!currentTabs.contains(trendingStatusesTab)) {
|
||||
addableTabs.add(trendingStatusesTab)
|
||||
}
|
||||
val bookmarksTab = TabViewData.from(Timeline.Bookmarks)
|
||||
if (!currentTabs.contains(trendingTagsTab)) {
|
||||
addableTabs.add(bookmarksTab)
|
||||
}
|
||||
|
||||
addableTabs.add(TabViewData.from(Timeline.Hashtags(emptyList())))
|
||||
addableTabs.add(TabViewData.from(Timeline.UserList("", "")))
|
||||
|
|
|
@ -135,7 +135,12 @@ data class TabViewData(
|
|||
icon = R.drawable.ic_bookmark_active_24dp,
|
||||
fragment = { TimelineFragment.newInstance(timeline) },
|
||||
)
|
||||
Timeline.Favourites -> throw IllegalArgumentException("can't add to tab: $timeline")
|
||||
Timeline.Favourites -> TabViewData(
|
||||
timeline = timeline,
|
||||
text = R.string.title_favourites,
|
||||
icon = R.drawable.ic_favourite_filled_24dp,
|
||||
fragment = { TimelineFragment.newInstance(timeline) },
|
||||
)
|
||||
is Timeline.User.Pinned -> throw IllegalArgumentException("can't add to tab: $timeline")
|
||||
is Timeline.User.Posts -> throw IllegalArgumentException("can't add to tab: $timeline")
|
||||
is Timeline.User.Replies -> throw IllegalArgumentException("can't add to tab: $timeline")
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
|
||||
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,17.27L18.18,21l-1.64,-7.03L22,9.24l-7.19,-0.61L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21z"/>
|
||||
|
||||
</vector>
|
Loading…
Reference in New Issue