Skip to content

Instantly share code, notes, and snippets.

@meeDamian
Created October 16, 2013 12:40
Show Gist options
  • Save meeDamian/7007065 to your computer and use it in GitHub Desktop.
Save meeDamian/7007065 to your computer and use it in GitHub Desktop.
package com.elimidateapp.android.customs;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.TextView;
public class MyTextView extends TextView {
private boolean allCaps = false;
public MyTextView(Context context) {
super(context);
}
public MyTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public void setAllCaps(boolean allCaps) {
this.allCaps = allCaps;
super.setAllCaps(allCaps);
}
@Override
public void setText(CharSequence text, BufferType type) {
if( allCaps && Build.VERSION.SDK_INT<Build.VERSION_CODES.ICE_CREAM_SANDWICH ) text = text.toString().toUpperCase();
super.setText(text, type);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment