Streamable Video.

This commit is contained in:
Nicholas
2023-08-29 16:52:17 -04:00
committed by Nicholas Tinsley
parent 099c94c215
commit 64babe2e42
23 changed files with 290 additions and 125 deletions

View File

@@ -66,9 +66,7 @@ class MediaPreviewRepository {
for (i in 0..limit) {
val element = MediaTable.MediaRecord.from(cursor)
if (element != null) {
mediaRecords.add(element)
}
mediaRecords.add(element)
if (!cursor.moveToNext()) {
break
}

View File

@@ -3,12 +3,14 @@ package org.thoughtcrime.securesms.mediapreview
import androidx.core.os.bundleOf
import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import org.signal.core.util.logging.Log
import org.thoughtcrime.securesms.attachments.Attachment
import org.thoughtcrime.securesms.mediasend.Media
import org.thoughtcrime.securesms.util.MediaUtil
import org.thoughtcrime.securesms.util.adapter.StableIdGenerator
class MediaPreviewV2Adapter(fragment: Fragment) : FragmentStateAdapter(fragment) {
private val TAG = Log.tag(MediaPreviewV2Adapter::class.java)
private var items: List<Attachment> = listOf()
private val stableIdGenerator = StableIdGenerator<Attachment>()
private val currentIdSet: HashSet<Long> = HashSet()

View File

@@ -6,6 +6,7 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -42,6 +43,12 @@ public final class VideoMediaPreviewFragment extends MediaPreviewFragment {
View itemView = inflater.inflate(R.layout.media_preview_video_fragment, container, false);
Bundle arguments = requireArguments();
Uri uri = arguments.getParcelable(DATA_URI);
if (uri == null) {
Log.w(TAG, "Media URI was null.");
Toast.makeText(requireContext(), R.string.MediaPreviewActivity_media_no_longer_available, Toast.LENGTH_LONG).show();
requireActivity().finish();
return itemView;
}
String contentType = arguments.getString(DATA_CONTENT_TYPE);
long size = arguments.getLong(DATA_SIZE);
boolean autoPlay = arguments.getBoolean(AUTO_PLAY);