package com.example.gsyvideoplayer.switchplay;

import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;

import com.example.gsyvideoplayer.R;
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;

public class SwitchVideo extends StandardGSYVideoPlayer {

    private TextView detailBtn;

    public SwitchVideo(Context context, Boolean fullFlag) {
        super(context, fullFlag);
    }

    public SwitchVideo(Context context) {
        super(context);
    }

    public SwitchVideo(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void init(Context context) {
        super.init(context);
        detailBtn = (TextView) findViewById(R.id.detail_btn);
        detailBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (isInPlayingState()) {
                    SwitchUtil.savePlayState(SwitchVideo.this);
                    getGSYVideoManager().setLastListener(SwitchVideo.this);
                    SwitchDetailActivity.startTActivity((Activity) getContext(), SwitchVideo.this);
                }
            }
        });
        if (mIfCurrentIsFullscreen) {
            detailBtn.setVisibility(GONE);
        }

    }

    @Override
    public int getLayoutId() {
        return R.layout.switch_video;
    }


    public void setSwitchUrl(String url) {
        mUrl = url;
        mOriginUrl = url;
    }

    public void setSwitchCache(boolean cache) {
        mCache = cache;
    }

    public void setSwitchTitle(String title) {
        mTitle = title;
    }

    public void setSurfaceToPlay() {
        addTextureView();
        getGSYVideoManager().setListener(this);
        checkoutState();
    }

    public SwitchVideo saveState() {
        SwitchVideo switchVideo = new SwitchVideo(getContext());
        cloneParams(this, switchVideo);
        return switchVideo;
    }

    public void cloneState(SwitchVideo switchVideo) {
        cloneParams(switchVideo, this);
    }

}

@@ -1113,32 +1113,207 @@
 tchVideo.this);%0A
+                    //fixme %E9%A1%B5%E9%9D%A2%E8%B7%B3%E8%BD%AC%E6%98%AF%EF%BC%8C%E5%85%83%E7%B4%A0%E5%85%B1%E4%BA%AB%EF%BC%8C%E6%95%88%E6%9E%9C%E4%BC%9A%E6%9C%89%E4%B8%80%E4%B8%AA%E4%B8%AD%E9%97%B4%E4%B8%AD%E9%97%B4%E6%8E%A7%E4%BB%B6%E7%9A%84%E5%AD%98%E5%9C%A8%0A                    //fixme %E8%BF%99%E6%97%B6%E5%80%99%E4%B8%AD%E9%97%B4%E6%8E%A7%E4%BB%B6 CURRENT_STATE_PLAYING%EF%BC%8C%E4%BC%9A%E8%A7%A6%E5%8F%91 startProgressTimer%0A                    //FIXME %E4%BD%86%E6%98%AF%E6%B2%A1%E6%9C%89cancel%0A
                 

add fix me