Java Code Examples for android.widget.TextView#setTransformationMethod()

The following examples show how to use android.widget.TextView#setTransformationMethod() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: AndroidFrame   File: GridPasswordView.java    License: Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 2
Source Project: Android-Shortify   File: Views.java    License: Apache License 2.0 6 votes vote down vote up
public static $ pwd(boolean option){
    try{
        if(mView instanceof TextView){
            TextView textView = (TextView) mView;
            if(option)
                textView.setTransformationMethod(new PasswordTransformationMethod());
            else
                textView.setTransformationMethod(null);
        }
        else if(mView instanceof EditText){
            EditText editText = (EditText) mView;
            if(option)
                editText.setTransformationMethod(new PasswordTransformationMethod());
            else
                editText.setTransformationMethod(null);
        }
    }catch (Exception e){
        Log.d(TAG, e.getMessage());
    }
    return  $.getInstance();
}
 
Example 3
/**
 * Create a link from the text on the view
 *
 * @param v    TextView
 * @param text id of text to add to the field
 */
protected void createLink(TextView v, int text) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        v.setText(Html.fromHtml(getString(text), Html.FROM_HTML_MODE_LEGACY));
    } else {
        v.setText(Html.fromHtml(getString(text)));
    }
    v.setTransformationMethod(new LinkTransformationMethod());
    v.setMovementMethod(LinkMovementMethod.getInstance());
}
 
Example 4
/**
 * Create a link from the text on the view
 *
 * @param v    TextView
 * @param text id of text to add to the field
 */
protected void createLink(TextView v, int text) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        v.setText(Html.fromHtml(getString(text), Html.FROM_HTML_MODE_LEGACY));
    } else {
        v.setText(Html.fromHtml(getString(text)));
    }
    v.setTransformationMethod(new LinkTransformationMethod());
    v.setMovementMethod(LinkMovementMethod.getInstance());
}
 
Example 5
Source Project: AndroidFrame   File: GridPasswordView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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());
        }
    }
}
 
Example 6
/**
 * Create a link from the text on the view
 * @param v TextView
 * @param text id of text to add to the field
 */
protected void createLink(TextView v, int text) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        v.setText(Html.fromHtml(getString(text), Html.FROM_HTML_MODE_LEGACY));
    } else {
        v.setText(Html.fromHtml(getString(text)));
    }
    v.setTransformationMethod(new LinkTransformationMethod());
    v.setMovementMethod(LinkMovementMethod.getInstance());
}
 
Example 7
/**
 * Create a link from the text on the view
 *
 * @param v    TextView
 * @param text id of text to add to the field
 */
protected void createLink(TextView v, int text) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        v.setText(Html.fromHtml(getString(text), Html.FROM_HTML_MODE_LEGACY));
    } else {
        v.setText(Html.fromHtml(getString(text)));
    }
    v.setTransformationMethod(new LinkTransformationMethod());
    v.setMovementMethod(LinkMovementMethod.getInstance());
}
 
Example 8
Source Project: ToDay   File: ToDayAdapter.java    License: MIT License 5 votes vote down vote up
public GroupViewHolder(View itemView) {
    super(itemView);
    textView = (TextView) itemView.findViewById(R.id.text_view_title);
    textView.setTransformationMethod(
            new AllCapsTransformationMethod(textView.getContext()));
    weather = itemView.findViewById(R.id.weather);
    textViewMorning = (TextView) itemView.findViewById(R.id.text_view_morning);
    textViewAfternoon = (TextView) itemView.findViewById(R.id.text_view_afternoon);
    textViewNight = (TextView) itemView.findViewById(R.id.text_view_night);
}
 
Example 9
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Module module = mActivity.getModule();
    if (module == null)
        return null;

    final View view = inflater.inflate(R.layout.download_details, container, false);

    TextView title = view.findViewById(R.id.download_title);
    title.setText(module.name);
    title.setTextIsSelectable(true);

    TextView author = view.findViewById(R.id.download_author);
    if (module.author != null && !module.author.isEmpty())
        author.setText(getString(R.string.download_author, module.author));
    else
        author.setText(R.string.download_unknown_author);

    TextView description = view.findViewById(R.id.download_description);
    if (module.description != null) {
        if (module.descriptionIsHtml) {
            description.setText(RepoParser.parseSimpleHtml(getActivity(), module.description, description));
            description.setTransformationMethod(new LinkTransformationMethod(getActivity()));
            description.setMovementMethod(LinkMovementMethod.getInstance());
        } else {
            description.setText(module.description);
        }
        description.setTextIsSelectable(true);
    } else {
        description.setVisibility(View.GONE);
    }

    ViewGroup moreInfoContainer = view.findViewById(R.id.download_moreinfo_container);
    for (Pair<String, String> moreInfoEntry : module.moreInfo) {
        View moreInfoView = inflater.inflate(R.layout.download_moreinfo, moreInfoContainer, false);
        TextView txtTitle = moreInfoView.findViewById(android.R.id.title);
        TextView txtValue = moreInfoView.findViewById(android.R.id.message);

        txtTitle.setText(String.format(moreInfoEntry.first + "%s", ":"));
        txtValue.setText(moreInfoEntry.second);

        final Uri link = NavUtil.parseURL(moreInfoEntry.second);
        if (link != null) {
            txtValue.setTextColor(txtValue.getLinkTextColors());
            moreInfoView.setOnClickListener(v -> NavUtil.startURL(getActivity(), link));
        }

        moreInfoContainer.addView(moreInfoView);
    }

    return view;
}
 
Example 10
Source Project: AndroidProjects   File: ShadowCardView.java    License: MIT License 4 votes vote down vote up
public void hideText() {
    final TextView textView = (TextView) findViewById(R.id.text_view);
    textView.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
 
Example 11
Source Project: AndroidProjects   File: ShadowCardView.java    License: MIT License 4 votes vote down vote up
public void showText() {
    final TextView textView = (TextView) findViewById(R.id.text_view);
    textView.setTransformationMethod(null);
}
 
Example 12
public static void setSingleLineAllCaps(TextView text) {
    text.setTransformationMethod(new SingleLineAllCapsTransform(text.getContext()));
}
 
Example 13
public static void setSingleLineAllCaps(TextView text) {
    text.setTransformationMethod(new SingleLineAllCapsTransform(text.getContext()));
}
 
Example 14
public static void setSingleLineAllCaps(TextView text) {
    text.setTransformationMethod(new SingleLineAllCapsTransform(text.getContext()));
}
 
Example 15
public static void setSingleLineAllCaps(TextView text) {
    text.setTransformationMethod(new SingleLineAllCapsTransform(text.getContext()));
}
 
Example 16
Source Project: V.FlyoutTest   File: PagerTitleStripIcs.java    License: MIT License 4 votes vote down vote up
public static void setSingleLineAllCaps(TextView text) {
    text.setTransformationMethod(new SingleLineAllCapsTransform(text.getContext()));
}
 
Example 17
Source Project: guideshow   File: PagerTitleStripIcs.java    License: MIT License 4 votes vote down vote up
public static void setSingleLineAllCaps(TextView text) {
    text.setTransformationMethod(new SingleLineAllCapsTransform(text.getContext()));
}