Example usage for android.graphics Paint UNDERLINE_TEXT_FLAG

List of usage examples for android.graphics Paint UNDERLINE_TEXT_FLAG

Introduction

In this page you can find the example usage for android.graphics Paint UNDERLINE_TEXT_FLAG.

Prototype

int UNDERLINE_TEXT_FLAG

To view the source code for android.graphics Paint UNDERLINE_TEXT_FLAG.

Click Source Link

Document

Paint flag that applies an underline decoration to drawn text.

Usage

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

protected void populateFilePart(View view, FileSearchResult sr) {
    ImageView fileTypeIcon = findView(view, R.id.view_bittorrent_search_result_list_item_filetype_icon);
    fileTypeIcon.setImageResource(getFileTypeIconId());

    TextView adIndicator = findView(view, R.id.view_bittorrent_search_result_list_item_ad_indicator);
    adIndicator.setVisibility(View.GONE);

    TextView title = findView(view, R.id.view_bittorrent_search_result_list_item_title);
    title.setText(sr.getDisplayName());//from  w w  w.  j a  v  a  2  s .co m
    // if marked as downloading
    // title.setTextColor(GlobalConstants.COLOR_DARK_BLUE);

    TextView fileSize = findView(view, R.id.view_bittorrent_search_result_list_item_file_size);
    if (sr.getSize() > 0) {
        fileSize.setText(UIUtils.getBytesInHuman(sr.getSize()));
    } else {
        fileSize.setText("");
    }

    TextView extra = findView(view, R.id.view_bittorrent_search_result_list_item_text_extra);
    extra.setText(FilenameUtils.getExtension(sr.getFilename()));

    TextView seeds = findView(view, R.id.view_bittorrent_search_result_list_item_text_seeds);
    seeds.setText("");

    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() + license); // TODO: ask for design
    sourceLink.setTag(sr.getDetailsUrl());
    sourceLink.setPaintFlags(sourceLink.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
    sourceLink.setOnClickListener(linkListener);
}

From source file:org.wikipedia.page.bottomcontent.BottomContentView.java

public void setup(PageFragment parentFragment, CommunicationBridge bridge, ObservableWebView webview) {
    this.parentFragment = parentFragment;
    this.webView = webview;
    this.bridge = bridge;
    setWebView(webview);/*from  ww w . ja va  2 s  .c  om*/

    webview.addOnScrollChangeListener(this);
    webview.addOnContentHeightChangedListener(this);

    pageExternalLink.setPaintFlags(pageExternalLink.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);

    if (parentFragment.callback() != null) {
        org.wikipedia.LongPressHandler.ListViewOverflowMenuListener overflowMenuListener = new LongPressHandler(
                parentFragment);

        new org.wikipedia.LongPressHandler(readMoreList, HistoryEntry.SOURCE_INTERNAL_LINK,
                overflowMenuListener);
    }

    addOnLayoutChangeListener((View v, int left, int top, int right, int bottom, int oldLeft, int oldTop,
            int oldRight, int oldBottom) -> {
        if (prevLayoutHeight == getHeight()) {
            if (!webViewPadded) {
                padWebView();
            }
            return;
        }
        prevLayoutHeight = getHeight();
        padWebView();
    });

    readMoreList.setAdapter(readMoreAdapter);

    // hide ourselves by default
    hide();
}

From source file:com.frostwire.android.gui.adapters.SearchResultListAdapter.java

