Example usage for android.text Html FROM_HTML_MODE_COMPACT

List of usage examples for android.text Html FROM_HTML_MODE_COMPACT

Introduction

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

Prototype

int FROM_HTML_MODE_COMPACT

To view the source code for android.text Html FROM_HTML_MODE_COMPACT.

Click Source Link

Document

Flags for #fromHtml(String,int,ImageGetter,TagHandler) : Separate block-level elements with line breaks (single newline character) in between.

Usage

From source file:com.hash.android.srijan.fragment.AboutUsFragment.java

/**
 * Called to have the fragment instantiate its user interface view.
 * This is optional, and non-graphical fragments can return null (which
 * is the default implementation).  This will be called between
 * {@link #onCreate(Bundle)} and {@link #onActivityCreated(Bundle)}.
 * <p>/*from  ww  w  .java2 s .c  om*/
 * <p>If you return a View from here, you will later be called in
 * {@link #onDestroyView} when the view is being released.
 *
 * @param inflater           The LayoutInflater object that can be used to inflate
 *                           any views in the fragment,
 * @param container          If non-null, this is the parent view that the fragment's
 *                           UI should be attached to.  The fragment should not add the view itself,
 *                           but this can be used to generate the LayoutParams of the view.
 * @param savedInstanceState If non-null, this fragment is being re-constructed
 *                           from a previous saved state as given here.
 * @return Return the View for the fragment's UI, or null.
 */
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.about_us_fragment, container, false);
    TextView textView = (TextView) rootView.findViewById(R.id.aboutUstextView);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        textView.setText(Html.fromHtml(
                "<p>Jadavpur University has always been an epitome of excellence and the perfect example of a place meant for holistic development of an individual. Ever since 1955, JU has been leading the front, be it for technical expertise or cultural prowess.</p><p>However, some time back in 2007, few individuals of the Faculty of Engineering and Technology at Jadavpur University grew restless thinking of how JU despite being an ocean of scientific mastery, was not contributing towards a platform for technical recreation. Every body could do classes, attend labs, have an \'adda\' at the field, crack complex research problems, or make merry dancing to songs at a fest. But as a leading technical institution, how was JU enabling others to explore their technical selves through recreation?</p><p>Thus, SRIJAN was conceived. :)</p><p>SRIJAN has always dedicated itself to the idea of promoting, showcasing, and encouraging concepts and research beyond the known periphery. Oddities are cheered, out-of-the-box thinking is lauded, and most importantly a platform is given to translate technical knowledge into realistic applications. SRIJAN has in its objectives to reflect the respect Jadavpur University commands in form of the talent supportive acts it anchors.</p><p>Today, SRIJAN stands proudly as the biggest and most prestigious techno-management fest in the City of Joy. Being a part of SRIJAN is like working at a startup: there are no fixed methods of working, you do not know whether your experiments will succeed, everyone has to do all kinds of work, you have to be bonded strongly to your teammates, and the learning and exposure is immense! :)</p><p>1955 to 2007 might have been a long time for SRIJAN to come into being, but 2007 to 2017 have been years of putting together blood and sweat to establish our beloved techno-management fest. Our track record is not a license to rest, but a challenge from our predecessors which we gladly accept. A shout-out to all our lovely seniors who worked day in and day out to make SRIJAN the favorite destination for all the dreamers and believers !</p><p>A month away from SRIJAN 2017, today we retrospect about what has gone and introspect about what is to come. With arms wide open, we invite everyone to come join us for 3 days of innovation, fun, recreation, brainstorming, productivity, and merry! We invite you to F.E.T.S.U. presents SRIJAN 2017.</p><p>24th, 25th, and 26th of February, 2017. Mark the dates.</p><p>SRIJAN is not just a fest for us. It is a Religion.</p>",
                Html.FROM_HTML_MODE_COMPACT));

    } else {
        textView.setText(Html.fromHtml(
                "<p>Jadavpur University has always been an epitome of excellence and the perfect example of a place meant for holistic development of an individual. Ever since 1955, JU has been leading the front, be it for technical expertise or cultural prowess.</p><p>However, some time back in 2007, few individuals of the Faculty of Engineering and Technology at Jadavpur University grew restless thinking of how JU despite being an ocean of scientific mastery, was not contributing towards a platform for technical recreation. Every body could do classes, attend labs, have an \'adda\' at the field, crack complex research problems, or make merry dancing to songs at a fest. But as a leading technical institution, how was JU enabling others to explore their technical selves through recreation?</p><p>Thus, SRIJAN was conceived. :)</p><p>SRIJAN has always dedicated itself to the idea of promoting, showcasing, and encouraging concepts and research beyond the known periphery. Oddities are cheered, out-of-the-box thinking is lauded, and most importantly a platform is given to translate technical knowledge into realistic applications. SRIJAN has in its objectives to reflect the respect Jadavpur University commands in form of the talent supportive acts it anchors.</p><p>Today, SRIJAN stands proudly as the biggest and most prestigious techno-management fest in the City of Joy. Being a part of SRIJAN is like working at a startup: there are no fixed methods of working, you do not know whether your experiments will succeed, everyone has to do all kinds of work, you have to be bonded strongly to your teammates, and the learning and exposure is immense! :)</p><p>1955 to 2007 might have been a long time for SRIJAN to come into being, but 2007 to 2017 have been years of putting together blood and sweat to establish our beloved techno-management fest. Our track record is not a license to rest, but a challenge from our predecessors which we gladly accept. A shout-out to all our lovely seniors who worked day in and day out to make SRIJAN the favorite destination for all the dreamers and believers !</p><p>A month away from SRIJAN 2017, today we retrospect about what has gone and introspect about what is to come. With arms wide open, we invite everyone to come join us for 3 days of innovation, fun, recreation, brainstorming, productivity, and merry! We invite you to F.E.T.S.U. presents SRIJAN 2017.</p><p>24th, 25th, and 26th of February, 2017. Mark the dates.</p><p>SRIJAN is not just a fest for us. It is a Religion.</p>"));

    }
    return rootView;

}

From source file:com.jadebyte.popularmovies.activities.MainActivity.java

private void showLicenseDialog() {
    LayoutInflater inflater = getLayoutInflater();
    View view = inflater.inflate(R.layout.dialog_license, null);
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setPositiveButton(R.string.dismiss, new DialogInterface.OnClickListener() {
        @Override/*from  www. j  av  a2s  .c  o  m*/
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    builder.setView(view);
    TextView textView = (TextView) view.findViewById(R.id.license_text);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        textView.setText(
                Html.fromHtml(MyFile.readFromAssets(this, "license.html"), Html.FROM_HTML_MODE_COMPACT));
    } else {
        textView.setText(Html.fromHtml(MyFile.readFromAssets(this, "license.html")));
    }
    builder.show();
}

From source file:io.github.hidroh.materialistic.AppUtils.java

public static CharSequence fromHtml(String htmlText, boolean compact) {
    if (TextUtils.isEmpty(htmlText)) {
        return null;
    }//from w  w  w . j av  a  2s  . c  om
    CharSequence spanned;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        //noinspection InlinedApi
        spanned = Html.fromHtml(htmlText, compact ? Html.FROM_HTML_MODE_COMPACT : Html.FROM_HTML_MODE_LEGACY);
    } else {
        //noinspection deprecation
        spanned = Html.fromHtml(htmlText);
    }
    return trim(spanned);
}

From source file:cc.metapro.openct.customviews.TableChooseDialog.java

private void setView() {
    mTableIds = new ArrayList<>(tableMap.size());
    for (String s : tableMap.keySet()) {
        mTableIds.add(s);/*from www.  jav  a 2 s . com*/
    }

    final List<View> views = new ArrayList<>(mTableIds.size());
    for (String s : mTableIds) {
        TextView textView = new TextView(getActivity());

        String content = tableMap.get(s).toString();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            textView.setText(Html.fromHtml(content, Html.FROM_HTML_MODE_COMPACT));
        } else {
            textView.setText(Html.fromHtml(content));
        }
        views.add(textView);
    }

    mTabBar.setupWithViewPager(mViewPager);
    mViewPager.setAdapter(new PagerAdapter() {
        @Override
        public int getCount() {
            return mTableIds.size();
        }

        @Override
        public CharSequence getPageTitle(int position) {
            return mTableIds.get(position);
        }

        @Override
        public boolean isViewFromObject(View view, Object object) {
            return view == object;
        }

        @Override
        public void destroyItem(ViewGroup container, int position, Object object) {
            container.removeView(views.get(position));
        }

        @Override
        public Object instantiateItem(ViewGroup container, int position) {
            container.addView(views.get(position));
            return views.get(position);
        }
    });
}

