Example usage for android.text SpannableString setSpan

List of usage examples for android.text SpannableString setSpan

Introduction

In this page you can find the example usage for android.text SpannableString setSpan.

Prototype

public void setSpan(Object what, int start, int end, int flags) 

Source Link

Usage

From source file:io.github.hidroh.materialistic.data.HackerNewsItem.java

@NonNull
private SpannableString createAuthorSpannable(boolean authorLink) {
    SpannableString bySpannable = new SpannableString(AUTHOR_SEPARATOR + by);
    if (!authorLink) {
        return bySpannable;
    }/*  w  w w . j  a v  a  2  s .  com*/
    bySpannable.setSpan(new StyleSpan(Typeface.BOLD), AUTHOR_SEPARATOR.length(), bySpannable.length(),
            Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
    ClickableSpan clickableSpan = new ClickableSpan() {
        @Override
        public void onClick(View view) {
            view.getContext()
                    .startActivity(new Intent(Intent.ACTION_VIEW).setData(AppUtils.createUserUri(getBy())));
        }

        @Override
        public void updateDrawState(TextPaint ds) {
            super.updateDrawState(ds);
            ds.setUnderlineText(false);
        }
    };
    bySpannable.setSpan(clickableSpan, AUTHOR_SEPARATOR.length(), bySpannable.length(),
            Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
    return bySpannable;
}

From source file:com.coderdojo.libretalk.MainActivity.java

private final void printMsg(final LibretalkMessageData message) {
    ArrayAdapter<SpannableString> adapter = new ArrayAdapter<SpannableString>(this,
            android.R.layout.simple_list_item_1, mMessageListArray);
    ListView listView = (ListView) findViewById(R.id.message_list);
    listView.setAdapter(adapter);// www . j a  va 2  s .co m
    listView.setStackFromBottom(true);

    final String sourceMessage = message.getSenderTag() + ": " + message.getData();
    final SpannableString formattedText = new SpannableString(sourceMessage);

    if (message.getData().startsWith(">")) {

        formattedText.setSpan(
                new ForegroundColorSpan(LibretalkMessageData.getColorFromString(message.getSenderTag())),
                sourceMessage.indexOf(message.getSenderTag()),
                sourceMessage.indexOf(message.getSenderTag()) + message.getSenderTag().length(),
                Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

        formattedText.setSpan(new ForegroundColorSpan(Color.rgb(120, 153, 34)),
                sourceMessage.indexOf(message.getData()),
                sourceMessage.indexOf(message.getData()) + message.getData().length(),
                Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    } else {

        formattedText.setSpan(
                new ForegroundColorSpan(LibretalkMessageData.getColorFromString(message.getSenderTag())),
                sourceMessage.indexOf(message.getSenderTag()),
                sourceMessage.indexOf(message.getSenderTag()) + message.getSenderTag().length(),
                Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    }

    mMessageListArray.add(formattedText);
    adapter.notifyDataSetChanged();
}

From source file:li.barter.activities.AbstractBarterLiActivity.java

/**
 * Sets the Action bar title, using the desired {@link Typeface} loaded from {@link
 * TypefaceCache}//from w w w .  j a  va2s . c  o m
 *
 * @param title The title to set for the Action Bar
 */

public final void setActionBarTitle(final String title) {

    final SpannableString s = new SpannableString(title);
    s.setSpan(new TypefacedSpan(this, TypefaceCache.SLAB_REGULAR), 0, s.length(),
            Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    // Update the action bar title with the TypefaceSpan instance
    final ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle(s);
}

From source file:au.org.ala.fielddata.mobile.CollectSurveyData.java

public void onSpeciesSelected(Species selectedSpecies) {

    surveyViewModel.speciesSelected(selectedSpecies);
    pager.setCurrentItem(1);/*from   w ww  .  j a  va  2s. com*/
    SpannableString title = new SpannableString(selectedSpecies.scientificName);
    title.setSpan(new StyleSpan(Typeface.ITALIC), 0, title.length(), 0);
    getSupportActionBar().setTitle(title);
    getSupportActionBar().setSubtitle(selectedSpecies.commonName);

}

From source file:com.github.socialc0de.gsw.android.MainActivity.java

private void fillLayout() {
    SpannableString s = new SpannableString(getString(R.string.app_name));
    s.setSpan(new com.github.socialc0de.gsw.android.TypefaceSpan(getApplicationContext(), "fabiolo.otf"), 0,
            s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    ((Toolbar) findViewById(R.id.app_bar)).setTitle(s);
    mTinyDB = new TinyDB(this);
    loadCategories();//from  w w  w.ja v a 2 s.co m
    loadAccount();
    if (mDrawer != null && mFragments != null) {
        for (int i = 0; i < mFragments.size(); i++) {
            mDrawer.removeItem(i);
        }
    }

    //create the drawer and remember the `Drawer` result object

    headerResult = new AccountHeaderBuilder().withActivity(this).withHeaderBackground(R.drawable.productback)
            .withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() {
                @Override
                public boolean onProfileChanged(View view, IProfile profile, boolean currentProfile) {
                    return false;
                }
            }).withSelectionListEnabledForSingleProfile(false).build();

    mFragments.clear();

    mFragments.add(new LocalFragment(this));
    mFragments.add(new CategoryFragment(this));
    mFragments.add(new ProfileFragment());
    mFragments.add(new PhraseFragment());
    mFragments.add(new FAQFragment());
    mFragments.add(new AuthorityMapFragment());
    mFragments.add(new DonateFragment());
    mFragments.add(new AboutFragment());

    if (mDrawer == null) {
        mDrawer = new DrawerBuilder().withActivity(this).withToolbar((Toolbar) findViewById(R.id.app_bar))
                .withActionBarDrawerToggle(true).withAccountHeader(headerResult)
                .addDrawerItems(
                        new PrimaryDrawerItem().withName(R.string.sharing_local)
                                .withIcon(R.drawable.ic_place_black_36dp),
                        new PrimaryDrawerItem().withName(R.string.sharing_categories)
                                .withIcon(R.drawable.ic_view_day_black_36dp),
                        new PrimaryDrawerItem().withName(R.string.profile)
                                .withIcon(R.drawable.ic_assignment_ind_black_36dp),
                        new PrimaryDrawerItem().withName(R.string.phrasebook)
                                .withIcon(R.drawable.ic_translate_black_36dp),
                        new PrimaryDrawerItem().withName(R.string.faq)
                                .withIcon(R.drawable.ic_question_answer_black_36dp),
                        new PrimaryDrawerItem().withName(R.string.authority_map)
                                .withIcon(R.drawable.ic_map_black_36dp),
                        new PrimaryDrawerItem().withName(R.string.donate)
                                .withIcon(R.drawable.ic_attach_money_black_36dp),
                        new PrimaryDrawerItem().withName(R.string.about)
                                .withIcon(R.drawable.ic_info_black_36dp))
                .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                    @Override
                    public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                        // do something with the clicked item :D
                        if (getSupportFragmentManager().findFragmentByTag(
                                mFragments.get(position - 1).getClass().getSimpleName()) != null)
                            return false;
                        getSupportFragmentManager().popBackStack(null,
                                FragmentManager.POP_BACK_STACK_INCLUSIVE);
                        getSupportFragmentManager().beginTransaction()
                                .replace(R.id.container, mFragments.get(position - 1),
                                        mFragments.get(position - 1).getClass().getSimpleName())
                                .addToBackStack(null).commit();

                        // closes Drawer
                        return false;
                    }
                }).build();
    }

    getSupportFragmentManager().beginTransaction().replace(R.id.container, mFragments.get(0)).commit();
}

From source file:gov.wa.wsdot.android.wsdot.ui.tollrates.SR167TollRatesFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_dynamic_toll_rates, null);

    mRecyclerView = root.findViewById(R.id.my_recycler_view);
    mRecyclerView.setHasFixedSize(true);
    mLayoutManager = new LinearLayoutManager(getActivity());
    mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mAdapter = new SR167TollRatesItemAdapter(getActivity());
    mRecyclerView.setAdapter(mAdapter);/*from  ww  w  .j a va2  s. c  o m*/

    mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(getActivity()));

    mRecyclerView.setPadding(0, 0, 0, 120);

    addDisclaimerView(root);

    directionRadioGroup = root.findViewById(R.id.segment_control);

    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext());
    radioGroupDirectionIndex = sharedPref.getInt(getString(R.string.toll_rates_167_travel_direction_key), 0);

    if (radioGroupDirectionIndex == 0) {
        RadioButton leftSegment = root.findViewById(R.id.radio_left);
        leftSegment.setChecked(true);
    } else {
        RadioButton rightSegment = root.findViewById(R.id.radio_right);
        rightSegment.setChecked(true);
    }

    directionRadioGroup.setOnCheckedChangeListener((group, checkedId) -> {

        RadioButton selectedDirection = directionRadioGroup.findViewById(checkedId);

        mAdapter.setData(filterTollsForDirection(String.valueOf(selectedDirection.getText().charAt(0))));

        mLayoutManager.scrollToPositionWithOffset(0, 0);
        SharedPreferences sharedPref1 = PreferenceManager.getDefaultSharedPreferences(getContext());
        SharedPreferences.Editor editor = sharedPref1.edit();

        radioGroupDirectionIndex = directionRadioGroup.indexOfChild(selectedDirection);

        TextView travelTimeView = root.findViewById(R.id.travel_time_text);
        travelTimeView.setText(getTravelTimeStringForDirection(radioGroupDirectionIndex == 0 ? "N" : "S"));

        editor.putInt(getString(R.string.toll_rates_167_travel_direction_key), radioGroupDirectionIndex);

        editor.apply();

    });

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    swipeRefreshLayout = root.findViewById(R.id.swipe_container);
    swipeRefreshLayout.setOnRefreshListener(this);
    swipeRefreshLayout.setColorSchemeResources(R.color.holo_blue_bright, R.color.holo_green_light,
            R.color.holo_orange_light, R.color.holo_red_light);

    mEmptyView = root.findViewById(R.id.empty_list_view);

    TextView header_link = root.findViewById(R.id.header_text);

    // create spannable string for underline
    SpannableString content = new SpannableString(
            getActivity().getResources().getString(R.string.sr167_info_link));
    content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
    header_link.setText(content);

    header_link.setTextColor(getResources().getColor(R.color.primary_default));
    header_link.setOnClickListener(v -> {
        Intent intent = new Intent();
        // GA tracker
        mTracker = ((WsdotApplication) getActivity().getApplication()).getDefaultTracker();
        mTracker.setScreenName("/Toll Rates/Learn about SR-167");
        mTracker.send(new HitBuilders.ScreenViewBuilder().build());
        intent.setAction(Intent.ACTION_VIEW);
        intent.setData(Uri.parse("https://www.wsdot.wa.gov/Tolling/SR167HotLanes/HOTtollrates.htm"));
        startActivity(intent);

    });

    viewModel = ViewModelProviders.of(this, viewModelFactory).get(TollRatesViewModel.class);

    viewModel.getResourceStatus().observe(this, resourceStatus -> {
        if (resourceStatus != null) {
            switch (resourceStatus.status) {
            case LOADING:
                swipeRefreshLayout.setRefreshing(true);
                break;
            case SUCCESS:
                swipeRefreshLayout.setRefreshing(false);
                break;
            case ERROR:
                swipeRefreshLayout.setRefreshing(false);
                Toast.makeText(this.getContext(), "connection error", Toast.LENGTH_LONG).show();
            }
        }
    });

    viewModel.getSR167TollRateItems().observe(this, tollRateGroups -> {
        if (tollRateGroups != null) {
            mEmptyView.setVisibility(View.GONE);

            Collections.sort(tollRateGroups, new SortTollGroupByLocation());
            Collections.sort(tollRateGroups, new SortTollGroupByDirection());

            tollGroups = new ArrayList<>(tollRateGroups);

            directionRadioGroup.getCheckedRadioButtonId();
            RadioButton selectedDirection = directionRadioGroup
                    .findViewById(directionRadioGroup.getCheckedRadioButtonId());

            mAdapter.setData(filterTollsForDirection(String.valueOf(selectedDirection.getText().charAt(0))));
        }
    });

    viewModel.getTravelTimesForETLFor("167").observe(this, travelTimes -> {

        TextView travelTimeView = root.findViewById(R.id.travel_time_text);

        if (travelTimes.size() > 0) {
            travelTimeView.setVisibility(View.VISIBLE);

            this.travelTimes = new ArrayList<>(travelTimes);

            travelTimeView.setText(getTravelTimeStringForDirection(radioGroupDirectionIndex == 0 ? "N" : "S"));
        } else {

            travelTimeView.setVisibility(View.GONE);
        }
    });

    timer = new Timer();
    timer.schedule(new SR167TollRatesFragment.RatesTimerTask(), 0, 60000); // Schedule rates to update every 60 seconds

    return root;
}

