视频控件GSYVideoPlayer 退出全屏 屏幕旋转问题(pad平板)

重写StandardGSYVideoPlayer 的 clearFullscreenLayout()

    @Override
    protected void clearFullscreenLayout() {
        //重写方法 取消原来逻辑调用
//        super.clearFullscreenLayout();
//        System.out.println("11111111111111");

        if (!mFullAnimEnd) {
            return;
        }
        mIfCurrentIsFullscreen = false;
        int delay = 0;

        if (!mShowFullAnimation) {
            delay = 0;
        }

        final ViewGroup vp = getViewGroup();
        final View oldF = vp.findViewById(getFullId());
        if (oldF != null) {
            //此处fix bug#265,推出全屏的时候,虚拟按键问题
            GSYVideoPlayer gsyVideoPlayer = (GSYVideoPlayer) oldF;
            gsyVideoPlayer.setIfCurrentIsFullscreen(false);
        }

        mInnerHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                backToNormal();
            }
        }, delay);
    }

    private ViewGroup getViewGroup() {
        return (ViewGroup) (CommonUtil.scanForActivity(getContext())).findViewById(Window.ID_ANDROID_CONTENT);
    }

全屏调用 使用

        videoPlayer.getFullscreenButton().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                videoPlayer.startWindowFullscreen(VideoActivity.this, false, true);
            }
        });

startWindowFullscreen中关闭全屏调用的 clearFullscreenLayout();

/**
     * 退出window层播放全屏效果
     */
    @SuppressWarnings("ResourceType")
    protected void clearFullscreenLayout() {
        if (!mFullAnimEnd) {
            return;
        }
        mIfCurrentIsFullscreen = false;
        int delay = 0;
        if (mOrientationUtils != null) {
            delay = mOrientationUtils.backToProtVideo();
            mOrientationUtils.setEnable(false);
            if (mOrientationUtils != null) {
                mOrientationUtils.releaseListener();
                mOrientationUtils = null;
            }
        }

        if (!mShowFullAnimation) {
            delay = 0;
        }

        final ViewGroup vp = getViewGroup();
        final View oldF = vp.findViewById(getFullId());
        if (oldF != null) {
            //此处fix bug#265,推出全屏的时候,虚拟按键问题
            GSYVideoPlayer gsyVideoPlayer = (GSYVideoPlayer) oldF;
            gsyVideoPlayer.mIfCurrentIsFullscreen = false;
        }

        mInnerHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                backToNormal();
            }
        }, delay);

    }

重弄写 clearFullscreenLayout 取掉屏幕旋转逻辑

没有直接调用 onBackFullscreen 重写 onBackFullscreen没有效果

    @Override
    public void onBackFullscreen() {
        clearFullscreenLayout();
    }

或者使用 activity的 屏幕旋转 setRequestedOrientation 也能达到效果

    @Override
    public void setRequestedOrientation(int requestedOrientation) {
//        super.setRequestedOrientation(requestedOrientation);
        //退出全屏 屏幕旋转bug
    }

上一篇:团体程序设计天梯赛-练习集 [ L1-032 Left-pad (20 分) ]


下一篇:PHP进行AES/ECB/PKCS7 padding加密的例子