Merge "Use TextView's text locale for capitalization."
This commit is contained in:
@@ -19,6 +19,7 @@ import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -39,11 +40,23 @@ public class AllCapsTransformationMethod implements TransformationMethod2 {
|
||||
|
||||
@Override
|
||||
public CharSequence getTransformation(CharSequence source, View view) {
|
||||
if (mEnabled) {
|
||||
return source != null ? source.toString().toUpperCase(mLocale) : null;
|
||||
if (!mEnabled) {
|
||||
Log.w(TAG, "Caller did not enable length changes; not transforming text");
|
||||
return source;
|
||||
}
|
||||
Log.w(TAG, "Caller did not enable length changes; not transforming text");
|
||||
return source;
|
||||
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Locale locale = null;
|
||||
if (view instanceof TextView) {
|
||||
locale = ((TextView)view).getTextLocale();
|
||||
}
|
||||
if (locale == null) {
|
||||
locale = mLocale;
|
||||
}
|
||||
return source.toString().toUpperCase(locale);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user