@Test public void shouldAllowSettingATransformationMethod() { textView.setTransformationMethod(PasswordTransformationMethod.getInstance()); assertThat(textView.getTransformationMethod()).isInstanceOf(PasswordTransformationMethod.class); }
if (Build.VERSION.SDK_INT <= 14) { mAmPmTextView.setTransformationMethod(new TransformationMethod() {
TextView textView = (TextView) findViewById(R.id.textview); textView.setTransformationMethod(null); ... textView.setText(ss);
/** * Set the enabled state of this view. */ @Override public void setPasswordVisibility(boolean visible) { for (TextView textView : mViewArr) { textView.setTransformationMethod(visible ? null : mTransformationMethod); if (textView instanceof EditText) { EditText et = (EditText) textView; et.setSelection(et.getText().length()); } } }
private void setCustomAttr(TextView view) { if (mTextColor != null) view.setTextColor(mTextColor); view.setTextSize(mTextSize); int inputType = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD; switch (mPasswordType) { case 1: inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD; break; case 2: inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; break; case 3: inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD; break; } view.setInputType(inputType); view.setTransformationMethod(mTransformationMethod); }
private void setShowMode(TextView textView){ if (mShowMode == NORMAL) textView.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); else textView.setTransformationMethod(PasswordTransformationMethod.getInstance()); }
@Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; UserAccountDataHolder holder = null; if (row == null) { LayoutInflater inflater = ((Activity) context).getLayoutInflater(); row = inflater.inflate(layoutResourceId, parent, false); } UserAccountData userAccountData = data[position]; TextView tvTitle = (TextView) row.findViewById(R.id.txtTitle); if(userAccountData.type.equals("pass")){ tvTitle.setTransformationMethod(new PasswordTransformationMethod()); } if(userAccountData.type.equals("notPass")){ tvTitle .setTransformationMethod(null); } }
@SuppressLint("NewApi") public static void setAllCaps(TextView textView, boolean allCaps) { if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH){ textView.setAllCaps(allCaps); }else{ textView.setTransformationMethod(allCaps ? AllCapsTransformationMethodCompat.getInstance() : null); } }
public static void setSingleLineAllCaps(TextView text) { text.setTransformationMethod(new SingleLineAllCapsTransform(text.getContext())); }
public TimeView(Context context, TimeRange t) { super(context); setOrientation(LinearLayout.HORIZONTAL); setPadding(5, 10, 5, 10); dateRange = new TextView(context); dateRange.setTextSize(fontSize); addView(dateRange, new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, 1f)); total = new TextView(context); total.setTextSize(fontSize); total.setGravity(Gravity.RIGHT); total.setTransformationMethod(SingleLineTransformationMethod.getInstance()); addView(total, new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, 0.0f)); setTimeRange(t); }
public ActivityView(Context context, Activity t) { super(context); setOrientation(LinearLayout.HORIZONTAL); setPadding(5, 10, 5, 10); name = new TextView(context); name.setTextSize(fontSize); name.setText(t.getName()); addView(name, new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, 1f)); checkMark = new ImageView(context); checkMark.setImageResource(R.drawable.ic_check_mark_dark); checkMark.setVisibility(View.INVISIBLE); addView(checkMark, new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, 0f)); total = new TextView(context); total.setTextSize(fontSize); total.setGravity(Gravity.RIGHT); total.setTransformationMethod(SingleLineTransformationMethod.getInstance()); total.setText(formatTotal(decimalFormat, t.getTotal(), 0)); addView(total, new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, 0f)); setGravity(Gravity.TOP); markupSelectedActivity(t); }
mAmPmTextView.setTransformationMethod(new TransformationMethod() {