Created
October 16, 2013 12:40
-
-
Save meeDamian/7007065 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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