private void populateFilePart(View view, FileSearchResult sr) {
    ImageView fileTypeIcon = findView(view, R.id.view_bittorrent_search_result_list_item_filetype_icon);
    fileTypeIcon.setImageResource(getFileTypeIconId());

    TextView adIndicator = findView(view, R.id.view_bittorrent_search_result_list_item_ad_indicator);
    adIndicator.setVisibility(View.GONE);

    TextView title = findView(view, R.id.view_bittorrent_search_result_list_item_title);
    title.setText(sr.getDisplayName());//from  w w  w.  j  av  a 2 s. c o  m

    TextView fileSize = findView(view, R.id.view_bittorrent_search_result_list_item_file_size);
    if (sr.getSize() > 0) {
        fileSize.setText(UIUtils.getBytesInHuman(sr.getSize()));
    } else {
        fileSize.setText("...");
    }

    TextView extra = findView(view, R.id.view_bittorrent_search_result_list_item_text_extra);
    extra.setText(FilenameUtils.getExtension(sr.getFilename()));

    TextView seeds = findView(view, R.id.view_bittorrent_search_result_list_item_text_seeds);
    seeds.setText("");

    String license = sr.getLicense().equals(Licenses.UNKNOWN) ? "" : " - " + sr.getLicense();

    TextView sourceLink = findView(view, R.id.view_bittorrent_search_result_list_item_text_source);
    sourceLink.setText(sr.getSource() + license); // TODO: ask for design
    sourceLink.setTag(sr.getDetailsUrl());
    sourceLink.setPaintFlags(sourceLink.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
    sourceLink.setOnClickListener(linkListener);
}

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 www.  j  a  v a  2 s. c  o  m
    sourceLink.setTag(sr.getDetailsUrl());
    sourceLink.setPaintFlags(sourceLink.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
    sourceLink.setOnClickListener(linkListener);
}

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) {/*from  www.  jav  a 2s .  c o 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.ofalvai.bpinfo.ui.alert.AlertDetailFragment.java

private void displayAlert(final Alert alert) {
    mTitleTextView.setText(alert.getHeader());

    String dateString = UiUtils.alertDateFormatter(getActivity(), alert.getStart(), alert.getEnd());
    mDateTextView.setText(dateString);//from  w w w .  j  av  a2  s  .c  o  m

    // There are alerts without affected routes, eg. announcements
    for (Route route : alert.getAffectedRoutes()) {
        // Some affected routes are visually identical to others in the list, no need
        // to diplay them again.
        if (!Utils.isRouteVisuallyDuplicate(route, mDisplayedRoutes)) {
            mDisplayedRoutes.add(route);
            UiUtils.addRouteIcon(getActivity(), mRouteIconsLayout, route);
        }
    }

    if (alert.getDescription() != null) {
        mDescriptionTextView.setHtml(alert.getDescription());
    }

    if (alert.getUrl() == null) {
        mUrlTextView.setVisibility(View.GONE);
    } else {
        mUrlTextView.setPaintFlags(mUrlTextView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
        mUrlTextView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Uri url = Uri.parse(alert.getUrl());
                UiUtils.openCustomTab(getActivity(), url);
                FabricUtils.logAlertUrlClick(alert);
            }
        });
    }
}

From source file:com.project.salminnella.prescoop.activity.SchoolDetailsActivity.java

/**
 * Populates all school details that are not in the TabLayout
 *///from  ww  w  .j  a v a  2s  .  c o m
private void populateSchoolDetails() {
    mSchoolName.setText(mPreschool.getName());
    setSchoolAddressTextView();
    mPhoneNumber.setText(mPreschool.getPhoneNumber());
    mFacilityNumber.setText(String.valueOf(mPreschool.getFacilityNumber()));
    mFacilityCapacity.setText(String.valueOf(mPreschool.getCapacity()));
    mFacilityType.setText(mPreschool.getType());
    mLicenseStatus.setText(mPreschool.getLicenseStatus());
    mLicenseDate.setText(mPreschool.getLicenseDate());
    if (mPreschool.getPrice() == 999) {
        mSchoolPrice.setText(R.string.contact_school_label_details);
    } else {
        String price = "$" + mPreschool.getPrice();
        mSchoolPrice.setText(price);
    }
    mSchoolNeighborhood.setText(mPreschool.getRegion());
    mSchoolWebLink.setText(mPreschool.getWebsiteUrl());
    mSchoolWebLink.setPaintFlags(mSchoolWebLink.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
    mSchoolRating.setImageResource(Utilities.getRatingImage(mPreschool.getRating()));
}

From source file:com.app.viaje.viaje.MapsActivity.java

/**
 * @description :: Get posts.//w  w w .j  av  a 2  s.  c o m
 */
private void getPosts() {

    final Query queryRef = dbRef.child(ViajeConstants.POSTS_KEY);

    queryRef.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {

            if (dataSnapshot.getValue() != null) {

                final Map<String, Post> td = new HashMap<String, Post>();
                final ArrayList<Post> postValues = new ArrayList<>(td.values());
                List<String> keys = new ArrayList<String>(td.keySet());

                for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {

                    Post post = postSnapshot.getValue(Post.class);
                    td.put(postSnapshot.getKey(), post);

                    double lat = post.getLat();
                    double lng = post.getLng();
                    String postContent = post.getText();
                    final String username = post.getUser().getUsername();

                    LatLng location = new LatLng(lat, lng); //User current location

                    mMap.addMarker(
                            new MarkerOptions().position(location).title("post").snippet(postSnapshot.getKey())
                                    .icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_launcher)))
                            .setTag(post);

                    mMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
                        @Override
                        public boolean onMarkerClick(final Marker marker) {

                            if (marker.getTitle().contains("post")) {

                                /**
                                 * Layout Inflater for the
                                 * alert dialog when a marker
                                 * has been click
                                 */
                                LayoutInflater inflater = getLayoutInflater();
                                View dialogLayout = inflater.inflate(R.layout.dialog_layout_comment, null,
                                        false);
                                AlertDialog.Builder builder = new AlertDialog.Builder(MapsActivity.this);
                                //Create StringBuilder to have a new line in every TextView
                                StringBuilder sb = new StringBuilder("");
                                post_content = (TextView) dialogLayout.findViewById(R.id.postContent);
                                date_time = (TextView) dialogLayout.findViewById(R.id.timestampID);
                                postCommentContent = (TextView) dialogLayout
                                        .findViewById(R.id.commentContentID);
                                postCommentedBy = (TextView) dialogLayout.findViewById(R.id.commentedByID);
                                commentContentBody = (EditText) dialogLayout.findViewById(R.id.post);

                                Post p = (Post) marker.getTag();
                                System.out.println(p);

                                post_content.append(p.getText());
                                post_content.setPaintFlags(
                                        post_content.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);

                                /**
                                 * Loop every entry of p.comments
                                 * inside the marker.getTag().
                                 */
                                if (p.comments != null) {
                                    Iterator entries = p.comments.entrySet().iterator();

                                    while (entries.hasNext()) {
                                        Map.Entry myEntry = (Map.Entry) entries.next();
                                        Object key = myEntry.getKey();
                                        Post.Comment value = (Post.Comment) myEntry.getValue();
                                        String commenter = value.getUser().getUsername();
                                        String dateTime = getDate(value.getTimestamp());
                                        //String dateTime = new Date(value.getTimestamp());

                                        sb.append(commenter + " on " + dateTime + "\n \t \t" + value.getText());
                                        sb.append("\n \n");

                                        postCommentedBy.setText(sb.toString());

                                    }
                                }

                                //Button that submits a comment to a post.
                                builder.setPositiveButton("Post Comment",
                                        new DialogInterface.OnClickListener() {
                                            @Override
                                            public void onClick(DialogInterface dialog, int which) {
                                                String comment = commentContentBody.getText().toString().trim();

                                                /**
                                                 * Function declaration that
                                                 * submits a comment to the 'post'
                                                 * at firebase database.
                                                 */
                                                if (comment.isEmpty()) {
                                                    Snackbar snackbar = Snackbar.make(relativeLayout,
                                                            "Comment must not be empty..",
                                                            Snackbar.LENGTH_LONG);
                                                    View sbView = snackbar.getView();
                                                    TextView textView = (TextView) sbView.findViewById(
                                                            android.support.design.R.id.snackbar_text);
                                                    textView.setTextColor(Color.RED);
                                                    snackbar.show();
                                                } else {
                                                    postComment(comment, marker.getSnippet());
                                                }

                                            }
                                        });

                                builder.setView(dialogLayout);
                                builder.create().show();

                            } else if (marker.getTitle().contains("safezone")) {

                                /**
                                 * If the marker type is safezone
                                 * then get the advertisement instead
                                 * of posts.
                                 */
                                final Safezone sz = (Safezone) marker.getTag();

                                /**
                                 * Layout Inflater for the
                                 * alert dialog when a marker
                                 * has been click
                                 */
                                LayoutInflater inflater = getLayoutInflater();
                                View adsDialog = inflater.inflate(R.layout.show_ads_info_window, null, false);
                                AlertDialog.Builder builder = new AlertDialog.Builder(MapsActivity.this);

                                ads_image = (ImageView) adsDialog.findViewById(R.id.ads);
                                adText = (TextView) adsDialog.findViewById(R.id.adText);
                                adTime = (TextView) adsDialog.findViewById(R.id.timestampID);
                                adTitle = (TextView) adsDialog.findViewById(R.id.adTitle);
                                shop_name = (TextView) adsDialog.findViewById(R.id.shop_name);

                                String service_type = sz.getService_information_type();
                                String username = sz.getUsername();
                                System.out.print(username);

                                if (service_type.contains("repair")) {

                                    /**
                                     * @description Get ads of every
                                     * safezone
                                     */
                                    getAds(sz);

                                } else if (service_type.contains("hospital")) {

                                    /**
                                     * @description Get ads of every
                                     * safezone
                                     */
                                    getAds(sz);

                                } else if (service_type.contains("towing")) {

                                    /**
                                     * @description Get ads of every
                                     * safezone
                                     */
                                    getAds(sz);

                                } else if (service_type.contains("vulcanizing")) {

                                    /**
                                     * @description Get ads of every
                                     * safezone
                                     */
                                    getAds(sz);

                                } else if (service_type.contains("gasoline")) {

                                    /**
                                     * @description Get ads of every
                                     * safezone
                                     */
                                    getAds(sz);

                                }

                                builder.setView(adsDialog);
                                builder.create().show();

                            } else {
                                Snackbar snackbar = Snackbar.make(relativeLayout, "Current Location..",
                                        Snackbar.LENGTH_LONG);
                                View sbView = snackbar.getView();
                                TextView textView = (TextView) sbView
                                        .findViewById(android.support.design.R.id.snackbar_text);
                                textView.setTextColor(
                                        ContextCompat.getColor(getApplicationContext(), R.color.app_color));
                                snackbar.show();
                            }

                            return true;
                        }
                    });

                }

            } //end if
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {

        }
    });

}

