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:com.digipom.manteresting.android.adapter.NailCursorAdapter.java

private CachedData cacheDataAndGet(Context context, Cursor cursor, int requestedWidth) throws JSONException {
    final String nailId = cursor.getString(nailIdColumnIndex);

    CachedData cachedDataForThisNailItem = cachedData.get(nailId);

    if (cachedDataForThisNailItem == null) {
        cachedDataForThisNailItem = new CachedData();

        final JSONObject nailObject = new JSONObject(cursor.getString(nailObjectColumnIndex));

        cachedDataForThisNailItem.originalImageUriString = nailObject.getString("original");
        cachedDataForThisNailItem.nailDescription = nailObject.getString("description");

        final String userName = nailObject.getJSONObject("user").getString("username");
        final String userNameFirstLetterCapitalised = userName.substring(0, 1).toUpperCase()
                + userName.substring(1);
        final String workBench = nailObject.getJSONObject("workbench").getString("title");

        cachedDataForThisNailItem.styledUserAndCategory = Html.fromHtml(String.format(
                Html.toHtml(new SpannedString(context.getResources().getText(R.string.nailUserAndCategory))),
                userNameFirstLetterCapitalised, workBench));

        cachedData.put(nailId, cachedDataForThisNailItem);
    }/*www .j  a  v  a  2  s  .c o  m*/

    // Request a bitmap load.
    if (!failedDownloads.contains(cachedDataForThisNailItem.originalImageUriString)
            && serviceConnector.getService() != null) {
        serviceConnector.getService().loadOnlyLifoAsync(cachedDataForThisNailItem.originalImageUriString,
                requestedWidth);
    }

    return cachedDataForThisNailItem;
}

From source file:ru.orangesoftware.financisto.activity.FlowzrSyncActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FlowzrSyncActivity.me = this;

    mNotifyBuilder = new NotificationCompat.Builder(getApplicationContext());
    nm = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
    setContentView(R.layout.flowzr_sync);
    restoreUIFromPref();//  w ww.ja  v a2 s  .  c  om

    AccountManager accountManager = AccountManager.get(getApplicationContext());
    final Account[] accounts = accountManager.getAccountsByType("com.google");
    if (accounts.length < 1) {
        new AlertDialog.Builder(this).setTitle(getString(R.string.flowzr_sync_error))
                .setMessage(R.string.account_required)
                .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        finish();
                    }
                }).show();
    }
    //checkbox
    CheckBox chk = (CheckBox) findViewById(R.id.chk_sync_from_zero);
    OnClickListener chk_listener = new OnClickListener() {
        public void onClick(View v) {
            lastSyncLocalTimestamp = 0;
            renderLastTime(0);
            flowzrSyncEngine.resetLastTime(getApplicationContext());
        }
    };
    chk.setOnClickListener(chk_listener);
    //radio crendentials
    RadioGroup radioGroupCredentials = (RadioGroup) findViewById(R.id.radioCredentials);
    OnClickListener radio_listener = new OnClickListener() {
        public void onClick(View v) {
            RadioButton radioButtonSelected = (RadioButton) findViewById(v.getId());
            for (Account account : accounts) {
                if (account.name == radioButtonSelected.getText()) {
                    lastSyncLocalTimestamp = 0;
                    renderLastTime(0);
                    flowzrSyncEngine.resetLastTime(getApplicationContext());
                    useCredential = account;
                }
            }
        }
    };
    radioGroupCredentials.setOnClickListener(radio_listener);
    //initialize value
    for (int i = 0; i < accounts.length; i++) {
        RadioButton rb = new RadioButton(this);
        radioGroupCredentials.addView(rb); //, 0, lp); 
        rb.setOnClickListener(radio_listener);
        rb.setText(((Account) accounts[i]).name);
        String prefAccount = MyPreferences.getFlowzrAccount(this);
        if (prefAccount != null) {
            if (accounts[i].name.equals(prefAccount)) {
                useCredential = accounts[i];
                rb.toggle(); //.setChecked(true);
            }
        }
    }

    bOk = (Button) findViewById(R.id.bOK);
    bOk.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            startSync();

        }
    });

    Button bCancel = (Button) findViewById(R.id.bCancel);
    bCancel.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            if (flowzrSyncEngine != null) {
                flowzrSyncEngine.isCanceled = true;
            }
            isRunning = false;
            setResult(RESULT_CANCELED);
            setReady();
            startActivity(new Intent(getApplicationContext(), MainActivity.class));
            //finish();
        }
    });

    Button textViewAbout = (Button) findViewById(R.id.buySubscription);
    textViewAbout.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            if (isOnline(FlowzrSyncActivity.this)) {
                visitFlowzr(useCredential);
            } else {
                showErrorPopup(FlowzrSyncActivity.this, R.string.flowzr_sync_error_no_network);
            }
        }
    });

    Button textViewAboutAnon = (Button) findViewById(R.id.visitFlowzr);
    textViewAboutAnon.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            if (isOnline(FlowzrSyncActivity.this)) {
                visitFlowzr(null);
            } else {
                showErrorPopup(FlowzrSyncActivity.this, R.string.flowzr_sync_error_no_network);
            }
        }
    });

    TextView textViewNotes = (TextView) findViewById(R.id.flowzrPleaseNote);
    textViewNotes.setMovementMethod(LinkMovementMethod.getInstance());
    textViewNotes.setText(Html.fromHtml(getString(R.string.flowzr_terms_of_use)));
    if (MyPreferences.isAutoSync(this)) {
        if (checkPlayServices()) {
            gcm = GoogleCloudMessaging.getInstance(this);
            regid = getRegistrationId(getApplicationContext());

            if (regid.equals("")) {
                registerInBackground();
            }
            Log.i(TAG, "Google Cloud Messaging registered as :" + regid);
        } else {
            Log.i(TAG, "No valid Google Play Services APK found.");
        }
    }
}

From source file:com.armtimes.activities.SingleArticlePreviewActivity.java

@Override
public void onSingleArticleDownloadCompleted(final ArticleInfo articleInfo) {

    if (progressDialog != null) {
        progressDialog.dismissAllowingStateLoss();
        progressDialog = null;//from   w  w  w.j ava 2  s  .com
    }

    // Finish current activity if Description or Title
    // are missing, missing of image is not a case to
    // finish activity.
    if (articleInfo == null) {
        Toast.makeText(getApplicationContext(), R.string.cant_show_news_data_missing, Toast.LENGTH_LONG).show();
        setResult(Activity.RESULT_CANCELED);
        finish();
        return;
    }

    // Title comes from the Database and it should be there
    // as it is downloaded at first phase from RSS.
    String title = getIntent().getStringExtra(EXTRA_TITLE);
    if (title == null || title.isEmpty()) {
        Toast.makeText(getApplicationContext(), R.string.cant_show_news_data_missing, Toast.LENGTH_LONG).show();
        setResult(Activity.RESULT_CANCELED);
        finish();
        return;
    }

    String description = articleInfo.getDescription();
    if (description == null || description.isEmpty()) {
        Toast.makeText(getApplicationContext(), R.string.cant_show_news_data_missing, Toast.LENGTH_LONG).show();
        setResult(Activity.RESULT_CANCELED);
        finish();
        return;
    }

    // If news article information was successfully downloaded,
    // and shown to the user - update database by setting given
    // news item read state to TRUE.
    try {
        // Get current table name, in which information for given
        // article must be updated.
        final String table = getIntent().getStringExtra(EXTRA_CATEGORY).toUpperCase();
        // Create Database helper object.
        NewsDatabaseHelper helper = new NewsDatabaseHelper(getApplicationContext());
        SQLiteDatabase database = helper.getWritableDatabase();
        // Create data which must be updated.
        ContentValues cv = new ContentValues();
        cv.put(NewsContract.COL_NAME_NEWS_IS_READ, 1);
        // Update appropriate field in database.
        database.update(table, cv, String.format("%s=\"%s\"", NewsContract.COL_NAME_NEWS_URL, articleInfo.url),
                null);
        // Close database
        database.close();
        helper.close();
    } catch (Exception ex) {
        Logger.e(TAG, "Exception occurs while trying to Update database!");
    }

    // Set layout Visible.
    layoutMain.setVisibility(View.VISIBLE);

    textTitle.setText(title.trim());
    textDescription.setText(Html.fromHtml(articleInfo.getDescription()));

    // Try to set image if it exists.
    InputStream is = null;
    try {
        is = new FileInputStream(new File(articleInfo.getMainImagePath()));
        imageBanner.setImageBitmap(BitmapFactory.decodeStream(is));
        imageBanner.setScaleType(ImageView.ScaleType.CENTER_CROP);
    } catch (IOException ex) {
        imageBanner.setScaleType(ImageView.ScaleType.CENTER);
    } finally {
        if (is != null) {
            try {
                is.close();
            } catch (IOException ex) {
                Logger.e(TAG, "Error occurs while trying to close Banner Image Stream.");
            }
        }
    }

    setResult(Activity.RESULT_OK);
}

From source file:cn.bingoogolapple.androidcommon.adapter.BGAViewHolderHelper.java

/**
 * idhtml// w  ww  . j  a v  a2  s . c om
 *
 * @param viewId
 * @param source html
 * @return
 */
public BGAViewHolderHelper setHtml(@IdRes int viewId, String source) {
    if (source == null) {
        source = "";
    }
    getTextView(viewId).setText(Html.fromHtml(source));
    return this;
}

From source file:in.shick.diode.common.Common.java

/**
 * Helper function to display a list of URLs.
 * @param theContext The current application context.
 * @param settings The settings to use regarding the browser component.
 * @param theItem The ThingInfo item to get URLs from.
 *//*from  ww  w  . j  av  a 2  s .c  o  m*/
public static void showLinksDialog(final Context theContext, final RedditSettings settings,
        final ThingInfo theItem) {
    assert (theContext != null);
    assert (theItem != null);
    assert (settings != null);
    final ArrayList<String> urls = new ArrayList<String>();
    final ArrayList<MarkdownURL> vtUrls = theItem.getUrls();
    for (MarkdownURL vtUrl : vtUrls) {
        urls.add(vtUrl.url);
    }
    ArrayAdapter<MarkdownURL> adapter = new ArrayAdapter<MarkdownURL>(theContext,
            android.R.layout.select_dialog_item, vtUrls) {
        public View getView(int position, View convertView, ViewGroup parent) {
            TextView tv;
            if (convertView == null) {
                tv = (TextView) ((LayoutInflater) theContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE))
                        .inflate(android.R.layout.select_dialog_item, null);
            } else {
                tv = (TextView) convertView;
            }

            String url = getItem(position).url;
            String anchorText = getItem(position).anchorText;
            //                        if (Constants.LOGGING) Log.d(TAG, "links url="+url + " anchorText="+anchorText);

            Drawable d = null;
            try {
                d = theContext.getPackageManager()
                        .getActivityIcon(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
            } catch (PackageManager.NameNotFoundException ignore) {
            }
            if (d != null) {
                d.setBounds(0, 0, d.getIntrinsicHeight(), d.getIntrinsicHeight());
                tv.setCompoundDrawablePadding(10);
                tv.setCompoundDrawables(d, null, null, null);
            }

            final String telPrefix = "tel:";
            if (url.startsWith(telPrefix)) {
                url = PhoneNumberUtils.formatNumber(url.substring(telPrefix.length()));
            }

            if (anchorText != null)
                tv.setText(Html.fromHtml("<span>" + anchorText + "</span><br /><small>" + url + "</small>"));
            else
                tv.setText(Html.fromHtml(url));

            return tv;
        }
    };

    AlertDialog.Builder b = new AlertDialog.Builder(
            new ContextThemeWrapper(theContext, settings.getDialogTheme()));

    DialogInterface.OnClickListener click = new DialogInterface.OnClickListener() {
        public final void onClick(DialogInterface dialog, int which) {
            if (which >= 0) {
                Common.launchBrowser(settings, theContext, urls.get(which),
                        Util.createThreadUri(theItem).toString(), false, false, settings.isUseExternalBrowser(),
                        settings.isSaveHistory());
            }
        }
    };

    b.setTitle(R.string.select_link_title);
    b.setCancelable(true);
    b.setAdapter(adapter, click);

    b.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
        public final void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });

    b.show();
}

From source file:com.amaze.filemanager.fragments.preference_fragments.Preffrag.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PreferenceUtils.reset();/*from   w ww . ja  v  a  2  s. c  om*/
    // Load the preferences from an XML resource
    addPreferencesFromResource(R.xml.preferences);

    sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity());

    final int th1 = Integer.parseInt(sharedPref.getString("theme", "0"));
    theme = th1 == 2 ? PreferenceUtils.hourOfDay() : th1;
    findPreference("donate").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            ((com.amaze.filemanager.activities.Preferences) getActivity()).donate();
            return false;
        }
    });
    findPreference("columns").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            final String[] sort = getResources().getStringArray(R.array.columns);
            MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity());
            if (theme == 1)
                a.theme(Theme.DARK);
            a.title(R.string.gridcolumnno);
            int current = Integer.parseInt(sharedPref.getString("columns", "-1"));
            current = current == -1 ? 0 : current;
            if (current != 0)
                current = current - 1;
            a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() {
                @Override
                public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
                    sharedPref.edit().putString("columns", "" + (which != 0 ? sort[which] : "" + -1)).commit();
                    dialog.dismiss();
                    return true;
                }
            });
            a.build().show();
            return true;
        }
    });

    findPreference("theme").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            String[] sort = getResources().getStringArray(R.array.theme);
            int current = Integer.parseInt(sharedPref.getString("theme", "0"));
            MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity());
            if (theme == 1)
                a.theme(Theme.DARK);
            a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() {
                @Override
                public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
                    sharedPref.edit().putString("theme", "" + which).commit();
                    dialog.dismiss();
                    restartPC(getActivity());
                    return true;
                }
            });
            a.title(R.string.theme);
            a.build().show();
            return true;
        }
    });
    findPreference("colors").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            ((com.amaze.filemanager.activities.Preferences) getActivity()).selectItem(1);
            return true;
        }
    });

    final CheckBx rootmode = (CheckBx) findPreference("rootmode");
    rootmode.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            boolean b = sharedPref.getBoolean("rootmode", false);
            if (b) {
                if (RootTools.isAccessGiven()) {
                    rootmode.setChecked(true);

                } else {
                    rootmode.setChecked(false);

                    Toast.makeText(getActivity(), getResources().getString(R.string.rootfailure),
                            Toast.LENGTH_LONG).show();
                }
            } else {
                rootmode.setChecked(false);

            }

            return false;
        }
    });

    // Authors
    Preference preference4 = (Preference) findPreference("authors");
    preference4.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {

            MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity());
            skin = PreferenceUtils.getPrimaryColorString(sharedPref);
            int fab_skin = Color.parseColor(PreferenceUtils.getAccentString(sharedPref));
            if (theme == 1)
                a.theme(Theme.DARK);

            a.positiveText(R.string.close);
            a.positiveColor(fab_skin);
            LayoutInflater layoutInflater = (LayoutInflater) getActivity()
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View view = layoutInflater.inflate(R.layout.authors, null);
            a.customView(view, true);
            a.title(R.string.authors);
            a.callback(new MaterialDialog.ButtonCallback() {
                @Override
                public void onPositive(MaterialDialog materialDialog) {

                    materialDialog.cancel();
                }

                @Override
                public void onNegative(MaterialDialog materialDialog) {

                }
            });
            /*a.setNegativeButton(R.string.close, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                dialogInterface.cancel();
            }
            });*/
            a.build().show();

            final Intent intent = new Intent(Intent.ACTION_VIEW);

            TextView googlePlus1 = (TextView) view.findViewById(R.id.googlePlus1);
            googlePlus1.setTextColor(Color.parseColor(skin));
            TextView googlePlus2 = (TextView) view.findViewById(R.id.googlePlus2);
            googlePlus2.setTextColor(Color.parseColor(skin));
            TextView git1 = (TextView) view.findViewById(R.id.git1);
            git1.setTextColor(Color.parseColor(skin));
            TextView git2 = (TextView) view.findViewById(R.id.git2);
            git2.setTextColor(Color.parseColor(skin));

            googlePlus1.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    intent.setData(Uri.parse("https://plus.google.com/u/0/110424067388738907251/"));
                    startActivity(intent);
                }
            });
            googlePlus2.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    intent.setData(Uri.parse("https://plus.google.com/+VishalNehra/"));
                    startActivity(intent);
                }
            });
            git1.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    intent.setData(Uri.parse("https://github.com/arpitkh96"));
                    startActivity(intent);
                }
            });
            git2.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    intent.setData(Uri.parse("https://github.com/vishal0071"));
                    startActivity(intent);
                }
            });

            // icon credits
            TextView textView = (TextView) view.findViewById(R.id.icon_credits);
            textView.setMovementMethod(LinkMovementMethod.getInstance());
            textView.setLinksClickable(true);
            textView.setText(Html.fromHtml(getActivity().getString(R.string.icon_credits)));

            return false;
        }
    });

    // Changelog
    Preference preference1 = (Preference) findPreference("changelog");
    preference1.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {

            MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity());
            if (theme == 1)
                a.theme(Theme.DARK);
            a.title(R.string.changelog);
            a.content(Html.fromHtml(getActivity().getString(R.string.changelog_version_9)
                    + getActivity().getString(R.string.changelog_change_9)
                    + getActivity().getString(R.string.changelog_version_8)
                    + getActivity().getString(R.string.changelog_change_8)
                    + getActivity().getString(R.string.changelog_version_7)
                    + getActivity().getString(R.string.changelog_change_7)
                    + getActivity().getString(R.string.changelog_version_6)
                    + getActivity().getString(R.string.changelog_change_6)
                    + getActivity().getString(R.string.changelog_version_5)
                    + getActivity().getString(R.string.changelog_change_5)
                    + getActivity().getString(R.string.changelog_version_4)
                    + getActivity().getString(R.string.changelog_change_4)
                    + getActivity().getString(R.string.changelog_version_3)
                    + getActivity().getString(R.string.changelog_change_3)
                    + getActivity().getString(R.string.changelog_version_2)
                    + getActivity().getString(R.string.changelog_change_2)
                    + getActivity().getString(R.string.changelog_version_1)
                    + getActivity().getString(R.string.changelog_change_1)));
            a.negativeText(R.string.close);
            a.positiveText(R.string.fullChangelog);
            int fab_skin = Color.parseColor(PreferenceUtils.getAccentString(sharedPref));
            a.positiveColor(fab_skin);
            a.negativeColor(fab_skin);
            a.callback(new MaterialDialog.ButtonCallback() {
                @Override
                public void onPositive(MaterialDialog materialDialog) {

                    Intent intent = new Intent(Intent.ACTION_VIEW,
                            Uri.parse("https://github.com/arpitkh96/AmazeFileManager/commits/master"));
                    startActivity(intent);
                }

                @Override
                public void onNegative(MaterialDialog materialDialog) {

                    materialDialog.cancel();
                }
            }).build().show();
            return false;
        }
    });

    // Open Source Licenses
    Preference preference2 = (Preference) findPreference("os");
    //Defining dialog layout
    final Dialog dialog = new Dialog(getActivity(),
            android.R.style.Theme_Holo_Light_DialogWhenLarge_NoActionBar);
    //dialog.setTitle("Open-Source Licenses");
    LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
    final View dialog_view = inflater.inflate(R.layout.open_source_licenses, null);
    dialog.setContentView(dialog_view);

    preference2.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {

        @Override
        public boolean onPreferenceClick(Preference arg0) {

            WebView wv = (WebView) dialog_view.findViewById(R.id.webView1);
            PreferenceUtils preferenceUtils = new PreferenceUtils();
            wv.loadData(PreferenceUtils.LICENCE_TERMS, "text/html", null);
            dialog.show();
            return false;
        }
    });

    // Feedback
    Preference preference3 = (Preference) findPreference("feedback");
    preference3.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
                    Uri.fromParts("mailto", "arpitkh96@gmail.com", null));
            emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Feedback : Amaze File Manager");
            Toast.makeText(getActivity(), getActivity().getFilesDir().getPath(), Toast.LENGTH_SHORT).show();
            File f = new File(getActivity().getExternalFilesDir("internal"), "log.txt");
            if (f.exists()) {
                emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f));
            }
            startActivity(Intent.createChooser(emailIntent, getResources().getString(R.string.feedback)));
            return false;
        }
    });

    // rate
    Preference preference5 = (Preference) findPreference("rate");
    preference5.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            Intent intent1 = new Intent(Intent.ACTION_VIEW);
            intent1.setData(Uri.parse("market://details?id=com.amaze.filemanager"));
            startActivity(intent1);
            return false;
        }
    });

    // studio
    Preference studio = findPreference("studio");
    studio.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            COUNT++;
            if (COUNT >= 5) {
                if (toast != null)
                    toast.cancel();
                toast = Toast.makeText(getActivity(), "Studio Mode : " + COUNT, Toast.LENGTH_SHORT);
                toast.show();

                sharedPref.edit().putInt("studio", Integer.parseInt(Integer.toString(COUNT) + "000")).apply();
            } else {
                sharedPref.edit().putInt("studio", 0).apply();
            }
            return false;
        }
    });

    // G+
    gplus = (CheckBx) findPreference("plus_pic");
    gplus.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            if (gplus.isChecked()) {
                boolean b = checkGplusPermission();
                if (!b)
                    requestGplusPermission();
            }
            return false;
        }
    });
    if (BuildConfig.IS_VERSION_FDROID)
        gplus.setEnabled(false);

    // Colored navigation bar
}

