Example usage for android.text Html fromHtml

List of usage examples for android.text Html fromHtml

Introduction

In this page you can find the example usage for android.text Html fromHtml.

Prototype

@Deprecated
public static Spanned fromHtml(String source) 

Source Link

Document

Returns displayable styled text from the provided HTML string with the legacy flags #FROM_HTML_MODE_LEGACY .

Usage

From source file:gr.scify.newsum.ui.SearchViewActivity.java

private void share() {
    TextView title = (TextView) findViewById(R.id.title);
    String sTitle = title.getText().toString();
    Intent share = new Intent(this, ShareBarActivity.class);
    share.putExtra("summaryF", "" + Html.fromHtml("<h2>" + sTitle + "</h2><br>" + pText));
    share.putExtra("summaryT", sTitle);

    this.startActivityForResult(share, 0);

}

From source file:ru.orangesoftware.financisto.export.flowzr.FlowzrSyncEngine.java

public static String makeRequest(String tableName, String json)
        throws ClientProtocolException, IOException, JSONException, Exception {
    if (isCanceled) {
        return FLOWZR_MSG_NET_ERROR;
    }//from  w  ww. ja  v  a  2 s  . c  o m

    String uri = FLOWZR_API_URL + nsString + "/" + tableName + "/";
    String strResponse;

    HttpPost httpPost = new HttpPost(uri);

    httpPost.setEntity(new StringEntity(json, HTTP.UTF_8));
    httpPost.addHeader("Cookie", "dev_appserver_login=test@example.com:False:18580476422013912411");

    HttpResponse response = http_client.execute(httpPost);
    HttpEntity entity = response.getEntity();
    int code = response.getStatusLine().getStatusCode();
    BufferedReader reader = new BufferedReader(new InputStreamReader(entity.getContent()));
    strResponse = reader.readLine();
    if (!tableName.equals("currency_exchange_rate")) {
        JSONArray arr = new JSONArray();
        arr = new JSONArray(strResponse);
        for (int i = 0; i < arr.length(); i++) {
            JSONObject o = arr.getJSONObject(i);
            String key = o.getString("key");
            int id = o.getInt("id");
            ContentValues args = new ContentValues();
            args.put("remote_key", key);
            db.update(tableName, args, String.format("%s = ?", "_id"), new String[] { String.valueOf(id) });
        }
    }
    entity.consumeContent();
    if (code != 200) {
        throw new Exception(Html.fromHtml(strResponse).toString());
    }
    return strResponse;
}

From source file:com.cssn.samplesdk.ShowDataActivity.java

/**
 * /*  ww  w .j ava 2 s  . c om*/
 */
