package com.dskj.trustlend.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import com.azhon.basic.utils.AnimUtil;
import com.dskj.trustlend.R;

public class LogoutDialog extends Dialog {
    protected TextView mRightBtn;
    private CharSequence mRightText = null;
    private View.OnClickListener mRightListener;
    protected TextView mLeftBtn;
    private View.OnClickListener mLeftListener;

    public LogoutDialog(Context context) {
        super(context, R.style.MaterialDesignDialog1);
    }

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

        mLeftBtn = findViewById(R.id.cancel_btn);

        mRightBtn = findViewById(R.id.sure_btn);
        if (mRightListener != null) {
            mRightBtn.setOnClickListener(mRightListener);
        }
        if (mLeftListener != null) {
            mLeftBtn.setOnClickListener(mLeftListener);
        }
        AnimUtil.setAnimView(mRightBtn);

        Window window = getWindow();
        WindowManager.LayoutParams wlp = window.getAttributes();
        wlp.gravity = Gravity.BOTTOM;
        wlp.width = WindowManager.LayoutParams.MATCH_PARENT;
        wlp.height = WindowManager.LayoutParams.WRAP_CONTENT;


        window.setAttributes(wlp);
    }


    public void setRightButton(View.OnClickListener listener) {
        mRightListener = listener;
    }
    public void setLeftButton(View.OnClickListener listener) {
        mLeftListener = listener;
    }

}
