package com.cooleshow.teacher.widgets;

import android.content.Context;
import android.text.Layout;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;

import com.cooleshow.teacher.R;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
 * Author by pq, Date on 2022/4/21.
 */
public class CourseTableArrowView extends FrameLayout {

    private ImageView mIvArrow;

    public CourseTableArrowView(@NonNull Context context) {
        this(context, null);
    }

    public CourseTableArrowView(@NonNull Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, -1);
    }

    public CourseTableArrowView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    private void init() {
        LayoutInflater.from(getContext()).inflate(R.layout.view_course_table_arrow_layout, this, false);
        mIvArrow = findViewById(R.id.iv_arrow);
    }

    public void updateArrowUI(boolean isExpend) {
        if (mIvArrow != null) {
            mIvArrow.setImageResource(isExpend ? R.drawable.ic_calendar_shrink : R.drawable.ic_calendar_shrink);
        }
    }
}