private void setResultsForDriversLicenseCard() {
    DriversLicenseCard processedLicenseCard = DataContext.getInstance().getProcessedLicenseCard();

    StringBuilder info = new StringBuilder();
    // name
    info.append(("Name").concat(" - ")).append(processedLicenseCard.getName()).append("<br/>");
    // first name
    info.append(("First Name").concat(" - ")).append(processedLicenseCard.getNameFirst()).append("<br/>");
    // middle name
    info.append(("Middle Name").concat(" - ")).append(processedLicenseCard.getNameMiddle()).append("<br/>");
    // last name
    info.append(("Last Name").concat(" - ")).append(processedLicenseCard.getNameLast()).append("<br/>");
    // name suffix
    info.append(("Name Suffix").concat(" - ")).append(processedLicenseCard.getNameSuffix()).append("<br/>");
    // license id
    info.append(("ID").concat(" - ")).append(processedLicenseCard.getLicenceID()).append("<br/>");
    // license
    info.append(("License").concat(" - ")).append(processedLicenseCard.getLicense()).append("<br/>");
    // date of birth long
    info.append(("DOB Long").concat(" - ")).append(processedLicenseCard.getDateOfBirth4()).append("<br/>");
    // date of birth short
    info.append(("DOB Short").concat(" - ")).append(processedLicenseCard.getDateOfBirth()).append("<br/>");
    // date of birth local
    info.append(("Date Of Birth Local").concat(" - ")).append(processedLicenseCard.getDateOfBirthLocal())
            .append("<br/>");
    // issue date long
    info.append(("Issue Date Long").concat(" - ")).append(processedLicenseCard.getIssueDate4()).append("<br/>");
    // issue date short
    info.append(("Issue Date Short").concat(" - ")).append(processedLicenseCard.getIssueDate()).append("<br/>");
    // issue date local
    info.append(("Issue Date Local").concat(" - ")).append(processedLicenseCard.getIssueDateLocal())
            .append("<br/>");

    // expiration date long
    info.append(("Expiration Date Long").concat(" - ")).append(processedLicenseCard.getExpirationDate4())
            .append("<br/>");
    // expiration date short
    info.append(("Expiration Date Short").concat(" - ")).append(processedLicenseCard.getExpirationDate())
            .append("<br/>");

    // eye color
    info.append(("EyeColor").concat(" - ")).append(processedLicenseCard.getEyeColor()).append("<br/>");
    // hair color
    info.append(("HairColor").concat(" - ")).append(processedLicenseCard.getHair()).append("<br/>");
    // height
    info.append(("Height").concat(" - ")).append(processedLicenseCard.getHeight()).append("<br/>");
    // weight
    info.append(("Weight").concat(" - ")).append(processedLicenseCard.getWeight()).append("<br/>");

    // address
    info.append(("Address").concat(" - ")).append(processedLicenseCard.getAddress()).append("<br/>");
    // address 2
    info.append(("Address 2").concat(" - ")).append(processedLicenseCard.getAddress2()).append("<br/>");
    // address 3
    info.append(("Address 3").concat(" - ")).append(processedLicenseCard.getAddress3()).append("<br/>");
    // address 4
    info.append(("Address 4").concat(" - ")).append(processedLicenseCard.getAddress4()).append("<br/>");
    // address 5
    info.append(("Address 5").concat(" - ")).append(processedLicenseCard.getAddress5()).append("<br/>");
    // address 6
    info.append(("Address 6").concat(" - ")).append(processedLicenseCard.getAddress6()).append("<br/>");

    // city
    info.append(("City").concat(" - ")).append(processedLicenseCard.getCity()).append("<br/>");
    // zip
    info.append(("Zip").concat(" - ")).append(processedLicenseCard.getZip()).append("<br/>");
    // state
    info.append(("State").concat(" - ")).append(processedLicenseCard.getState()).append("<br/>");
    // country
    info.append(("Country").concat(" - ")).append(processedLicenseCard.getCounty()).append("<br/>");
    // country short
    info.append(("Country short").concat(" - ")).append(processedLicenseCard.getCountryShort()).append("<br/>");
    // country long
    info.append(("Country long").concat(" - ")).append(processedLicenseCard.getIdCountry()).append("<br/>");

    // license class
    info.append(("Class").concat(" - ")).append(processedLicenseCard.getLicenceClass()).append("<br/>");
    // restriction
    info.append(("Restriction").concat(" - ")).append(processedLicenseCard.getRestriction()).append("<br/>");
    // sex
    info.append(("Sex").concat(" - ")).append(processedLicenseCard.getSex()).append("<br/>");
    // audit
    info.append(("Audit").concat(" - ")).append(processedLicenseCard.getAudit()).append("<br/>");
    // Endorsements
    info.append(("Endorsements").concat(" - ")).append(processedLicenseCard.getEndorsements()).append("<br/>");
    // Fee
    info.append(("Fee").concat(" - ")).append(processedLicenseCard.getFee()).append("<br/>");
    // CSC
    info.append(("CSC").concat(" - ")).append(processedLicenseCard.getCSC()).append("<br/>");
    // SigNum
    info.append(("SigNum").concat(" - ")).append(processedLicenseCard.getSigNum()).append("<br/>");
    // Text1
    info.append(("Text1").concat(" - ")).append(processedLicenseCard.getText1()).append("<br/>");
    // Text2
    info.append(("Text2").concat(" - ")).append(processedLicenseCard.getText2()).append("<br/>");
    // Text3
    info.append(("Text3").concat(" - ")).append(processedLicenseCard.getText3()).append("<br/>");
    // Type
    info.append(("Type").concat(" - ")).append(processedLicenseCard.getType()).append("<br/>");
    // Doc Type
    info.append(("Doc Type").concat(" - ")).append(processedLicenseCard.getDocType()).append("<br/>");
    // Father Name
    info.append(("Father Name").concat(" - ")).append(processedLicenseCard.getFatherName()).append("<br/>");
    // Mother Name
    info.append(("Mother Name").concat(" - ")).append(processedLicenseCard.getMotherName()).append("<br/>");
    // NameFirst_NonMRZ
    info.append(("NameFirst_NonMRZ").concat(" - ")).append(processedLicenseCard.getNameFirst_NonMRZ())
            .append("<br/>");
    // NameFirst_NonMRZ
    info.append(("NameLast_NonMRZ").concat(" - ")).append(processedLicenseCard.getNameLast_NonMRZ())
            .append("<br/>");
    // NameLast1
    info.append(("NameLast1").concat(" - ")).append(processedLicenseCard.getNameLast1()).append("<br/>");
    // NameLast2
    info.append(("NameLast2").concat(" - ")).append(processedLicenseCard.getNameLast2()).append("<br/>");
    // NameMiddle_NonMRZ
    info.append(("NameMiddle_NonMRZ").concat(" - ")).append(processedLicenseCard.getNameMiddle_NonMRZ())
            .append("<br/>");
    // NameSuffix_NonMRZ
    info.append(("NameSuffix_NonMRZ").concat(" - ")).append(processedLicenseCard.getNameSuffix_NonMRZ())
            .append("<br/>");
    // Nationality
    info.append(("Nationality").concat(" - ")).append(processedLicenseCard.getNationality()).append("<br/>");
    // Original
    info.append(("Original").concat(" - ")).append(processedLicenseCard.getOriginal()).append("<br/>");
    // PlaceOfBirth
    info.append(("Place Of Birth").concat(" - ")).append(processedLicenseCard.getPlaceOfBirth())
            .append("<br/>");
    // PlaceOfIssue
    info.append(("Place Of Issue").concat(" - ")).append(processedLicenseCard.getPlaceOfIssue())
            .append("<br/>");
    // Social Security
    info.append(("Social Security").concat(" - ")).append(processedLicenseCard.getSocialSecurity())
            .append("<br/>");
    info.append("IsAddressCorrected ".concat(" - ")).append(processedLicenseCard.isAddressCorrected())
            .append("<br/>");
    info.append("IsAddressVerified ".concat(" - ")).append(processedLicenseCard.isAddressVerified())
            .append("<br/>");

    textViewCardInfo.setText(Html.fromHtml(info.toString()));

    frontSideCardImageView.setImageBitmap(
            Util.getRoundedCornerBitmap(processedLicenseCard.getReformatImage(), this.getApplicationContext()));
    imgFaceViewer.setImageBitmap(processedLicenseCard.getFaceImage());
    imgSignatureViewer.setImageBitmap(processedLicenseCard.getSignImage());
}