From source file:com.brodev.socialapp.view.MusicPlaySong.java

public void getMusicAdapter() {
    String resString = getResultFromGET();

    try {/*from   w  w w .  j a v  a  2s.c  om*/
        JSONObject mainJSON = new JSONObject(resString);

        Object intervention = mainJSON.get("output");

        if (intervention instanceof JSONObject) {
            JSONObject outputJSON = mainJSON.getJSONObject("output");

            //set user id
            music.setUser_id(outputJSON.getString("user_id"));
            //set title
            music.setTitle(Html.fromHtml(outputJSON.getString("title")).toString());
            //set song path
            music.setSong_path(outputJSON.getString("song_path"));
            //set user image
            music.setUser_image_path(outputJSON.getString("user_image_path"));
            //set short text
            music.setShort_text(outputJSON.getString("short_text"));
            //set total like
            music.setTotal_like(outputJSON.getString("total_like"));
            //set total comment
            music.setTotal_comment(outputJSON.getString("total_comment"));
            //set time stamp
            music.setTime_stamp(Html.fromHtml(outputJSON.getString("time_stamp")).toString());

            //set is liked
            if (outputJSON.has("is_liked") && !outputJSON.isNull("is_liked")) {
                Object inte = outputJSON.get("is_liked");
                if (inte instanceof String)
                    music.setLiked(true);
            }

            //set can post comment
            if (outputJSON.has("can_post_comment")) {
                music.setCanPostComment(outputJSON.getBoolean("can_post_comment"));
            }

            //set share
            if (outputJSON.has("no_share"))
                music.setShare(true);
        }
    } catch (Exception ex) {
        ex.printStackTrace();

    }

}

From source file:com.eyekabob.ArtistInfo.java

private void toggleBioText(boolean detailed) {
    TextView bioView = (TextView) findViewById(R.id.infoBioContent);

    String contentHtml = "";
    if (artist != null && !"".equals(artist.getContent())) {
        if (detailed) {
            contentHtml = artist.getContent();
        } else {/*from  w  ww.  j  a va2s.  com*/
            contentHtml = artist.getSummary();
        }
    }

    bioView.setText(Html.fromHtml(contentHtml));
}

From source file:com.nuvolect.securesuite.data.SqlSyncTest.java

public void pingPongConfirmDiag(final Activity act) {

    m_act = act;/*  www  .j a  v a2s . co  m*/

    if (!WebUtil.companionServerAssigned()) {
        Toast.makeText(act, "Configure companion device for test to operate", Toast.LENGTH_LONG).show();
        return;
    }

    String title = "Pyramid comm test with companion device";
    String message = "This is a non-destructive network performance test. "
            + "Payload size is incrementally increased.";

    AlertDialog.Builder builder = new AlertDialog.Builder(act);
    builder.setTitle(title);
    builder.setMessage(Html.fromHtml(message));
    builder.setIcon(CConst.SMALL_ICON);
    builder.setCancelable(true);

    builder.setPositiveButton("Start test", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {

            setProgressCallback(m_act, pingPongCallbacks);
            pingPongProgress(act);
            SqlSyncTest.getInstance().init();// Small amount of init on UI thread
            WorkerCommand.quePingTest(m_act);// Heavy lifting on non-UI thread
        }
    });
    builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {

            dialog_alert.cancel();
        }
    });
    dialog_alert = builder.create();
    dialog_alert.show();

    // Activate the HTML
    TextView tv = ((TextView) dialog_alert.findViewById(android.R.id.message));
    tv.setMovementMethod(LinkMovementMethod.getInstance());
}

