update fork #128

Manually merged
tristan merged 181 commits from mirror/monocles_chat_clean:master into master 2026-01-23 14:02:38 +01:00
2 changed files with 8 additions and 5 deletions
Showing only changes of commit 66b89824a8 - Show all commits

Fix video preview dialog not being centered

Arne 2026-01-16 10:33:18 +01:00

View file

@ -111,6 +111,7 @@ public class PostsAdapter extends RecyclerView.Adapter<PostsAdapter.PostViewHold
final Dialog dialog = new Dialog(mActivity);
dialog.setContentView(R.layout.dialog_video_preview);
VideoView videoView = dialog.findViewById(R.id.video_view);
android.widget.FrameLayout frameLayout = dialog.findViewById(R.id.video_frame);
Glide.with(mActivity)
.asFile()
.load(url)
@ -135,10 +136,11 @@ public class PostsAdapter extends RecyclerView.Adapter<PostsAdapter.PostViewHold
}
});
MediaController controller = new MediaController(mActivity);
controller.setMediaPlayer(videoView);
controller.setAnchorView(frameLayout);
videoView.setMediaController(controller);
if (dialog.getWindow() != null) {
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
}
dialog.show();
}

View file

@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/video_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@android:color/transparent">
<VideoView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true" />
android:layout_gravity="center" />
</RelativeLayout>
</FrameLayout>