From source file:com.activiti.android.ui.form.FormManager.java

/**
 * Unsupported + Required field//  w  w  w.j a  v a2  s  . c o  m
 */
public void abort() {
    getActivity().getSupportFragmentManager().popBackStack();

    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity())
            .title(R.string.form_message_unsupported_title)
            .cancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialog) {
                    dialog.dismiss();
                }
            }).content(Html.fromHtml(getActivity().getString(R.string.form_message_unsupported_description)))
            .positiveText(R.string.ok).callback(new MaterialDialog.ButtonCallback() {
                @Override
                public void onPositive(MaterialDialog dialog) {
                }
            });
    builder.show();
}

From source file:gr.scify.newsum.ui.SearchViewActivity.java

private void Sendmail() {
    TextView title = (TextView) findViewById(R.id.title);
    String emailSubject = title.getText().toString();

    // track the Send mail action
    if (getAnalyticsPref()) {
        EasyTracker.getTracker().sendEvent(SHARING_ACTION, "Send Mail", emailSubject, 0l);
    }/*from ww  w  .j  a  va2  s .c  o m*/
    final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.setType("text/html");
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "NewSum app : " + emailSubject);
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(sText));
    startActivity(Intent.createChooser(emailIntent, "Email:"));

}

From source file:com.hybris.mobile.app.commerce.fragment.ProductDetailFragmentBase.java

