feat: Add left-nav entries for Local, Federated, and Direct Messages (#583)
Fixes #570
This commit is contained in:
parent
d65d969257
commit
4ea42f4a2c
|
@ -624,6 +624,33 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
primaryDrawerItem {
|
||||||
|
nameRes = R.string.title_public_local
|
||||||
|
iconRes = R.drawable.ic_local_24dp
|
||||||
|
onClick = {
|
||||||
|
startActivityWithSlideInAnimation(
|
||||||
|
TimelineActivityIntent.publicLocal(context),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
primaryDrawerItem {
|
||||||
|
nameRes = R.string.title_public_federated
|
||||||
|
iconRes = R.drawable.ic_public_24dp
|
||||||
|
onClick = {
|
||||||
|
startActivityWithSlideInAnimation(
|
||||||
|
TimelineActivityIntent.publicFederated(context),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
primaryDrawerItem {
|
||||||
|
nameRes = R.string.title_direct_messages
|
||||||
|
iconRes = R.drawable.ic_reblog_direct_24dp
|
||||||
|
onClick = {
|
||||||
|
startActivityWithSlideInAnimation(
|
||||||
|
TimelineActivityIntent.conversations(context),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
primaryDrawerItem {
|
primaryDrawerItem {
|
||||||
nameRes = R.string.action_view_bookmarks
|
nameRes = R.string.action_view_bookmarks
|
||||||
iconicsIcon = GoogleMaterial.Icon.gmd_bookmark
|
iconicsIcon = GoogleMaterial.Icon.gmd_bookmark
|
||||||
|
|
|
@ -25,9 +25,12 @@ import app.pachli.core.database.model.DraftAttachment
|
||||||
import app.pachli.core.model.Timeline
|
import app.pachli.core.model.Timeline
|
||||||
import app.pachli.core.navigation.LoginActivityIntent.LoginMode
|
import app.pachli.core.navigation.LoginActivityIntent.LoginMode
|
||||||
import app.pachli.core.navigation.TimelineActivityIntent.Companion.bookmarks
|
import app.pachli.core.navigation.TimelineActivityIntent.Companion.bookmarks
|
||||||
|
import app.pachli.core.navigation.TimelineActivityIntent.Companion.conversations
|
||||||
import app.pachli.core.navigation.TimelineActivityIntent.Companion.favourites
|
import app.pachli.core.navigation.TimelineActivityIntent.Companion.favourites
|
||||||
import app.pachli.core.navigation.TimelineActivityIntent.Companion.hashtag
|
import app.pachli.core.navigation.TimelineActivityIntent.Companion.hashtag
|
||||||
import app.pachli.core.navigation.TimelineActivityIntent.Companion.list
|
import app.pachli.core.navigation.TimelineActivityIntent.Companion.list
|
||||||
|
import app.pachli.core.navigation.TimelineActivityIntent.Companion.publicFederated
|
||||||
|
import app.pachli.core.navigation.TimelineActivityIntent.Companion.publicLocal
|
||||||
import app.pachli.core.network.model.Attachment
|
import app.pachli.core.network.model.Attachment
|
||||||
import app.pachli.core.network.model.Filter
|
import app.pachli.core.network.model.Filter
|
||||||
import app.pachli.core.network.model.NewPoll
|
import app.pachli.core.network.model.NewPoll
|
||||||
|
@ -386,7 +389,8 @@ class ReportActivityIntent(context: Context, accountId: String, userName: String
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use one of [bookmarks], [favourites], [hashtag], or [list] to construct.
|
* Use one of [bookmarks], [conversations], [favourites], [hashtag], [list], [publicFederated],
|
||||||
|
* or [publicLocal] to construct.
|
||||||
*/
|
*/
|
||||||
class TimelineActivityIntent private constructor(context: Context) : Intent() {
|
class TimelineActivityIntent private constructor(context: Context) : Intent() {
|
||||||
init {
|
init {
|
||||||
|
@ -405,6 +409,15 @@ class TimelineActivityIntent private constructor(context: Context) : Intent() {
|
||||||
putExtra(EXTRA_TIMELINE, Timeline.Bookmarks)
|
putExtra(EXTRA_TIMELINE, Timeline.Bookmarks)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the user's conversations (direct messages).
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
|
fun conversations(context: Context) = TimelineActivityIntent(context).apply {
|
||||||
|
putExtra(EXTRA_TIMELINE, Timeline.Conversations)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the user's favourites.
|
* Show the user's favourites.
|
||||||
*
|
*
|
||||||
|
@ -435,6 +448,24 @@ class TimelineActivityIntent private constructor(context: Context) : Intent() {
|
||||||
putExtra(EXTRA_TIMELINE, Timeline.UserList(listId, title))
|
putExtra(EXTRA_TIMELINE, Timeline.UserList(listId, title))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show statuses from the Public Federated feed
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
|
fun publicFederated(context: Context) = TimelineActivityIntent(context).apply {
|
||||||
|
putExtra(EXTRA_TIMELINE, Timeline.PublicFederated)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show statuses from the Public Local feed
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
|
fun publicLocal(context: Context) = TimelineActivityIntent(context).apply {
|
||||||
|
putExtra(EXTRA_TIMELINE, Timeline.PublicLocal)
|
||||||
|
}
|
||||||
|
|
||||||
/** @return The [Timeline] to show */
|
/** @return The [Timeline] to show */
|
||||||
fun getTimeline(intent: Intent) = IntentCompat.getParcelableExtra(intent, EXTRA_TIMELINE, Timeline::class.java)!!
|
fun getTimeline(intent: Intent) = IntentCompat.getParcelableExtra(intent, EXTRA_TIMELINE, Timeline::class.java)!!
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue