提交 f4b70d02 编写于 作者: S shuyu

fix 全屏列表

上级 6ea9eba7
......@@ -13,6 +13,7 @@ import com.example.gsyvideoplayer.adapter.ListNormalAdapter;
import com.example.gsyvideoplayer.adapter.ListVideoAdapter;
import com.shuyu.gsyvideoplayer.GSYVideoPlayer;
import com.shuyu.gsyvideoplayer.utils.ListVideoUtil;
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;
import butterknife.BindView;
import butterknife.ButterKnife;
......@@ -49,6 +50,13 @@ public class ListVideoActivity extends AppCompatActivity {
}
@Override
public void onBackPressed() {
if (StandardGSYVideoPlayer.backFromWindowFull(this)) {
return;
}
super.onBackPressed();
}
@Override
protected void onDestroy() {
......
......@@ -84,6 +84,7 @@ public abstract class GSYVideoPlayer extends FrameLayout implements View.OnClick
protected GSYTextureView textureView;
protected Surface mSurface;
protected Activity activity;
protected ImageView backButton;
protected String mUrl;
protected Object[] mObjects;
......@@ -117,6 +118,9 @@ public abstract class GSYVideoPlayer extends FrameLayout implements View.OnClick
protected boolean mLooping = false;
protected boolean mCache = false;
protected boolean actionBar;
protected boolean statusBar;
protected int mSeekTimePosition;
public abstract int getLayoutId();
......@@ -136,6 +140,7 @@ public abstract class GSYVideoPlayer extends FrameLayout implements View.OnClick
protected void init(Context context) {
View.inflate(context, getLayoutId(), this);
startButton = (ImageView) findViewById(R.id.start);
backButton = (ImageView) findViewById(R.id.back);
fullscreenButton = (ImageView) findViewById(R.id.fullscreen);
progressBar = (SeekBar) findViewById(R.id.progress);
currentTimeTextView = (TextView) findViewById(R.id.current);
......@@ -669,9 +674,7 @@ public abstract class GSYVideoPlayer extends FrameLayout implements View.OnClick
@Override
public void onBackFullscreen() {
mCurrentState = GSYVideoManager.instance().getLastState();
setStateAndUi(mCurrentState);
addTextureView();
}
protected void startProgressTimer() {
......@@ -779,9 +782,9 @@ public abstract class GSYVideoPlayer extends FrameLayout implements View.OnClick
&& GSYVideoManager.instance().listener() == this;
}
public void startWindowFullscreen(final Context context, final boolean actionBar, final boolean statusBar) {
this.actionBar = actionBar;
this.statusBar = statusBar;
hideSupportActionBar(context, actionBar, statusBar);
ViewGroup vp = (ViewGroup) (CommonUtil.scanForActivity(getContext())).findViewById(Window.ID_ANDROID_CONTENT);
......@@ -814,6 +817,13 @@ public abstract class GSYVideoPlayer extends FrameLayout implements View.OnClick
clearFullscreenLayout(context, actionBar, statusBar);
}
});
gsyVideoPlayer.getBackButton().setVisibility(VISIBLE);
gsyVideoPlayer.getBackButton().setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
clearFullscreenLayout(context, actionBar, statusBar);
}
});
GSYVideoManager.instance().setLastListener(this);
GSYVideoManager.instance().setListener(gsyVideoPlayer);
} catch (InstantiationException e) {
......@@ -844,7 +854,6 @@ public abstract class GSYVideoPlayer extends FrameLayout implements View.OnClick
CLICK_QUIT_FULLSCREEN_TIME = System.currentTimeMillis();
}
/**
* 滑动改变亮度
*
......@@ -886,6 +895,10 @@ public abstract class GSYVideoPlayer extends FrameLayout implements View.OnClick
return fullscreenButton;
}
public ImageView getBackButton() {
return backButton;
}
public int getCurrentState() {
return mCurrentState;
}
......
......@@ -14,6 +14,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
......@@ -21,14 +22,19 @@ import android.widget.TextView;
import android.widget.Toast;
import com.shuyu.gsyvideoplayer.GSYVideoManager;
import com.shuyu.gsyvideoplayer.GSYVideoPlayer;
import com.shuyu.gsyvideoplayer.R;
import com.shuyu.gsyvideoplayer.listener.StandardVideoAllCallBack;
import com.shuyu.gsyvideoplayer.utils.CommonUtil;
import java.lang.reflect.Constructor;
import java.util.Timer;
import java.util.TimerTask;
import static com.shuyu.gsyvideoplayer.utils.CommonUtil.hideSupportActionBar;
import static com.shuyu.gsyvideoplayer.utils.CommonUtil.showSupportActionBar;
/**
* Created by shuyu on 2016/11/11.
*/
......@@ -38,7 +44,6 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
protected static Timer DISSMISS_CONTROL_VIEW_TIMER;
protected ImageView backButton;
protected ProgressBar bottomProgressBar, loadingProgressBar;
protected TextView titleTextView;
protected RelativeLayout thumbImageViewLayout;
......@@ -51,6 +56,11 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
protected ProgressBar mDialogVolumeProgressBar;
protected StandardVideoAllCallBack standardVideoAllCallBack;
protected Dialog mProgressDialog;
protected ProgressBar mDialogProgressBar;
protected TextView mDialogSeekTime;
protected TextView mDialogTotalTime;
protected ImageView mDialogIcon;
protected DismissControlViewTimerTask mDismissControlViewTimerTask;
......@@ -73,7 +83,6 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
super.init(context);
bottomProgressBar = (ProgressBar) findViewById(R.id.bottom_progressbar);
titleTextView = (TextView) findViewById(R.id.title);
backButton = (ImageView) findViewById(R.id.back);
thumbImageViewLayout = (RelativeLayout) findViewById(R.id.thumb);
coverImageView = (ImageView) findViewById(R.id.cover);
loadingProgressBar = (ProgressBar) findViewById(R.id.loading);
......@@ -423,12 +432,6 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
}
}
protected Dialog mProgressDialog;
protected ProgressBar mDialogProgressBar;
protected TextView mDialogSeekTime;
protected TextView mDialogTotalTime;
protected ImageView mDialogIcon;
@Override
protected void showProgressDialog(float deltaX, String seekTime, int seekTimePosition, String totalTime, int totalTimeDuration) {
super.showProgressDialog(deltaX, seekTime, seekTimePosition, totalTime, totalTimeDuration);
......@@ -607,7 +610,21 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
return titleTextView;
}
public ImageView getBackButton() {
return backButton;
@Override
public void onBackFullscreen() {
clearFullscreenLayout(getContext(), actionBar, statusBar);
}
public static boolean backFromWindowFull(Context context) {
boolean backFrom = false;
ViewGroup vp = (ViewGroup) (CommonUtil.scanForActivity(context)).findViewById(Window.ID_ANDROID_CONTENT);
View oldF = vp.findViewById(FULLSCREEN_ID);
if (oldF != null) {
backFrom = true;
GSYVideoManager.instance().lastListener().onBackFullscreen();
}
return backFrom;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册