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:io.radio.streamer.MainActivity.java

private void updateNP(Packet packet) {
    updateRemoteMetadata(Html.fromHtml(packet.main.artist).toString(),
            Html.fromHtml(packet.main.title).toString());

    progress = packet.main.progress;/*w  w w .j a  v  a  2s  .c  o m*/
    length = packet.main.length;
    title.setText(Html.fromHtml(packet.main.title));
    artist.setText(Html.fromHtml(packet.main.artist));
    dj.setText(Html.fromHtml(packet.main.dj.name));
    songProgressBar.setMax(length);
    songProgressBar.setProgress(progress);
    if (lastDj != packet.main.dj.id) {
        lastDj = packet.main.dj.id;
        DJImageLoader imageLoader = new DJImageLoader();
        imageLoader.execute(packet);

    }
    listeners.setText("Listeners: " + packet.main.listeners);
    songLength.setText(Util.formatSongLength(progress, length));

}

From source file:com.armtimes.drawer.NavigationDrawerFragment.java

/**
 * Per the navigation drawer design guidelines, updates the action bar to show the global app
 * 'context', rather than just what's in the current screen.
 *///from   w  w w .ja v  a  2 s  .  c o m
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setBackgroundDrawable(new ColorDrawable(0xFFFA294C));
    actionBar.setTitle(Html.fromHtml("<small>" + getActivity().getString(R.string.app_name) + "</small>"));
}

From source file:com.fanfou.app.opensource.api.ApiParser.java

public static Search trend(final JSONObject o) throws IOException {
    try {/*from  www.j  av  a2 s  .c  om*/
        final Search t = new Search();
        t.name = Html.fromHtml(o.getString(ApiParser.NAME)).toString();
        t.query = Html.fromHtml(o.getString(ApiParser.QUERY)).toString();
        return t;
    } catch (final JSONException e) {
        if (AppContext.DEBUG) {
            e.printStackTrace();
        }
    }
    return null;
}

From source file:com.example.imen.facebookfalseprofile.ui.MainActivity.java

private void setUiPageViewController() {
    dotsLayout = (LinearLayout) findViewById(R.id.viewPagerCountDots);
    dotsCount = myViewPagerAdapter.getCount();
    dots = new TextView[dotsCount];

    for (int i = 0; i < dotsCount; i++) {
        dots[i] = new TextView(this);
        dots[i].setText(Html.fromHtml("&#8226;"));
        dots[i].setTextSize(30);/*  w w  w  .j a  v a 2 s .c  o m*/
        dots[i].setTextColor(getResources().getColor(android.R.color.darker_gray));
        dotsLayout.addView(dots[i]);
    }

    dots[0].setTextColor(getResources().getColor(R.color.com_facebook_button_background_color_pressed));
}

From source file:com.inmobi.ultrapush.AnalyzeActivity.java

private void showInstructions() {
    TextView tv = new TextView(this);
    tv.setMovementMethod(new ScrollingMovementMethod());
    tv.setText(Html.fromHtml(getString(R.string.instructions_text)));
    new AlertDialog.Builder(this).setTitle(R.string.instructions_title).setView(tv)
            .setNegativeButton(R.string.dismiss, null).create().show();
}

From source file:com.appsimobile.appsii.module.home.YahooLocationChooserDialogFragment.java

private void updateCurrentLocationFields(String header, String summary) {
    mCurrentLocationContainer.setVisibility(View.VISIBLE);
    mHeaderTextView.setText(header);/*from  w  ww  .ja v a  2 s  .  c  o m*/
    String text = getResources().getString(R.string.user_location, header, summary);
    CharSequence styled = Html.fromHtml(text);
    mHeaderTextView.setText(styled);
}

From source file:com.amaze.carbonfilemanager.fragments.ProcessViewer.java

