package com.tencent.liteav.demo.player;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.tencent.liteav.demo.player.ui.MenuItemView;

public class PlayerMenu extends AppCompatActivity implements View.OnClickListener {
    private static final String KEY = "COURSE_ID";

    public static void start(Context context, String courseId) {
        Intent intent = new Intent(context, PlayerMenu.class);
        intent.putExtra(KEY, courseId);
        context.startActivity(intent);
    }

    private ImageView imageBack;
    private MenuItemView imageShare;
    private MenuItemView imageFavorite;
    private MenuItemView imageCast;
    private MenuItemView imageTimer;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_menu);

        getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);

        imageBack = findViewById(R.id.menu_item_back);
        imageBack.setOnClickListener(this);

        imageShare = findViewById(R.id.menu_item_share);
        imageShare.setOnClickListener(this);
        imageShare.setIcon(R.mipmap.item_share);
        imageShare.setTitle("分享");

        imageFavorite = findViewById(R.id.menu_item_favorite);
        imageFavorite.setOnClickListener(this);
        imageFavorite.setIcon(R.mipmap.item_favorite);
        imageFavorite.setTitle("收藏");

        imageCast = findViewById(R.id.menu_item_cast);
        imageCast.setOnClickListener(this);
        imageCast.setIcon(R.mipmap.item_cast);
        imageCast.setTitle("投屏");

        imageTimer = findViewById(R.id.menu_item_timer);
        imageTimer.setOnClickListener(this);
        imageTimer.setIcon(R.mipmap.item_timer);
        imageTimer.setTitle("定时关闭");
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.menu_item_back) {
            finish();
        } else if (v.getId() == R.id.menu_item_cast) {

        } else if (v.getId() == R.id.menu_item_favorite) {

        } else if (v.getId() == R.id.menu_item_share) {

        } else if (v.getId() == R.id.menu_item_timer) {

        }
    }
}
