refactor: Move actions.xml to core.ui (#754)
This commit is contained in:
parent
3a1a0073e9
commit
2327ab5221
|
@ -72,10 +72,10 @@ class ListStatusAccessibilityDelegate<T : IStatusViewData>(
|
|||
info.addAction(if (actionable.bookmarked) unbookmarkAction else bookmarkAction)
|
||||
|
||||
val mediaActions = intArrayOf(
|
||||
R.id.action_open_media_1,
|
||||
R.id.action_open_media_2,
|
||||
R.id.action_open_media_3,
|
||||
R.id.action_open_media_4,
|
||||
app.pachli.core.ui.R.id.action_open_media_1,
|
||||
app.pachli.core.ui.R.id.action_open_media_2,
|
||||
app.pachli.core.ui.R.id.action_open_media_3,
|
||||
app.pachli.core.ui.R.id.action_open_media_4,
|
||||
)
|
||||
val attachmentCount = min(actionable.attachments.size, MAX_MEDIA_ATTACHMENTS)
|
||||
for (i in 0 until attachmentCount) {
|
||||
|
@ -111,37 +111,37 @@ class ListStatusAccessibilityDelegate<T : IStatusViewData>(
|
|||
val pos = recyclerView.getChildAdapterPosition(host)
|
||||
val status = statusProvider.getStatus(pos) ?: return false
|
||||
when (action) {
|
||||
R.id.action_reply -> {
|
||||
app.pachli.core.ui.R.id.action_reply -> {
|
||||
interrupt()
|
||||
statusActionListener.onReply(status)
|
||||
}
|
||||
R.id.action_favourite -> statusActionListener.onFavourite(status, true)
|
||||
R.id.action_unfavourite -> statusActionListener.onFavourite(status, false)
|
||||
R.id.action_bookmark -> statusActionListener.onBookmark(status, true)
|
||||
R.id.action_unbookmark -> statusActionListener.onBookmark(status, false)
|
||||
R.id.action_reblog -> statusActionListener.onReblog(status, true)
|
||||
R.id.action_unreblog -> statusActionListener.onReblog(status, false)
|
||||
R.id.action_open_profile -> {
|
||||
app.pachli.core.ui.R.id.action_favourite -> statusActionListener.onFavourite(status, true)
|
||||
app.pachli.core.ui.R.id.action_unfavourite -> statusActionListener.onFavourite(status, false)
|
||||
app.pachli.core.ui.R.id.action_bookmark -> statusActionListener.onBookmark(status, true)
|
||||
app.pachli.core.ui.R.id.action_unbookmark -> statusActionListener.onBookmark(status, false)
|
||||
app.pachli.core.ui.R.id.action_reblog -> statusActionListener.onReblog(status, true)
|
||||
app.pachli.core.ui.R.id.action_unreblog -> statusActionListener.onReblog(status, false)
|
||||
app.pachli.core.ui.R.id.action_open_profile -> {
|
||||
interrupt()
|
||||
statusActionListener.onViewAccount(status.actionable.account.id)
|
||||
}
|
||||
R.id.action_open_media_1 -> {
|
||||
app.pachli.core.ui.R.id.action_open_media_1 -> {
|
||||
interrupt()
|
||||
statusActionListener.onViewMedia(status, 0, null)
|
||||
}
|
||||
R.id.action_open_media_2 -> {
|
||||
app.pachli.core.ui.R.id.action_open_media_2 -> {
|
||||
interrupt()
|
||||
statusActionListener.onViewMedia(status, 1, null)
|
||||
}
|
||||
R.id.action_open_media_3 -> {
|
||||
app.pachli.core.ui.R.id.action_open_media_3 -> {
|
||||
interrupt()
|
||||
statusActionListener.onViewMedia(status, 2, null)
|
||||
}
|
||||
R.id.action_open_media_4 -> {
|
||||
app.pachli.core.ui.R.id.action_open_media_4 -> {
|
||||
interrupt()
|
||||
statusActionListener.onViewMedia(status, 3, null)
|
||||
}
|
||||
R.id.action_expand_cw -> {
|
||||
app.pachli.core.ui.R.id.action_expand_cw -> {
|
||||
// Toggling it directly to avoid animations
|
||||
// which cannot be disabled for detailed status for some reason
|
||||
val holder = recyclerView.getChildViewHolder(host) as StatusBaseViewHolder<IStatusViewData>
|
||||
|
@ -151,26 +151,26 @@ class ListStatusAccessibilityDelegate<T : IStatusViewData>(
|
|||
// to be possible.
|
||||
forceFocus(host)
|
||||
}
|
||||
R.id.action_collapse_cw -> {
|
||||
app.pachli.core.ui.R.id.action_collapse_cw -> {
|
||||
statusActionListener.onExpandedChange(status, false)
|
||||
interrupt()
|
||||
}
|
||||
R.id.action_links -> showLinksDialog(host)
|
||||
R.id.action_mentions -> showMentionsDialog(host)
|
||||
R.id.action_hashtags -> showHashtagsDialog(host)
|
||||
R.id.action_open_reblogger -> {
|
||||
app.pachli.core.ui.R.id.action_links -> showLinksDialog(host)
|
||||
app.pachli.core.ui.R.id.action_mentions -> showMentionsDialog(host)
|
||||
app.pachli.core.ui.R.id.action_hashtags -> showHashtagsDialog(host)
|
||||
app.pachli.core.ui.R.id.action_open_reblogger -> {
|
||||
interrupt()
|
||||
statusActionListener.onOpenReblog(status.actionable)
|
||||
}
|
||||
R.id.action_open_reblogged_by -> {
|
||||
app.pachli.core.ui.R.id.action_open_reblogged_by -> {
|
||||
interrupt()
|
||||
statusActionListener.onShowReblogs(status.actionableId)
|
||||
}
|
||||
R.id.action_open_faved_by -> {
|
||||
app.pachli.core.ui.R.id.action_open_faved_by -> {
|
||||
interrupt()
|
||||
statusActionListener.onShowFavs(status.actionableId)
|
||||
}
|
||||
R.id.action_more -> {
|
||||
app.pachli.core.ui.R.id.action_more -> {
|
||||
statusActionListener.onMore(host, status)
|
||||
}
|
||||
else -> return super.performAccessibilityAction(host, action, args)
|
||||
|
@ -279,87 +279,87 @@ class ListStatusAccessibilityDelegate<T : IStatusViewData>(
|
|||
private fun isHashtag(text: CharSequence) = text.startsWith("#")
|
||||
|
||||
private val collapseCwAction = AccessibilityActionCompat(
|
||||
R.id.action_collapse_cw,
|
||||
app.pachli.core.ui.R.id.action_collapse_cw,
|
||||
context.getString(R.string.post_content_warning_show_less),
|
||||
)
|
||||
|
||||
private val expandCwAction = AccessibilityActionCompat(
|
||||
R.id.action_expand_cw,
|
||||
app.pachli.core.ui.R.id.action_expand_cw,
|
||||
context.getString(R.string.post_content_warning_show_more),
|
||||
)
|
||||
|
||||
private val replyAction = AccessibilityActionCompat(
|
||||
R.id.action_reply,
|
||||
app.pachli.core.ui.R.id.action_reply,
|
||||
context.getString(R.string.action_reply),
|
||||
)
|
||||
|
||||
private val unreblogAction = AccessibilityActionCompat(
|
||||
R.id.action_unreblog,
|
||||
app.pachli.core.ui.R.id.action_unreblog,
|
||||
context.getString(R.string.action_unreblog),
|
||||
)
|
||||
|
||||
private val reblogAction = AccessibilityActionCompat(
|
||||
R.id.action_reblog,
|
||||
app.pachli.core.ui.R.id.action_reblog,
|
||||
context.getString(R.string.action_reblog),
|
||||
)
|
||||
|
||||
private val unfavouriteAction = AccessibilityActionCompat(
|
||||
R.id.action_unfavourite,
|
||||
app.pachli.core.ui.R.id.action_unfavourite,
|
||||
context.getString(R.string.action_unfavourite),
|
||||
)
|
||||
|
||||
private val favouriteAction = AccessibilityActionCompat(
|
||||
R.id.action_favourite,
|
||||
app.pachli.core.ui.R.id.action_favourite,
|
||||
context.getString(R.string.action_favourite),
|
||||
)
|
||||
|
||||
private val bookmarkAction = AccessibilityActionCompat(
|
||||
R.id.action_bookmark,
|
||||
app.pachli.core.ui.R.id.action_bookmark,
|
||||
context.getString(R.string.action_bookmark),
|
||||
)
|
||||
|
||||
private val unbookmarkAction = AccessibilityActionCompat(
|
||||
R.id.action_unbookmark,
|
||||
app.pachli.core.ui.R.id.action_unbookmark,
|
||||
context.getString(R.string.action_bookmark),
|
||||
)
|
||||
|
||||
private val openProfileAction = AccessibilityActionCompat(
|
||||
R.id.action_open_profile,
|
||||
app.pachli.core.ui.R.id.action_open_profile,
|
||||
context.getString(app.pachli.core.ui.R.string.action_view_profile),
|
||||
)
|
||||
|
||||
private val linksAction = AccessibilityActionCompat(
|
||||
R.id.action_links,
|
||||
app.pachli.core.ui.R.id.action_links,
|
||||
context.getString(app.pachli.core.ui.R.string.action_links),
|
||||
)
|
||||
|
||||
private val mentionsAction = AccessibilityActionCompat(
|
||||
R.id.action_mentions,
|
||||
app.pachli.core.ui.R.id.action_mentions,
|
||||
context.getString(app.pachli.core.ui.R.string.action_mentions),
|
||||
)
|
||||
|
||||
private val hashtagsAction = AccessibilityActionCompat(
|
||||
R.id.action_hashtags,
|
||||
app.pachli.core.ui.R.id.action_hashtags,
|
||||
context.getString(app.pachli.core.ui.R.string.action_hashtags),
|
||||
)
|
||||
|
||||
private val openRebloggerAction = AccessibilityActionCompat(
|
||||
R.id.action_open_reblogger,
|
||||
app.pachli.core.ui.R.id.action_open_reblogger,
|
||||
context.getString(R.string.action_open_reblogger),
|
||||
)
|
||||
|
||||
private val openRebloggedByAction = AccessibilityActionCompat(
|
||||
R.id.action_open_reblogged_by,
|
||||
app.pachli.core.ui.R.id.action_open_reblogged_by,
|
||||
context.getString(R.string.action_open_reblogged_by),
|
||||
)
|
||||
|
||||
private val openFavsAction = AccessibilityActionCompat(
|
||||
R.id.action_open_faved_by,
|
||||
app.pachli.core.ui.R.id.action_open_faved_by,
|
||||
context.getString(R.string.action_open_faved_by),
|
||||
)
|
||||
|
||||
private val moreAction = AccessibilityActionCompat(
|
||||
R.id.action_more,
|
||||
app.pachli.core.ui.R.id.action_more,
|
||||
context.getString(app.pachli.core.ui.R.string.action_more),
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue