private void showNote(boolean xml) { if (xml) { content.setText(note.getXmlContent()); title.setText((CharSequence) note.getTitle()); this.setTitle(this.getTitle() + " - XML"); return; } LinkInternalSpan[] links = noteContent.getSpans(0, noteContent.length(), LinkInternalSpan.class); MatchFilter noteLinkMatchFilter = LinkInternalSpan.getNoteLinkMatchFilter(noteContent, links); // show the note (spannable makes the TextView able to output styled text) content.setText(noteContent, TextView.BufferType.SPANNABLE); // add links to stuff that is understood by Android except phone numbers because it's too // aggressive // TODO this is SLOWWWW!!!! int linkFlags = 0; if (Preferences.getBoolean(Preferences.Key.LINK_EMAILS)) linkFlags |= Linkify.EMAIL_ADDRESSES; if (Preferences.getBoolean(Preferences.Key.LINK_URLS)) linkFlags |= Linkify.WEB_URLS; if (Preferences.getBoolean(Preferences.Key.LINK_ADDRESSES)) linkFlags |= Linkify.MAP_ADDRESSES; Linkify.addLinks(content, linkFlags); // Custom phone number linkifier (fixes lp:512204) if (Preferences.getBoolean(Preferences.Key.LINK_PHONES)) Linkify.addLinks( content, LinkifyPhone.PHONE_PATTERN, "tel:", LinkifyPhone.sPhoneNumberMatchFilter, Linkify.sPhoneNumberTransformFilter); // This will create a link every time a note title is found in the text. // The pattern contains a very dumb (title1)|(title2) escaped correctly // Then we transform the url from the note name to the note id to avoid characters that mess up // with the URI (ex: ?) if (Preferences.getBoolean(Preferences.Key.LINK_TITLES)) { Pattern pattern = NoteManager.buildNoteLinkifyPattern(this, note.getTitle()); if (pattern != null) { Linkify.addLinks( content, pattern, Tomdroid.CONTENT_URI + "/", noteLinkMatchFilter, noteTitleTransformFilter); // content.setMovementMethod(LinkMovementMethod.getInstance()); } } title.setText((CharSequence) note.getTitle()); }
public void linkiFy(TextView tv) { // 使@可以点击 Pattern p = Pattern.compile("@[A-Za-z0-9_]{1,}"); Linkify.addLinks(tv, Linkify.EMAIL_ADDRESSES); Linkify.addLinks(tv, p, "at://v2ex?name="); // 这一句一定要在后面 String strP2 = "http(s)?://[A-Za-z0-9/.\\-_?%=&+#]{1,}"; Pattern p2 = Pattern.compile(strP2); Linkify.addLinks(tv, p2, ""); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Tjek om vi er blevet startet med et Intent med en URL, f.eks. som // new Intent(Intent.ACTION_VIEW, Uri.parse("http://javabog.dk/OOP/kapitel3.jsp")); Intent i = getIntent(); String urlFraIntent = i.getDataString(); if (urlFraIntent == null) { TextView tv = new TextView(this); tv.setText( "Dette eksempel viser hvordan man fanger et browserintent.\n" + "Gå ind på http://javabog.dk og vælg et kapitel fra grundbogen, " + "f.eks http://javabog.dk/OOP/kapitel3.jsp "); Linkify.addLinks(tv, Linkify.ALL); setContentView(tv); } else { // Ok, der var en URL med i intentet Toast.makeText(this, "AndroidElementer viser\n" + urlFraIntent, Toast.LENGTH_LONG).show(); Toast.makeText(this, "Intent var\n" + i, Toast.LENGTH_LONG).show(); WebView webView = new WebView(this); webView.loadUrl(urlFraIntent); setContentView(webView); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayShowTitleEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle("About us"); TextView t = (TextView) findViewById(R.id.textView4); Linkify.addLinks(t, Linkify.PHONE_NUMBERS); TextView t2 = (TextView) findViewById(R.id.textView6); Linkify.addLinks(t2, Linkify.EMAIL_ADDRESSES); }
@Override public void onClick(View v) { if (v.getId() == R.id.del) { del(); } else if (v.getId() == R.id.hør) { hør(); } else if (v.getId() == R.id.hent) { hent(); } else if (v.getId() == R.id.info) { visInfo = true; bygListe(); } else if (v.getId() == R.id.titel) { TextView titel = (TextView) v; titel.setText(udsendelse.beskrivelse); Linkify.addLinks(titel, Linkify.WEB_URLS); } else if (v.getId() == R.id.playliste) { visInfo = false; bygListe(); } else if (v.getId() == R.id.vis_hele_playlisten) { visHelePlaylisten = true; bygListe(); } else if (v.getId() == R.id.favorit) { CheckBox favorit = (CheckBox) v; DRData.instans.favoritter.sætFavorit(udsendelse.programserieSlug, favorit.isChecked()); if (favorit.isChecked()) App.kortToast(R.string.Programserien_er_føjet_til_favoritter); Log.registrérTestet("Valg af favoritprogram", udsendelse.programserieSlug); } else { App.langToast("fejl"); } }
public void onCreate(Bundle savedInstanceState) { String[] strings = new String[mItems.length]; for (int i = 0; i < mItems.length; i++) { strings[i] = mItems[i].title; } List<String> list = Arrays.asList(strings); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); super.onCreate(savedInstanceState); setContentView(R.layout.main); setListAdapter(new ExamplesAdapter(this, list)); TextView linkView = (TextView) findViewById(R.id.textView1); linkView.setPadding(10, 0, 10, 20); linkView.setTextSize(20); linkView.setText(getString(R.string.github_url)); linkView.setTextColor(0xaaffffff); linkView.setLinkTextColor(0xaaffffff); Linkify.addLinks(linkView, Linkify.WEB_URLS); Typeface font = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Regular.ttf"); linkView.setTypeface(font); }
public void showAboutDialog() { final TextView message = new TextView(this); final SpannableString spannableString = new SpannableString(getString(R.string.dialog_about_body)); Linkify.addLinks(spannableString, Linkify.ALL); message.setText(spannableString); message.setMovementMethod(LinkMovementMethod.getInstance()); AlertDialog.Builder dialog = new AlertDialog.Builder(this); dialog.setIcon(R.drawable.about); dialog.setTitle(getString(R.string.dialog_about_title)); dialog.setMessage(spannableString); // dialog.setView(message); dialog.setNeutralButton( getString(R.string.dialog_ack), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog alertDialog = dialog.show(); ((TextView) alertDialog.findViewById(android.R.id.message)) .setMovementMethod(LinkMovementMethod.getInstance()); }
private void dialogie(String s) { if (s == null || s.length() == 0) return; AlertDialog ad = new AlertDialog.Builder(me).create(); ad.setCancelable(true); ad.setCanceledOnTouchOutside(true); ad.setTitle("Linkification view"); LinearLayout rl = new LinearLayout(me); rl.setBackgroundColor(Color.WHITE); rl.setPadding(scalemex(5), scalemex(25), scalemex(5), scalemex(25)); TextView tv; tv = new TextView(me); rl.addView(tv); tv.setBackgroundColor(Color.WHITE); tv.setTextColor(Color.BLACK); tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 19f); tv.setText(s); Linkify.addLinks(tv, Linkify.ALL); ScrollView ho = new ScrollView(me); ho.addView(rl); ad.setView(ho); ad.show(); }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); getSupportActionBar() .setDisplayOptions( ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_HOME_AS_UP); PackageInfo packageInfo = null; String versionName = ""; try { packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0); versionName = packageInfo.versionName; } catch (PackageManager.NameNotFoundException e) { } TextView versionView = (TextView) findViewById(R.id.version); versionView.setText("version " + versionName); TextView legalView = (TextView) findViewById(R.id.legal); legalView.setText(getResources().getString(R.string.legal)); TextView authorEmailView = (TextView) findViewById(R.id.author_email); Linkify.addLinks(authorEmailView, Linkify.EMAIL_ADDRESSES); }
public DownloadIconsDialog(final Context context, final boolean changeSettings) { super(context); mChangeSettingsEnabled = changeSettings; setTitle(R.string.msg_download_icons_dialog_title); setCancelable(true); setIcon(android.R.drawable.ic_dialog_info); final TextView message = new TextView(context); String str; try { str = FileUtil.writeToString(context.getResources().openRawResource(R.raw.icons_pack)); } catch (Exception e) { str = e.toString(); } final SpannableString s = new SpannableString(Html.fromHtml(str)); Linkify.addLinks(s, Linkify.WEB_URLS); message.setText(s); message.setMovementMethod(LinkMovementMethod.getInstance()); message.setPadding(5, 5, 5, 5); message.setTextColor(context.getResources().getColorStateList(R.color.dialog_text_color)); message.setLinkTextColor(context.getResources().getColorStateList(R.color.links_color)); setView(message); setButton(AlertDialog.BUTTON_POSITIVE, context.getText(android.R.string.yes), this); setButton(AlertDialog.BUTTON_NEGATIVE, context.getText(android.R.string.no), this); setOnCancelListener(this); }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.info: View infoView = getActivity().getLayoutInflater().inflate(R.layout.dialog_channel_info, null); TextView topicView = (TextView) infoView.findViewById(R.id.topic); topicView.setText(mChannel.getTopic()); Linkify.addLinks(topicView, Linkify.WEB_URLS); // FIXME: modes, etc... new AlertDialog.Builder(getActivity()) .setTitle(getString(R.string.info_format, mChannel.getName())) .setView(infoView) .setPositiveButton(android.R.string.ok, null) .show(); return true; case R.id.members: Intent intent = new Intent(getActivity(), MemberListActivity.class); intent.putExtra(ARG_CONNECTION_ID, getArguments().getLong(ARG_CONNECTION_ID)); intent.putExtra(ARG_BUFFER_ID, getArguments().getLong(ARG_BUFFER_ID)); startActivity(intent); return true; case R.id.part_channel: mChannel.part(); return true; } return super.onOptionsItemSelected(item); }
public final void run() { if ((this.a.F) || (!this.a.i())) { return; } Spanned localSpanned = Html.fromHtml(this.a.az); if ((localSpanned instanceof SpannableStringBuilder)) {} int i; int j; for (SpannableStringBuilder localSpannableStringBuilder = (SpannableStringBuilder) localSpanned; ; localSpannableStringBuilder = new SpannableStringBuilder(localSpanned)) { i = localSpannableStringBuilder.length(); for (j = 0; (j != i) && (Character.isWhitespace(localSpannableStringBuilder.charAt(j))); j++) {} } if (j != 0) { localSpannableStringBuilder.delete(0, j); i = localSpannableStringBuilder.length(); } for (int k = i - 1; (k >= 0) && (Character.isWhitespace(localSpannableStringBuilder.charAt(k))); k--) {} if (k != i - 1) { localSpannableStringBuilder.delete(k + 1, i); } this.a.ax.setText(localSpannableStringBuilder); Linkify.addLinks(this.a.ax, 1); this.a.ax.setVisibility(0); this.a.ax.setMovementMethod(LinkMovementMethod.getInstance()); this.a.ay.setVisibility(0); }
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { String text = String.format( "%s\n\n%s\n\n%s", DreamDroid.VERSION_STRING, getString(R.string.license), getString(R.string.source_code_link)); MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity()); builder .title(R.string.about) .content(text) .neutralText(R.string.donate) .positiveText(R.string.privacy) .callback( new MaterialDialog.ButtonCallback() { @Override public void onNeutral(MaterialDialog dialog) { ExtendedHashMap skus = ((BaseActivity) getActivity()).getIabItems(); DonationDialog d = DonationDialog.newInstance(skus); ((MultiPaneHandler) getActivity()).showDialogFragment(d, "donate_dialog"); } @Override public void onPositive(MaterialDialog dialog) { finishDialog(Statics.ACTION_SHOW_PRIVACY_STATEMENT, null); } }); MaterialDialog dialog = builder.build(); Linkify.addLinks(dialog.getContentView(), Linkify.EMAIL_ADDRESSES | Linkify.WEB_URLS); return dialog; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.about); TextView tv = (TextView) findViewById(R.id.app_information); Linkify.addLinks(tv, Linkify.ALL); }
public static AlertDialog create(final FileListActivity context) { final TextView message = new TextView(context); final SpannableString s = new SpannableString(context.getText(R.string.eula_popup_text)); Linkify.addLinks(s, Linkify.WEB_URLS); message.setText(s); message.setMovementMethod(LinkMovementMethod.getInstance()); return new AlertDialog.Builder(context) .setTitle(R.string.eula_popup_title) .setCancelable(false) .setPositiveButton( R.string.eula_accept, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { new PreferenceHelper(context).markEulaAccepted(); dialog.dismiss(); context.refresh(); } }) .setNegativeButton( R.string.eula_decline, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { context.finish(); } }) .setView(message) .create(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); emailTextView = (AutoCompleteTextView) findViewById(R.id.email); loadAutoComplete(); passwordTextView = (EditText) findViewById(R.id.password); passwordTextView.setOnEditorActionListener( new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) { if (id == EditorInfo.IME_NULL) { initLogin(); return true; } return false; } }); loginFormView = findViewById(R.id.login_form); progressView = findViewById(R.id.login_progress); tv = (TextView) findViewById(R.id.tv); // Adiciona botom para el loguin Button loginButton = (Button) findViewById(R.id.email_sign_in_button); loginButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View view) { dialog = ProgressDialog.show(LoginActivity.this, "", "Validacion de Usuario...", true); new Thread( new Runnable() { @Override public void run() { initLogin(); } }) .start(); } }); // adding underline and link to signup textview signUpTextView = (TextView) findViewById(R.id.signUpTextView); signUpTextView.setPaintFlags(signUpTextView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); Linkify.addLinks(signUpTextView, Linkify.ALL); signUpTextView.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Log.i("LoginActivity", "Sign Up Activity activated."); // this is where you should start the signup Activity // LoginActivity.this.startActivity(new Intent(LoginActivity.this, // SignupActivity.class)); } }); }
/** Update GUI from currently selected POI Load POI actions */ private void updateGUI() { try { TextView poiName = (TextView) findViewById(R.id.textPOIName); TextView poiDescription = (TextView) findViewById(R.id.textPOIDescription); View layoutLocation = findViewById(R.id.layoutPOILocation); poiThumbnail = (RemoteImageView) findViewById(R.id.imagePOIThumbnail); if (mPOI.getThumbnailURL().length() > 0) { poiThumbnail.setRemoteSource(new String(mPOI.getThumbnailURL())); } else { poiThumbnail.setVisibility(View.INVISIBLE); } final String name = mPOI.getName(); if (name != null && name.length() >= 0) poiName.setText(name); poiDescription.setText(mPOI.getDescription()); // add clickable links to strings like emails and websites Linkify.addLinks(poiDescription, Linkify.EMAIL_ADDRESSES | Linkify.WEB_URLS); // show location information only if the POI has LLA coordinates if (mPOI.hasLLA()) { TextView poiLocation = (TextView) findViewById(R.id.textPOILocation); LLACoordinate mylocation = JunaioPlugin.getSensorsManager(getApplicationContext()).getLocation(); // get the distance and store in results[0], get the bearing and // store it in results[1] float[] results = new float[2]; Location.distanceBetween( mylocation.getLatitude(), mylocation.getLongitude(), mPOI.getLocation().getLatitude(), mPOI.getLocation().getLongitude(), results); // get the proper units. To change units see // JunaioPlugin.Settings.useImperialUnits poiLocation.setText( JunaioUtils.getRelativeLocationString( mPOI.getCurrentDistance(), 0, false, JunaioPlugin.Settings.useImperialUnits)); JunaioPlugin.log("Bearing: " + results[1]); pointer.updateOrientation(-results[1]); layoutLocation.setVisibility(View.VISIBLE); } else { layoutLocation.setVisibility(View.GONE); } loadPOIActions(); } catch (Exception e) { JunaioPlugin.log("POIDetailDialog.updateGUI: " + e.getMessage()); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.info); // get information int descriptionRes; String version; PackageInfo info; try { info = getPackageManager().getPackageInfo(getPackageName(), 0); } catch (NameNotFoundException e) { info = null; } if (info != null) { descriptionRes = info.applicationInfo.descriptionRes; version = info.versionName; } else { descriptionRes = R.string.app_description; version = "unknown"; } // get views ImageView vIcon = (ImageView) findViewById(R.id.about_icon); TextView vName = (TextView) findViewById(R.id.about_name); TextView vVersion = (TextView) findViewById(R.id.about_version); TextView vDescription = (TextView) findViewById(R.id.about_description); TextView vLink = (TextView) findViewById(R.id.about_link); TextView vCopyright = (TextView) findViewById(R.id.about_copyright); TextView vContact = (TextView) findViewById(R.id.about_contact); // set values vIcon.setImageResource(R.drawable.app_icon); vName.setText(R.string.app_name); vVersion.setText(version); vDescription.setText(descriptionRes); vLink.setText(R.string.app_link); vCopyright.setText(R.string.app_copyright); vContact.setText(R.string.app_contact); // linkify Linkify.addLinks(vLink, Linkify.ALL); Linkify.addLinks(vCopyright, Linkify.ALL); Linkify.addLinks(vContact, Linkify.ALL); }
@Override public void onStart() { super.onStart(); TextView message = (TextView) getDialog().findViewById(R.id.message); message.setTextAppearance(getActivity(), R.style.Holo_TextAppearance_Small_Light); message.setGravity(Gravity.CENTER); Linkify.addLinks(message, Linkify.WEB_URLS | Linkify.EMAIL_ADDRESSES); message.setMovementMethod(LinkMovementMethod.getInstance()); }
/** change presentation of locations in the list */ @Override public boolean setViewValue(View view, Cursor c, int index) { if (view.getId() == android.R.id.text2) { String transport = c.getString(c.getColumnIndex(Const.TRANSPORT_COLUMN)); String address = c.getString(c.getColumnIndex(Const.ADDRESS_COLUMN)); String hours = c.getString(c.getColumnIndex(Const.HOURS_COLUMN)); String remark = c.getString(c.getColumnIndex(Const.REMARK_COLUMN)); String room = c.getString(c.getColumnIndex(Const.ROOM_COLUMN)); StringBuilder sb = new StringBuilder(hours).append('\n').append(address); if (!room.isEmpty()) { sb.append(", ").append(room); } if (!transport.isEmpty()) { sb.append(" (").append(transport).append(')'); } if (!remark.isEmpty()) { sb.append('\n').append(COMPILE.matcher(remark).replaceAll("\n")); } TextView tv = (TextView) view; tv.setText(sb.toString()); // link email addresses and phone numbers (e.g. 089-123456) Linkify.addLinks(tv, Linkify.EMAIL_ADDRESSES); Linkify.addLinks(tv, Pattern.compile("[0-9-]{6,}"), "tel:"); return true; } else if (view.getId() == R.id.text3) { StringBuilder url = new StringBuilder(c.getString(c.getColumnIndex(Const.URL_COLUMN))); TextView tv = (TextView) view; if (url.toString().isEmpty()) { tv.setVisibility(View.GONE); } else { url.insert(0, "<a href=\"") .append("\">") .append(getString(R.string.website)) .append("</a>"); tv.setMovementMethod(LinkMovementMethod.getInstance()); tv.setText(Utils.fromHtml(url.toString())); } return true; } return false; }
/** * 给微博文字加上样式,表情,##,@,链接等 * * @param text 微博 * @param imageSpan 不需要表情传入null */ public static void vividTweet(TweetTextView text, TweetImageSpan imageSpan) { if (imageSpan != null) { text.setText(imageSpan.getImageSpan(text.getText())); } Linkify.addLinks( text, TweetTextView.MENTION_PATTERN, TweetTextView.MENTION_SCHEME, null, TweetTextView.MENTION_FILTER); Linkify.addLinks( text, TweetTextView.TOPIC_PATTERN, TweetTextView.TOPIC_SCHEME, null, TweetTextView.TOPIC_FILTER); Linkify.addLinks( text, TweetTextView.WEB_URL, TweetTextView.WEB_SCHEME, null, TweetTextView.URL_FILTER); removeLinkUnderline(text); }
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.b002); b002_help = (TextView) findViewById(R.id.b002_help); Pattern patternUseInfo = Pattern.compile(getResources().getString(R.string.use_info)); Linkify.addLinks(b002_help, patternUseInfo, "puripuri_link://"); getUIComponent(); setUIEvent(); }
public static void setTweetText(TextView textView, String text) { textView.setText(text); Linkify.TransformFilter filter = new Linkify.TransformFilter() { public final String transformUrl(final Matcher match, String url) { return match.group(); } }; Pattern mentionPattern = Pattern.compile("@([A-Za-z0-9_-]+)"); String mentionScheme = "http://www.twitter.com/"; Linkify.addLinks(textView, mentionPattern, mentionScheme, null, filter); Pattern hashtagPattern = Pattern.compile("#([A-Za-z0-9_-]+)"); String hashtagScheme = "http://www.twitter.com/search/"; Linkify.addLinks(textView, hashtagPattern, hashtagScheme, null, filter); Pattern urlPattern = Patterns.WEB_URL; Linkify.addLinks(textView, urlPattern, null, null, filter); }
@Override public void onCreate(Bundle savedInstanceState) { setContentView(R.layout.about); TextView tv = (TextView) findViewById(R.id.legal_text); tv.setText(readRawTextFile(R.raw.legal)); tv = (TextView) findViewById(R.id.info_text); tv.setText(Html.fromHtml(readRawTextFile(R.raw.info))); tv.setLinkTextColor(Color.BLUE); Linkify.addLinks(tv, Linkify.ALL); }
private void addChildItems(CommentItem parent, LinearLayout ll) { if (parent.getChildren() != null && parent.getChildren().size() > 0 && mInflator != null) { CommentItem childItem = null; for (int i = 0; i < parent.getChildren().size(); i++) { childItem = parent.getChildren().get(i); View childView = mInflator.inflate(R.layout.fragment_comments, null); TextView commentViewChild = (TextView) childView.findViewById(R.id.comment_comment); TextView hourViewChild = (TextView) childView.findViewById(R.id.comment_whenposted); TextView authorViewChild = (TextView) childView.findViewById(R.id.comment_author); if (commentViewChild != null) { commentViewChild.setText(childItem.getComment()); int color = -1; if (isNiteMode) { commentViewChild.setBackgroundColor(Color.BLACK); if (parent.getColor() == Color.BLACK) { commentViewChild.setTextAppearance(mActivity, R.style.TextCommentInverse); childItem.setColor(Color.WHITE); } else { commentViewChild.setTextColor(Color.WHITE); childItem.setColor(Color.BLACK); } } else { color = (parent.getColor() == Color.WHITE) ? Color.LTGRAY : Color.WHITE; commentViewChild.setBackgroundColor(color); childItem.setColor(color); } Linkify.addLinks(commentViewChild, Linkify.ALL); } if (hourViewChild != null) { hourViewChild.setText(childItem.getPostedDate()); } if (authorViewChild != null) { authorViewChild.setText(childItem.getAuthor()); } ll.addView(childView); LinearLayout cll = (LinearLayout) childView.findViewById(R.id.comments_layout); DisplayMetrics displaymetrics = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); Log.d(TAG, "Screen Width: " + displaymetrics.widthPixels); cll.setPadding(30, 0, 0, 0); if (cll != null && childItem.getChildren() != null && childItem.getChildren().size() > 0) { addChildItems(childItem, cll); } } } }
/** * {@inheritDoc} */ @Override public void onCreate(Bundle savedInstanceState) { setTitle(R.string.about_this_app); setContentView(R.layout.about); if (this.applicationIconId>0) { ImageView iv = (ImageView)findViewById(R.id.about_application_id); iv.setImageResource(this.applicationIconId); } TextView tv = (TextView)findViewById(R.id.about_legal_text); tv.setText(Html.fromHtml(readAsset(this.legalAssetName))); tv = (TextView)findViewById(R.id.about_info_text); tv.setText(Html.fromHtml(readAsset(this.infoAssetName))); Linkify.addLinks(tv, Linkify.EMAIL_ADDRESSES | Linkify.WEB_URLS); }
private void initUI() { countrySpinner = (Spinner) findViewById(R.id.country_spinner_register_layout); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource( RegisterActivity.this, R.array.countries_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); countrySpinner.setAdapter(adapter); registerBtn = (Button) findViewById(R.id.register_buton); registerBtn.setOnClickListener(this); registerBtn.setActivated(false); phoneNumEdt = (EditText) findViewById(R.id.phone_number_register_layout_edt); phoneNumEdt.addTextChangedListener( new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (!StringUtils.isEmpty(s.toString())) { registerBtn.setEnabled(true); } else { registerBtn.setEnabled(false); } } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {} @Override public void afterTextChanged(Editable s) {} }); phoneNumEdt.setHint(Tools.getCurrentPhoneNum(RegisterActivity.this)); privacyTv = (TextView) findViewById(R.id.privacy_register_tv); privacyTv.setText( Html.fromHtml( getString(R.string.privacy_policy_register) + " " + "<a href=\"https://play.google.com/store/search?q=dinostudio8891&c=apps\">" + getString(R.string.agree_term_con) + "</a>" + " " + getString(R.string.and) + " " + "<a href=\"https://play.google.com/store/search?q=dinostudio8891&c=apps\">" + getString(R.string.security_policy) + "</a>" + getString(R.string.go_next))); Linkify.addLinks(privacyTv, Linkify.ALL); privacyTv.setMovementMethod(LinkMovementMethod.getInstance()); }
public final CharSequence markup(CharSequence text) { SpannableString result; if (text instanceof SpannableString) { result = (SpannableString) text; } else { result = new SpannableString(text); } Linkify.addLinks(result, Linkify.ALL); // applyEmoticons(result); return result; }
public static ScrollView LinkifyText(Context context, String message) { ScrollView svMessage = new ScrollView(context); TextView tvMessage = new TextView(context); SpannableString spanText = new SpannableString(message); Linkify.addLinks(spanText, Linkify.ALL); tvMessage.setText(spanText); tvMessage.setMovementMethod(LinkMovementMethod.getInstance()); svMessage.setPadding(14, 2, 10, 12); svMessage.addView(tvMessage); return svMessage; }
private void showInfos() { SharedPreferences settings = getSharedPreferences(NAVIT_PREFS, MODE_PRIVATE); boolean firstStart = settings.getBoolean("firstStart", true); if (firstStart) { AlertDialog.Builder infobox = new AlertDialog.Builder(this); infobox.setTitle(getString(R.string.initial_info_box_title)); // TRANS infobox.setCancelable(false); final TextView message = new TextView(this); message.setFadingEdgeLength(20); message.setVerticalFadingEdgeEnabled(true); // message.setVerticalScrollBarEnabled(true); RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT); message.setLayoutParams(rlp); final SpannableString s = new SpannableString(getString(R.string.initial_info_box_message)); // TRANS Linkify.addLinks(s, Linkify.WEB_URLS); message.setText(s); message.setMovementMethod(LinkMovementMethod.getInstance()); infobox.setView(message); // TRANS infobox.setPositiveButton(getString(R.string.initial_info_box_OK), new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { Log.e("Navit", "Ok, user saw the infobox"); } }); // TRANS infobox.setNeutralButton(getString(R.string.initial_info_box_more_info), new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { Log.e("Navit", "user wants more info, show the website"); String url = "http://wiki.navit-project.org/index.php/Navit_on_Android"; Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } }); infobox.show(); SharedPreferences.Editor edit_settings = settings.edit(); edit_settings.putBoolean("firstStart", false); edit_settings.commit(); } }