From source file:org.bobstuff.bobball.ActivityStateEnum.java

private void updateStatus(final GameState currGameState) {

    SpannableStringBuilder timeLeftStr = SpannableStringBuilder
            .valueOf(getString(R.string.timeLeftLabel, gameManager.timeLeft() / 10));

    SpannableStringBuilder livesStr = formatPerPlayer(getString(R.string.livesLabel), new playstat() {
        @Override/*from w  w  w .ja  v  a2 s. c om*/
        public int call(Player p) {
            return p.getLives();
        }
    });
    SpannableStringBuilder scoreStr = formatPerPlayer(getString(R.string.scoreLabel), new playstat() {
        @Override
        public int call(Player p) {
            return p.getScore();
        }
    });

    SpannableStringBuilder clearedStr = formatPerPlayer(getString(R.string.areaClearedLabel), new playstat() {
        @Override
        public int call(Player p) {
            Grid grid = currGameState.getGrid();
            if (grid != null)
                return currGameState.getGrid().getPercentComplete(p.getPlayerId());
            else
                return 0;
        }
    });

    //display fps
    if (secretHandshake >= 3) {

        float fps = displayLoop.getFPS();
        int color = (fps < NUMBER_OF_FRAMES_PER_SECOND * 0.98f ? Color.RED : Color.GREEN);
        SpannableString s = new SpannableString(String.format(" FPS: %2.1f", fps));

        s.setSpan(new ForegroundColorSpan(color), 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        timeLeftStr.append(s);

        color = (gameManager.getUPS() < gameManager.NUMBER_OF_UPDATES_PER_SECOND * 0.98f ? Color.RED
                : Color.GREEN);
        s = new SpannableString(String.format(" UPS: %3.1f", gameManager.getUPS()));

        s.setSpan(new ForegroundColorSpan(color), 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        timeLeftStr.append(s);
    }

    statusTopleft.setText(timeLeftStr);
    statusTopright.setText(livesStr);
    statusBotleft.setText(scoreStr);
    statusBotright.setText(clearedStr);
}

From source file:gov.wa.wsdot.android.wsdot.ui.tollrates.I405TollRatesFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_dynamic_toll_rates, null);

    mRecyclerView = root.findViewById(R.id.my_recycler_view);
    mRecyclerView.setHasFixedSize(true);
    mLayoutManager = new LinearLayoutManager(getActivity());
    mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mAdapter = new I405TollRatesItemAdapter(getActivity());
    mRecyclerView.setAdapter(mAdapter);/*w  w  w . ja va2  s  .  c o m*/

    mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(getActivity()));

    mRecyclerView.setPadding(0, 0, 0, 120);

    addDisclaimerView(root);

    directionRadioGroup = root.findViewById(R.id.segment_control);

    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext());
    radioGroupDirectionIndex = sharedPref.getInt(getString(R.string.toll_rates_405_travel_direction_key), 0);

    if (radioGroupDirectionIndex == 0) {
        RadioButton leftSegment = root.findViewById(R.id.radio_left);
        leftSegment.setChecked(true);
    } else {
        RadioButton rightSegment = root.findViewById(R.id.radio_right);
        rightSegment.setChecked(true);
    }

    directionRadioGroup.setOnCheckedChangeListener((group, checkedId) -> {

        RadioButton selectedDirection = directionRadioGroup.findViewById(checkedId);

        mAdapter.setData(filterTollsForDirection(String.valueOf(selectedDirection.getText().charAt(0))));

        mLayoutManager.scrollToPositionWithOffset(0, 0);
        SharedPreferences sharedPref1 = PreferenceManager.getDefaultSharedPreferences(getContext());
        SharedPreferences.Editor editor = sharedPref1.edit();

        radioGroupDirectionIndex = directionRadioGroup.indexOfChild(selectedDirection);

        TextView travelTimeView = root.findViewById(R.id.travel_time_text);
        travelTimeView.setText(getTravelTimeStringForDirection(radioGroupDirectionIndex == 0 ? "N" : "S"));

        editor.putInt(getString(R.string.toll_rates_405_travel_direction_key), radioGroupDirectionIndex);

        editor.apply();

    });

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    swipeRefreshLayout = root.findViewById(R.id.swipe_container);
    swipeRefreshLayout.setOnRefreshListener(this);
    swipeRefreshLayout.setColorSchemeResources(R.color.holo_blue_bright, R.color.holo_green_light,
            R.color.holo_orange_light, R.color.holo_red_light);

    mEmptyView = root.findViewById(R.id.empty_list_view);

    TextView header_link = root.findViewById(R.id.header_text);

    // create spannable string for underline
    SpannableString content = new SpannableString(
            getActivity().getResources().getString(R.string.i405_info_link));
    content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
    header_link.setText(content);

    header_link.setTextColor(getResources().getColor(R.color.primary_default));
    header_link.setOnClickListener(v -> {
        Intent intent = new Intent();
        // GA tracker
        mTracker = ((WsdotApplication) getActivity().getApplication()).getDefaultTracker();
        mTracker.setScreenName("/Toll Rates/Learn about I-405");
        mTracker.send(new HitBuilders.ScreenViewBuilder().build());
        intent.setAction(Intent.ACTION_VIEW);
        intent.setData(Uri.parse("https://www.wsdot.wa.gov/Tolling/405/rates.htm"));
        startActivity(intent);
    });

    viewModel = ViewModelProviders.of(this, viewModelFactory).get(TollRatesViewModel.class);

    viewModel.getResourceStatus().observe(this, resourceStatus -> {
        if (resourceStatus != null) {
            switch (resourceStatus.status) {
            case LOADING:
                swipeRefreshLayout.setRefreshing(true);
                break;
            case SUCCESS:
                swipeRefreshLayout.setRefreshing(false);
                break;
            case ERROR:
                swipeRefreshLayout.setRefreshing(false);
                Toast.makeText(this.getContext(), "connection error", Toast.LENGTH_LONG).show();
            }
        }
    });

    viewModel.getTravelTimesStatus().observe(this, resourceStatus -> {
        if (resourceStatus != null) {
            switch (resourceStatus.status) {
            case LOADING:
                break;
            case SUCCESS:
                root.findViewById(R.id.travel_time_text).setVisibility(View.VISIBLE);
                break;
            case ERROR:
                root.findViewById(R.id.travel_time_text).setVisibility(View.GONE);
            }
        }
    });

    viewModel.getI405TollRateItems().observe(this, tollRateGroups -> {
        if (tollRateGroups != null) {

            mEmptyView.setVisibility(View.GONE);

            Collections.sort(tollRateGroups, new SortTollGroupByLocation());
            Collections.sort(tollRateGroups, new SortTollGroupByDirection());

            tollGroups = new ArrayList<>(tollRateGroups);

            directionRadioGroup.getCheckedRadioButtonId();
            RadioButton selectedDirection = directionRadioGroup
                    .findViewById(directionRadioGroup.getCheckedRadioButtonId());

            mAdapter.setData(filterTollsForDirection(String.valueOf(selectedDirection.getText().charAt(0))));
        }
    });

    viewModel.getTravelTimesForETLFor("405").observe(this, travelTimes -> {

        TextView travelTimeView = root.findViewById(R.id.travel_time_text);

        if (travelTimes.size() > 0) {
            travelTimeView.setVisibility(View.VISIBLE);

            this.travelTimes = new ArrayList<>(travelTimes);

            travelTimeView.setText(getTravelTimeStringForDirection(radioGroupDirectionIndex == 0 ? "N" : "S"));
        } else {
            travelTimeView.setVisibility(View.GONE);
        }
    });

    timer = new Timer();
    timer.schedule(new RatesTimerTask(), 0, 60000); // Schedule rates to update every 60 seconds

    return root;
}

