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

The following examples show how to use android.widget.TextView#setTransformationMethod() . 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 check out the related API usage on the sidebar.
Example 1
Source File: GridPasswordView.java    From AndroidFrame with 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 File: Views.java    From Android-Shortify with 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
Source File: BaseDialogFragment.java    From natrium-android-wallet with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * 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
Source File: BaseFragment.java    From natrium-android-wallet with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * 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 File: GridPasswordView.java    From AndroidFrame with 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
Source File: BaseDialogFragment.java    From nano-wallet-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * 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
Source File: BaseFragment.java    From nano-wallet-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * 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 File: ToDayAdapter.java    From ToDay with 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
Source File: PagerTitleStripIcs.java    From guideshow with MIT License 4 votes vote down vote up
public static void setSingleLineAllCaps(TextView text) {
    text.setTransformationMethod(new SingleLineAllCapsTransform(text.getContext()));
}
 
Example 10
Source File: DownloadDetailsFragment.java    From EdXposedManager with GNU General Public License v3.0 4 votes vote down vote up
@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 11
Source File: PagerTitleStripIcs.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
public static void setSingleLineAllCaps(TextView text) {
    text.setTransformationMethod(new SingleLineAllCapsTransform(text.getContext()));
}
 
Example 12
Source File: PagerTitleStriplcs.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
public static void setSingleLineAllCaps(TextView text) {
    text.setTransformationMethod(new SingleLineAllCapsTransform(text.getContext()));
}
 
Example 13
Source File: PagerTitleStriplcs.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
public static void setSingleLineAllCaps(TextView text) {
    text.setTransformationMethod(new SingleLineAllCapsTransform(text.getContext()));
}
 
Example 14
Source File: PagerTitleStripIcs.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
public static void setSingleLineAllCaps(TextView text) {
    text.setTransformationMethod(new SingleLineAllCapsTransform(text.getContext()));
}
 
Example 15
Source File: PagerTitleStripIcs.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
public static void setSingleLineAllCaps(TextView text) {
    text.setTransformationMethod(new SingleLineAllCapsTransform(text.getContext()));
}
 
Example 16
Source File: ShadowCardView.java    From AndroidProjects with MIT License 4 votes vote down vote up
public void showText() {
    final TextView textView = (TextView) findViewById(R.id.text_view);
    textView.setTransformationMethod(null);
}
 
Example 17
Source File: ShadowCardView.java    From AndroidProjects with MIT License 4 votes vote down vote up
public void hideText() {
    final TextView textView = (TextView) findViewById(R.id.text_view);
    textView.setTransformationMethod(PasswordTransformationMethod.getInstance());
}