/**
 * Populate the product//  ww w .  j a va2  s  .  c  o m
 *
 * @param product
 */
protected void populateProduct(ProductBase product) {
    if (product != null) {

        mProduct = product;

        /**
         * Populate the view with data from response and associate it to the right element in the view
         */
        mProductDetaiNameText.setText(product.getName() + " (" + product.getCode() + ")");

        if (StringUtils.isNotBlank(product.getDescription())) {

            mProductDetailExpandableText.setText(Html.fromHtml(product.getDescription()));
        }

        if (StringUtils.isNotBlank(product.getSummary())) {
            mProductDetailDescriptionLayout.setVisibility(View.VISIBLE);
            mProductShortDescription.setText(Html.fromHtml(product.getSummary()));
        }

        if (product.getStock() != null) {

            boolean resetAddToCart = true;

            mStocklevelText.setVisibility(View.VISIBLE);
            if (product.isLowStock() || product.isOutOfStock()) {
                mStocklevelText.setTextColor(getResources().getColor(R.color.product_item_low_stock));
                mStocklevelText.setContentDescription(getString(R.string.product_item_low_stock));

                if (product.isOutOfStock()) {
                    resetAddToCart = false;
                    mQuantityEditText.setEnabled(false);
                    mQuantityEditText.setText("");
                    mStocklevelText.setText(product.getStock().getStockLevel() + "\n"
                            + getString(R.string.product_detail_in_stock));
                }
            }

            if (product.isInStock()) {
                mStocklevelText.setText(product.getStock().getStockLevel() + "\n"
                        + getString(R.string.product_detail_in_stock));
                mStocklevelText.setTextColor(getResources().getColor(R.color.product_item_in_stock));
            }

            if (resetAddToCart) {
                mQuantityEditText.setEnabled(true);
                mQuantityEditText.setText(getString(R.string.default_qty));
            }

        } else {
            Log.d(TAG, "Stock is null");
        }

        if (product.getPrice() != null) {
            // to show pipe
            mProductPrice
                    .setText((product.getVolumePrices() != null) ? product.getPriceRangeFormattedValue() + " | "
                            : product.getPriceRangeFormattedValue());

            // Set the price with the default total value with currency sign
            mTotalPriceText
                    .setText((StringUtils.substring(product.getPrice().getFormattedValue(), 0, 1)
                            + ProductUtils.calculateQuantityPrice(mQuantityEditText.getText().toString(),
                                    (product.getVolumePrices() != null) ? ProductUtils.findVolumePrice(
                                            mQuantityEditText.getText().toString(), product.getVolumePrices())
                                            : product.getPrice())));
        } else {
            Log.d(TAG, "Price is null");
        }

        if (product.getVolumePrices() != null) {
            mVolumePricingExpandableButton.setVisibility(View.VISIBLE);

        }

        //Rating
        if (product.getAverageRating() != null) {
            mRatingBar.setVisibility(View.VISIBLE);
            mRatingBar.setRating(product.getAverageRating().floatValue());
        } else {
            mRatingBar.setVisibility(View.GONE);
        }

        //Reviews
        if (product.getReviews() != null && !product.getReviews().isEmpty()) {
            mReviews.setVisibility(View.VISIBLE);
            mReviews.setText(getString(R.string.product_detail_reviews, product.getNumberOfReviews()));
        } else {
            mReviews.setVisibility(View.GONE);
        }

        setClickableAddToCartButton();

        // Updating images
        updateImageViewPagerIndicator(product.getImagesGallery());

    }
}

From source file:com.birdeye.MainActivity.java

