Program: 183127
Project: 183127
Buggy source:
public TextView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  mText="String_Node_Str";
  mTextPaint=new TextPaint(Paint.ANTI_ALIAS_FLAG);
  mTextPaint.density=getResources().getDisplayMetrics().density;
  mHighlightPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mMovement=getDefaultMovementMethod();
  mTransformation=null;
  TypedArray a=context.obtainStyledAttributes(attrs,com.android.internal.R.styleable.TextView,defStyle,0);
  int textColorHighlight=0;
  ColorStateList textColor=null;
  ColorStateList textColorHint=null;
  ColorStateList textColorLink=null;
  int textSize=15;
  int typefaceIndex=-1;
  int styleIndex=-1;
  TypedArray appearance=null;
  int ap=a.getResourceId(com.android.internal.R.styleable.TextView_textAppearance,-1);
  if (ap != -1) {
    appearance=context.obtainStyledAttributes(ap,com.android.internal.R.styleable.TextAppearance);
  }
  if (appearance != null) {
    int n=appearance.getIndexCount();
    for (int i=0; i < n; i++) {
      int attr=appearance.getIndex(i);
switch (attr) {
case com.android.internal.R.styleable.TextAppearance_textColorHighlight:
        textColorHighlight=appearance.getColor(attr,textColorHighlight);
      break;
case com.android.internal.R.styleable.TextAppearance_textColor:
    textColor=appearance.getColorStateList(attr);
  break;
case com.android.internal.R.styleable.TextAppearance_textColorHint:
textColorHint=appearance.getColorStateList(attr);
break;
case com.android.internal.R.styleable.TextAppearance_textColorLink:
textColorLink=appearance.getColorStateList(attr);
break;
case com.android.internal.R.styleable.TextAppearance_textSize:
textSize=appearance.getDimensionPixelSize(attr,textSize);
break;
case com.android.internal.R.styleable.TextAppearance_typeface:
typefaceIndex=appearance.getInt(attr,-1);
break;
case com.android.internal.R.styleable.TextAppearance_textStyle:
styleIndex=appearance.getInt(attr,-1);
break;
}
}
appearance.recycle();
}
boolean editable=getDefaultEditable();
CharSequence inputMethod=null;
int numeric=0;
CharSequence digits=null;
boolean phone=false;
boolean autotext=false;
int autocap=-1;
int buffertype=0;
boolean selectallonfocus=false;
Drawable drawableLeft=null, drawableTop=null, drawableRight=null, drawableBottom=null;
int drawablePadding=0;
int ellipsize=-1;
boolean singleLine=false;
int maxlength=-1;
CharSequence text="String_Node_Str";
CharSequence hint=null;
int shadowcolor=0;
float dx=0, dy=0, r=0;
boolean password=false;
int inputType=EditorInfo.TYPE_NULL;
int n=a.getIndexCount();
for (int i=0; i < n; i++) {
int attr=a.getIndex(i);
switch (attr) {
case com.android.internal.R.styleable.TextView_editable:
editable=a.getBoolean(attr,editable);
break;
case com.android.internal.R.styleable.TextView_inputMethod:
inputMethod=a.getText(attr);
break;
case com.android.internal.R.styleable.TextView_numeric:
numeric=a.getInt(attr,numeric);
break;
case com.android.internal.R.styleable.TextView_digits:
digits=a.getText(attr);
break;
case com.android.internal.R.styleable.TextView_phoneNumber:
phone=a.getBoolean(attr,phone);
break;
case com.android.internal.R.styleable.TextView_autoText:
autotext=a.getBoolean(attr,autotext);
break;
case com.android.internal.R.styleable.TextView_capitalize:
autocap=a.getInt(attr,autocap);
break;
case com.android.internal.R.styleable.TextView_bufferType:
buffertype=a.getInt(attr,buffertype);
break;
case com.android.internal.R.styleable.TextView_selectAllOnFocus:
selectallonfocus=a.getBoolean(attr,selectallonfocus);
break;
case com.android.internal.R.styleable.TextView_autoLink:
mAutoLinkMask=a.getInt(attr,0);
break;
case com.android.internal.R.styleable.TextView_linksClickable:
mLinksClickable=a.getBoolean(attr,true);
break;
case com.android.internal.R.styleable.TextView_drawableLeft:
drawableLeft=a.getDrawable(attr);
break;
case com.android.internal.R.styleable.TextView_drawableTop:
drawableTop=a.getDrawable(attr);
break;
case com.android.internal.R.styleable.TextView_drawableRight:
drawableRight=a.getDrawable(attr);
break;
case com.android.internal.R.styleable.TextView_drawableBottom:
drawableBottom=a.getDrawable(attr);
break;
case com.android.internal.R.styleable.TextView_drawablePadding:
drawablePadding=a.getDimensionPixelSize(attr,drawablePadding);
break;
case com.android.internal.R.styleable.TextView_maxLines:
setMaxLines(a.getInt(attr,-1));
break;
case com.android.internal.R.styleable.TextView_maxHeight:
setMaxHeight(a.getDimensionPixelSize(attr,-1));
break;
case com.android.internal.R.styleable.TextView_lines:
setLines(a.getInt(attr,-1));
break;
case com.android.internal.R.styleable.TextView_height:
setHeight(a.getDimensionPixelSize(attr,-1));
break;
case com.android.internal.R.styleable.TextView_minLines:
setMinLines(a.getInt(attr,-1));
break;
case com.android.internal.R.styleable.TextView_minHeight:
setMinHeight(a.getDimensionPixelSize(attr,-1));
break;
case com.android.internal.R.styleable.TextView_maxEms:
setMaxEms(a.getInt(attr,-1));
break;
case com.android.internal.R.styleable.TextView_maxWidth:
setMaxWidth(a.getDimensionPixelSize(attr,-1));
break;
case com.android.internal.R.styleable.TextView_ems:
setEms(a.getInt(attr,-1));
break;
case com.android.internal.R.styleable.TextView_width:
setWidth(a.getDimensionPixelSize(attr,-1));
break;
case com.android.internal.R.styleable.TextView_minEms:
setMinEms(a.getInt(attr,-1));
break;
case com.android.internal.R.styleable.TextView_minWidth:
setMinWidth(a.getDimensionPixelSize(attr,-1));
break;
case com.android.internal.R.styleable.TextView_gravity:
setGravity(a.getInt(attr,-1));
break;
case com.android.internal.R.styleable.TextView_hint:
hint=a.getText(attr);
break;
case com.android.internal.R.styleable.TextView_text:
text=a.getText(attr);
break;
case com.android.internal.R.styleable.TextView_scrollHorizontally:
if (a.getBoolean(attr,false)) {
setHorizontallyScrolling(true);
}
break;
case com.android.internal.R.styleable.TextView_singleLine:
singleLine=a.getBoolean(attr,singleLine);
break;
case com.android.internal.R.styleable.TextView_ellipsize:
ellipsize=a.getInt(attr,ellipsize);
break;
case com.android.internal.R.styleable.TextView_marqueeRepeatLimit:
setMarqueeRepeatLimit(a.getInt(attr,mMarqueeRepeatLimit));
break;
case com.android.internal.R.styleable.TextView_includeFontPadding:
if (!a.getBoolean(attr,true)) {
setIncludeFontPadding(false);
}
break;
case com.android.internal.R.styleable.TextView_cursorVisible:
if (!a.getBoolean(attr,true)) {
setCursorVisible(false);
}
break;
case com.android.internal.R.styleable.TextView_maxLength:
maxlength=a.getInt(attr,-1);
break;
case com.android.internal.R.styleable.TextView_textScaleX:
setTextScaleX(a.getFloat(attr,1.0f));
break;
case com.android.internal.R.styleable.TextView_freezesText:
mFreezesText=a.getBoolean(attr,false);
break;
case com.android.internal.R.styleable.TextView_shadowColor:
shadowcolor=a.getInt(attr,0);
break;
case com.android.internal.R.styleable.TextView_shadowDx:
dx=a.getFloat(attr,0);
break;
case com.android.internal.R.styleable.TextView_shadowDy:
dy=a.getFloat(attr,0);
break;
case com.android.internal.R.styleable.TextView_shadowRadius:
r=a.getFloat(attr,0);
break;
case com.android.internal.R.styleable.TextView_enabled:
setEnabled(a.getBoolean(attr,isEnabled()));
break;
case com.android.internal.R.styleable.TextView_textColorHighlight:
textColorHighlight=a.getColor(attr,textColorHighlight);
break;
case com.android.internal.R.styleable.TextView_textColor:
textColor=a.getColorStateList(attr);
break;
case com.android.internal.R.styleable.TextView_textColorHint:
textColorHint=a.getColorStateList(attr);
break;
case com.android.internal.R.styleable.TextView_textColorLink:
textColorLink=a.getColorStateList(attr);
break;
case com.android.internal.R.styleable.TextView_textSize:
textSize=a.getDimensionPixelSize(attr,textSize);
break;
case com.android.internal.R.styleable.TextView_typeface:
typefaceIndex=a.getInt(attr,typefaceIndex);
break;
case com.android.internal.R.styleable.TextView_textStyle:
styleIndex=a.getInt(attr,styleIndex);
break;
case com.android.internal.R.styleable.TextView_password:
password=a.getBoolean(attr,password);
break;
case com.android.internal.R.styleable.TextView_lineSpacingExtra:
mSpacingAdd=a.getDimensionPixelSize(attr,(int)mSpacingAdd);
break;
case com.android.internal.R.styleable.TextView_lineSpacingMultiplier:
mSpacingMult=a.getFloat(attr,mSpacingMult);
break;
case com.android.internal.R.styleable.TextView_inputType:
inputType=a.getInt(attr,mInputType);
break;
case com.android.internal.R.styleable.TextView_imeOptions:
if (mInputContentType == null) {
mInputContentType=new InputContentType();
}
mInputContentType.imeOptions=a.getInt(attr,mInputContentType.imeOptions);
break;
case com.android.internal.R.styleable.TextView_imeActionLabel:
if (mInputContentType == null) {
mInputContentType=new InputContentType();
}
mInputContentType.imeActionLabel=a.getText(attr);
break;
case com.android.internal.R.styleable.TextView_imeActionId:
if (mInputContentType == null) {
mInputContentType=new InputContentType();
}
mInputContentType.imeActionId=a.getInt(attr,mInputContentType.imeActionId);
break;
case com.android.internal.R.styleable.TextView_privateImeOptions:
setPrivateImeOptions(a.getString(attr));
break;
case com.android.internal.R.styleable.TextView_editorExtras:
try {
setInputExtras(a.getResourceId(attr,0));
}
 catch (XmlPullParserException e) {
Log.w("String_Node_Str","String_Node_Str",e);
}
catch (IOException e) {
Log.w("String_Node_Str","String_Node_Str",e);
}
break;
}
}
a.recycle();
BufferType bufferType=BufferType.EDITABLE;
if ((inputType & (EditorInfo.TYPE_MASK_CLASS | EditorInfo.TYPE_MASK_VARIATION)) == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD)) {
password=true;
}
if (inputMethod != null) {
Class c;
try {
c=Class.forName(inputMethod.toString());
}
 catch (ClassNotFoundException ex) {
throw new RuntimeException(ex);
}
try {
mInput=(KeyListener)c.newInstance();
}
 catch (InstantiationException ex) {
throw new RuntimeException(ex);
}
catch (IllegalAccessException ex) {
throw new RuntimeException(ex);
}
try {
mInputType=inputType != EditorInfo.TYPE_NULL ? inputType : mInput.getInputType();
}
 catch (IncompatibleClassChangeError e) {
mInputType=EditorInfo.TYPE_CLASS_TEXT;
}
}
 else if (digits != null) {
mInput=DigitsKeyListener.getInstance(digits.toString());
mInputType=inputType != EditorInfo.TYPE_NULL ? inputType : EditorInfo.TYPE_CLASS_TEXT;
}
 else if (inputType != EditorInfo.TYPE_NULL) {
setInputType(inputType,true);
singleLine=(inputType & (EditorInfo.TYPE_MASK_CLASS | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE)) != (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE);
}
 else if (phone) {
mInput=DialerKeyListener.getInstance();
mInputType=inputType=EditorInfo.TYPE_CLASS_PHONE;
}
 else if (numeric != 0) {
mInput=DigitsKeyListener.getInstance((numeric & SIGNED) != 0,(numeric & DECIMAL) != 0);
inputType=EditorInfo.TYPE_CLASS_NUMBER;
if ((numeric & SIGNED) != 0) {
inputType|=EditorInfo.TYPE_NUMBER_FLAG_SIGNED;
}
if ((numeric & DECIMAL) != 0) {
inputType|=EditorInfo.TYPE_NUMBER_FLAG_DECIMAL;
}
mInputType=inputType;
}
 else if (autotext || autocap != -1) {
TextKeyListener.Capitalize cap;
inputType=EditorInfo.TYPE_CLASS_TEXT;
if (!singleLine) {
inputType|=EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
}
switch (autocap) {
case 1:
cap=TextKeyListener.Capitalize.SENTENCES;
inputType|=EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES;
break;
case 2:
cap=TextKeyListener.Capitalize.WORDS;
inputType|=EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS;
break;
case 3:
cap=TextKeyListener.Capitalize.CHARACTERS;
inputType|=EditorInfo.TYPE_TEXT_FLAG_CAP_CHARACTERS;
break;
default :
cap=TextKeyListener.Capitalize.NONE;
break;
}
mInput=TextKeyListener.getInstance(autotext,cap);
mInputType=inputType;
}
 else if (editable) {
mInput=TextKeyListener.getInstance();
mInputType=EditorInfo.TYPE_CLASS_TEXT;
}
 else {
mInput=null;
switch (buffertype) {
case 0:
bufferType=BufferType.NORMAL;
break;
case 1:
bufferType=BufferType.SPANNABLE;
break;
case 2:
bufferType=BufferType.EDITABLE;
break;
}
}
if (password && (mInputType & EditorInfo.TYPE_MASK_CLASS) == EditorInfo.TYPE_CLASS_TEXT) {
mInputType=(mInputType & ~(EditorInfo.TYPE_MASK_VARIATION)) | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD;
}
if (selectallonfocus) {
mSelectAllOnFocus=true;
if (bufferType == BufferType.NORMAL) bufferType=BufferType.SPANNABLE;
}
setCompoundDrawablesWithIntrinsicBounds(drawableLeft,drawableTop,drawableRight,drawableBottom);
setCompoundDrawablePadding(drawablePadding);
if (singleLine) {
setSingleLine();
if (mInput == null && ellipsize < 0) {
ellipsize=3;
}
}
switch (ellipsize) {
case 1:
setEllipsize(TextUtils.TruncateAt.START);
break;
case 2:
setEllipsize(TextUtils.TruncateAt.MIDDLE);
break;
case 3:
setEllipsize(TextUtils.TruncateAt.END);
break;
case 4:
setHorizontalFadingEdgeEnabled(true);
setEllipsize(TextUtils.TruncateAt.MARQUEE);
break;
}
setTextColor(textColor != null ? textColor : ColorStateList.valueOf(0xFF000000));
setHintTextColor(textColorHint);
setLinkTextColor(textColorLink);
if (textColorHighlight != 0) {
setHighlightColor(textColorHighlight);
}
setRawTextSize(textSize);
if (password) {
setTransformationMethod(PasswordTransformationMethod.getInstance());
typefaceIndex=MONOSPACE;
}
 else if ((mInputType & (EditorInfo.TYPE_MASK_CLASS | EditorInfo.TYPE_MASK_VARIATION)) == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD)) {
typefaceIndex=MONOSPACE;
}
setTypefaceByIndex(typefaceIndex,styleIndex);
if (shadowcolor != 0) {
setShadowLayer(r,dx,dy,shadowcolor);
}
if (maxlength >= 0) {
setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxlength)});
}
 else {
setFilters(NO_FILTERS);
}
setText(text,bufferType);
if (hint != null) setHint(hint);
a=context.obtainStyledAttributes(attrs,com.android.internal.R.styleable.View,defStyle,0);
boolean focusable=mMovement != null || mInput != null;
boolean clickable=focusable;
boolean longClickable=focusable;
n=a.getIndexCount();
for (int i=0; i < n; i++) {
int attr=a.getIndex(i);
switch (attr) {
case com.android.internal.R.styleable.View_focusable:
focusable=a.getBoolean(attr,focusable);
break;
case com.android.internal.R.styleable.View_clickable:
clickable=a.getBoolean(attr,clickable);
break;
case com.android.internal.R.styleable.View_longClickable:
longClickable=a.getBoolean(attr,longClickable);
break;
}
}
a.recycle();
setFocusable(focusable);
setClickable(clickable);
setLongClickable(longClickable);
}

Fixed version (ground truth):
public TextView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  mText="String_Node_Str";
  mTextPaint=new TextPaint(Paint.ANTI_ALIAS_FLAG);
  mTextPaint.density=getResources().getDisplayMetrics().density;
  mTextPaint.setCompatibilityScaling(getResources().getCompatibilityInfo().applicationScale);
  mHighlightPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mHighlightPaint.setCompatibilityScaling(getResources().getCompatibilityInfo().applicationScale);
  mMovement=getDefaultMovementMethod();
  mTransformation=null;
  TypedArray a=context.obtainStyledAttributes(attrs,com.android.internal.R.styleable.TextView,defStyle,0);
  int textColorHighlight=0;
  ColorStateList textColor=null;
  ColorStateList textColorHint=null;
  ColorStateList textColorLink=null;
  int textSize=15;
  int typefaceIndex=-1;
  int styleIndex=-1;
  TypedArray appearance=null;
  int ap=a.getResourceId(com.android.internal.R.styleable.TextView_textAppearance,-1);
  if (ap != -1) {
    appearance=context.obtainStyledAttributes(ap,com.android.internal.R.styleable.TextAppearance);
  }
  if (appearance != null) {
    int n=appearance.getIndexCount();
    for (int i=0; i < n; i++) {
      int attr=appearance.getIndex(i);
switch (attr) {
case com.android.internal.R.styleable.TextAppearance_textColorHighlight:
        textColorHighlight=appearance.getColor(attr,textColorHighlight);
      break;
case com.android.internal.R.styleable.TextAppearance_textColor:
    textColor=appearance.getColorStateList(attr);
  break;
case com.android.internal.R.styleable.TextAppearance_textColorHint:
textColorHint=appearance.getColorStateList(attr);
break;
case com.android.internal.R.styleable.TextAppearance_textColorLink:
textColorLink=appearance.getColorStateList(attr);
break;
case com.android.internal.R.styleable.TextAppearance_textSize:
textSize=appearance.getDimensionPixelSize(attr,textSize);
break;
case com.android.internal.R.styleable.TextAppearance_typeface:
typefaceIndex=appearance.getInt(attr,-1);
break;
case com.android.internal.R.styleable.TextAppearance_textStyle:
styleIndex=appearance.getInt(attr,-1);
break;
}
}
appearance.recycle();
}
boolean editable=getDefaultEditable();
CharSequence inputMethod=null;
int numeric=0;
CharSequence digits=null;
boolean phone=false;
boolean autotext=false;
int autocap=-1;
int buffertype=0;
boolean selectallonfocus=false;
Drawable drawableLeft=null, drawableTop=null, drawableRight=null, drawableBottom=null;
int drawablePadding=0;
int ellipsize=-1;
boolean singleLine=false;
int maxlength=-1;
CharSequence text="String_Node_Str";
CharSequence hint=null;
int shadowcolor=0;
float dx=0, dy=0, r=0;
boolean password=false;
int inputType=EditorInfo.TYPE_NULL;
int n=a.getIndexCount();
for (int i=0; i < n; i++) {
int attr=a.getIndex(i);
switch (attr) {
case com.android.internal.R.styleable.TextView_editable:
editable=a.getBoolean(attr,editable);
break;
case com.android.internal.R.styleable.TextView_inputMethod:
inputMethod=a.getText(attr);
break;
case com.android.internal.R.styleable.TextView_numeric:
numeric=a.getInt(attr,numeric);
break;
case com.android.internal.R.styleable.TextView_digits:
digits=a.getText(attr);
break;
case com.android.internal.R.styleable.TextView_phoneNumber:
phone=a.getBoolean(attr,phone);
break;
case com.android.internal.R.styleable.TextView_autoText:
autotext=a.getBoolean(attr,autotext);
break;
case com.android.internal.R.styleable.TextView_capitalize:
autocap=a.getInt(attr,autocap);
break;
case com.android.internal.R.styleable.TextView_bufferType:
buffertype=a.getInt(attr,buffertype);
break;
case com.android.internal.R.styleable.TextView_selectAllOnFocus:
selectallonfocus=a.getBoolean(attr,selectallonfocus);
break;
case com.android.internal.R.styleable.TextView_autoLink:
mAutoLinkMask=a.getInt(attr,0);
break;
case com.android.internal.R.styleable.TextView_linksClickable:
mLinksClickable=a.getBoolean(attr,true);
break;
case com.android.internal.R.styleable.TextView_drawableLeft:
drawableLeft=a.getDrawable(attr);
break;
case com.android.internal.R.styleable.TextView_drawableTop:
drawableTop=a.getDrawable(attr);
break;
case com.android.internal.R.styleable.TextView_drawableRight:
drawableRight=a.getDrawable(attr);
break;
case com.android.internal.R.styleable.TextView_drawableBottom:
drawableBottom=a.getDrawable(attr);
break;
case com.android.internal.R.styleable.TextView_drawablePadding:
drawablePadding=a.getDimensionPixelSize(attr,drawablePadding);
break;
case com.android.internal.R.styleable.TextView_maxLines:
setMaxLines(a.getInt(attr,-1));
break;
case com.android.internal.R.styleable.TextView_maxHeight:
setMaxHeight(a.getDimensionPixelSize(attr,-1));
break;
case com.android.internal.R.styleable.TextView_lines:
setLines(a.getInt(attr,-1));
break;
case com.android.internal.R.styleable.TextView_height:
setHeight(a.getDimensionPixelSize(attr,-1));
break;
case com.android.internal.R.styleable.TextView_minLines:
setMinLines(a.getInt(attr,-1));
break;
case com.android.internal.R.styleable.TextView_minHeight:
setMinHeight(a.getDimensionPixelSize(attr,-1));
break;
case com.android.internal.R.styleable.TextView_maxEms:
setMaxEms(a.getInt(attr,-1));
break;
case com.android.internal.R.styleable.TextView_maxWidth:
setMaxWidth(a.getDimensionPixelSize(attr,-1));
break;
case com.android.internal.R.styleable.TextView_ems:
setEms(a.getInt(attr,-1));
break;
case com.android.internal.R.styleable.TextView_width:
setWidth(a.getDimensionPixelSize(attr,-1));
break;
case com.android.internal.R.styleable.TextView_minEms:
setMinEms(a.getInt(attr,-1));
break;
case com.android.internal.R.styleable.TextView_minWidth:
setMinWidth(a.getDimensionPixelSize(attr,-1));
break;
case com.android.internal.R.styleable.TextView_gravity:
setGravity(a.getInt(attr,-1));
break;
case com.android.internal.R.styleable.TextView_hint:
hint=a.getText(attr);
break;
case com.android.internal.R.styleable.TextView_text:
text=a.getText(attr);
break;
case com.android.internal.R.styleable.TextView_scrollHorizontally:
if (a.getBoolean(attr,false)) {
setHorizontallyScrolling(true);
}
break;
case com.android.internal.R.styleable.TextView_singleLine:
singleLine=a.getBoolean(attr,singleLine);
break;
case com.android.internal.R.styleable.TextView_ellipsize:
ellipsize=a.getInt(attr,ellipsize);
break;
case com.android.internal.R.styleable.TextView_marqueeRepeatLimit:
setMarqueeRepeatLimit(a.getInt(attr,mMarqueeRepeatLimit));
break;
case com.android.internal.R.styleable.TextView_includeFontPadding:
if (!a.getBoolean(attr,true)) {
setIncludeFontPadding(false);
}
break;
case com.android.internal.R.styleable.TextView_cursorVisible:
if (!a.getBoolean(attr,true)) {
setCursorVisible(false);
}
break;
case com.android.internal.R.styleable.TextView_maxLength:
maxlength=a.getInt(attr,-1);
break;
case com.android.internal.R.styleable.TextView_textScaleX:
setTextScaleX(a.getFloat(attr,1.0f));
break;
case com.android.internal.R.styleable.TextView_freezesText:
mFreezesText=a.getBoolean(attr,false);
break;
case com.android.internal.R.styleable.TextView_shadowColor:
shadowcolor=a.getInt(attr,0);
break;
case com.android.internal.R.styleable.TextView_shadowDx:
dx=a.getFloat(attr,0);
break;
case com.android.internal.R.styleable.TextView_shadowDy:
dy=a.getFloat(attr,0);
break;
case com.android.internal.R.styleable.TextView_shadowRadius:
r=a.getFloat(attr,0);
break;
case com.android.internal.R.styleable.TextView_enabled:
setEnabled(a.getBoolean(attr,isEnabled()));
break;
case com.android.internal.R.styleable.TextView_textColorHighlight:
textColorHighlight=a.getColor(attr,textColorHighlight);
break;
case com.android.internal.R.styleable.TextView_textColor:
textColor=a.getColorStateList(attr);
break;
case com.android.internal.R.styleable.TextView_textColorHint:
textColorHint=a.getColorStateList(attr);
break;
case com.android.internal.R.styleable.TextView_textColorLink:
textColorLink=a.getColorStateList(attr);
break;
case com.android.internal.R.styleable.TextView_textSize:
textSize=a.getDimensionPixelSize(attr,textSize);
break;
case com.android.internal.R.styleable.TextView_typeface:
typefaceIndex=a.getInt(attr,typefaceIndex);
break;
case com.android.internal.R.styleable.TextView_textStyle:
styleIndex=a.getInt(attr,styleIndex);
break;
case com.android.internal.R.styleable.TextView_password:
password=a.getBoolean(attr,password);
break;
case com.android.internal.R.styleable.TextView_lineSpacingExtra:
mSpacingAdd=a.getDimensionPixelSize(attr,(int)mSpacingAdd);
break;
case com.android.internal.R.styleable.TextView_lineSpacingMultiplier:
mSpacingMult=a.getFloat(attr,mSpacingMult);
break;
case com.android.internal.R.styleable.TextView_inputType:
inputType=a.getInt(attr,mInputType);
break;
case com.android.internal.R.styleable.TextView_imeOptions:
if (mInputContentType == null) {
mInputContentType=new InputContentType();
}
mInputContentType.imeOptions=a.getInt(attr,mInputContentType.imeOptions);
break;
case com.android.internal.R.styleable.TextView_imeActionLabel:
if (mInputContentType == null) {
mInputContentType=new InputContentType();
}
mInputContentType.imeActionLabel=a.getText(attr);
break;
case com.android.internal.R.styleable.TextView_imeActionId:
if (mInputContentType == null) {
mInputContentType=new InputContentType();
}
mInputContentType.imeActionId=a.getInt(attr,mInputContentType.imeActionId);
break;
case com.android.internal.R.styleable.TextView_privateImeOptions:
setPrivateImeOptions(a.getString(attr));
break;
case com.android.internal.R.styleable.TextView_editorExtras:
try {
setInputExtras(a.getResourceId(attr,0));
}
 catch (XmlPullParserException e) {
Log.w("String_Node_Str","String_Node_Str",e);
}
catch (IOException e) {
Log.w("String_Node_Str","String_Node_Str",e);
}
break;
}
}
a.recycle();
BufferType bufferType=BufferType.EDITABLE;
if ((inputType & (EditorInfo.TYPE_MASK_CLASS | EditorInfo.TYPE_MASK_VARIATION)) == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD)) {
password=true;
}
if (inputMethod != null) {
Class c;
try {
c=Class.forName(inputMethod.toString());
}
 catch (ClassNotFoundException ex) {
throw new RuntimeException(ex);
}
try {
mInput=(KeyListener)c.newInstance();
}
 catch (InstantiationException ex) {
throw new RuntimeException(ex);
}
catch (IllegalAccessException ex) {
throw new RuntimeException(ex);
}
try {
mInputType=inputType != EditorInfo.TYPE_NULL ? inputType : mInput.getInputType();
}
 catch (IncompatibleClassChangeError e) {
mInputType=EditorInfo.TYPE_CLASS_TEXT;
}
}
 else if (digits != null) {
mInput=DigitsKeyListener.getInstance(digits.toString());
mInputType=inputType != EditorInfo.TYPE_NULL ? inputType : EditorInfo.TYPE_CLASS_TEXT;
}
 else if (inputType != EditorInfo.TYPE_NULL) {
setInputType(inputType,true);
singleLine=(inputType & (EditorInfo.TYPE_MASK_CLASS | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE)) != (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE);
}
 else if (phone) {
mInput=DialerKeyListener.getInstance();
mInputType=inputType=EditorInfo.TYPE_CLASS_PHONE;
}
 else if (numeric != 0) {
mInput=DigitsKeyListener.getInstance((numeric & SIGNED) != 0,(numeric & DECIMAL) != 0);
inputType=EditorInfo.TYPE_CLASS_NUMBER;
if ((numeric & SIGNED) != 0) {
inputType|=EditorInfo.TYPE_NUMBER_FLAG_SIGNED;
}
if ((numeric & DECIMAL) != 0) {
inputType|=EditorInfo.TYPE_NUMBER_FLAG_DECIMAL;
}
mInputType=inputType;
}
 else if (autotext || autocap != -1) {
TextKeyListener.Capitalize cap;
inputType=EditorInfo.TYPE_CLASS_TEXT;
if (!singleLine) {
inputType|=EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
}
switch (autocap) {
case 1:
cap=TextKeyListener.Capitalize.SENTENCES;
inputType|=EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES;
break;
case 2:
cap=TextKeyListener.Capitalize.WORDS;
inputType|=EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS;
break;
case 3:
cap=TextKeyListener.Capitalize.CHARACTERS;
inputType|=EditorInfo.TYPE_TEXT_FLAG_CAP_CHARACTERS;
break;
default :
cap=TextKeyListener.Capitalize.NONE;
break;
}
mInput=TextKeyListener.getInstance(autotext,cap);
mInputType=inputType;
}
 else if (editable) {
mInput=TextKeyListener.getInstance();
mInputType=EditorInfo.TYPE_CLASS_TEXT;
}
 else {
mInput=null;
switch (buffertype) {
case 0:
bufferType=BufferType.NORMAL;
break;
case 1:
bufferType=BufferType.SPANNABLE;
break;
case 2:
bufferType=BufferType.EDITABLE;
break;
}
}
if (password && (mInputType & EditorInfo.TYPE_MASK_CLASS) == EditorInfo.TYPE_CLASS_TEXT) {
mInputType=(mInputType & ~(EditorInfo.TYPE_MASK_VARIATION)) | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD;
}
if (selectallonfocus) {
mSelectAllOnFocus=true;
if (bufferType == BufferType.NORMAL) bufferType=BufferType.SPANNABLE;
}
setCompoundDrawablesWithIntrinsicBounds(drawableLeft,drawableTop,drawableRight,drawableBottom);
setCompoundDrawablePadding(drawablePadding);
if (singleLine) {
setSingleLine();
if (mInput == null && ellipsize < 0) {
ellipsize=3;
}
}
switch (ellipsize) {
case 1:
setEllipsize(TextUtils.TruncateAt.START);
break;
case 2:
setEllipsize(TextUtils.TruncateAt.MIDDLE);
break;
case 3:
setEllipsize(TextUtils.TruncateAt.END);
break;
case 4:
setHorizontalFadingEdgeEnabled(true);
setEllipsize(TextUtils.TruncateAt.MARQUEE);
break;
}
setTextColor(textColor != null ? textColor : ColorStateList.valueOf(0xFF000000));
setHintTextColor(textColorHint);
setLinkTextColor(textColorLink);
if (textColorHighlight != 0) {
setHighlightColor(textColorHighlight);
}
setRawTextSize(textSize);
if (password) {
setTransformationMethod(PasswordTransformationMethod.getInstance());
typefaceIndex=MONOSPACE;
}
 else if ((mInputType & (EditorInfo.TYPE_MASK_CLASS | EditorInfo.TYPE_MASK_VARIATION)) == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD)) {
typefaceIndex=MONOSPACE;
}
setTypefaceByIndex(typefaceIndex,styleIndex);
if (shadowcolor != 0) {
setShadowLayer(r,dx,dy,shadowcolor);
}
if (maxlength >= 0) {
setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxlength)});
}
 else {
setFilters(NO_FILTERS);
}
setText(text,bufferType);
if (hint != null) setHint(hint);
a=context.obtainStyledAttributes(attrs,com.android.internal.R.styleable.View,defStyle,0);
boolean focusable=mMovement != null || mInput != null;
boolean clickable=focusable;
boolean longClickable=focusable;
n=a.getIndexCount();
for (int i=0; i < n; i++) {
int attr=a.getIndex(i);
switch (attr) {
case com.android.internal.R.styleable.View_focusable:
focusable=a.getBoolean(attr,focusable);
break;
case com.android.internal.R.styleable.View_clickable:
clickable=a.getBoolean(attr,clickable);
break;
case com.android.internal.R.styleable.View_longClickable:
longClickable=a.getBoolean(attr,longClickable);
break;
}
}
a.recycle();
setFocusable(focusable);
setClickable(clickable);
setLongClickable(longClickable);
}