Example usage for android.widget TextView setPaintFlags

List of usage examples for android.widget TextView setPaintFlags

Introduction

In this page you can find the example usage for android.widget TextView setPaintFlags.

Prototype

@android.view.RemotableViewMethod
public void setPaintFlags(int flags) 

Source Link

Document

Sets flags on the Paint being used to display the text and reflows the text if they are different from the old flags.

Usage

From source file:com.anysoftkeyboard.ui.tutorials.ChangeLogFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    LayoutInflater inflater = LayoutInflater.from(getActivity());

    ViewGroup logContainer = (ViewGroup) view.findViewById(getLogItemsContainerId());

    for (VersionChangeLogs.VersionChangeLog change : VersionChangeLogs.createChangeLog()) {
        View logHeader = inflater.inflate(R.layout.changelogentry_header, logContainer, false);
        TextView versionName = (TextView) logHeader.findViewById(R.id.changelog_version_title);
        versionName.setPaintFlags(versionName.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
        setTitleText(versionName, change.versionName);

        logContainer.addView(logHeader);
        for (String changeEntry : change.changes) {
            TextView entryView = (TextView) inflater.inflate(R.layout.changelogentry_item, logContainer, false);
            entryView.setText(getString(R.string.change_log_bullet_point, changeEntry));
            logContainer.addView(entryView);
        }//  w w w  .j  av a2 s.  co m
        //TODO: add milestone url
        if (mLogToShow == SHOW_LATEST_CHANGELOG)
            break;//in this case, one is enough.
        //adding a divider between version
        logContainer.addView(inflater.inflate(R.layout.transparent_divider, logContainer, false));
    }
}

From source file:nodomain.freeyourgadget.gadgetbridge.activities.CalBlacklistActivity.java

private void toggleEntry(View view) {
    TextView name = (TextView) view.findViewById(R.id.calendar_name);
    CheckBox checked = (CheckBox) view.findViewById(R.id.item_checkbox);

    name.setPaintFlags(name.getPaintFlags() ^ Paint.STRIKE_THRU_TEXT_FLAG);
    checked.toggle();//www  .  j av a2 s.  com
}

From source file:io.upnext.beaconcontrol.app.LoginActivity.java

private void wireViews() {
    emailEditText = (EditText) findViewById(R.id.email);
    passwordEditText = (EditText) findViewById(R.id.password);
    passwordEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override/*  ww w. j ava2 s . co m*/
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                logIn();
            }
            return false;
        }
    });
    progressBar = (ProgressBar) findViewById(R.id.progress_bar);

    Button loginButton = (Button) findViewById(R.id.login_btn);
    loginButton.setOnClickListener(loginButtonListener);

    TextView createAccountLink = (TextView) findViewById(R.id.create_account);
    createAccountLink.setPaintFlags(createAccountLink.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
    createAccountLink.setOnClickListener(createAccountListener);
}

From source file:com.skyousuke.ivtool.view.HintSpinnerAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = LayoutInflater.from(context).inflate(R.layout.simple_spinner, parent, false);
    }/* ww  w  . j  av  a  2 s.c  o  m*/
    TextView text = ViewHolder.get(convertView, R.id.simple_spinner_text);
    Object item = getItem(position);
    text.setText(item.toString());
    if (isEqualHint(item)) {
        text.setPaintFlags(text.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
        text.setTextColor(ContextCompat.getColor(context, R.color.dark_gray));
    } else {
        if (color == ContextCompat.getColor(context, R.color.dark_yellow)) {
            TextViewCompat.setTextAppearance(text, R.style.ShadowText);
        } else
            TextViewCompat.setTextAppearance(text, R.style.NoShadowText);
        text.setTextColor(color);
    }
    return convertView;
}

From source file:com.justwayward.reader.view.recyclerview.adapter.BaseViewHolder.java

public BaseViewHolder setTypeface(int viewId, Typeface typeface) {
    TextView view = getView(viewId);
    view.setTypeface(typeface);/* w  w  w . j av  a2 s .  co m*/
    view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
    return this;
}

From source file:com.justwayward.reader.view.recyclerview.adapter.BaseViewHolder.java

