package com.wasu.cs.widget.mediacontrol;

import android.content.Context;
import android.media.MediaPlayer;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;

import java.util.List;

import cn.com.wasu.main.R;

/**
 * 频道顶部提示条
 */
public class ChannelHeader extends LinearLayout implements IMediaControllerChildView<LiveMediaController> {

    private LiveMediaController mediaController;

    private TextView channelName;
    private TextView channelTime;
    private TextView showName;

    public ChannelHeader(Context context) {
        super(context);
        init(context);
    }

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

    public ChannelHeader(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init(context);
    }

    private void init(Context context) {
        setId(MediaController.generateID());

        LayoutInflater.from(context).inflate(R.layout.media_controller_channel_header, this);

        channelName = (TextView) findViewById(R.id.channel_name);
        channelTime = (TextView) findViewById(R.id.channel_time);
        showName = (TextView) findViewById(R.id.show_name);
    }

    @Override
    public boolean isAutoHide() {
        return true;
    }

    @Override
    public void onShow(LiveMediaController mediaController) {
        this.mediaController = mediaController;

        if (this.mediaController == null || this.mediaController.getLiveInfo() == null) {
            return;
        }

        channelName.setText(this.mediaController.getLiveInfo().getChannelName(mediaController.getChannelId()));
    }

    @Override
    public void onHide(LiveMediaController mediaController) {

    }

    @Override
    public boolean onShield(KeyEvent event) {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public void clear() {
        // TODO Auto-generated method stub

    }

    @Override
    public void onAdStatusChanged(int arg0, int arg1) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onCompletion(MediaPlayer arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onError(MediaPlayer arg0, int arg1, int arg2) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onInfo(MediaPlayer arg0, int arg1, int arg2) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onPause(MediaPlayer arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onPrepareComplete(MediaPlayer arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onPreparing(MediaPlayer arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onProgress(int arg0, int arg1, int arg2) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onResume(MediaPlayer arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onSeekComplete(MediaPlayer arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onSeeking(MediaPlayer arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onStart(MediaPlayer arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onStatusChanged(MediaPlayer arg0, int arg1) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onStop(MediaPlayer arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onWasuError(int arg0, String arg1) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onWasuPlayLimit(int arg0, String arg1) {
        // TODO Auto-generated method stub

    }

    @Override
    public void setRelativeViews(IMediaControllerChildView<LiveMediaController>... views) {
        // TODO Auto-generated method stub

    }

    @Override
    public List<IMediaControllerChildView<LiveMediaController>> getRelativeViews() {
        // TODO Auto-generated method stub
        return null;
    }

}