From source file:de.teammartens.android.wattfinder.worker.AnimationWorker.java

public static void hideStartup() {
    if (LogWorker.isVERBOSE())
        LogWorker.d(LOG_TAG, "hideStartup " + startupScreen);

    View startup = getInstance().findViewById(R.id.startupScreen);
    if (startupScreen) {
        if (LogWorker.isVERBOSE())
            LogWorker.d(LOG_TAG, "privacyConsent " + privacyConsent);
        //if(!KartenActivity.privacyConsent && (System.currentTimeMillis() - KartenActivity.sharedPref.getLong(KartenActivity.sP_Timestamp,0))>3600*1000) {//Zeige Eula wenn privacyConsent nicht aktiviert und letztes Programmende ist mindestens eine Stunde eher
        if (!KartenActivity.privacyConsent) {
            if (LogWorker.isVERBOSE())
                LogWorker.d(LOG_TAG, "privacyConsent treffer ");

            final View v = getInstance().findViewById(R.id.eulaScreen);
            if (v != null) {
                fadeIn(v, 0, 1.0f);//from   w  w  w. ja  v  a2  s . c om
                hide_mapSearch();

                TextView tv = getInstance().findViewById(R.id.welcomeText);
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
                    tv.setText(Html.fromHtml(getInstance().getString(R.string.privacy_text_short),
                            Html.FROM_HTML_MODE_COMPACT));
                else
                    tv.setText(Html.fromHtml(getInstance().getString(R.string.privacy_text_short)));

                Button b = (Button) getInstance().findViewById(R.id.eulaButton);
                b.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {

                        final CheckBox cb = (CheckBox) getInstance().findViewById(R.id.privacy_consent);
                        TextView tv = getInstance().findViewById(R.id.privacyText);
                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
                            tv.setText(Html.fromHtml(getInstance().getString(R.string.privacy_desc_long),
                                    Html.FROM_HTML_MODE_COMPACT));
                        else
                            tv.setText(Html.fromHtml(getInstance().getString(R.string.privacy_desc_long)));
                        tv = getInstance().findViewById(R.id.privacyLicense);
                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
                            tv.setText(Html.fromHtml(getInstance().getString(R.string.privacy_license),
                                    Html.FROM_HTML_MODE_COMPACT));
                        else
                            tv.setText(Html.fromHtml(getInstance().getString(R.string.privacy_license)));

                        show_fabs();
                        View vv = getInstance().findViewById(R.id.welcome_scroll);
                        fadeOut(vv, 0);
                        vv = getInstance().findViewById(R.id.privacy_long);
                        fadeIn(vv, 0, 1.0f);
                        vv = getInstance().findViewById(R.id.eulaSubTitle);
                        fadeIn(vv, 0, 1.0f);

                        Button b = (Button) getInstance().findViewById(R.id.eulaButton);
                        b.setText(R.string.close);
                        b.setEnabled(false);
                        b.setAlpha(0.3f);
                        b.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                KartenActivity.privacyConsent = cb.isChecked();
                                KartenActivity.sharedPref.edit()
                                        .putBoolean("privacyConsent", KartenActivity.privacyConsent).apply();
                                slideDown(v, 0);
                                GeoWorks.setupLocationListener();

                                SaeulenWorks.reloadMarker();

                                show_fabs();
                                show_debug();

                            }
                        });
                        cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                            @Override
                            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                                Button b = (Button) getInstance().findViewById(R.id.eulaButton);
                                if (isChecked)
                                    b.setAlpha(1.0f);
                                else
                                    b.setAlpha(0.3f);
                                b.setEnabled(isChecked);
                            }
                        });

                    }
                });

            }
        }
        KartenActivity.setMapCenter();

        slideDown(startup, 500);
        startup.setVisibility(View.GONE);
        startupScreen = false;
    }
    //slideSearchBarDown(mapSearch,0);
}

From source file:com.lloydtorres.stately.helpers.SparkleHelper.java

/**
 * Wrapper for Html.fromHtml, which has different calls depending on the API version.
 * @param src//from  w  ww .  jav  a2  s .  c  o m
 * @return
 */
public static Spanned fromHtml(String src) {
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
        return Html.fromHtml(src, Html.FROM_HTML_MODE_COMPACT);
    } else {
        return Html.fromHtml(src);
    }
}