Timeline: Add akkoma's Bubble timeline
This commit is contained in:
parent
6a66056216
commit
cd08a36862
|
@ -31,6 +31,7 @@ import java.util.Objects
|
|||
const val HOME = "Home"
|
||||
const val NOTIFICATIONS = "Notifications"
|
||||
const val LOCAL = "Local"
|
||||
const val BUBBLE = "Bubble"
|
||||
const val FEDERATED = "Federated"
|
||||
const val DIRECT = "Direct"
|
||||
const val TRENDING = "Trending"
|
||||
|
@ -82,6 +83,12 @@ fun createTabDataFromId(id: String, arguments: List<String> = emptyList()): TabD
|
|||
icon = R.drawable.ic_local_24dp,
|
||||
fragment = { TimelineFragment.newInstance(TimelineViewModel.Kind.PUBLIC_LOCAL) }
|
||||
)
|
||||
BUBBLE -> TabData(
|
||||
BUBBLE,
|
||||
R.string.title_bubble,
|
||||
R.drawable.ic_circle_24dp,
|
||||
{ TimelineFragment.newInstance(TimelineViewModel.Kind.BUBBLE) }
|
||||
)
|
||||
FEDERATED -> TabData(
|
||||
id = FEDERATED,
|
||||
text = R.string.title_public_federated,
|
||||
|
|
|
@ -370,6 +370,10 @@ class TabPreferenceActivity : BaseActivity(), Injectable, ItemInteractionListene
|
|||
if (!currentTabs.contains(localTab)) {
|
||||
addableTabs.add(localTab)
|
||||
}
|
||||
val bubbleTab = createTabDataFromId(BUBBLE)
|
||||
if (!currentTabs.contains(bubbleTab)) {
|
||||
addableTabs.add(bubbleTab)
|
||||
}
|
||||
val federatedTab = createTabDataFromId(FEDERATED)
|
||||
if (!currentTabs.contains(federatedTab)) {
|
||||
addableTabs.add(federatedTab)
|
||||
|
|
|
@ -551,6 +551,7 @@ class TimelineFragment :
|
|||
when (kind) {
|
||||
TimelineViewModel.Kind.HOME,
|
||||
TimelineViewModel.Kind.PUBLIC_FEDERATED,
|
||||
TimelineViewModel.Kind.BUBBLE,
|
||||
TimelineViewModel.Kind.PUBLIC_LOCAL -> adapter.refresh()
|
||||
TimelineViewModel.Kind.USER,
|
||||
TimelineViewModel.Kind.USER_WITH_REPLIES -> if (status.account.id == viewModel.id) {
|
||||
|
|
|
@ -279,6 +279,7 @@ class NetworkTimelineViewModel @Inject constructor(
|
|||
return when (kind) {
|
||||
Kind.HOME -> api.homeTimeline(maxId = fromId, sinceId = uptoId, limit = limit)
|
||||
Kind.PUBLIC_FEDERATED -> api.publicTimeline(null, fromId, uptoId, limit)
|
||||
Kind.BUBBLE -> api.bubbleTimeline(fromId, uptoId, limit)
|
||||
Kind.PUBLIC_LOCAL -> api.publicTimeline(true, fromId, uptoId, limit)
|
||||
Kind.TAG -> {
|
||||
val firstHashtag = tags[0]
|
||||
|
|
|
@ -325,12 +325,12 @@ abstract class TimelineViewModel(
|
|||
}
|
||||
|
||||
enum class Kind {
|
||||
HOME, PUBLIC_LOCAL, PUBLIC_FEDERATED, TAG, USER, USER_PINNED, USER_WITH_REPLIES, FAVOURITES, LIST, BOOKMARKS;
|
||||
HOME, PUBLIC_LOCAL, PUBLIC_FEDERATED, TAG, USER, USER_PINNED, USER_WITH_REPLIES, FAVOURITES, LIST, BOOKMARKS, BUBBLE;
|
||||
|
||||
fun toFilterKind(): Filter.Kind {
|
||||
return when (valueOf(name)) {
|
||||
HOME, LIST -> Filter.Kind.HOME
|
||||
PUBLIC_FEDERATED, PUBLIC_LOCAL, TAG, FAVOURITES -> Filter.Kind.PUBLIC
|
||||
PUBLIC_FEDERATED, PUBLIC_LOCAL, TAG, FAVOURITES, BUBBLE -> Filter.Kind.PUBLIC
|
||||
USER, USER_WITH_REPLIES, USER_PINNED -> Filter.Kind.ACCOUNT
|
||||
else -> Filter.Kind.PUBLIC
|
||||
}
|
||||
|
|
|
@ -110,6 +110,13 @@ interface MastodonApi {
|
|||
@Query("limit") limit: Int? = null
|
||||
): Response<List<Status>>
|
||||
|
||||
@GET("api/v1/timelines/bubble")
|
||||
suspend fun bubbleTimeline(
|
||||
@Query("max_id") maxId: String? = null,
|
||||
@Query("since_id") sinceId: String? = null,
|
||||
@Query("limit") limit: Int? = null
|
||||
): Response<List<Status>>
|
||||
|
||||
@GET("api/v1/timelines/tag/{hashtag}")
|
||||
suspend fun hashtagTimeline(
|
||||
@Path("hashtag") hashtag: String,
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#fff"
|
||||
android:pathData="M12,22Q9.925,22 8.1,21.212Q6.275,20.425 4.925,19.075Q3.575,17.725 2.788,15.9Q2,14.075 2,12Q2,9.925 2.788,8.1Q3.575,6.275 4.925,4.925Q6.275,3.575 8.1,2.787Q9.925,2 12,2Q14.075,2 15.9,2.787Q17.725,3.575 19.075,4.925Q20.425,6.275 21.212,8.1Q22,9.925 22,12Q22,14.075 21.212,15.9Q20.425,17.725 19.075,19.075Q17.725,20.425 15.9,21.212Q14.075,22 12,22Z"/>
|
||||
</vector>
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
<string name="status_replied_to_format">Reply to %s</string>
|
||||
<string name="pref_title_enable_big_emojis">Enable bigger custom emojis</string>
|
||||
<string name="title_bubble">Bubble</string>
|
||||
|
||||
<string name="admin">Admin</string>
|
||||
<string name="moderator">Moderator</string>
|
||||
|
|
Loading…
Reference in New Issue