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;
|
}
|
|
}
|