Program: 39379
Project: 39379
Buggy source:
@Override protected void initWidget(){
  mEtProp=(EditText)findViewById(R.id.prop_et);
  mBtProp=(Button)findViewById(R.id.prop_bt);
  mBtProp.setTextColor(getColor(this,getMainTheme().getMainColorID()));
  mLvAccountType=(ListView)findViewById(R.id.account_type);
  findViewById(mEditType == PROP_TYPE_ACCOUNT_TYPE ? R.id.account_other_param : R.id.account_type_param).setVisibility(View.GONE);
switch (mEditType) {
case PROP_TYPE_ACCOUNT_NAME:
    getSupportActionBar().setTitle("String_Node_Str");
  mEtProp.setText(mParam);
break;
case PROP_TYPE_ACCOUNT_MONEY:
getSupportActionBar().setTitle("String_Node_Str");
mEtProp.setText(String.format(getResources().getString(R.string.record_money_format),mMoney));
mEtProp.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
break;
case PROP_TYPE_ACCOUNT_REMARK:
getSupportActionBar().setTitle("String_Node_Str");
mEtProp.setText(mParam);
break;
case PROP_TYPE_ACCOUNT_TYPE:
getSupportActionBar().setTitle("String_Node_Str");
initListView();
break;
default :
break;
}
mEtProp.setSelection(mEtProp.getText().toString().length());
mBtProp.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View v){
saveProp(mEtProp.getText().toString());
}
}
);
mEtProp.addTextChangedListener(new TextWatcher(){
@Override public void beforeTextChanged(CharSequence s,int start,int count,int after){
}
@Override public void onTextChanged(CharSequence s,int start,int before,int count){
if (mEditType != PROP_TYPE_ACCOUNT_MONEY) return;
String tmp=s.toString();
if (tmp.contains("String_Node_Str")) {
String[] strs=tmp.split("String_Node_Str");
if (strs.length > 1 && strs[1].length() > 2) {
mEtProp.setText(tmp.substring(0,tmp.length() - 1));
mEtProp.setSelection(tmp.length() - 1);
}
}
}
@Override public void afterTextChanged(Editable s){
}
}
);
}

Fixed version (ground truth):
@Override protected void initWidget(){
  mEtProp=(EditText)findViewById(R.id.prop_et);
  mBtProp=(Button)findViewById(R.id.prop_bt);
  mBtProp.setTextColor(getColor(this,getMainTheme().getMainColorID()));
  mLvAccountType=(ListView)findViewById(R.id.account_type);
  findViewById(mEditType == PROP_TYPE_ACCOUNT_TYPE ? R.id.account_other_param : R.id.account_type_param).setVisibility(View.GONE);
switch (mEditType) {
case PROP_TYPE_ACCOUNT_NAME:
    getSupportActionBar().setTitle(getResources().getString(R.string.edit_account_name));
  mEtProp.setText(mParam);
break;
case PROP_TYPE_ACCOUNT_MONEY:
getSupportActionBar().setTitle(getResources().getString(R.string.edit_account_money));
mEtProp.setText(String.format(getResources().getString(R.string.record_money_format),mMoney));
mEtProp.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
break;
case PROP_TYPE_ACCOUNT_REMARK:
getSupportActionBar().setTitle(getResources().getString(R.string.edit_account_remark));
mEtProp.setText(mParam);
break;
case PROP_TYPE_ACCOUNT_TYPE:
getSupportActionBar().setTitle(getResources().getString(R.string.edit_account_type));
initListView();
break;
default :
break;
}
mEtProp.setSelection(mEtProp.getText().toString().length());
mBtProp.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View v){
saveProp(mEtProp.getText().toString());
}
}
);
mEtProp.addTextChangedListener(new TextWatcher(){
@Override public void beforeTextChanged(CharSequence s,int start,int count,int after){
}
@Override public void onTextChanged(CharSequence s,int start,int before,int count){
if (mEditType != PROP_TYPE_ACCOUNT_MONEY) return;
String tmp=s.toString();
if (tmp.contains("String_Node_Str")) {
String[] strs=tmp.split("String_Node_Str");
if (strs.length > 1 && strs[1].length() > 2) {
mEtProp.setText(tmp.substring(0,tmp.length() - 1));
mEtProp.setSelection(tmp.length() - 1);
}
}
}
@Override public void afterTextChanged(Editable s){
}
}
);
}