lzw
2024-02-19 a9ac419b3564590e5fccba048988e287490bc79c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package com.fwupgrade.saymanss.view;
 
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
import android.widget.TextView;
 
import com.fwupgrade.saymanss.R;
 
 
/**
 * 
 * @description  基类的对话框,,其中有两个按钮:
 *                 1、 "取消"
 *                 2、 "确定"
 *
 * @modified author Rocky
 *
 * @version  1.0.0
 *
 * @date 2014-6-6
 *
 */
public class BaseButtonDialog extends LinearLayout implements OnClickListener {
 
    /**
     * @return the custom_bottombtnll_cancelbtn
     */
    public int getBaseDialogCancelbtn() {
        return R.id.basedialog_cancelbtn;
    }
 
    /**
     * @return the custom_bottombtnll_okbtn
     */
    public int getBaseDialogOKbtn() {
        return R.id.basedialog_okbtn;
    }
 
    private LayoutInflater inflater;
 
    private TextView cancelBtn;
    private TextView okBtn;
 
    public BaseButtonDialog(Context context) {
        super(context);
    }
 
    public BaseButtonDialog(Context context, AttributeSet attrs) {
        super(context, attrs);
        inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflater.inflate(R.layout.base_dialog, this);
        cancelBtn = (TextView) findViewById(R.id.basedialog_cancelbtn);
        okBtn = (TextView) findViewById(R.id.basedialog_okbtn);
 
        initUI();
 
    }
    
    public int getOkButtonId()
    {
        return R.id.basedialog_okbtn;
    }
    
    public TextView getOkButton(){
        return okBtn;
    }
    
    public int getCancelButtonId()
    {
        return R.id.basedialog_cancelbtn;
    }
    
    public void setViewText(){
        cancelBtn.setText("取消");
        okBtn.setText("确定");
    }
 
    private void initUI() { 
        setViewText();
        
        okBtn.setOnClickListener(this);
        cancelBtn.setOnClickListener(this);
    }
 
    @Override
    public void onClick(View v) {
    }
 
    public void setBtnOnClickListener(OnClickListener onClickListener) {
        okBtn.setOnClickListener(onClickListener);
        cancelBtn.setOnClickListener(onClickListener);
    }
    
    public void setBtnOkValid(boolean valid) {
        okBtn.setEnabled(valid);
    }
 
    public TextView getCancelBtn() {
        return cancelBtn;
    }
 
}