package com.kdanmobile.kdan_others_library_for_android.card;

import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.kdanmobile.kdan_others_library_for_android.R;

public class PdfReaderPromoteCard extends LinearLayout {

    private Runnable intentPlayPdf;

    private Button tryNow;


    public PdfReaderPromoteCard(Context context) {
        super(context);
        initView();
    }
    
    public void setButtonColor(int color) {
        tryNow.setTextColor(color);
    }

    public void setTryPdfClickListener(Runnable intentPlayPdf){
        this.intentPlayPdf = intentPlayPdf;
    }

    private void initView() {
        View view = inflate(getContext(), R.layout.widget_pdfreader_promote_card, this);
        tryNow = (Button) view.findViewById(R.id.button_pdfreader_promote_card_try_now);
        ImageView imageView = (ImageView) view.findViewById(R.id.image_view_pdfreader_promote_card);

        tryNow.setOnClickListener(view1 -> {if(intentPlayPdf!=null) intentPlayPdf.run();});
        imageView.setOnClickListener(view12 -> {if(intentPlayPdf!=null) intentPlayPdf.run();});
    }

}