@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {

    switch (item.getItemId()) {
    case R.id.logout:

        fullReset();/*  w  w  w .  j  av a 2 s . c o m*/
        startActivity(LoginActivity.create(this));
        finish();

        return true;

    case R.id.About:

        final Dialog dialog2 = new Dialog(MainActivity.this);
        dialog2.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog2.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
        dialog2.setContentView(R.layout.about);
        dialog2.setCancelable(false);

        dialog2.show();

        return true;

    case R.id.ShareApp:

        Intent sharingIntent = new Intent(Intent.ACTION_SEND);
        sharingIntent.setType("text/html");
        sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(
                "<p>Hey, am using this really cool hashtag activated camera app. Get it here #birdeyecamera.</p>"));
        startActivity(Intent.createChooser(sharingIntent, "Share using"));

        return true;

    case R.id.Recommend:

        Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
                Uri.fromParts("BirdEyeCamera", "birdeyecamera@digitalbabi.es", null));
        emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Feature Recommendation");
        startActivity(Intent.createChooser(emailIntent, "Send email..."));

        return true;

    case R.id.rateApp:

        final Uri uri = Uri.parse("market://details?id=" + getApplicationContext().getPackageName());
        final Intent rateAppIntent = new Intent(Intent.ACTION_VIEW, uri);

        if (getPackageManager().queryIntentActivities(rateAppIntent, 0).size() > 0) {
            startActivity(rateAppIntent);
        } else {
            /* handle your error case: the device has no way to handle market urls */
        }

        return true;

    case R.id.RemoveAds:

        if (Globals.hasPaid) {
            Toast.makeText(MainActivity.this, "You already are in a premium account", Toast.LENGTH_SHORT)
                    .show();

        } else {

            removeAdsDialog();

        }

        return true;

    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.dwdesign.tweetings.fragment.BaseStatusesListFragment.java