From source file:tw.com.geminihsu.app01.fragment.Fragment_Client_Service_test.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    MenuItem item = menu.add(Menu.NONE, ACTIONBAR_MENU_ITEM_FIILTER, Menu.NONE,
            getString(R.string.order_call_taxi_page_title));
    SpannableString spanString = new SpannableString(item.getTitle().toString());
    spanString.setSpan(new ForegroundColorSpan(Color.WHITE), 0, spanString.length(), 0); //fix the color to white
    item.setTitle(spanString);/* w  ww . j  ava  2s . c  om*/
    Utility driver = new Utility(getActivity());

    if (isShowOneKey && driver.getAllDriverAccountInfo().isEmpty())
        item.setVisible(true);
    else
        item.setVisible(false);
    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    super.onCreateOptionsMenu(menu, inflater);
}

From source file:com.kyakujin.android.autoeco.ui.MainActivity.java

/**
 * About/*ww w . j a  v a 2 s .co  m*/
 */
private void showAboutDialog() {
    PackageManager pm = this.getPackageManager();
    String packageName = this.getPackageName();
    String versionName;
    try {
        PackageInfo info = pm.getPackageInfo(packageName, 0);
        versionName = info.versionName;
    } catch (PackageManager.NameNotFoundException e) {
        versionName = "N/A";
    }

    SpannableStringBuilder aboutBody = new SpannableStringBuilder();

    SpannableString mailAddress = new SpannableString(getString(R.string.mailto));
    mailAddress.setSpan(new ClickableSpan() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent();
            intent.setAction(Intent.ACTION_SENDTO);
            intent.setData(Uri.parse(getString(R.string.description_mailto)));
            intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.description_mail_subject));
            startActivity(intent);
        }
    }, 0, mailAddress.length(), 0);

    aboutBody.append(Html.fromHtml(getString(R.string.about_body, versionName)));
    aboutBody.append("\n");
    aboutBody.append(mailAddress);

    LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    TextView aboutBodyView = (TextView) layoutInflater.inflate(R.layout.fragment_about_dialog, null);
    aboutBodyView.setText(aboutBody);
    aboutBodyView.setMovementMethod(LinkMovementMethod.getInstance());

    AlertDialog dlg = new AlertDialog.Builder(this).setTitle(R.string.alert_title_about).setView(aboutBodyView)
            .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).create();
    dlg.show();
}