Show album rail when entering media preview from All Media.
This commit is contained in:
parent
daa3721145
commit
3a78031a71
7 changed files with 20 additions and 4 deletions
|
@ -2331,6 +2331,7 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
|||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
MediaDatabase.Sorting.Newest.ordinal(),
|
||||
slide.isVideoGif());
|
||||
context.startActivity(MediaIntentFactory.create(context, args));
|
||||
|
|
|
@ -247,6 +247,7 @@ public final class MediaOverviewPageFragment extends Fragment
|
|||
true,
|
||||
true,
|
||||
threadId == MediaDatabase.ALL_THREADS,
|
||||
true,
|
||||
sorting.ordinal(),
|
||||
attachment.isVideoGif());
|
||||
context.startActivity(MediaIntentFactory.create(context, args));
|
||||
|
|
|
@ -35,6 +35,7 @@ object MediaIntentFactory {
|
|||
val leftIsRecent: Boolean = false,
|
||||
val hideAllMedia: Boolean = false,
|
||||
val showThread: Boolean = false,
|
||||
val allMediaInRail: Boolean = false,
|
||||
val sorting: Int,
|
||||
val isVideoGif: Boolean
|
||||
) : Parcelable
|
||||
|
|
|
@ -141,6 +141,7 @@ class MediaPreviewV2Fragment : Fragment(R.layout.fragment_media_preview_v2), Med
|
|||
}.show()
|
||||
}
|
||||
viewModel.setShowThread(args.showThread)
|
||||
viewModel.setAlwaysShowAlbumRail(args.allMediaInRail)
|
||||
val sorting = MediaDatabase.Sorting.values()[args.sorting]
|
||||
viewModel.fetchAttachments(PartAuthority.requireAttachmentId(args.initialMediaUri), args.threadId, sorting)
|
||||
}
|
||||
|
@ -198,9 +199,13 @@ class MediaPreviewV2Fragment : Fragment(R.layout.fragment_media_preview_v2), Med
|
|||
val currentItem: MediaDatabase.MediaRecord = currentState.mediaRecords[currentState.position]
|
||||
val currentFragment: Fragment? = childFragmentManager.findFragmentByTag("f${currentState.position}")
|
||||
val playbackControls = (currentFragment as? MediaPreviewFragment)?.playbackControls
|
||||
val albumThumbnailMedia = currentState.mediaRecords
|
||||
.filter { it.attachment != null && it.attachment!!.mmsId == currentItem.attachment?.mmsId }
|
||||
.map { it.toMedia() }
|
||||
val albumThumbnailMedia = if (currentState.allMediaInAlbumRail) {
|
||||
currentState.mediaRecords.map { it.toMedia() }
|
||||
} else {
|
||||
currentState.mediaRecords
|
||||
.filter { it.attachment != null && it.attachment!!.mmsId == currentItem.attachment?.mmsId }
|
||||
.map { it.toMedia() }
|
||||
}
|
||||
val caption = currentItem.attachment?.caption
|
||||
if (albumThumbnailMedia.size <= 1 && caption == null && playbackControls == null) {
|
||||
binding.mediaPreviewDetailsContainer.visibility = View.GONE
|
||||
|
|
|
@ -6,7 +6,8 @@ data class MediaPreviewV2State(
|
|||
val mediaRecords: List<MediaDatabase.MediaRecord> = emptyList(),
|
||||
val loadState: LoadState = LoadState.INIT,
|
||||
val position: Int = 0,
|
||||
val showThread: Boolean = false
|
||||
val showThread: Boolean = false,
|
||||
val allMediaInAlbumRail: Boolean = false
|
||||
) {
|
||||
enum class LoadState { INIT, READY, LOADED }
|
||||
}
|
||||
|
|
|
@ -41,6 +41,12 @@ class MediaPreviewV2ViewModel : ViewModel() {
|
|||
}
|
||||
}
|
||||
|
||||
fun setAlwaysShowAlbumRail(value: Boolean) {
|
||||
store.update { oldState ->
|
||||
oldState.copy(allMediaInAlbumRail = value)
|
||||
}
|
||||
}
|
||||
|
||||
fun setCurrentPage(position: Int) {
|
||||
store.update { oldState ->
|
||||
oldState.copy(position = position, loadState = MediaPreviewV2State.LoadState.LOADED)
|
||||
|
|
|
@ -481,6 +481,7 @@ public class AttachmentManager {
|
|||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
MediaDatabase.Sorting.Newest.ordinal(),
|
||||
slide.isVideoGif());
|
||||
context.startActivity(MediaIntentFactory.create(context, args));
|
||||
|
|
Loading…
Add table
Reference in a new issue