forked from mirror/monocles_chat_clean
update fork #128
2 changed files with 8 additions and 5 deletions
Fix video preview dialog not being centered
commit
66b89824a8
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue