Add support for GIF playback in 'see replies' bottom sheet.
This commit is contained in:
parent
3336d92cb1
commit
50701dd292
2 changed files with 45 additions and 4 deletions
|
@ -21,6 +21,11 @@ import org.thoughtcrime.securesms.database.model.MessageId
|
||||||
import org.thoughtcrime.securesms.database.model.MessageRecord
|
import org.thoughtcrime.securesms.database.model.MessageRecord
|
||||||
import org.thoughtcrime.securesms.database.model.MmsMessageRecord
|
import org.thoughtcrime.securesms.database.model.MmsMessageRecord
|
||||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
|
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
|
||||||
|
import org.thoughtcrime.securesms.giph.mp4.GiphyMp4ItemDecoration
|
||||||
|
import org.thoughtcrime.securesms.giph.mp4.GiphyMp4PlaybackController
|
||||||
|
import org.thoughtcrime.securesms.giph.mp4.GiphyMp4PlaybackPolicy
|
||||||
|
import org.thoughtcrime.securesms.giph.mp4.GiphyMp4ProjectionPlayerHolder
|
||||||
|
import org.thoughtcrime.securesms.giph.mp4.GiphyMp4ProjectionRecycler
|
||||||
import org.thoughtcrime.securesms.groups.GroupId
|
import org.thoughtcrime.securesms.groups.GroupId
|
||||||
import org.thoughtcrime.securesms.groups.GroupMigrationMembershipChange
|
import org.thoughtcrime.securesms.groups.GroupMigrationMembershipChange
|
||||||
import org.thoughtcrime.securesms.linkpreview.LinkPreview
|
import org.thoughtcrime.securesms.linkpreview.LinkPreview
|
||||||
|
@ -101,6 +106,24 @@ class MessageQuotesBottomSheet : FixedRoundedCornerBottomSheetDialogFragment() {
|
||||||
colorizer.onNameColorsChanged(map)
|
colorizer.onNameColorsChanged(map)
|
||||||
messageAdapter.notifyItemRangeChanged(0, messageAdapter.itemCount, ConversationAdapter.PAYLOAD_NAME_COLORS)
|
messageAdapter.notifyItemRangeChanged(0, messageAdapter.itemCount, ConversationAdapter.PAYLOAD_NAME_COLORS)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initializeGiphyMp4(view.findViewById(R.id.video_container) as ViewGroup, list)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initializeGiphyMp4(videoContainer: ViewGroup, list: RecyclerView): GiphyMp4ProjectionRecycler {
|
||||||
|
val maxPlayback = GiphyMp4PlaybackPolicy.maxSimultaneousPlaybackInConversation()
|
||||||
|
val holders = GiphyMp4ProjectionPlayerHolder.injectVideoViews(
|
||||||
|
requireContext(),
|
||||||
|
viewLifecycleOwner.lifecycle,
|
||||||
|
videoContainer,
|
||||||
|
maxPlayback
|
||||||
|
)
|
||||||
|
val callback = GiphyMp4ProjectionRecycler(holders)
|
||||||
|
|
||||||
|
GiphyMp4PlaybackController.attach(list, callback, maxPlayback)
|
||||||
|
list.addItemDecoration(GiphyMp4ItemDecoration(callback) {}, 0)
|
||||||
|
|
||||||
|
return callback
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getCallback(): Callback {
|
private fun getCallback(): Callback {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
@ -11,11 +12,28 @@
|
||||||
android:layout_height="2dp"
|
android:layout_height="2dp"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:background="@color/signal_icon_tint_tab_unselected" />
|
android:background="@color/signal_icon_tint_tab_unselected"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/video_container"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/quotes_list"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/quotes_list"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/quotes_list"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/quotes_list" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/quotes_list"
|
android:id="@+id/quotes_list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="24dp"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/anchor"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
</LinearLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Add table
Reference in a new issue