Created
May 30, 2013 15:46
-
-
Save robUx4/5678904 to your computer and use it in GitHub Desktop.
Why does it keep a ref to the Locale ? It gets the view back when transforming...
This file contains 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
class PagerTitleStripIcs { | |
public static void setSingleLineAllCaps(TextView text) { | |
text.setTransformationMethod(new SingleLineAllCapsTransform(text.getContext())); | |
} | |
private static class SingleLineAllCapsTransform extends SingleLineTransformationMethod { | |
private static final String TAG = "SingleLineAllCapsTransform"; | |
private Locale mLocale; | |
public SingleLineAllCapsTransform(Context context) { | |
mLocale = context.getResources().getConfiguration().locale; | |
} | |
@Override | |
public CharSequence getTransformation(CharSequence source, View view) { | |
source = super.getTransformation(source, view); | |
return source != null ? source.toString().toUpperCase(mLocale) : null; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment