*/
private String temp_;
// 标志该控件是否是密码输入控件,广发新增要求要求对密码输入控件内容作一定校验
private boolean isPasswordWidget_;
/**
- Indicator of setting label and input field in ONE row.
*/
boolean isLabelIndianFile_;
/**
- Indicate the inputting is not empty.
*/
boolean required_;
String group;
String ref;
int inputFieldWidth_;
boolean editable_ = true;
/**
- minimum of the characters
*/
int minSize_;
/**
- maxmum of the characters
*/
int maxSize_ = 18;
double maxValue_ = -1;
double minValue_ = -1;
String alartInfo = “”;
// 输入框的输入限制类型
private int inputType_;
String TextType = “”;
/* input not support “.” */
Paint form_;
String attrName_;
String attrValue_;
boolean attrSave_;
String isEncrypt_;
String hint_;
private int height_;
private int width_;
MainActivity bv_;
public LPTextField(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
public LPTextField(Context context, AttributeSet attrs) {
super(context, attrs);
setTransformationMethod(new PasswordTransformationMethod());
bv_ = (MainActivity) context;
bv_.inputManager_= (InputMethodManager)bv_.getSystemService(Context.INPUT_METHOD_SERVICE);
}
String password_ = “password”;
@Override
protected void onFocusChanged(boolean focused, int direction,
Rect previouslyFocusedRect) {
// TODO Auto-generated method stub
super.onFocusChanged(focused, direction, previouslyFocusedRect);
}
public boolean dispatchTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
this.requestFocus();
boolean rt = false;
if(null != password_ && password_.equalsIgnoreCase(“password”)){
bv_.inputManager_.hideSoftInputFromWindow(this.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
if(bv_.dlg == null || !bv_.dlg.isShowing()){
if(this.isEnabled()){
bv_.OnCreateInputWindow(this);
rt = true;
}
}
}
return super.dispatchTouchEvent(event);
}
public String getContentText() {
return super.getText().toString();
}
public String getLabel() {
// TODO Auto-generated method stub
// 由于国航项目取消了输入框的label。
// 改为将label作hint显示,嵌入到输入框中,所以作此改动
String str = “”;
if (null != this.getHint()) {
str = this.getHint().toString();
if ((null == str) || (str.equals("")))
str = “”;
}
return str;
}
/**
-
*/
public boolean onKeyDown(int keyCode, KeyEvent event) {
return super.onKeyDown(keyCode, event);
}
@Override
protected void onTextChanged(CharSequence text, int start,
int lengthBefore, int lengthAfter) {
super.onTextChanged(text, start, lengthBefore, lengthAfter);
}
String checkText(String text) {
if (minValue_ == -1 && maxValue_ == -1)
return text;
if (text == null || text.equals(""))
return text;
Double sour = Double.parseDouble(text);
if ((maxValue_ != -1) && sour >= maxValue_) {
alartInfo = hint_ + “不能大于” + maxValue_;
sour = maxValue_;
}
if ((minValue_ != -1) && sour <= minValue_) {
alartInfo = hint_ + “不能小于” + minValue_;
sour = minValue_;
}
String destext = null;
// 判断输入的内容是否有小数。
if (sour % 1 < 0.001) {
destext = (sour + “”).substring(0, (sour + “”).indexOf("."));
}
if (sour % 1 > 0.001) {
destext = sour.toString();
}
return destext;
}
public boolean getPasswordMark() {
return isPasswordWidget_;
}
// 设置密码输入框标志,如果控件是密码输入框,则该方法一定要执行
public void setPasswordMark(boolean iswork) {
isPasswordWidget_ = iswork;
}
public void setContentText(String text) {
// TODO Auto-generated method stub
this.setText(text);
}
public void setEditable_(boolean editable_) {
this.editable_ = editable_;
}
public void shrinkWidth() {
// TODO Auto-generated method stub
}
public void cleanText() {
// TODO Auto-generated method stub
}
public void setLPHeidht(int height) {
// TODO Auto-generated method stub
}
public void setLPWidth(int width) {
// TODO Auto-generated method stub
}
public View getLPView() {
return this;
}
public int getLPHeight() {
return height_;
}
public int getLPWidth() {
return width_;
}
public void setInTable(boolean inTable) {
// TODO Auto-generated method stub
}
public boolean isInTable() {
// TODO Auto-generated method stub
return false;
}
}
/**
- 密码键盘,字母、数字随机排列显示
*/
public class LPKeyBoard extends LinearLayout {
private PopupWindow popWindow_;
Dialog dlg_;
boolean isShow_ = false;
LPImfView imfView;
MainActivity bv_;
EditText tempEdit_;
buttonOk btnOK_; // 确定按钮
// 判断当前输入框输入类型是否是数字
boolean inputTypeNumber_ = false;
// cs模板定义的输入长度限制
int maxSize;
private Vibrator vibrator_;
private static final long VIBRATE_DURATION = 30L;
public LPKeyBoard(Context context, LPTextField text) {
super(context);
// TODO Auto-generated constructor stub
bv_ = (MainActivity) context;
btnOK_ = new buttonOk(context, false);
tempEdit_ = new EditText(