@Override
public boolean onMenuItemClick(final MenuItem item) {
    final ParcelableStatus status = mSelectedStatus;
    if (status == null)
        return false;
    final long account_id = getDefaultAccountId(mApplication);
    switch (item.getItemId()) {
    case MENU_VIEW: {
        openStatus(getActivity(), status);
        break;// ww  w .j  a v  a  2s.com
    }
    case MENU_SHARE: {
        final Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType("text/plain");
        intent.putExtra(Intent.EXTRA_TEXT, "@" + status.screen_name + ": " + status.text_plain);
        startActivity(Intent.createChooser(intent, getString(R.string.share)));
        break;
    }
    case MENU_TRANSLATE: {
        translate(status);
        break;
    }
    case MENU_RETWEET: {
        if (isMyRetweet(status)) {
            mService.destroyStatus(status.account_id, status.status_id);
        } else {
            final long id_to_retweet = mSelectedStatus.is_retweet && mSelectedStatus.retweet_id > 0
                    ? mSelectedStatus.retweet_id
                    : mSelectedStatus.status_id;
            mService.retweetStatus(status.account_id, id_to_retweet);
        }
        break;
    }
    case MENU_QUOTE: {
        final Intent intent = new Intent(INTENT_ACTION_COMPOSE);
        final Bundle bundle = new Bundle();
        bundle.putLong(INTENT_KEY_ACCOUNT_ID, status.account_id);
        bundle.putBoolean(INTENT_KEY_IS_QUOTE, true);
        bundle.putString(INTENT_KEY_TEXT, getQuoteStatus(getActivity(), status.screen_name, status.text_plain));
        intent.putExtras(bundle);
        startActivity(intent);
        break;
    }
    case MENU_QUOTE_REPLY: {
        final Intent intent = new Intent(INTENT_ACTION_COMPOSE);
        final Bundle bundle = new Bundle();
        bundle.putLong(INTENT_KEY_ACCOUNT_ID, status.account_id);
        bundle.putLong(INTENT_KEY_IN_REPLY_TO_ID, status.status_id);
        bundle.putString(INTENT_KEY_IN_REPLY_TO_SCREEN_NAME, status.screen_name);
        bundle.putString(INTENT_KEY_IN_REPLY_TO_NAME, status.name);
        bundle.putBoolean(INTENT_KEY_IS_QUOTE, true);
        bundle.putString(INTENT_KEY_TEXT, getQuoteStatus(getActivity(), status.screen_name, status.text_plain));
        intent.putExtras(bundle);
        startActivity(intent);
        break;
    }
    case MENU_ADD_TO_BUFFER: {
        final Intent intent = new Intent(INTENT_ACTION_COMPOSE);
        final Bundle bundle = new Bundle();
        bundle.putLong(INTENT_KEY_ACCOUNT_ID, status.account_id);
        bundle.putBoolean(INTENT_KEY_IS_BUFFER, true);
        bundle.putString(INTENT_KEY_TEXT, getQuoteStatus(getActivity(), status.screen_name, status.text_plain));
        intent.putExtras(bundle);
        startActivity(intent);
        break;
    }
    case MENU_REPLY: {
        final Intent intent = new Intent(INTENT_ACTION_COMPOSE);
        final Bundle bundle = new Bundle();
        final List<String> mentions = new Extractor().extractMentionedScreennames(status.text_plain);
        mentions.remove(status.screen_name);
        mentions.add(0, status.screen_name);
        bundle.putStringArray(INTENT_KEY_MENTIONS, mentions.toArray(new String[mentions.size()]));
        bundle.putLong(INTENT_KEY_ACCOUNT_ID, status.account_id);
        bundle.putLong(INTENT_KEY_IN_REPLY_TO_ID, status.status_id);
        bundle.putString(INTENT_KEY_IN_REPLY_TO_TWEET, status.text_plain);
        bundle.putString(INTENT_KEY_IN_REPLY_TO_SCREEN_NAME, status.screen_name);
        bundle.putString(INTENT_KEY_IN_REPLY_TO_NAME, status.name);
        intent.putExtras(bundle);
        startActivity(intent);
        break;
    }
    case MENU_FAV: {
        if (mSelectedStatus.is_favorite) {
            mService.destroyFavorite(status.account_id, status.status_id);
        } else {
            mService.createFavorite(status.account_id, status.status_id);
        }
        break;
    }
    case MENU_CONVERSATION: {
        openConversation(getActivity(), status.account_id, status.status_id);
        break;
    }
    case MENU_DELETE: {
        mService.destroyStatus(status.account_id, status.status_id);
        break;
    }
    case MENU_EXTENSIONS: {
        final Intent intent = new Intent(INTENT_ACTION_EXTENSION_OPEN_STATUS);
        final Bundle extras = new Bundle();
        extras.putParcelable(INTENT_KEY_STATUS, status);
        intent.putExtras(extras);
        startActivity(Intent.createChooser(intent, getString(R.string.open_with_extensions)));
        break;
    }
    case MENU_MULTI_SELECT: {
        if (!mApplication.isMultiSelectActive()) {
            mApplication.startMultiSelect();
        }
        final NoDuplicatesLinkedList<Object> list = mApplication.getSelectedItems();
        if (!list.contains(status)) {
            list.add(status);
        }
        break;
    }
    case MENU_BLOCK: {
        mService.createBlock(account_id, status.user_id);
        break;
    }
    case MENU_REPORT_SPAM: {
        mService.reportSpam(account_id, status.user_id);
        break;
    }
    case MENU_MUTE_USER: {
        final String screen_name = status.screen_name;
        final Uri uri = Filters.Users.CONTENT_URI;
        final ContentValues values = new ContentValues();
        final SharedPreferences.Editor editor = getSharedPreferences(SHARED_PREFERENCES_NAME,
                Context.MODE_PRIVATE).edit();
        final ContentResolver resolver = getContentResolver();
        values.put(Filters.Users.TEXT, screen_name);
        resolver.delete(uri, Filters.Users.TEXT + " = '" + screen_name + "'", null);
        resolver.insert(uri, values);
        editor.putBoolean(PREFERENCE_KEY_ENABLE_FILTER, true).commit();
        Toast.makeText(getActivity(), R.string.user_muted, Toast.LENGTH_SHORT).show();
        break;
    }
    case MENU_MAKE_GAP: {
        Uri uri = Statuses.CONTENT_URI;
        final Uri query_uri = buildQueryUri(uri, false);
        ContentResolver mResolver = getContentResolver();
        final ContentValues values = new ContentValues();
        values.put(Statuses.IS_GAP, 1);
        final StringBuilder where = new StringBuilder();
        where.append(Statuses.ACCOUNT_ID + "=" + account_id);
        where.append(" AND " + Statuses.STATUS_ID + "=" + status.status_id);
        mResolver.update(query_uri, values, where.toString(), null);
        getActivity().sendBroadcast(new Intent(BROADCAST_FILTERS_UPDATED).putExtra(INTENT_KEY_SUCCEED, true));
        break;
    }
    case MENU_COPY: {
        final CharSequence text = Html.fromHtml(status.text_html);
        if (ClipboardUtils.setText(getActivity(), text)) {
            Toast.makeText(getActivity(), R.string.text_copied, Toast.LENGTH_SHORT).show();
        }
        break;
    }
    }
    return true;
}

From source file:com.activiti.android.ui.fragments.task.TaskDetailsFoundationFragment.java

private void displayDueDate(Date due) {
    dueDateHolder.topText.setText(R.string.task_field_due);
    dueDateHolder.icon.setImageResource(R.drawable.ic_event_grey);

    dueAt = due;//from  w w w  .ja  v  a  2  s . c o m
    if (due != null) {
        StringBuilder builder = new StringBuilder();
        GregorianCalendar calendar = new GregorianCalendar();
        calendar.setTime(due);
        if (calendar.before(new GregorianCalendar())) {
            builder.append("<font color='#F44336'>");
            builder.append(DateFormat.getLongDateFormat(getActivity()).format(due.getTime()));
            builder.append("</font>");
        } else {
            builder.append(DateFormat.getLongDateFormat(getActivity()).format(due.getTime()));
        }
        dueDateHolder.bottomText.setText(builder.toString());
        dueDateHolder.bottomText.setText(Html.fromHtml(builder.toString()), TextView.BufferType.SPANNABLE);
    } else {
        dueDateHolder.bottomText.setText(R.string.task_message_no_duedate);
    }
    if (!isEnded) {
        viewById(R.id.task_details_due_container).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                DatePickerFragment.newInstance(DUE_DATE, getTag()).show(getFragmentManager(),
                        DatePickerFragment.TAG);
            }
        });
    } else {
        UIUtils.setBackground(viewById(R.id.task_details_due_container), null);
    }
}

From source file:com.irccloud.android.Notifications.java

private void showOtherNotifications() {
    String title = "";
    String text = "";
    String ticker = null;//from   w ww . ja v a  2s.  c o m
    SharedPreferences prefs = PreferenceManager
            .getDefaultSharedPreferences(IRCCloudApplication.getInstance().getApplicationContext());
    ArrayList<Notification> notifications = getOtherNotifications();

    int notify_type = Integer.parseInt(prefs.getString("notify_type", "1"));
    boolean notify = false;
    if (notify_type == 1 || (notify_type == 2 && NetworkConnection.getInstance().isVisible()))
        notify = true;

    if (notifications.size() > 0 && notify) {
        for (Notification n : notifications) {
            if (!n.shown) {
                if (n.message_type.equals("callerid")) {
                    title = "Callerid: " + n.nick + " (" + n.network + ")";
                    text = n.nick + " " + n.message;
                    ticker = n.nick + " " + n.message;
                } else {
                    title = n.nick + " (" + n.network + ")";
                    text = n.message;
                    ticker = n.message;
                }
                NotificationManagerCompat.from(IRCCloudApplication.getInstance().getApplicationContext())
                        .notify((int) (n.eid / 1000), buildNotification(ticker, n.bid, new long[] { n.eid },
                                title, text, Html.fromHtml(text), 1, null, null, title, null));
                n.shown = true;
            }
        }
    }
}