11e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell/* 21e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell * Copyright (C) 2012 The Android Open Source Project 31e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell * 41e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell * Licensed under the Apache License, Version 2.0 (the "License"); 51e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell * you may not use this file except in compliance with the License. 61e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell * You may obtain a copy of the License at 71e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell * 81e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell * http://www.apache.org/licenses/LICENSE-2.0 91e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell * 101e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell * Unless required by applicable law or agreed to in writing, software 111e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell * distributed under the License is distributed on an "AS IS" BASIS, 121e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 131e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell * See the License for the specific language governing permissions and 141e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell * limitations under the License. 151e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell */ 161e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell 171e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powellpackage android.support.v4.view; 181e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell 191e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powellimport android.content.Context; 201e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powellimport android.text.method.SingleLineTransformationMethod; 211e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powellimport android.view.View; 221e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powellimport android.widget.TextView; 231e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell 241e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powellimport java.util.Locale; 251e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell 261e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powellclass PagerTitleStripIcs { 271e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell public static void setSingleLineAllCaps(TextView text) { 281e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell text.setTransformationMethod(new SingleLineAllCapsTransform(text.getContext())); 291e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell } 301e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell 311e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell private static class SingleLineAllCapsTransform extends SingleLineTransformationMethod { 321e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell private static final String TAG = "SingleLineAllCapsTransform"; 331e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell 341e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell private Locale mLocale; 351e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell 361e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell public SingleLineAllCapsTransform(Context context) { 371e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell mLocale = context.getResources().getConfiguration().locale; 381e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell } 391e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell 401e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell @Override 411e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell public CharSequence getTransformation(CharSequence source, View view) { 421e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell source = super.getTransformation(source, view); 431e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell return source != null ? source.toString().toUpperCase(mLocale) : null; 441e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell } 451e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell } 461e37da8d4fbd23a4440f32eba784520dc7a03265Adam Powell} 47