public BaseViewHolder setTypeface(Typeface typeface, int... viewIds) {
    for (int viewId : viewIds) {
        TextView view = getView(viewId);
        view.setTypeface(typeface);//from  w  ww. jav a 2  s  . c  om
        view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
    }
    return this;
}

From source file:de.gebatzens.sia.dialog.LoginDialog.java

@Override
public void onStart() {
    super.onStart();

    boolean hideSid = getArguments().getBoolean("hideSid");
    String sid = getArguments().getString("sid");
    boolean auth = getArguments().getBoolean("auth");
    String user = getArguments().getString("user");
    final AlertDialog dialog = (AlertDialog) getDialog();

    ((SetupActivity) getActivity()).currentLoginDialog = dialog;

    if (auth) {//  ww w  .  j  ava 2s . co m
        final EditText passwordInput = (EditText) dialog.findViewById(R.id.passwordInput);
        final CheckBox passwordToggle = (CheckBox) dialog.findViewById(R.id.passwordToggle);
        passwordToggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (!isChecked) {
                    passwordInput.setTransformationMethod(PasswordTransformationMethod.getInstance());
                    passwordInput.setSelection(passwordInput.getText().length());
                } else {
                    passwordInput.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
                    passwordInput.setSelection(passwordInput.getText().length());
                }
            }
        });

        ((EditText) dialog.findViewById(R.id.usernameInput)).setText(user);
    } else {
        dialog.findViewById(R.id.passwordInput).setVisibility(View.GONE);
        dialog.findViewById(R.id.passwordToggle).setVisibility(View.GONE);
        dialog.findViewById(R.id.usernameInput).setVisibility(View.GONE);
    }

    if (hideSid) {
        dialog.findViewById(R.id.sidInput).setVisibility(View.GONE);
    } else {
        ((EditText) dialog.findViewById(R.id.sidInput)).setText(sid);
    }

    TextView acceptTermsLink = (TextView) dialog.findViewById(R.id.acceptTermsLink);
    acceptTermsLink.setPaintFlags(acceptTermsLink.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);

    acceptTermsLink.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View widget) {
            Intent i = new Intent(activity, TextActivity.class);
            i.putExtra("title", R.string.terms_title);
            i.putExtra("text", R.array.terms);
            activity.startActivity(i);
        }
    });

    final CheckBox acceptTerms = (CheckBox) dialog.findViewById(R.id.acceptTerms);

    acceptTerms.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            dialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(isChecked);
        }
    });

    dialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(acceptTerms.isChecked());

}

From source file:com.aniruddhc.acemusic.player.Dialogs.AddMusicLibraryDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    libraryLabelID = "circle_blue_dark";
    View rootView = getActivity().getLayoutInflater().inflate(R.layout.dialog_add_music_library, null);
    TextView instructions = (TextView) rootView.findViewById(R.id.add_music_library_instructions);
    instructions.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light"));
    instructions.setPaintFlags(instructions.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    final ImageButton labelButton = (ImageButton) rootView.findViewById(R.id.add_music_library_label_button);
    final EditText musicLibraryName = (EditText) rootView.findViewById(R.id.add_music_library_text_field);
    musicLibraryName.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light"));
    musicLibraryName/*from  w  ww  . j a  v  a 2 s . co  m*/
            .setPaintFlags(musicLibraryName.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    labelButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            //Create a new array with a list of all the library labels.
            final Drawable[] labelsArray = {
                    getActivity().getResources().getDrawable(R.drawable.circle_blue_dark),
                    getActivity().getResources().getDrawable(R.drawable.circle_blue_light),
                    getActivity().getResources().getDrawable(R.drawable.circle_green_dark),
                    getActivity().getResources().getDrawable(R.drawable.circle_green_light),
                    getActivity().getResources().getDrawable(R.drawable.circle_purple_dark),
                    getActivity().getResources().getDrawable(R.drawable.circle_purple_light),
                    getActivity().getResources().getDrawable(R.drawable.circle_red_dark),
                    getActivity().getResources().getDrawable(R.drawable.circle_red_light),
                    getActivity().getResources().getDrawable(R.drawable.circle_yellow_dark),
                    getActivity().getResources().getDrawable(R.drawable.circle_yellow_light) };

            //Create a new array with a list of all the library labels.
            final String[] labelsIdsArray = { "circle_blue_dark", "circle_blue_light", "circle_green_dark",
                    "circle_green_light", "circle_purple_dark", "circle_purple_light", "circle_red_dark",
                    "circle_red_light", "circle_yellow_dark", "circle_yellow_light" };

            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
            builder.setTitle(R.string.music_library_label);
            ArrayList<String> labelTitles = new ArrayList<String>();
            labelTitles
                    .addAll(Arrays.asList(getActivity().getResources().getStringArray(R.array.library_labels)));
            builder.setAdapter(new LibraryLabelsAdapter(getActivity(), labelTitles), new OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    libraryLabelID = labelsIdsArray[which];
                    labelButton.setImageDrawable(labelsArray[which]);

                }

            });

            builder.create().show();

        }

    });

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    //Set the dialog title.
    builder.setTitle(R.string.add_music_library);
    builder.setView(rootView);
    builder.setPositiveButton(R.string.ok, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int arg1) {
            String libraryName = musicLibraryName.getText().toString();

            Intent intent = new Intent(getActivity(), MusicLibraryEditorActivity.class);
            Bundle bundle = new Bundle();
            bundle.putString("LIBRARY_NAME", libraryName);
            bundle.putString("LIBRARY_ICON", libraryLabelID);
            intent.putExtras(bundle);
            startActivity(intent);

            dialog.dismiss();
            getActivity().finish();

        }

    });

    builder.setNegativeButton(R.string.cancel, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int arg1) {
            dialog.dismiss();
            getActivity().finish();

        }

    });

    return builder.create();
}

