package com.example.beijing_daxing.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.example.beijing_daxing.R;


/**
 * Created by wangh on 2020/10/10-14:57。
 */
public class TipsDialog extends Dialog {
    public TextView textView, button;
    private ImageView imageView;

    public TipsDialog(@NonNull Context context) {
        super(context, R.style.dialog);
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_tip);
        imageView = findViewById(R.id.tip_image);
        textView = findViewById(R.id.tip_tip);
        findViewById(R.id.dialog_no).setOnClickListener(v -> dismiss());

    }


    public void showImage(boolean imageState, String tip) {
        show();
        if (imageState) {
            imageView.setImageResource(R.mipmap.dialog_success);
        } else {
            imageView.setImageResource(R.mipmap.dialog_failure);
        }
        textView.setText(tip);

    }

}