From source file:com.project.salminnella.prescoop.activity.SchoolDetailsActivity.java

/**
 * Calls Yelp API//from w  w w  . j  a  va  2s .c  om
 */
private void callYelpProvider() {
    YelpAPIFactory apiFactory = new YelpAPIFactory(BuildConfig.YELP_CONSUMER_KEY,
            BuildConfig.YELP_CONSUMER_SECRET, BuildConfig.YELP_TOKEN, BuildConfig.YELP_TOKEN_SECRET);

    YelpAPI yelpAPI = apiFactory.createAPI();
    Map<String, String> params = new HashMap<>();

    // general params
    params.put(Constants.YELP_SEARCH_PARAM_TERMS, mPreschool.getName());
    params.put(Constants.YELP_SEARCH_PARAM_LIMIT, Constants.YELP_RESPONSE_LIMIT_STRING);
    params.put(Constants.YELP_SEARCH_PARAM_CATEGORY, Constants.YELP_CATEGORY);
    params.put(Constants.YELP_SEARCH_PARAM_SORT, Constants.YELP_SORT);

    Call<SearchResponse> call = yelpAPI.search(Constants.YELP_SEARCH_PARAM_LOCATION, params);
    Callback<SearchResponse> callback = new Callback<SearchResponse>() {
        @Override
        public void onResponse(Call<SearchResponse> call, Response<SearchResponse> response) {
            SearchResponse searchResponse = response.body();
            if (searchResponse.total() == 0) {
                mYelpTitleText.setText(R.string.empty_yelp_response);
            } else {
                // Update UI text with the searchResponse.
                mYelpSchoolMatch = filterYelpResponse(searchResponse);
                if (mYelpSchoolMatch != null) {
                    mYelpTitleText.setText(mYelpSchoolMatch.name());
                    Picasso.with(SchoolDetailsActivity.this).load(mYelpSchoolMatch.ratingImgUrlLarge())
                            .into(mYelpRating);
                    String reviewText = String.valueOf(mYelpSchoolMatch.reviewCount())
                            + getString(R.string.yelp_reviews_text);
                    mYelpNumReviews.setText(reviewText);
                    mYelpSnippet.setText(mYelpSchoolMatch.snippetText());
                    mYelpTitleText.setPaintFlags(mYelpTitleText.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
                    mYelpTitleText.setTextColor(Color.parseColor(getString(R.string.html_color_num_blue)));
                    setYelpClickListener();
                } else {
                    mYelpTitleText.setText(R.string.empty_yelp_response_title);
                    ArrayList<Business> businesses = searchResponse.businesses();
                    mYelpAdapter = new YelpAdapter(SchoolDetailsActivity.this, businesses);
                    mYelpListView.setAdapter(mYelpAdapter);
                }
            }
        }

        @Override
        public void onFailure(Call<SearchResponse> call, Throwable t) {
            // Handle HTTP error
        }
    };

    call.enqueue(callback);
}

From source file:net.bither.fragment.hot.OptionHotFragment.java

private void initView(View view) {
    ssvCurrency = (SettingSelectorView) view.findViewById(R.id.ssv_currency);
    ssvMarket = (SettingSelectorView) view.findViewById(R.id.ssv_market);
    ssvTransactionFee = (SettingSelectorView) view.findViewById(R.id.ssv_transaction_fee);
    ssvBitcoinUnit = (SettingSelectorView) view.findViewById(R.id.ssv_bitcoin_unit);
    tvVersion = (TextView) view.findViewById(R.id.tv_version);
    tvWebsite = (TextView) view.findViewById(R.id.tv_website);
    tvWebsite.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
    ivLogo = (ImageView) view.findViewById(R.id.iv_logo);
    btnSwitchToCold = (Button) view.findViewById(R.id.btn_switch_to_cold);
    llSwitchToCold = view.findViewById(R.id.ll_switch_to_cold);
    btnAvatar = (Button) view.findViewById(R.id.btn_avatar);
    btnCheck = (Button) view.findViewById(R.id.btn_check_private_key);
    btnDonate = (Button) view.findViewById(R.id.btn_donate);
    btnAdvance = (Button) view.findViewById(R.id.btn_advance);
    ssvCurrency.setSelector(currencySelector);
    ssvMarket.setSelector(marketSelector);
    ssvTransactionFee.setSelector(transactionFeeModeSelector);
    ssvBitcoinUnit.setSelector(bitcoinUnitSelector);
    dp = new DialogProgress(getActivity(), R.string.please_wait);
    dp.setCancelable(false);/*from  www .j  av  a2 s  .  c  o m*/
    String version = null;
    try {
        version = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(),
                0).versionName;
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }
    if (version != null) {
        tvVersion.setText(version);
        tvVersion.setVisibility(View.VISIBLE);
    } else {
        tvVersion.setVisibility(View.GONE);
    }
    btnSwitchToCold.setOnClickListener(switchToColdClick);
    btnCheck.setOnClickListener(checkClick);
    btnDonate.setOnClickListener(donateClick);
    btnAvatar.setOnClickListener(avatarClick);
    btnAdvance.setOnClickListener(advanceClick);
    tvWebsite.setOnClickListener(websiteClick);
    ivLogo.setOnClickListener(logoClickListener);
    setAvatar(AppSharedPreference.getInstance().getUserAvatar());
}