package com.ym.library.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;

import com.ym.library.MyConstant;
import com.ym.library.R;

public class NavigationBottomView extends LinearLayout {


    public NavigationBottomView(Context context) {
        super(context);
        initView();
    }

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

    public NavigationBottomView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView();
    }

    private void initView() {

    }

    private void createItemView() {

        BottomNavigationHelper.bindTabWithData(this, new BottomNavigationItem(0, "", R.drawable.welfare_tab, R.drawable.welfare_tab, R.drawable.welfare_tab, false));
        if (MyConstant.ISENTERTAINMENT == 1) {
            BottomNavigationHelper.bindTabWithData(this, new BottomNavigationItem(1, "", R.drawable.happyplaytab, R.drawable.happyplaytab, R.drawable.happyplaytab, false));
        }
        BottomNavigationHelper.bindTabWithData(this, new BottomNavigationItem(3, "", R.drawable.signin_withdraw_tab, R.drawable.signin_withdraw_tab, R.drawable.signin_withdraw_tab, false));
        BottomNavigationHelper.bindTabWithData(this, new BottomNavigationItem(2, "", R.drawable.tasktab, R.drawable.tasktab, R.drawable.tasktab, false));
    }

    public NavigationBottomView setTabSelectedListener(OnTabSelectedListener tabSelectedListener) {
        BottomNavigationHelper.setTabSelectedListener(tabSelectedListener);
        return this;
    }

    public void setItemData() {
        BottomNavigationHelper.clear();
        removeAllViews();
        createItemView();
    }

    public int getSelectId() {
        return BottomNavigationHelper.getSelectedId();
    }


    public void selectTabInternal(int id) {
        BottomNavigationHelper.selectTabInternal(id);
    }

    public void setBgMode(String codeDay) {
        BottomNavigationHelper.switchMode(codeDay);
    }

    public interface OnTabSelectedListener {
        void onTabSelected(int id);
    }

    public void setBottomTvNum(int num,int tabId){
        BottomNavigationHelper.setBottomTaskNum(tabId,num);
    }

}
