android.text.method.LinkMovementMethod Java Examples
The following examples show how to use
android.text.method.LinkMovementMethod.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: text-decorator Author: nntuyen File: TextDecorator.java License: Apache License 2.0 | 8 votes |
public TextDecorator makeTextClickable(final OnTextClickListener listener, final int start, final int end, final boolean underlineText) { checkIndexOutOfBoundsException(start, end); decoratedContent.setSpan(new ClickableSpan() { @Override public void onClick(View view) { listener.onClick(view, content.substring(start, end)); } @Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setUnderlineText(underlineText); } }, start, end, flags); textView.setMovementMethod(LinkMovementMethod.getInstance()); return this; }
Example #2
Source Project: Kore Author: xbmc File: AddHostFragmentZeroconf.java License: Apache License 2.0 | 6 votes |
private void noNetworkConnection() { titleTextView.setText(R.string.no_network_connection); messageTextView.setText(Html.fromHtml(getString(R.string.wizard_search_no_network_connection))); messageTextView.setMovementMethod(LinkMovementMethod.getInstance()); progressBar.setVisibility(View.GONE); hostListGridView.setVisibility(View.GONE); nextButton.setVisibility(View.GONE); previousButton.setVisibility(View.VISIBLE); previousButton.setText(R.string.search_again); previousButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startSearching(); } }); }
Example #3
Source Project: AndroidAppShortcuts Author: michelelacorte File: MainActivity.java License: Apache License 2.0 | 6 votes |
private void aboutAlertDialog() { AlertDialog builder = new AlertDialog.Builder(this, R.style.AlertDialogCustom).setTitle(getResources().getString(R.string.app_name)) .setCancelable(false) .setIcon(R.mipmap.ic_launcher) .setMessage(R.string.disclaimer_dialog_message) .setPositiveButton(getResources().getString(R.string.disclaimer_dialog_ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }).create(); builder.show(); ((TextView)builder.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance()); ((TextView)builder.findViewById(android.R.id.message)).setGravity(Gravity.CENTER_VERTICAL); builder.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); }
Example #4
Source Project: audio-analyzer-for-android Author: bewantbe File: AnalyzerViews.java License: Apache License 2.0 | 6 votes |
void showInstructions() { TextView tv = new TextView(activity); tv.setMovementMethod(LinkMovementMethod.getInstance()); tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15); tv.setText(fromHtml(activity.getString(R.string.instructions_text))); PackageInfo pInfo = null; String version = "\n" + activity.getString(R.string.app_name) + " Version: "; try { pInfo = activity.getPackageManager().getPackageInfo(activity.getPackageName(), 0); version += pInfo.versionName; } catch (PackageManager.NameNotFoundException e) { version += "(Unknown)"; } tv.append(version); new AlertDialog.Builder(activity) .setTitle(R.string.instructions_title) .setView(tv) .setNegativeButton(R.string.dismiss, null) .create().show(); }
Example #5
Source Project: droidddle Author: goodev File: ProjectViewHolder.java License: Apache License 2.0 | 6 votes |
public void setData(Project data) { mData = data; mUserImageView.setImageURI(Uri.parse(data.user.avatarUrl)); // Glide.with(mContext).load(data.user.avatarUrl).placeholder(R.drawable.person_image_empty).into(mUserImageView); mBucketNameView.setText(data.name); String des = data.description; // if (TextUtils.isEmpty(des)) { // mBucketDescView.setVisibility(View.GONE); // } else { // mBucketDescView.setVisibility(View.VISIBLE); // } if (!TextUtils.isEmpty(des)) { Spanned spannable = GoURLSpan.hackURLSpan(Html.fromHtml(des)); mBucketDescView.setText(spannable); mBucketDescView.setMovementMethod(LinkMovementMethod.getInstance()); } else { mBucketDescView.setText(des); } mUserNameView.setText(data.user.name); String count = mContext.getResources().getQuantityString(R.plurals.shot_count, data.shotsCount, data.shotsCount); mShotCountView.setText(count); }
Example #6
Source Project: weMessage Author: RomanScott File: OutgoingMessageViewHolder.java License: GNU Affero General Public License v3.0 | 6 votes |
@Override protected void configureLinksBehavior(TextView text) { text.setLinksClickable(false); text.setMovementMethod(new LinkMovementMethod(){ @Override public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event) { if (isSelectionMode) return true; if (Patterns.WEB_URL.matcher(buffer.toString()).matches()) { getParentFragment().launchWebView(buffer.toString()); return true; } itemView.onTouchEvent(event); return false; } }); }
Example #7
Source Project: arcusandroid Author: arcus-smart-home File: ScleraTextView.java License: Apache License 2.0 | 6 votes |
private void setHtmlContent(int htmlResId, String htmlString) { if(htmlResId > 0) { htmlString = getResources().getString(htmlResId); } if (!StringUtils.isEmpty(htmlString)) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { setText(Html.fromHtml(htmlString, Html.FROM_HTML_MODE_LEGACY)); } else { setText(Html.fromHtml(htmlString)); } setLinksClickable(true); setMovementMethod(LinkMovementMethod.getInstance()); } }
Example #8
Source Project: AndroidAppShortcuts Author: michelelacorte File: MainActivity.java License: Apache License 2.0 | 6 votes |
private void donationAlertDialog(){ AlertDialog builder = new AlertDialog.Builder(this, R.style.AlertDialogCustom).setTitle(getResources().getString(R.string.app_name)) .setCancelable(false) .setIcon(R.mipmap.ic_launcher) .setMessage(R.string.donation_dialog_message) .setPositiveButton(getResources().getString(R.string.disclaimer_dialog_ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }).create(); builder.show(); ((TextView)builder.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance()); ((TextView)builder.findViewById(android.R.id.message)).setGravity(Gravity.CENTER_VERTICAL); // builder.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); }
Example #9
Source Project: product-catalogue-android Author: contentful-graveyard File: ProductActivity.java License: MIT License | 6 votes |
private void setBrandText() { String companyName = null; Brand brand = product.brand(); if (brand != null) { companyName = brand.companyName(); } if (companyName == null) { companyNameView.setVisibility(View.GONE); } else { String link = brand.website(); if (link == null) { link = "#"; } companyNameView.setText(Html.fromHtml( getString(R.string.product_company_name, companyName, link))); companyNameView.setMovementMethod(LinkMovementMethod.getInstance()); } }
Example #10
Source Project: AutoCompleteBubbleText Author: FrederickRider File: MultiSelectEditText.java License: Apache License 2.0 | 6 votes |
protected void init(){ setInitialComponents(); setFreezesText(true); setMovementMethod(LinkMovementMethod.getInstance()); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { SparseBooleanArray checked = listView.getCheckedItemPositions(); if(checked.get(position)) addItemChecked(adapter.getItem(position)); else removeItemChecked(adapter.getItem(position)); setString(); } }); watcher = new BubbleWatcher(); addTextChangedListener(watcher); setMinHeight(getPaddingBottom() + getPaddingTop() + calculateLineHeight()); }
Example #11
Source Project: AdaptiveTableLayout Author: Cleveroad File: CsvPickerFragment.java License: MIT License | 6 votes |
@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); SpannableString ss = new SpannableString(getString(R.string.pick_csv_or_demo_file)); ClickableSpan clickableSpan = new ClickableSpan() { @Override public void onClick(View textView) { if (PermissionHelper.checkOrRequest(CsvPickerFragment.this, REQUEST_CODE_PERMISSION_READ_EXTERNAL_STORAGE_DEMO, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { createDemoFile(); } } @Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setUnderlineText(false); } }; ss.setSpan(clickableSpan, START_CHARACTER, END_CHARACTER, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); tvPickFile.setText(ss); tvPickFile.setMovementMethod(LinkMovementMethod.getInstance()); tvPickFile.setHighlightColor(Color.TRANSPARENT); }
Example #12
Source Project: ankihelper Author: mmjang File: AboutActivity.java License: GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { if(Settings.getInstance(this).getPinkThemeQ()){ setTheme(R.style.AppThemePink); }else{ setTheme(R.style.AppTheme); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); getSupportActionBar().setDisplayHomeAsUpEnabled(true); ImageButton alipay10 = (ImageButton) findViewById(R.id.alipay10); ImageButton alipay20 = (ImageButton) findViewById(R.id.alipay20); ImageButton alipayany = (ImageButton) findViewById(R.id.alipayany); TextView supportMessage = (TextView) findViewById(R.id.support_message); supportMessage.setMovementMethod(LinkMovementMethod.getInstance()); setAlipayListener(alipay10, "HTTPS://QR.ALIPAY.COM/FKX00121JPEUHZAMZ3LCB7"); setAlipayListener(alipay20, "HTTPS://QR.ALIPAY.COM/FKX07815DLYKHMJO06FT9D"); setAlipayListener(alipayany, "HTTPS://QR.ALIPAY.COM/FKX011406PTCIHXZJPW7A1"); }
Example #13
Source Project: LLApp Author: Alex-Jerry File: VIPCountDownTimer.java License: Apache License 2.0 | 6 votes |
/** 重写父类的setBackgroundSpan方法 * 我们知道设置Span的样式主要是控制两个变量start,end索引 * 以确定设置start到end位置的字符串的子串的样式,表示每个数字子串在整个字符串中的位置范围 * mGapLen = 1,表示一个间隔块的长度, * 例如:12时36分27秒的"时","分","秒"的间隔长度 * 所以通过遍历Span集合,给字符串设置Span, * 通过分析不难得出每个数值块的Span的start索引:start = i*numbers[i].length() + i*mGapLen; * end = start + numbers[i].length(); * */ @Override public void setBackgroundSpan(String timeStr) { int mGapLen = 1; mSpan = new SpannableString(timeStr); initSpanData(timeStr); int start = 0 ; int count =0; for (int i=0;i<vipNumbers.length;i++){ for (int j=start;j<start + vipNumbers[i].toCharArray().length;j++,count++){ TimerUtils.setContentSpan(mSpan,mSpanList.get(count),j,j+mGapLen); } //此时表示遍历完了某一块的数值,从而需要将此时该块数值去更新start变量 start = start + vipNumbers[i].toCharArray().length; if (i < nonNumbers.length){ TimerUtils.setContentSpan(mSpan,mTextColorSpanList.get(i),start,start+mGapLen); start = start +mGapLen;//如果是个间隔还得去加上每个间隔长度最后去更新start变量 } } mDateTv.setMovementMethod(LinkMovementMethod.getInstance()); mDateTv.setText(mSpan); }
Example #14
Source Project: PanoramaGL Author: isudev File: SimpleVrVideoActivity.java License: Apache License 2.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_layout); seekBar = (SeekBar) findViewById(R.id.seek_bar); seekBar.setOnSeekBarChangeListener(new SeekBarListener()); statusText = (TextView) findViewById(R.id.status_text); // Make the source link clickable. TextView sourceText = (TextView) findViewById(R.id.source); sourceText.setText(Html.fromHtml(getString(R.string.source))); sourceText.setMovementMethod(LinkMovementMethod.getInstance()); // Bind input and output objects for the view. videoWidgetView = (VrVideoView) findViewById(R.id.video_view); videoWidgetView.setEventListener(new ActivityEventListener()); loadVideoStatus = LOAD_VIDEO_STATUS_UNKNOWN; // Initial launch of the app or an Activity recreation due to rotation. handleIntent(getIntent()); }
Example #15
Source Project: android-open-project-demo Author: android-cn File: ContentTextViewFragment.java License: Apache License 2.0 | 6 votes |
private void initView(View v) { tvAbout=(TextView)v.findViewById(R.id.tv_about); tvAbout.setMovementMethod(LinkMovementMethod.getInstance()); tvAbout.setText(Html.fromHtml((getResources().getString((R.string.app_about))))); ptr = (PtrClassicFrameLayout) v.findViewById(R.id.ptr_main); ptr.setPtrHandler(new PtrDefaultHandler() { @Override public void onRefreshBegin(PtrFrameLayout ptrFrameLayout) { new Handler().postDelayed(new Runnable() { @Override public void run() { ptr.refreshComplete(); } }, 2000); } }); }
Example #16
Source Project: busybox Author: meefik File: MainActivity.java License: GNU General Public License v2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PrefStore.setLocale(this); setContentView(R.layout.activity_main); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); output = findViewById(R.id.outputView); scroll = findViewById(R.id.scrollView); // enable context clickable output.setMovementMethod(LinkMovementMethod.getInstance()); }
Example #17
Source Project: Moment Author: Assassinss File: AboutActivity.java License: GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); getWindow().setStatusBarColor(Color.TRANSPARENT); setContentView(R.layout.about_activity); TextView sourceCode = (TextView) findViewById(R.id.source_code); sourceCode.setText(Html.fromHtml(getString(R.string.source_code))); sourceCode.setMovementMethod(new LinkMovementMethod()); TextView appVersion = (TextView) findViewById(R.id.app_version); appVersion.setText(String.format("v%s", BuildConfig.VERSION_NAME)); TextView openSource = (TextView) findViewById(R.id.open_source); openSource.setText(Html.fromHtml(getString(R.string.open_source_used))); openSource.setMovementMethod(new LinkMovementMethod()); }
Example #18
Source Project: KernelAdiutor Author: Grarak File: FeaturesFragment.java License: GNU General Public License v3.0 | 6 votes |
@Override protected void addItems(List<RecyclerViewItem> items) { for (SupportedDownloads.KernelContent.Feature feature : mFeatures) { DescriptionView descriptionView = new DescriptionView(); if (feature.hasItems()) { StringBuilder stringBuilder = new StringBuilder(); for (String subFeature : feature.getItems()) { if (stringBuilder.length() == 0) { stringBuilder.append("\u2022").append(" ").append(subFeature); } else { stringBuilder.append("<br>").append("\u2022").append(" ").append(subFeature); } } descriptionView.setTitle(Utils.htmlFrom(feature.getItem())); descriptionView.setSummary(Utils.htmlFrom(stringBuilder.toString())); } else { descriptionView.setSummary(Utils.htmlFrom(feature.getItem())); } descriptionView.setMovementMethod(LinkMovementMethod.getInstance()); items.add(descriptionView); } }
Example #19
Source Project: BaseRecyclerViewAdapterHelper Author: CymChad File: NestAdapter.java License: MIT License | 6 votes |
@Override protected void convert(@NonNull BaseViewHolder helper, Status item) { switch (helper.getLayoutPosition() % 3) { case 0: helper.setImageResource(R.id.img, R.mipmap.animation_img1); break; case 1: helper.setImageResource(R.id.img, R.mipmap.animation_img2); break; case 2: helper.setImageResource(R.id.img, R.mipmap.animation_img3); break; default: break; } helper.setText(R.id.tweetName, "Hoteis in Rio de Janeiro"); String msg = "\"He was one of Australia's most of distinguished artistes, renowned for his portraits\""; ((TextView) helper.getView(R.id.tweetText)).setText(SpannableStringUtils.getBuilder(msg).append("landscapes and nedes").setClickSpan(clickableSpan).create()); ((TextView) helper.getView(R.id.tweetText)).setMovementMethod(LinkMovementMethod.getInstance()); }
Example #20
Source Project: MvpRoute Author: TLocation File: SpanActivity.java License: Apache License 2.0 | 6 votes |
@Override protected void initView(@Nullable Bundle savedInstanceState ){ super.initView(savedInstanceState); seekBar = findViewById(R.id.span_seekbar); seekBar.setMax(200); seekBar.setOnSeekBarChangeListener(this); maxText = findViewById(R.id.span_max_size); seekBar.setProgress(100); spanTextBack = findViewById(R.id.span_text_back); findViewById(R.id.span_color_click).setOnClickListener(this); spanColorText = findViewById(R.id.span_color_text); spanOne = findViewById(R.id.span_style_one); spanTwo = findViewById(R.id.span_style_two); SpanThree = findViewById(R.id.span_style_three); spanClickText = findViewById(R.id.span_text_clcik); //设置文字点击事件必须调用这个方法 spanClickText.setMovementMethod(LinkMovementMethod.getInstance()); }
Example #21
Source Project: nfcard Author: sinpolib File: MainActivity.java License: GNU General Public License v3.0 | 6 votes |
private void initViews() { board = (ViewSwitcher) findViewById(R.id.switcher); Typeface tf = ThisApplication.getFontResource(R.string.font_oem1); TextView tv = (TextView) findViewById(R.id.txtAppName); tv.setTypeface(tf); tf = ThisApplication.getFontResource(R.string.font_oem2); tv = getFrontPage(); tv.setMovementMethod(LinkMovementMethod.getInstance()); tv.setTypeface(tf); tv = getBackPage(); tv.setMovementMethod(LinkMovementMethod.getInstance()); tv.setTypeface(tf); toolbar = new Toolbar((ViewGroup) findViewById(R.id.toolbar)); }
Example #22
Source Project: ProjectX Author: AlexMofer File: MultiActionTextView.java License: Apache License 2.0 | 6 votes |
private void initView(Context context, AttributeSet attrs) { setMovementMethod(LinkMovementMethod.getInstance()); if (!isFocusable()) { setFocusable(true); } if (!isFocusableInTouchMode()) { setFocusableInTouchMode(true); } requestFocus(); requestFocusFromTouch(); super.setOnClickListener(new MultiActionListener()); if (attrs == null) return; final TypedArray a = context.obtainStyledAttributes(attrs, ATTRS); mHighlightColor = a.getColor(0, Color.TRANSPARENT); a.recycle(); }
Example #23
Source Project: BaseRecyclerViewAdapterHelper Author: CymChad File: LoadMoreAdapter.java License: MIT License | 6 votes |
@Override protected void convert(@NotNull BaseViewHolder helper, @Nullable Status item) { switch (helper.getLayoutPosition() % 3) { case 0: helper.setImageResource(R.id.img, R.mipmap.animation_img1); break; case 1: helper.setImageResource(R.id.img, R.mipmap.animation_img2); break; case 2: helper.setImageResource(R.id.img, R.mipmap.animation_img3); break; default: break; } helper.setText(R.id.tweetName, "Hoteis in Rio de Janeiro"); String msg = "\"He was one of Australia's most of distinguished artistes, renowned for his portraits\""; ((TextView) helper.getView(R.id.tweetText)).setText(SpannableStringUtils.getBuilder(msg).append("landscapes and nedes").setClickSpan(clickableSpan).create()); ((TextView) helper.getView(R.id.tweetText)).setMovementMethod(LinkMovementMethod.getInstance()); }
Example #24
Source Project: Android-UPnP-Browser Author: dgmltn File: UPnPDeviceAdapter.java License: Apache License 2.0 | 6 votes |
private void linkify(TextView view, CharSequence str, String url) { if (TextUtils.isEmpty(str) && TextUtils.isEmpty(url)) { view.setVisibility(View.GONE); return; } view.setVisibility(View.VISIBLE); if (TextUtils.isEmpty(url)) { view.setText(str); return; } if (TextUtils.isEmpty(str)) { str = url; } SpannableBuilder builder = new SpannableBuilder(view.getContext()); builder.append(str, new URLSpan(url)); view.setText(builder.build()); view.setMovementMethod(LinkMovementMethod.getInstance()); }
Example #25
Source Project: privacy-friendly-pedometer Author: SecUSo File: AboutActivity.java License: GNU General Public License v3.0 | 6 votes |
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); ActionBar ab = getSupportActionBar(); if(ab != null) { ab.setDisplayHomeAsUpEnabled(true); } View mainContent = findViewById(R.id.main_content); if (mainContent != null) { mainContent.setAlpha(0); mainContent.animate().alpha(1).setDuration(BaseActivity.MAIN_CONTENT_FADEIN_DURATION); } ((TextView)findViewById(R.id.secusoWebsite)).setMovementMethod(LinkMovementMethod.getInstance()); ((TextView)findViewById(R.id.githubURL)).setMovementMethod(LinkMovementMethod.getInstance()); ((TextView)findViewById(R.id.textFieldVersionName)).setText(BuildConfig.VERSION_NAME); ((TextView)findViewById(R.id.textViewLib)).setMovementMethod(LinkMovementMethod.getInstance()); overridePendingTransition(0, 0); }
Example #26
Source Project: MVPAndroidBootstrap Author: richardradics File: DialogUtils.java License: Apache License 2.0 | 5 votes |
/** * Show a model dialog box. The <code>android.app.AlertDialog</code> object is returned so that * you can specify an OnDismissListener (or other listeners) if required. * <b>Note:</b> show() is already called on the AlertDialog being returned. * * @param context The current Context or Activity that this method is called from. * @param message Message to display in the dialog. * @return AlertDialog that is being displayed. */ public static AlertDialog quickDialog(final Activity context, final String message) { final SpannableString s = new SpannableString(message); //Make links clickable Linkify.addLinks(s, Linkify.ALL); Builder builder = new AlertDialog.Builder(context); builder.setMessage(s); builder.setPositiveButton(android.R.string.ok, closeDialogListener()); AlertDialog dialog = builder.create(); dialog.show(); ((TextView) dialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance()); //Make links clickable return dialog; }
Example #27
Source Project: 365browser Author: mogoweb File: TextMessagePreference.java License: Apache License 2.0 | 5 votes |
@Override protected void onBindView(View view) { super.onBindView(view); TextView textView = (TextView) view.findViewById(android.R.id.title); textView.setSingleLine(false); textView.setMaxLines(Integer.MAX_VALUE); textView.setMovementMethod(LinkMovementMethod.getInstance()); }
Example #28
Source Project: Telegram-FOSS Author: Telegram-FOSS-Team File: ChatAttachAlertLocationLayout.java License: GNU General Public License v2.0 | 5 votes |
private TextView getAttributionOverlay(Context context) { attributionOverlay = new TextView(context); attributionOverlay.setText(Html.fromHtml("© <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors")); attributionOverlay.setShadowLayer(1, -1, -1, Color.WHITE); attributionOverlay.setLinksClickable(true); attributionOverlay.setMovementMethod(LinkMovementMethod.getInstance()); return attributionOverlay; }
Example #29
Source Project: NekoSMS Author: apsun File: MainActivity.java License: GNU General Public License v3.0 | 5 votes |
private void showAboutDialog() { Spanned html = Html.fromHtml(getString(R.string.format_about_message, GITHUB_URL, WIKI_URL)); AlertDialog dialog = new AlertDialog.Builder(this) .setTitle(getString(R.string.app_name) + ' ' + VERSION_NAME) .setMessage(html) .setPositiveButton(R.string.close, null) .show(); TextView textView = (TextView)dialog.findViewById(android.R.id.message); textView.setMovementMethod(LinkMovementMethod.getInstance()); }
Example #30
Source Project: editor Author: billthefarmer File: Editor.java License: GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("deprecation") private void aboutClicked() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.appName); DateFormat dateFormat = DateFormat.getDateTimeInstance(); SpannableStringBuilder spannable = new SpannableStringBuilder(getText(R.string.version)); Pattern pattern = Pattern.compile("%s"); Matcher matcher = pattern.matcher(spannable); if (matcher.find()) spannable.replace(matcher.start(), matcher.end(), BuildConfig.VERSION_NAME); matcher.reset(spannable); if (matcher.find()) spannable.replace(matcher.start(), matcher.end(), dateFormat.format(BuildConfig.BUILT)); builder.setMessage(spannable); // Add the button builder.setPositiveButton(R.string.ok, null); // Create the AlertDialog Dialog dialog = builder.show(); // Set movement method TextView text = dialog.findViewById(android.R.id.message); if (text != null) { text.setTextAppearance(builder.getContext(), android.R.style.TextAppearance_Small); text.setMovementMethod(LinkMovementMethod.getInstance()); } }