Skip to content

Instantly share code, notes, and snippets.

@robUx4
Created May 30, 2013 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robUx4/5678904 to your computer and use it in GitHub Desktop.
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...
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