我正在制作一个应用程序,当我在纵向模式下点击视频时,我应该以横向模式打开视频视图。我计划添加一个片段来做到这一点,但我想保留上一个视图中所有内容的状态,这样就不会中断调用。有没有办法做到这一点? 这是我的片段代码:
public class SecureRoomCallFragment extends BaseCallFragment {
@BindView(R.id.callStatusContainer)
ViewGroup callStatusContainer;
@BindView(R.id.callNameText)
TextView callNameText;
@BindView(R.id.callParticipantCountText)
TextView callParticipantCountText;
@BindView(R.id.callDurationText)
TextView callDurationText;
@BindView(R.id.activeSpeakerContainer)
ViewGroup activeSpeakerContainer;
@BindView(R.id.activeSpeakerVideo)
ViewGroup activeSpeakerVideo;
@BindView(R.id.activeSpeakerImage)
ImageView activeSpeakerImage;
@BindView(R.id.activeSpeakerName)
TextView activeSpeakerName;
@BindView(R.id.callProgressContainer)
ViewGroup callProgressContainer;
@BindView(R.id.callProgressName)
TextView callProgressName;
@BindView(R.id.callProgressText)
TextView callProgressText;
@BindView(R.id.groupCallerList)
RecyclerView groupCallerList;
@BindView(R.id.callButtonContainerUnavailable)
ViewGroup callButtonContainerUnavailable;
@BindView(R.id.callButtonCancel)
Button cancelButton;
@BindView(R.id.callButtonRetry)
Button retryButton;
@BindView(R.id.full_screen_image)
ImageView fullScreenImage;
private GroupCallAdapter callerAdapter;
private int totalNumberOfUsers = -1;
private static final int MAX_NUM_USERS_ALLOW_IN_CALL = 10;
private boolean isFullScreen = true;
private boolean isScreenShareEnabled = false;
private String screenshareuserID;
private String participantuserID;
public SecureRoomCallFragment(final int totalNumberOfUsers) {
this.totalNumberOfUsers = (totalNumberOfUsers < MAX_NUM_USERS_ALLOW_IN_CALL) ? totalNumberOfUsers : MAX_NUM_USERS_ALLOW_IN_CALL;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View layout = inflater.inflate(R.layout.fragment_call_room, container, false);
ButterKnife.bind(this, layout);
resetUI();
callProgressName.setText(callHelper.getConvo().getName());
callNameText.setText(callHelper.getConvo().getName());
return layout;
}
@Override
protected void onCallConnected() {
if (!callHelper.getConvo().isPrivateChat()) {
callProgressText.setText(getString(R.string.call_status_connected));
callProgressContainer.setVisibility(View.INVISIBLE);
groupCallerList.setVisibility(View.VISIBLE);
callStatusContainer.setVisibility(View.VISIBLE);
}
}
@Override
protected void onCallCompleted() {
DialogInterface.OnClickListener positiveClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
callProgressText.setText(getString(R.string.call_status_completed));
callProgressContainer.setVisibility(View.VISIBLE);
groupCallerList.setVisibility(View.INVISIBLE);
getActivity().finish();
}
};
showAlert(getString(R.string.dialog_title_meeting_end), getString(R.string.dialog_message_meeting_end), getString(android.R.string.ok), positiveClickListener, true /* isModal */);
}
@Override
protected void onUserJoined(@NonNull Participant participant, final int participantSize) {
if (participant == null) {
return;
}
participantuserID = participant.userId;
if (callProgressContainer.getVisibility() == View.VISIBLE) {
callProgressText.setText(getString(R.string.call_status_connected));
callProgressContainer.setVisibility(View.INVISIBLE);
groupCallerList.setVisibility(View.VISIBLE);
callStatusContainer.setVisibility(View.VISIBLE);
}
final boolean isActiveParticipant = callHelper.isActiveParticipant(participant);
if (isActiveParticipant) {
final Caller activeCaller = callHelper.getActiveCaller();
if (activeCaller != null) {
final Participant activeParticipant = activeCaller.getParticipant();
activeSpeakerVideo.removeAllViews();
activeSpeakerVideo.addView(activeParticipant.videoPlayer.videoView, videoLayoutParams);
activeSpeakerName.setText(activeCaller.getName());
activeSpeakerName.setVisibility(View.VISIBLE);
if (activeCaller.getImage() != null) {
activeSpeakerImage.setImageBitmap(activeCaller.getImage());
} else {
activeSpeakerImage.setImageResource(R.drawable.call_default_profile);
}
activeSpeakerImage.setVisibility(View.INVISIBLE);
activeSpeakerImage.setVisibility(View.VISIBLE);
showActiveSpeakerVideo(!activeCaller.isVideoPaused());
showControlButtons(true);
}
}
callerAdapter.notifyDataSetChanged();
callParticipantCountText.setText("( " +participantSize+" / "+totalNumberOfUsers+" )");
super.onUserJoined(participant, participantSize);
}
@Override
protected void onUserLeft(@NonNull Participant participant, final int participantSize) {
if (participant == null) {
return;
}
final boolean isActiveParticipant = callHelper.isActiveParticipant(participant);
if (isActiveParticipant) {
final Caller activeCaller = callHelper.getActiveCaller();
if (activeCaller != null) {
swapVideoView(activeCaller);
} else {
showActiveSpeakerVideo(false);
activeSpeakerName.setVisibility(View.GONE);
}
} else {
callerAdapter.notifyDataSetChanged();
}
callParticipantCountText.setText("( " +participantSize+" / "+totalNumberOfUsers+" )");
}
@Override
protected void onUserVideoPaused(@NonNull Participant participant, boolean isVideoPaused) {
if (participant == null) {
return;
}
final boolean isActiveParticipant = callHelper.isActiveParticipant(participant);
if (isActiveParticipant) {
showActiveSpeakerVideo(!isVideoPaused);
} else {
callerAdapter.notifyDataSetChanged();
}
}
@Override
protected void onDurationTick(long duration, @NonNull String formattedString) {
callDurationText.setText(formattedString);
}
@Override
protected void onAVDEvent(@NonNull String avdUserID) {
final Caller activeCaller = callHelper.getActiveCaller();
if (activeCaller != null) {
swapVideoView(activeCaller);
}
}
@Override
protected void onScreenShare(boolean inScreenShare, @NonNull String userID, @NonNull int width, @NonNull int height) {
isScreenShareEnabled = inScreenShare;
screenshareuserID = userID;
if (inScreenShare) {
fullscreenvideodisplay(userID, width, height);
} else {
regularvideodisplay(userID);
}
}
private void toggleFullScreen() {
if (isFullScreen) {
regularvideodisplay(null);
} else {
fullscreenvideodisplay(null, -1, -1);
}
isFullScreen = !isFullScreen;
}
public void fullscreenvideodisplay(@NonNull String userID, @NonNull int width, @NonNull int height) {
DisplayMetrics metrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) activeSpeakerContainer.getLayoutParams();
if(width <= 0 || height <=0) {
width = metrics.widthPixels;
height = metrics.heightPixels;
}
params.leftMargin = 0;
params.topMargin = 300;
activeSpeakerVideo.setEnabled(true);
activeSpeakerContainer.setRotation(90);
float scale ;
if(height > width ) {
scale = (height * 1.0f) / (width * 1.0f);
}else{
scale = (width * 1.0f) / (height * 1.0f);
}
activeSpeakerContainer.setScaleX(scale);
groupCallerList.setVisibility(View.INVISIBLE);
}
public void regularvideodisplay(@NonNull String userID) {
DisplayMetrics metrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) activeSpeakerContainer.getLayoutParams();
params.width = metrics.widthPixels;
params.height = metrics.heightPixels;
params.leftMargin = 0;
params.topMargin = 0;
activeSpeakerVideo.setEnabled(false);
activeSpeakerContainer.setRotation(0);
activeSpeakerContainer.setVisibility(View.VISIBLE);
groupCallerList.setVisibility(View.VISIBLE);
activeSpeakerContainer.setScaleX(1);
activeSpeakerContainer.setScaleY(1);
}
@Override
protected void refresh() {
// Refresh activeCaller's avatar
final Caller activeCaller = callHelper.getActiveCaller();
if (activeCaller != null) {
setActiveSpeakerAvator(activeCaller);
}
// Refresh other callers' avatars
callerAdapter.notifyDataSetChanged();
}
private void setActiveSpeakerAvator(@NonNull final Caller activeCaller) {
if (activeCaller.getImage() != null) {
activeSpeakerImage.setImageBitmap(activeCaller.getImage());
} else {
activeSpeakerImage.setImageResource(R.drawable.call_default_profile);
}
}
private void swapVideoView(@NonNull final Caller activeCaller) {
if ((activeCaller == null) || (activeCaller.getParticipant() == null)) {
return;
}
final Participant activeParticipant = activeCaller.getParticipant();
if (activeSpeakerVideo.getChildCount() != 0) {
activeSpeakerVideo.removeAllViews();
}
final VideoView videoView;
if (activeParticipant.isMe) {
videoView = activeParticipant.videoStreamer.videoView;
} else {
videoView = activeParticipant.videoPlayer.videoView;
}
if (videoView.getParent() != null) {
Timber.tag(NPLCallFSM.NPLDebugTAG);
ViewGroup parent = (ViewGroup) videoView.getParent();
parent.removeView(videoView);
}
activeSpeakerVideo.addView(videoView, videoLayoutParams);
activeSpeakerName.setText(activeCaller.getName());
activeSpeakerName.setVisibility(View.VISIBLE);
setActiveSpeakerAvator(activeCaller);
activeSpeakerImage.setVisibility(View.INVISIBLE);
activeSpeakerImage.setVisibility(View.VISIBLE);
showActiveSpeakerVideo(!activeCaller.isVideoPaused());
callerAdapter.notifyDataSetChanged();
}
@Override
public void resetUI() {
groupCallerList.setVisibility(View.INVISIBLE);
callProgressText.setText(getString(R.string.call_status_connecting));
callProgressContainer.setVisibility(View.VISIBLE);
callButtonContainer.setVisibility(View.VISIBLE);
callStatusContainer.setVisibility(View.GONE);
callButtonContainerUnavailable.setVisibility(View.GONE);
activeSpeakerName.setText(getString(R.string.empty_string));
activeSpeakerName.setVisibility(View.GONE);
activeSpeakerImage.setImageResource(R.drawable.call_default_profile);
activeSpeakerImage.setVisibility(View.VISIBLE);
activeSpeakerVideo.removeAllViews();
activeSpeakerVideo.setVisibility(View.INVISIBLE);
LinearLayoutManager manager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
callerAdapter = new GroupCallAdapter(callHelper.getCallers());
groupCallerList.setLayoutManager(manager);
groupCallerList.setAdapter(callerAdapter);
showControlButtons(false);
onDurationTick(0, "00:00:00");
}
private void showActiveSpeakerVideo(boolean showVideo) {
if (showVideo) {
activeSpeakerImage.setVisibility(View.INVISIBLE);
activeSpeakerVideo.setVisibility(View.VISIBLE);
if(isScreenShareEnabled && screenshareuserID.equals(participantuserID)) {
fullScreenImage.setVisibility(View.VISIBLE);
fullScreenImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// do something when the button is clicked
toggleFullScreen();
}
});
}
} else {
activeSpeakerImage.setVisibility(View.VISIBLE);
activeSpeakerVideo.setVisibility(View.INVISIBLE);
fullScreenImage.setVisibility(View.GONE);
regularvideodisplay(null);
}
}
@Override
protected void onCallUnavailable() {
if (callHelper.getConvo().isPrivateChat()) {
showActiveSpeakerVideo(false);
// callHelper.getSelfCaller().setVideoPaused(true);
callStatusContainer.setVisibility(View.GONE);
callProgressContainer.setVisibility(View.VISIBLE);
callProgressText.setText(getString(R.string.call_status_unavailable));
callButtonContainer.setVisibility(View.INVISIBLE);
callButtonContainerUnavailable.setVisibility(View.VISIBLE);
callerAdapter.notifyDataSetChanged();
}
}
@OnClick(R.id.callButtonCancel)
public void onCallButtonCancelPressed() {
callHelper.onCancelButtonPressed(cancelButton);
}
@OnClick(R.id.callButtonRetry)
public void onCallButtonRetryPressed() {
callHelper.onRetryButtonPressed(retryButton);
}
}
这是我的布局:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/activeSpeakerContainer"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/groupCallerList"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ZoomLayout
android:id="@+id/activeSpeakerVideo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black" />
<ImageView
android:id="@+id/activeSpeakerImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="48dp"
android:src="@drawable/call_default_profile" />
<ImageView
android:id="@+id/beta_calling_watermark"
android:layout_width="130dp"
android:layout_height="28dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="36dp"
android:layout_marginLeft="16dp"
android:src="@drawable/ic_beta_calling_watermark_blue" />
<ImageView
android:id="@+id/full_screen_image"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_alignParentTop="true"
android:layout_marginTop="36dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:visibility="gone"
android:src="@drawable/fullscreen_icon" />
<TextView
android:id="@+id/activeSpeakerName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#AA555555"
android:ellipsize="end"
android:gravity="center_horizontal|bottom"
android:lines="1"
android:textSize="16sp"
tools:text="" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/callStatusContainer"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#AA555555"
android:padding="8dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/callNameText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:ellipsize="end"
android:lines="1"
android:textSize="14sp"
tools:text="" />
<TextView
android:id="@+id/callParticipantCountText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toEndOf="@+id/callNameText"
android:layout_toRightOf="@+id/callNameText"
android:ellipsize="end"
android:lines="1"
android:paddingLeft="18dp"
android:paddingRight="18dp"
android:textSize="14sp" />
<TextView
android:id="@+id/callDurationText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_toEndOf="@id/callParticipantCountText"
android:layout_toLeftOf="@+id/callButtonVideoRotate"
android:layout_toRightOf="@id/callParticipantCountText"
android:layout_toStartOf="@id/callButtonVideoRotate"
android:lines="1"
android:textSize="14sp"
tools:text="03:16" />
<ImageButton
android:id="@+id/callButtonVideoRotate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/callDurationText"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@android:color/transparent"
android:src="@drawable/ic_video_cam_switch" />
</RelativeLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/groupCallerList"
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="invisible"
app:layout_constraintBottom_toTopOf="@+id/callButtonContainer"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/activeSpeakerContainer">
</android.support.v7.widget.RecyclerView>
<RelativeLayout
android:id="@+id/callProgressContainer"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="@+id/groupCallerList"
app:layout_constraintLeft_toLeftOf="@+id/groupCallerList"
app:layout_constraintRight_toRightOf="@+id/groupCallerList"
app:layout_constraintTop_toTopOf="@+id/groupCallerList">
<TextView
android:id="@+id/callProgressName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:gravity="center_horizontal"
android:textSize="20sp"
tools:text="Caller Name" />
<TextView
android:id="@+id/callProgressText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/callProgressName"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:gravity="center_horizontal"
android:text="@string/call_status_connecting"
android:textSize="16sp" />
</RelativeLayout>
<include
android:id="@+id/callButtonContainer"
layout="@layout/layout_call_button_bar_1_row"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/groupCallerList" />
<android.support.constraint.ConstraintLayout
android:id="@+id/callButtonContainerUnavailable"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/callButtonContainer"
app:layout_constraintLeft_toLeftOf="@+id/callButtonContainer"
app:layout_constraintRight_toRightOf="@+id/callButtonContainer"
app:layout_constraintTop_toTopOf="@+id/callButtonContainer"
tools:visibility="visible">
<Button
android:id="@+id/callButtonCancel"
style="@style/CallButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/btn_call_end"
android:text="@string/dialog_button_cancel"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/callButtonRetry"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/callButtonRetry"
style="@style/CallButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/btn_call_retry"
android:text="@string/button_try_again"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/callButtonCancel"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
这是适配器:
public class GroupCallAdapter extends RecyclerView.Adapter<GroupCallAdapter.CallerViewHolder> {
private CopyOnWriteArrayList<Caller> callers;
public GroupCallAdapter(@NonNull final CopyOnWriteArrayList<Caller> callers) {
this.callers = callers;
}
@Override
public CallerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
final View layout = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_caller, parent, false);
final CallerViewHolder viewHolder = new CallerViewHolder(layout);
return viewHolder;
}
@Override
public void onBindViewHolder(CallerViewHolder holder, int position) {
final Caller caller = callers.get(position);
final Participant participant = caller.getParticipant();
if (caller.getName() != null) {
holder.callerName.setText(caller.getName());
}
if (caller.getImage() != null) {
holder.callerImage.setImageBitmap(caller.getImage());
} else {
holder.callerImage.setImageResource(R.drawable.call_default_profile);
}
holder.callerImage.setVisibility(View.INVISIBLE);
holder.callerImage.setVisibility(View.VISIBLE);
final VideoView videoView;
if (participant.isMe) {
videoView = participant.videoStreamer.videoView;
} else {
videoView = participant.videoPlayer.videoView;
}
if (holder.callerVideo.getChildCount() != 0) {
holder.callerVideo.removeAllViews();
}
if (videoView.getParent() != null) {
ViewGroup parent = (ViewGroup) videoView.getParent();
parent.removeView(videoView);
}
holder.callerVideo.addView(videoView, CallerViewHolder.videoLayoutParams);
if (caller.isVideoPaused()) {
holder.callerVideo.setVisibility(View.INVISIBLE);
holder.callerImage.setVisibility(View.VISIBLE);
} else {
holder.callerVideo.setVisibility(View.VISIBLE);
holder.callerImage.setVisibility(View.INVISIBLE);
}
}
@Override
public int getItemCount() {
return callers.size();
}
public static final class CallerViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.callerVideo)
public ViewGroup callerVideo;
@BindView(R.id.callerImage)
public ImageView callerImage;
@BindView(R.id.callerName)
public TextView callerName;
protected static PinchandZoomLayout.LayoutParams videoLayoutParams = new PinchandZoomLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
);
public CallerViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
}
这是另一个电话布局:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:id="@+id/callerContainer"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent">
<ZoomLayout
android:id="@+id/callerVideo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black" />
<ImageView
android:id="@+id/callerImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
android:src="@drawable/call_default_profile" />
<TextView
android:id="@+id/callerName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#AA555555"
android:gravity="center_horizontal|bottom"
android:textSize="12sp"
android:lines="1"
android:ellipsize="end"
tools:text=""
android:layout_alignParentBottom="true" />
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
答案 0 :(得分:0)
以下代码可能对您有所帮助:
private void exitFullScreen() {
isFullScreen = false;
btnFullScreen.setImageResource(R.drawable.ic_full_screen);
rlBottom.setVisibility(View.VISIBLE);
((DrawerLocker) getActivity()).setDrawerEnabled(true);
((MainModuleActivity) getActivity()).getSupportActionBar().show();
DisplayMetrics metrics = new DisplayMetrics();
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) videoView.getLayoutParams();
params.leftMargin = 30;
videoView.setLayoutParams(params);
}
private void viewFullScreen() {
isFullScreen = true;
btnFullScreen.setImageResource(R.drawable.ic_small_screen);
rlBottom.setVisibility(View.GONE);
((MainModuleActivity) getActivity()).getSupportActionBar().hide();
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
getActivity().getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
((DrawerLocker) getActivity()).setDrawerEnabled(false);
DisplayMetrics displaymetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int height = displaymetrics.heightPixels;
int width = displaymetrics.widthPixels;
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) videoView.getLayoutParams();
params.width = params.MATCH_PARENT;
params.height = params.MATCH_PARENT;
params.setMargins(0, 0, 0, 0);
}