From source file:com.bt.download.android.gui.adapters.SearchResultListAdapter.java

protected void populateAppiaPart(View view, AppiaSearchResult sr) {
    TextView adIndicator = findView(view, R.id.view_bittorrent_search_result_list_item_ad_indicator);
    adIndicator.setVisibility(View.VISIBLE);

    TextView extra = findView(view, R.id.view_bittorrent_search_result_list_item_text_extra);
    extra.setText(sr.getCategoryName() + " : " + sr.getDescription());

    //TextView seeds = findView(view, R.id.view_bittorrent_search_result_list_item_text_seeds);
    //String license = sr.getLicense().equals(License.UNKNOWN) ? "" : " - " + sr.getLicense();

    TextView sourceLink = findView(view, R.id.view_bittorrent_search_result_list_item_text_source);
    sourceLink.setText(sr.getSource());/*from  w w  w  . j av  a  2s . c  o  m*/
    sourceLink.setTag(sr.getDetailsUrl());
    sourceLink.setPaintFlags(sourceLink.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
    sourceLink.setOnClickListener(linkListener);
}

From source file:com.maxleap.mall.activities.ProductDetailActivity.java

private void initViews() {
    Toolbar toolbar = mBinding.toolbar;/*from  ww w  .j  a  va 2  s .  c o m*/
    toolbar.setTitle(R.string.activity_product_detail_title);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });

    TextView tv = mBinding.originPrice;
    tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);

    mBinding.review.setOnClickListener(this);
    mBinding.spec.setOnClickListener(this);
    mBinding.detail.setOnClickListener(this);
    mBinding.increaseQuantity.setOnClickListener(this);
    mBinding.decreaseQuantity.setOnClickListener(this);
    mBinding.fav.setOnClickListener(this);
    mBinding.cart.setOnClickListener(this);
    mBinding.addToCart.setOnClickListener(this);
    mBinding.info1Layout.setOnClickListener(this);
    mBinding.info2Layout.setOnClickListener(this);
    mBinding.info3Layout.setOnClickListener(this);

    checkFav();

    initViewPager();

    mBinding.cartNum.setVisibility(View.GONE);
    CartPreferenceUtil cartPreferenceUtil = CartPreferenceUtil.getComplexPreferences(getApplicationContext());
    // CartList cartList = cartPreferenceUtil.getObject(CartPreferenceUtil.KEY, CartList.class);
    List<ProductData> dataList = cartPreferenceUtil.getProductData();
    if (dataList != null && dataList.size() > 0) {
        mBinding.cartNum.setVisibility(View.VISIBLE);
        mBinding.cartNum.setText(dataList.size() + "");
    }

}