From source file:com.liato.bankdroid.banking.banks.Nordea.Nordea.java

@Override
public void updateTransactions(Account account, Urllib urlopen) throws LoginException, BankException {
    super.updateTransactions(account, urlopen);

    //No transaction history for loans, funds and credit cards.
    int accType = account.getType();
    if (accType == Account.LOANS || accType == Account.FUNDS || accType == Account.CCARD)
        return;/*w w  w. ja v a 2  s.  co  m*/

    String response = null;
    Matcher matcher;
    try {
        response = urlopen.open("https://mobil.nordea.se/banking-nordea/nordea-c3/accounts.html");
        response = urlopen.open(
                "https://mobil.nordea.se/banking-nordea/nordea-c3/account.html?id=konton:" + account.getId());
        matcher = reCurrency.matcher(response);
        /*
         * Capture groups:
         * GROUP                EXAMPLE DATA
         * 1: Currency          SEK 
         *   
         */
        String currency = "SEK";
        if (matcher.find()) {
            currency = matcher.group(1).trim();
        } else {
            Log.w(TAG, "Unable to find currency, assuming SEK.");
        }
        matcher = reTransactions.matcher(response);
        ArrayList<Transaction> transactions = new ArrayList<Transaction>();
        while (matcher.find()) {
            Transaction transaction = new Transaction(Html.fromHtml(matcher.group(1)).toString().trim(),
                    Html.fromHtml(matcher.group(2)).toString().trim(), Helpers.parseBalance(matcher.group(3)));
            transaction.setCurrency(currency);
            transactions.add(transaction);
        }
        account.setTransactions(transactions);
        account.setCurrency(currency);
    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}