use of android.text.method.LinkMovementMethod in project android_packages_apps_Settings by SudaMod.
the class LinkablePreference method onBindViewHolder.
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
super.onBindViewHolder(view);
TextView textView = (TextView) view.findViewById(android.R.id.title);
if (textView == null) {
return;
}
textView.setSingleLine(false);
if (mContentTitle == null || mClickListener == null) {
return;
}
StringBuilder contentBuilder = new StringBuilder().append(mContentTitle);
if (mContentDescription != null) {
contentBuilder.append("\n\n");
contentBuilder.append(mContentDescription);
}
boolean linked = LinkifyUtils.linkify(textView, contentBuilder, mClickListener);
if (linked && mContentTitle != null) {
// Embolden and enlarge the title.
Spannable boldSpan = (Spannable) textView.getText();
boldSpan.setSpan(new TextAppearanceSpan(getContext(), android.R.style.TextAppearance_Medium), 0, mContentTitle.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
textView.setText(boldSpan);
textView.setMovementMethod(new LinkMovementMethod());
}
}
use of android.text.method.LinkMovementMethod in project platform_packages_apps_Settings by BlissRoms.
the class LinkablePreference method onBindViewHolder.
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
super.onBindViewHolder(view);
TextView textView = (TextView) view.findViewById(android.R.id.title);
if (textView == null) {
return;
}
textView.setSingleLine(false);
if (mContentTitle == null || mClickListener == null) {
return;
}
StringBuilder contentBuilder = new StringBuilder().append(mContentTitle);
if (mContentDescription != null) {
contentBuilder.append("\n\n");
contentBuilder.append(mContentDescription);
}
boolean linked = LinkifyUtils.linkify(textView, contentBuilder, mClickListener);
if (linked && mContentTitle != null) {
// Embolden and enlarge the title.
Spannable boldSpan = (Spannable) textView.getText();
boldSpan.setSpan(new TextAppearanceSpan(getContext(), android.R.style.TextAppearance_Medium), 0, mContentTitle.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
textView.setText(boldSpan);
textView.setMovementMethod(new LinkMovementMethod());
}
}
use of android.text.method.LinkMovementMethod in project ButterRemote-Android by se-bastiaan.
the class DonationFragment method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Activity activity = getActivity();
assert activity != null;
View view = getActivity().getLayoutInflater().inflate(R.layout.donation_dialog, null, false);
AlertDialog.Builder builder = new AlertDialog.Builder(activity).setTitle(R.string.donation_title).setView(view).setNegativeButton(android.R.string.cancel, null);
TextView info = (TextView) view.findViewById(R.id.info);
info.setText(Html.fromHtml(getString(R.string.donation_info)));
info.setMovementMethod(new LinkMovementMethod());
mError = (TextView) view.findViewById(R.id.error);
mProgressBar = (ProgressBar) view.findViewById(android.R.id.progress);
mGridView = (GridView) view.findViewById(R.id.grid);
mGridView.setAdapter(new DonationAdapter(getActivity(), mDonationList, mInventorySet));
mGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
DonationAdapter adapter = (DonationAdapter) parent.getAdapter();
Donation donation = adapter.getItem(position);
if (!mInventorySet.contains(donation.sku)) {
/**
* See {@link sharedcode.turboeditor.iab.DonationFragment#verifyDeveloperPayload(Purchase)}.
*/
String payload = "";
try {
mHelper.launchPurchaseFlow(getActivity(), donation.sku, RC_REQUEST, mPurchaseFinishedListener, payload);
} catch (Exception e) {
Toast.makeText(getActivity(), "Failed to launch a purchase flow.", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(getActivity(), getString(R.string.donation_item_bought), Toast.LENGTH_LONG);
}
}
});
final AlertDialog alertDialog;
alertDialog = builder.create();
initBilling();
return alertDialog;
}
use of android.text.method.LinkMovementMethod in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationFooterPreference method onBindViewHolder.
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
TextView title = holder.itemView.findViewById(android.R.id.title);
title.setMovementMethod(new LinkMovementMethod());
title.setClickable(false);
title.setLongClickable(false);
}
use of android.text.method.LinkMovementMethod in project Stringlate by LonamiWebs.
the class ActivityUtils method showDialogWithHtmlTextView.
public void showDialogWithHtmlTextView(@StringRes int resTitleId, String text, boolean isHtml, DialogInterface.OnDismissListener dismissedListener) {
AppCompatTextView textView = new AppCompatTextView(_context);
int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, _context.getResources().getDisplayMetrics());
textView.setMovementMethod(new LinkMovementMethod());
textView.setPadding(padding, 0, padding, 0);
textView.setText(isHtml ? new SpannableString(Html.fromHtml(text)) : text);
AlertDialog.Builder dialog = new AlertDialog.Builder(_context).setPositiveButton(android.R.string.ok, null).setOnDismissListener(dismissedListener).setTitle(resTitleId).setView(textView);
dialog.show();
}
Aggregations