public void processResults(final DataPackage dataPackage, ServiceType serviceType) {
    if (dataPackage != null) {
        String name = dataPackage.getName();
        long total = dataPackage.getTotal();
        long doneBytes = dataPackage.getByteProgress();
        boolean move = dataPackage.isMove();

        if (!isInitialized) {

            // initializing views for the first time
            chartInit(total);/*from w w w .  ja v a 2 s .  com*/

            // setting progress image
            setupDrawables(serviceType, move);
            isInitialized = true;
        }

        addEntry(Futils.readableFileSizeFloat(doneBytes),
                Futils.readableFileSizeFloat(dataPackage.getSpeedRaw()));

        mProgressFileNameText.setText(name);

        Spanned bytesText = Html.fromHtml(getResources().getString(R.string.written) + " <font color='"
                + accentColor + "'><i>" + Formatter.formatFileSize(getContext(), doneBytes) + " </font></i>"
                + getResources().getString(R.string.out_of) + " <i>"
                + Formatter.formatFileSize(getContext(), total) + "</i>");
        mProgressBytesText.setText(bytesText);

        Spanned fileProcessedSpan = Html.fromHtml(getResources().getString(R.string.processing_file)
                + " <font color='" + accentColor + "'><i>" + (dataPackage.getSourceProgress()) + " </font></i>"
                + getResources().getString(R.string.of) + " <i>" + dataPackage.getSourceFiles() + "</i>");
        mProgressFileText.setText(fileProcessedSpan);

        Spanned speedSpan = Html.fromHtml(
                getResources().getString(R.string.current_speed) + ": <font color='" + accentColor + "'><i>"
                        + Formatter.formatFileSize(getContext(), dataPackage.getSpeedRaw()) + "/s</font></i>");
        mProgressSpeedText.setText(speedSpan);

        Spanned timerSpan = Html.fromHtml(getResources().getString(R.string.service_timer) + ": <font color='"
                + accentColor + "'><i>" + formatTimer(++time) + "</font></i>");

        mProgressTimer.setText(timerSpan);
    }
}

From source file:com.newtifry.android.SourceEditor2.java

@SuppressLint("NewApi")
public void updateSourcecolor(String value) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        if (value.equals("default")) {
            sourceColorPreference.setSummary(getString(R.string.froyo_color_summary));

        } else {/*from ww w  .  j a va  2s  .c  om*/
            String hexColor = Integer.toHexString(Color.parseColor(value));
            String html = "<font color=\"#" + hexColor.substring(hexColor.length() - 6, 8) + "\">"
                    + getString(R.string.froyo_color_summary) + "</font>";
            sourceColorPreference.setSummary(Html.fromHtml(html));
        }
        return;
    }

    String uri = "drawable/icon_color_" + value;
    int imageResource = getResources().getIdentifier(uri, null, getPackageName());
    Drawable icon = getResources().getDrawable(imageResource);
    sourceColorPreference.setIcon(icon);
}

From source file:com.magicmod.mmweather.engine.YahooWeatherProvider.java

@Override
public void refreshData(Location location, boolean metricUnits) {
    mLocation = location;//www.  j  a v  a  2s . c  o m
    mMetricUnits = metricUnits;

    String language = getLanguage();
    String params = String.format(Locale.US, "\"%f %f\" and locale=\"%s\"", location.getLatitude(),
            location.getLongitude(), language);
    String url = URL_PLACEFINDER + Uri.encode(params);
    JSONObject results = fetchResults(url);
    if (results == null) {
        mWeatherInfo = null;
        return;
    }

    try {
        JSONObject result = results.getJSONObject("Result");
        String woeid = result.getString("woeid");
        String city = result.getString("city");

        if (city == null) {
            city = result.getString("neighborhood");
        }

        // The city name in the placefinder result is HTML encoded :-(
        if (city != null) {
            city = Html.fromHtml(city).toString();
        }

        Log.d(TAG, "Resolved location " + location + " to " + city + " (" + woeid + ")");

        mWeatherInfo = getWeatherInfo(woeid, city, metricUnits);
    } catch (JSONException e) {
        Log.e(TAG, "Received malformed placefinder data (location=" + location + ", lang=" + language + ")", e);
        mWeatherInfo = null;
    }
    if (mWeatherDataChangedListener != null)
        mWeatherDataChangedListener.onDataChanged();
}