Java Code Examples for android.text.Html
The following code examples are extracted from open source projects. You can click to
vote up the examples that are useful to you.
Example 1
From project adg-android, under directory /src/com/analysedesgeeks/android/.
Source file: AboutActivity.java

@Override protected void onCreate(final Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); moogAudioIV.setOnClickListener(new OnClickListener(){ @Override public void onClick( final View v){ ActivityController.onUrlClicked(AboutActivity.this,Const.MOOG_AUDIO_URL); } } ); cipcIV.setOnClickListener(new OnClickListener(){ @Override public void onClick( final View v){ ActivityController.onUrlClicked(AboutActivity.this,Const.CIPC_URL); } } ); aboutTV.setText(Html.fromHtml(REALISED_BY_HTML)); Linkify.addLinks(aboutTV,0); aboutTV.setMovementMethod(LinkMovementMethod.getInstance()); }
Example 2
From project AirCastingAndroidClient, under directory /src/main/java/pl/llp/aircasting/activity/.
Source file: AboutActivity.java

@Override public View getChildView(int groupPosition,int childPosition,boolean isLastChild,View convertView,ViewGroup parent){ if (convertView == null) { convertView=layoutInflater.inflate(R.layout.about_content,null); } String text=contents[groupPosition]; Spanned spanned=Html.fromHtml(text); spanned=stripUnderlines(spanned); TextView view=(TextView)convertView.findViewById(R.id.content); view.setText(spanned); view.setMovementMethod(LinkMovementMethod.getInstance()); return convertView; }
Example 3
From project Amantech, under directory /Android/CloudAppStudioAndroid/src/com/cloudappstudio/utility/.
Source file: CloudViewEntryParser.java

public List<CloudViewEntry> parseFromString(String json) throws JSONException { JSONArray outlineArray=new JSONArray(json); List<CloudViewEntry> views=new ArrayList<CloudViewEntry>(); for (int i=0; i < outlineArray.length(); i++) { JSONObject appObject=outlineArray.getJSONObject(i); JSONArray columnsJson=appObject.getJSONArray("columns"); final String[] columns=new String[columnsJson.length()]; for (int j=0; j < columns.length; j++) { columns[j]=columnsJson.getString(j); } JSONArray rowsJson=appObject.getJSONArray("rows"); for (int j=0; j < rowsJson.length(); j++) { JSONObject rowObject=rowsJson.getJSONObject(j); JSONArray valuesJson=rowObject.getJSONArray("columns"); List<ColumnValue> viewEntries=new ArrayList<ColumnValue>(); final String[] values=new String[valuesJson.length()]; for (int x=0; x < valuesJson.length(); x++) { values[x]=valuesJson.getString(x); } for (int k=0; k < values.length; k++) { if (columns.length <= values.length) { viewEntries.add(new ColumnValue(columns[k],Html.fromHtml(values[k]).toString())); } } views.add(new CloudViewEntry(viewEntries)); } } return views; }
Example 4
From project and-bible, under directory /AndBible/src/net/bible/android/view/activity/footnoteandref/.
Source file: ItemAdapter.java

@Override public View getView(int position,View convertView,ViewGroup parent){ Note item=getItem(position); TwoLineListItem view; if (convertView == null) { LayoutInflater inflater=(LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); view=(TwoLineListItem)inflater.inflate(resource,parent,false); } else { view=(TwoLineListItem)convertView; } if (view.getText1() != null) { String summary=item.getSummary(); view.getText1().setText(Html.fromHtml(summary)); } if (view.getText2() != null) { String detail=item.getDetail(); view.getText2().setText(Html.fromHtml(detail)); } return view; }
Example 5
From project andlytics, under directory /src/com/github/andlyticsproject/.
Source file: BaseChartActivity.java

protected final void updateChartHeadline(){ String subHeadlineText=""; String title=myAdapter.getCurrentChartTitle(); String ret=myAdapter.getCurrentSubHeadLine(); if (ret != null) subHeadlineText=ret; updateTitleTextSwitcher(title); if (Preferences.getShowChartHint(this)) { timeframeText.setText(Html.fromHtml(getChartHint())); } else { if (timetext != null) { timeframeText.setText(Html.fromHtml(timetext + ": <b>" + subHeadlineText+ "</b>")); } } }
Example 6
public void setValue(String key,String value){ if ("title".equals(key)) { mTitle=value; } else if ("pubDate".equals(key)) { mPubDate=value; } else if ("published".equals(key)) { setPublished(value); } else if ("description".equals(key) || "content".equals(key)) { mDesc=Html.fromHtml(value).toString(); } else if ("link".equals(key)) { mLink=value; } }
Example 7
From project android-bankdroid, under directory /src/com/liato/bankdroid/banking/banks/.
Source file: AkeliusInvest.java

public Urllib login() throws LoginException, BankException { try { LoginPackage lp=preLogin(); String response=urlopen.open(lp.getLoginTarget(),lp.getPostData()); Matcher matcher=reError.matcher(response); if (matcher.find()) { String errormsg=Html.fromHtml(matcher.group(1).trim()).toString(); if (errormsg.contains("ord eller personnummer") || errormsg.contains("et alternativ") || errormsg.contains("fyra siffror")) { throw new LoginException(errormsg); } else { throw new BankException(errormsg); } } } catch ( ClientProtocolException e) { Log.e(TAG,"ClientProtocolException: " + e.getMessage()); throw new BankException(e.getMessage()); } catch ( IOException e) { Log.e(TAG,"IOException: " + e.getMessage()); throw new BankException(e.getMessage()); } return urlopen; }
Example 8
From project android-client, under directory /xwiki-android-components/src/hu/scythe/droidwriter/.
Source file: DroidWriterEditText.java

private void initialize(){ imageGetter=new Html.ImageGetter(){ @Override public Drawable getDrawable( String source){ return null; } } ; this.addTextChangedListener(new DWTextWatcher()); }
Example 9
@Override protected Dialog onCreateDialog(int id){ switch (id) { case DIALOG_CHANGELOG: StringBuilder changelog=new StringBuilder(); BufferedReader input; try { InputStream is=getResources().openRawResource(R.raw.changelog); input=new BufferedReader(new InputStreamReader(is)); String line; while ((line=input.readLine()) != null) { changelog.append(line); changelog.append("<br/>"); } input.close(); } catch (IOException e) { e.printStackTrace(); } return new AlertDialog.Builder(this).setTitle(R.string.changelog_title).setMessage(Html.fromHtml(changelog.toString())).setPositiveButton(R.string.close,null).create(); } return null; }
Example 10
From project android-flip, under directory /FlipView/Demo/src/com/aphidmobile/flip/demo/.
Source file: FlipComplexLayoutActivity.java

@Override public View getView(int position,View convertView,ViewGroup parent){ View layout=convertView; if (convertView == null) layout=inflater.inflate(R.layout.complex1,null); final Data data=IMG_DESCRIPTIONS.get(position); TextView titleView=(TextView)layout.findViewById(R.id.title); titleView.setText(AphidLog.format("%d. %s",position,data.title)); ImageView photoView=(ImageView)layout.findViewById(R.id.photo); photoView.setImageBitmap(IO.readBitmap(inflater.getContext().getAssets(),data.imageFilename)); TextView textView=(TextView)layout.findViewById(R.id.description); textView.setText(Html.fromHtml(data.description)); Button wikipedia=(Button)layout.findViewById(R.id.wikipedia); wikipedia.setOnClickListener(new View.OnClickListener(){ @Override public void onClick( View v){ Intent intent=new Intent(Intent.ACTION_VIEW,Uri.parse(data.link)); inflater.getContext().startActivity(intent); } } ); return layout; }
Example 11
From project android-tether, under directory /src/og/android/tether/.
Source file: MainActivity.java

private synchronized void updateRSSView(String JSONrss){ Log.d(MSG_TAG,"Intent JSONRSS: " + JSONrss); try { this.rssAdapter.clear(); this.rssAdapter.notifyDataSetChanged(); this.jsonRssArray=new JSONArray(JSONrss); for (int i=0; i < jsonRssArray.length(); i++) { JSONObject jsonRssItem=jsonRssArray.getJSONObject(i); this.rssAdapter.add(Html.fromHtml(jsonRssItem.getString("title") + " - <i>" + jsonRssItem.getString("creator")+ "</i>")); } if (jsonRssArray.length() > 0 && !this.application.settings.getBoolean("rss_closed",false)) this.rssPanel.setOpen(true,true); } catch ( JSONException e) { e.printStackTrace(); } }
Example 12
From project android-voip-service, under directory /src/main/java/org/linphone/.
Source file: LinphoneActivity.java

private void onFirstLaunch(){ AlertDialog.Builder builder=new AlertDialog.Builder(this); TextView lDialogTextView=new TextView(this); lDialogTextView.setAutoLinkMask(0x0f); lDialogTextView.setPadding(10,10,10,10); lDialogTextView.setText(Html.fromHtml(getString(R.string.first_launch_message))); builder.setCustomTitle(lDialogTextView).setCancelable(false).setPositiveButton(getString(R.string.cont),new DialogInterface.OnClickListener(){ public void onClick( DialogInterface dialog, int id){ LinphoneManager.getInstance().initializePayloads(); startprefActivity(); checkAccount=false; } } ); builder.create().show(); }
Example 13
From project android-xbmcremote, under directory /src/org/xbmc/android/remote/presentation/activity/.
Source file: AboutActivity.java

@Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.about); final Display display=getWindowManager().getDefaultDisplay(); ThumbSize.setScreenSize(display.getWidth(),display.getHeight()); try { mEventClientManager=ManagerFactory.getEventClientManager(null); final String versionName=getPackageManager().getPackageInfo(getPackageName(),0).versionName; final int versionCode=getPackageManager().getPackageInfo(getPackageName(),0).versionCode; ((TextView)findViewById(R.id.about_version)).setText("v" + versionName); ((TextView)findViewById(R.id.about_revision)).setText("Revision " + versionCode); TextView message=(TextView)findViewById(R.id.about_url_message); message.setText(Html.fromHtml("Visit our project page at <a href=\"http://code.google.com/p/android-xbmcremote\">Google Code</a>.")); message.setMovementMethod(LinkMovementMethod.getInstance()); } catch ( NameNotFoundException e) { ((TextView)findViewById(R.id.about_version)).setText("Error reading version"); } mConfigurationManager=ConfigurationManager.getInstance(this); }
Example 14
From project android-xbmcremote-sandbox, under directory /src/org/xbmc/android/util/.
Source file: UIUtils.java

/** * Populate the given {@link TextView} with the requested text, formattingthrough {@link Html#fromHtml(String)} when applicable. Also sets{@link TextView#setMovementMethod} so inline links are handled. */ public static void setTextMaybeHtml(TextView view,String text){ if (TextUtils.isEmpty(text)) { view.setText(""); return; } if (text.contains("<") && text.contains(">")) { view.setText(Html.fromHtml(text)); view.setMovementMethod(LinkMovementMethod.getInstance()); } else { view.setText(text); } }
Example 15
From project androidquery, under directory /src/com/androidquery/service/.
Source file: MarketService.java

protected void showUpdateDialog(JSONObject jo){ if (jo == null || version != null) return; if (!isActive()) return; JSONObject dia=jo.optJSONObject("dialog"); String update=dia.optString("update","Update"); String skip=dia.optString("skip","Skip"); String rate=dia.optString("rate","Rate"); String body=dia.optString("wbody",""); String title=dia.optString("title","Update Available"); AQUtility.debug("wbody",body); version=jo.optString("version",null); Drawable icon=getAppIcon(); Context context=act; final AlertDialog dialog=new AlertDialog.Builder(context).setIcon(icon).setTitle(title).setPositiveButton(rate,handler).setNeutralButton(skip,handler).setNegativeButton(update,handler).create(); dialog.setMessage(Html.fromHtml(patchBody(body),null,handler)); aq.show(dialog); return; }
Example 16
From project androidtracks, under directory /src/org/sfcta/cycletracks/.
Source file: SaveTrip.java

@Override public void onCheckedChanged(CompoundButton v,boolean isChecked){ if (isChecked) { for ( Entry<Integer,ToggleButton> e : purpButtons.entrySet()) { e.getValue().setChecked(false); } v.setChecked(true); purpose=v.getText().toString(); ((TextView)findViewById(R.id.TextPurpDescription)).setText(Html.fromHtml(purpDescriptions.get(v.getId()))); } }
Example 17
From project android_5, under directory /src/aarddict/android/.
Source file: DictionariesActivity.java

@Override void initUI(){ setContentView(R.layout.dictionaries); listView=(ListView)findViewById(R.id.dictionariesList); Button scanSDButton=(Button)findViewById(R.id.scanSDButton); scanSDButton.setOnClickListener(new View.OnClickListener(){ public void onClick( View v){ scandSDCard(); } } ); TextView messageView=(TextView)findViewById(R.id.dictionariesMessageView); messageView.setMovementMethod(LinkMovementMethod.getInstance()); messageView.setText(Html.fromHtml(getString(R.string.noDictionaries))); String appName=getString(R.string.appName); setTitle(getString(R.string.titleDictionariesActivity,appName)); try { loadVerifyData(); } catch ( Exception e) { Log.e(TAG,"Failed to load verify data",e); } }
Example 18
From project android_packages_apps_QuickSearchBox, under directory /src/com/android/quicksearchbox/ui/.
Source file: DefaultSuggestionView.java

private CharSequence formatText(String str,SuggestionCursor suggestion,boolean highlightSuggested){ boolean isHtml="html".equals(suggestion.getSuggestionFormat()); if (isHtml && looksLikeHtml(str)) { return Html.fromHtml(str); } else if (highlightSuggested && suggestion.isWebSearchSuggestion() && !TextUtils.isEmpty(suggestion.getUserQuery())) { return mSuggestionFormatter.formatSuggestion(suggestion.getUserQuery(),str); } else { return str; } }
Example 19
From project android_packages_apps_Tag, under directory /src/com/android/apps/tag/.
Source file: TagList.java

public void setEmptyView(){ TextView empty=(TextView)findViewById(R.id.text); View button=findViewById(R.id.more_info); if (mShowStarredOnly) { empty.setText(R.string.empty_list_starred); button.setVisibility(View.GONE); } else { empty.setText(Html.fromHtml(getString(R.string.empty_list))); button.setVisibility(View.VISIBLE); button.setOnClickListener(this); } }
Example 20
From project andtweet, under directory /src/com/xorcode/andtweet/.
Source file: TweetActivity.java

@Override protected void onResume(){ super.onResume(); if (mCursor != null) { mCursor.moveToFirst(); String aAuthor=mCursor.getString(mCursor.getColumnIndex(Tweets.AUTHOR_ID)); String aMessage=mCursor.getString(mCursor.getColumnIndex(Tweets.MESSAGE)); long aSentDate=mCursor.getLong(mCursor.getColumnIndex(Tweets.SENT_DATE)); mAuthor.setText(aAuthor); mMessage.setLinksClickable(true); mMessage.setFocusable(true); mMessage.setFocusableInTouchMode(true); mMessage.setText(aMessage); Linkify.addLinks(mMessage,Linkify.ALL); String inReplyTo=""; int colIndex=mCursor.getColumnIndex(Tweets.IN_REPLY_TO_AUTHOR_ID); if (colIndex > -1) { inReplyTo=mCursor.getString(colIndex); if (inReplyTo != null && "null".equals(inReplyTo) == false) { inReplyTo=String.format(Locale.getDefault(),getText(R.string.tweet_source_in_reply_to).toString(),inReplyTo); } } if (inReplyTo == null || "null".equals(inReplyTo)) inReplyTo=""; String sentDate=String.format(Locale.getDefault(),getText(R.string.tweet_source_from).toString(),RelativeTime.getDifference(this,aSentDate),Html.fromHtml(mCursor.getString(mCursor.getColumnIndex(Tweets.SOURCE))),inReplyTo); mSentDate.setText(sentDate); } else { Log.e(TAG,"No cursor found"); } }
Example 21
From project AquaNotesTest, under directory /src/com/google/android/apps/iosched/util/.
Source file: UIUtils.java

/** * Populate the given {@link TextView} with the requested text, formattingthrough {@link Html#fromHtml(String)} when applicable. Also sets{@link TextView#setMovementMethod} so inline links are handled. */ public static void setTextMaybeHtml(TextView view,String text){ if (TextUtils.isEmpty(text)) { view.setText(""); return; } if (text.contains("<") && text.contains(">")) { view.setText(Html.fromHtml(text)); view.setMovementMethod(LinkMovementMethod.getInstance()); } else { view.setText(text); } }
Example 22
From project Barcamp-Bangalore-Android-App, under directory /bcb_app/src/com/bangalore/barcamp/activity/.
Source file: ScheduleActivity.java

private void updateViews(BarcampData data){ findViewById(R.id.spinnerLayout).setVisibility(View.GONE); if (TextUtils.isEmpty(data.status)) { findViewById(R.id.listView1).setVisibility(View.VISIBLE); addScheduleItems(data.slotsArray); findViewById(R.id.infoText).setVisibility(View.GONE); } else { TextView infoText=((TextView)findViewById(R.id.infoText)); infoText.setMovementMethod(LinkMovementMethod.getInstance()); infoText.setText(Html.fromHtml(data.status)); infoText.setVisibility(View.VISIBLE); findViewById(R.id.listView1).setVisibility(View.GONE); } }
Example 23
@Override public boolean onOptionsItemSelected(MenuItem item){ if (item.getItemId() == 0 || item.getItemId() == R.id.menu_about) { TextView aboutTv=(TextView)View.inflate(c,R.layout.tabletext,null); aboutTv.setText(Html.fromHtml(res.getStringArray(R.array.aboutDialog)[1])); aboutTv.setPadding(10,0,10,0); aboutTv.setTextSize(18); aboutTv.setMovementMethod(LinkMovementMethod.getInstance()); new AlertDialog.Builder(c).setTitle(res.getStringArray(R.array.aboutDialog)[0]).setIcon(R.drawable.ic_launcher).setView(aboutTv).setPositiveButton("Okay!",null).show(); return true; } return false; }
Example 24
From project beintoo-android-sdk, under directory /BeintooSDK/src/com/beintoo/activities/.
Source file: Challenges.java

private TableRow createRow(ImageView image,String name,String contest,Context activity){ TableRow row=new TableRow(activity); int size=(int)(50 * context.getResources().getDisplayMetrics().density + 0.5f); LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(size,size); params.rightMargin=(int)(ratio * 10); params.leftMargin=(int)(ratio * 10); image.setLayoutParams(params); params.gravity=Gravity.CENTER; LinearLayout rowContainer=new LinearLayout(row.getContext()); rowContainer.setOrientation(LinearLayout.HORIZONTAL); rowContainer.addView(image); LinearLayout main=new LinearLayout(row.getContext()); main.setLayoutParams(new LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT)); main.setOrientation(LinearLayout.VERTICAL); main.setGravity(Gravity.CENTER_VERTICAL); TextView contestName=new TextView(activity); if (contest.length() > 26) contestName.setText(contest.substring(0,23) + "..."); else contestName.setText(contest); contestName.setPadding(0,0,0,0); contestName.setTextColor(Color.parseColor("#545859")); contestName.setTextSize(16); contestName.setLayoutParams(new LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT)); TextView from=new TextView(activity); from.setText(Html.fromHtml(name)); from.setPadding(0,0,0,0); from.setTextColor(Color.parseColor("#787A77")); from.setTextSize(14); from.setLayoutParams(new LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT)); main.addView(contestName); main.addView(from); rowContainer.addView(main,new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,(int)(ratio * 70))); row.addView(rowContainer); return row; }
Example 25
From project BF3-Battlelog, under directory /src/com/ninetwozero/battlelog/activity/feed/.
Source file: PostOverviewFragment.java

public void initNews(View v){ mTextTitle=(TextView)v.findViewById(R.id.text_title); mTextContent=(TextView)v.findViewById(R.id.text_content); mTextInfo=(TextView)v.findViewById(R.id.text_author); mTextTitle.setText(mNewsData.getTitle()); mTextInfo.setText(Html.fromHtml(getString(R.string.info_news_posted_by).replace("{author}",mNewsData.getAuthorName()).replace("{date}",PublicUtils.getRelativeDate(mContext,mNewsData.getDate())))); mTextContent.setText(Html.fromHtml(mNewsData.getContent())); }
Example 26
From project Biljetter, under directory /src/se/rebootit/android/tagbiljetter/.
Source file: About.java

@Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.about); getSupportActionBar().setTitle(getString(R.string.About_header)); TextView txtDescription=((TextView)findViewById(R.id.txtDescription)); txtDescription.setText(Html.fromHtml(getString(R.string.About_description))); txtDescription.setMovementMethod(LinkMovementMethod.getInstance()); ((ImageButton)findViewById(R.id.btnFlattr)).setOnClickListener(this); ((ImageButton)findViewById(R.id.btnPayPal)).setOnClickListener(this); ((ImageButton)findViewById(R.id.btnBitcoin)).setOnClickListener(this); try { PackageInfo pinfo=getPackageManager().getPackageInfo(getPackageName(),0); int versionNumber=pinfo.versionCode; String versionName=pinfo.versionName; ((TextView)findViewById(R.id.txtVersion)).setText("Version " + versionName + " (build "+ versionNumber+ ")"); } catch ( Exception e) { } getSupportActionBar().setDisplayHomeAsUpEnabled(true); }
Example 27
From project BombusLime, under directory /src/org/bombusim/lime/activity/.
Source file: About.java

public static void showAboutDialog(Activity hostActivity){ Context context=hostActivity.getBaseContext(); StringBuilder sb=new StringBuilder(); try { InputStreamReader isr=new InputStreamReader(context.getResources().openRawResource(R.raw.about)); while (true) { int c=isr.read(); if (c == -1) break; sb.append((char)c); } isr.close(); } catch ( Exception e) { e.printStackTrace(); } String about=String.format(sb.toString(),context.getText(R.string.app_name),Lime.getInstance().getVersion()); CharSequence aboutDecorated=Html.fromHtml(about); AlertDialog.Builder builder=new AlertDialog.Builder(hostActivity); builder.setTitle(context.getText(R.string.aboutBombusLime)).setIcon(R.drawable.ic_launcher).setMessage(aboutDecorated).setPositiveButton(R.string.close,new DialogInterface.OnClickListener(){ public void onClick( DialogInterface dialog, int id){ dialog.dismiss(); } } ); AlertDialog alert=builder.create(); alert.setOwnerActivity(hostActivity); alert.show(); ((TextView)alert.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance()); }
Example 28
From project BreizhCamp-android, under directory /src/org/breizhjug/breizhcamp/.
Source file: SessionActivity.java

@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); imageLoader=new ImageLoader(this); setContentView(R.layout.session); LayoutInflater inflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); Session session=getIntent().getParcelableExtra("session"); TextView title=(TextView)findViewById(R.id.title); title.setText(session.title); TextView description=(TextView)findViewById(R.id.description); description.setText(session.description); TextView room=(TextView)findViewById(R.id.room); room.setText(session.room != null ? session.room.name : ""); LinearLayout speakers=(LinearLayout)findViewById(R.id.speakers); for ( final Speaker speaker : session.speakers) { View view=inflater.inflate(R.layout.speaker_item,null); TextView name=(TextView)view.findViewById(R.id.name); name.setText(Html.fromHtml("<u>" + speaker.name + "</u> ")); name.setOnClickListener(new OnClickListener(){ @Override public void onClick( View v){ Intent intent=new Intent(SessionActivity.this,SpeakerActivity.class); intent.putExtra("speaker",speaker); startChildActivity("speaker",intent); } } ); speakers.addView(view); } LinearLayout subjects=(LinearLayout)findViewById(R.id.subjects); for ( final Subject subject : session.subjects) { View view=inflater.inflate(R.layout.subject_item,null); ImageView image=(ImageView)view.findViewById(R.id.image); imageLoader.displayImage(subject.imageUrl,subject.name,image); subjects.addView(view); } subjects.setVisibility(session.subjects.isEmpty() ? View.GONE : View.VISIBLE); }
Example 29
From project Catroid-maven-playground, under directory /src/main/java/at/tugraz/ist/catroid/ui/dialogs/.
Source file: AboutDialog.java

@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_LEFT_ICON); setContentView(R.layout.dialog_about); setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,android.R.drawable.ic_dialog_info); setTitle(R.string.about_title); setCanceledOnTouchOutside(true); TextView aboutUrlTextView=(TextView)findViewById(R.id.dialog_about_url_text_view); aboutUrlTextView.setMovementMethod(LinkMovementMethod.getInstance()); Resources resources=context.getResources(); String aboutUrl=String.format(resources.getString(R.string.about_link_template),resources.getString(R.string.about_catroid_url),resources.getString(R.string.about_link_text)); aboutUrlTextView.setText(Html.fromHtml(aboutUrl)); TextView aboutVersionNameTextView=(TextView)findViewById(R.id.dialog_about_version_name_text_view); String versionName=Utils.getVersionName(context); aboutVersionNameTextView.setText(versionName); }
Example 30
From project CineShowTime-Android, under directory /Libraries/CineShowTime/src/com/binomed/showtime/android/layout/dialogs/last/.
Source file: LastChangeDialog.java

/** * @see android.app.Dialog#onCreate(android.os.Bundle) */ @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.dialog_last); try { SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(mainContext); Editor editor=prefs.edit(); editor.remove(CineShowtimeCst.PREF_KEY_APP_ENGINE); editor.commit(); } catch ( Exception e) { } Button btnClose=(Button)findViewById(R.id.lastBtnClose); btnClose.setOnClickListener(new View.OnClickListener(){ @Override public void onClick( View arg0){ LastChangeDialog.this.dismiss(); } } ); setTitle(mainContext.getResources().getString(R.string.dialogLastChangeTitle)); TextView contentLastChange=(TextView)findViewById(R.id.lastChangetText); Spanned spanned=Html.fromHtml("<b>v3.0.12</b><br><br>" + " * * Fix crash for tablet when change portrait to landscape <br>" + "<br>"+ "<b>v3.0.11</b><br><br>"+ " * * Fix somes crash bug <br>"+ "<br>"+ "<b>v3.0.10</b><br><br>"+ " * * Fix somes crash bug <br>"+ "<br>"+ "<b>v3.0.9</b><br><br>"+ " * Improve fast scrolling in results <br>"+ "<br>"+ "<b>v3.0.8</b><br><br>"+ " * Fix somes crash bug (call, widgets, sort...)<br>"+ "<br>"+ "<b>v3.0.7</b><br><br>"+ " * Fix somes crash bug (call, results, ...)<br>"+ "<br>"+ "<b>v3.0.6</b><br><br>"+ " * Fix somes crash bug<br>"+ "<br>"+ "<b>v3.0.5</b><br><br>"+ " * Fix somes crash bug<br>"+ "<br>"+ "<b>v3.0.4</b><br><br>"+ " * Fix crash bug for search movies<br>"+ " * Fix widgets crash<br>"+ "<br>"+ "<b>v3.0.3</b><br><br>"+ " * Fix crash bug for donuts phones<br>"+ "<br>"+ "<b>v3.0.2</b><br><br>"+ " * Fix starting crash<br>"+ "<br>"+ "<b>v3.0.1</b><br><br>"+ " * Fix some server bug<br>"+ " * New translation for italian<br>"+ "<br>"+ "<b>v3.0.0</b><br><br>"+ " * Reset Widgets<br>"+ " * Multi Widgets support<br>"+ " * Add of Action bar<br>"+ " * Tablet screen support<br>"+ " * Improve UI<br>"+ " * Fix some crash problems<br>"+ " * Integration of Chinese langages<br>"+ "<br>"+ "<b>v2.1.1</b><br><br>"+ " * Fix some crash problems<br>"+ "<br>"+ "<b>v2.1.0</b><br><br>"+ " * Add of SplashScreen<br>"+ " * Add of Google Analytics<br>"+ " * Add of menu in movie screen<br>"+ " * App2Sd support<br>"+ " * Add of GPS animation<br>"+ " * Fix some crash problems<br>"+ "<br>"+ "<b>v2.0.3</b><br><br>"+ " * Fix some crash problems<br>"+ "<br>"+ "<b>v2.0.2</b><br><br>"+ " * Fix some crash problems<br>"+ "<br>"+ "<b>v2.0.1</b><br><br>"+ " * Fix landscape problem for search screen<br>"+ " * Fix some crash problems<br>"+ "<br>"+ "<b>v2.0.0</b><br><br>"+ " * New UI<br>"+ " * Add Themes management<br>"+ " * Add tab review in movie screen<br>"+ " * Add trailers directly in movie screen<br>"+ " * Possibility to reserve if infomation is available<br>"+ "<br>"+ "<b>v1.10.1</b><br><br>"+ " * Minor fix corresponding to crash reports<br>"+ " * Suppression of gps message when launching app<br>"+ "<br>"+ "<b>v1.10.0</b><br><br>"+ " * Fix with favorites<br>"+ " * Fix with distance<br>"+ "<br>"+ "<b>v1.9.2</b><br><br>"+ " * Fix for archos tablet<br>"+ "<br>"+ "<b>v1.9.1</b><br><br>"+ " * Minor bug correction with favorites<br>"+ " * Change of icon<br>"+ " * <b>Please update your favorites cinemas (delete, recreate) if there is an error<b><br>"+ "<br>"+ "<b>v1.9.0</b><br><br>"+ " * Support of japanese langage and italian<br>"+ " * Change of icon<br>"+ " * Change of widget : you have to reset your widget<br>"+ "<br>"+ "<b>v1.8.1</b><br><br>"+ " * Minor fix for bookmark bug"+ "<br>"+ "<b>v1.8.0</b><br><br>"+ " * Location bugs correction<br>"+ " * crash bug correction<br>"+ " * correction on server for movie descriptions<br>"+ " * integration of 'es' langage, complete rewrite of 'en' traductions.<br>"+ " * managment of widget in cupcake in multi-screen and multi resolutions<br>"+ "<br>"+ "<b>v1.7.2 and 1.7.3</b><br>"+ "<br>"+ " * Location bugs correction<br>"+ " * crash bug correction<br>"+ " * correction on server for movie times<br>"+ " * integration of pt, pt_BR, and cz langages<br>"+ "<br>"+ "<b>v1.7.1</b><br>"+ "<br>"+ " * Minor update for integrating message when no results come from server<br>"+ "<br>"+ "<b>v1.7.0</b><br>"+ "<br>"+ " * Management of Turkish langage<br>"+ " * Management of widget for multiScreen (Add of widget for cupcake)<br>"+ "<br>"+ "<b>v1.6.2 and v1.6.3</b><br>"+ "<br>"+ " * Minor update correcting widget bug<br>"+ "<br>"+ "<b>v1.6.1</b><br>"+ "<br>"+ " * Enhance UI<br>"+ " * Management of deutch langage<br>"+ "<br>"+ "<b>v1.6.0</b><br>"+ "<br>"+ " * Integration of SkyHook? framework => you can search near your wifi position, ip position<br>"+ " * Correction of bugs with bookmarks theater.<br>"+ " * Integration of projection langage.<br>"+ " * Warning ! this version will reset your bookmark theater and the widget.<br>"+ "<br>"+ "<b>v1.5.0</b><br>"+ "<br>"+ " * Management of time of adds before movies showtime in preferences<br>"+ " * Correction of bug of gps localisation invisible buttons, for android 1.1 and 1.5<br>"+ " * Support of ru langage (Thanks Stan)<br>"+ "<br>"+ "<b>v1.4.0</b><br>"+ "<br>"+ " * Add of button Bookmarks on main screen<br>"+ " * Click on widget now open directly on theater showtimes<br>"+ " * Add of possibility to have drive direction to theaters<br>"+ " * Possibility of multi-page in widget search<br>"+ " * Add search speech for name of city and name of movie (if speech available). Works for english word only (wait for google :))<br>"+ " * Increase number of day in spinner<br>"+ " * Improve of way to get movie summary<br>"+ "<br>"+ "<b>v1.3.1</b><br>"+ "<br>"+ " * Correction for motorola blur (but many other phone could be concerned) for text of buttons invisible<br>"+ "<br>"+ "<b>v1.3.0</b><br>"+ "<br>"+ " * Management of drive time to go to theater. You could have only showtime reachables.<br>"+ " * You can add a showtime into calendar application.<br>"+ " * You can localise you with network position.<br>"+ " * Correction of issues 1,2,3 and 4.<br>"+ " * Add of option in menu for management of localisation.<br>"+ "<br>"+ "<b>v1.2.0</b><br>"+ "<br>"+ " * Add of about menu (version informations)<br>"+ " * Add of help menu<br>"+ " * Correction of bug with showtimes accross days and theaters<br>"+ " * Improve UI fast<br>"+ "<br>"+ "<b>v1.1.0</b><br>"+ "<br>"+ " * Widget management<br>"+ " * Improve UI<br>"+ " * Correction of some bugs<br>"+ "<br>"+ "<b>v1.0.0</b><br>"+ "<br>"+ " * Search theaters according to position and show movie list and showtimes corresponding<br>"+ " * You can call theaters<br>"+ " * You can launch maps to localize the theaters<br>"+ " * You can search trailers of the movies<br>"+ " * You can manage theaters bookmarks<br>"+ " * For each movie, there is a description screen with several information on the movie<br>"+ " * You can use your GPS to localise you and search show time near your position<br>"+ " * You can sort your results by :<br>"+ " * Distance of the theater<br>"+ " * Name of the theater<br>"+ " * The closest showtime<br>"+ " * You can see what's on screens during the 3 next day<br>"+ " * Search showtimes by movie name<br>"+ " * You can invite your friends by sms or mail to a film event<br>"+ " * Management of langage :<br>"+ " ->en<br>"+ " ->fr<br>"+ " ->de<br>"+ " ->pt<br>"); contentLastChange.setText(spanned); }
Example 31
From project conference-mobile-app, under directory /android-app/src/com/google/android/apps/iosched/util/.
Source file: UIUtils.java

/** * Populate the given {@link TextView} with the requested text, formattingthrough {@link Html#fromHtml(String)} when applicable. Also sets{@link TextView#setMovementMethod} so inline links are handled. */ public static void setTextMaybeHtml(TextView view,String text){ if (TextUtils.isEmpty(text)) { view.setText(""); return; } if (text.contains("<") && text.contains(">")) { view.setText(Html.fromHtml(text)); view.setMovementMethod(LinkMovementMethod.getInstance()); } else { view.setText(text); } }
Example 32
From project creamed_glacier_app_settings, under directory /src/com/android/settings/bluetooth/.
Source file: BluetoothDevicePreference.java

private void askDisconnect(){ Context context=getContext(); String name=mCachedDevice.getName(); if (TextUtils.isEmpty(name)) { name=context.getString(R.string.bluetooth_device); } String message=context.getString(R.string.bluetooth_disconnect_all_profiles,name); String title=context.getString(R.string.bluetooth_disconnect_title); DialogInterface.OnClickListener disconnectListener=new DialogInterface.OnClickListener(){ public void onClick( DialogInterface dialog, int which){ mCachedDevice.disconnect(); } } ; mDisconnectDialog=Utils.showDisconnectDialog(context,mDisconnectDialog,disconnectListener,title,Html.fromHtml(message)); }
Example 33
From project cwac-richedit, under directory /tests/src/com/commonsware/cwac/richedit/.
Source file: EffectTestCaseBase.java

public void testAddAndRemove(){ Spannable str=new SpannableString(Html.fromHtml("0123 56 89012345")); assertSpans(str,getAllSpans(str),0); updateSpannable(str,0,4,true); assertSpans(str,getAllSpans(str),1,0,4); updateSpannable(str,0,4,false); assertSpans(str,getAllSpans(str),0); updateSpannable(str,4,10,true); assertSpans(str,getAllSpans(str),1,4,10); updateSpannable(str,4,10,false); assertSpans(str,getAllSpans(str),0); updateSpannable(str,8,15,true); assertSpans(str,getAllSpans(str),1,8,15); updateSpannable(str,8,15,false); assertSpans(str,getAllSpans(str),0); }
Example 34
From project dccsched, under directory /src/com/underhilllabs/dccsched/util/.
Source file: UIUtils.java

/** * Populate the given {@link TextView} with the requested text, formattingthrough {@link Html#fromHtml(String)} when applicable. Also sets{@link TextView#setMovementMethod} so inline links are handled. */ public static void setTextMaybeHtml(TextView view,String text){ if (text.contains("<") && text.contains(">")) { view.setText(Html.fromHtml(text)); view.setMovementMethod(LinkMovementMethod.getInstance()); } else { view.setText(text); } }
Example 35
From project dcnyc10-android, under directory /android/src/com/lullabot/android/apps/iosched/ui/.
Source file: TwitterStreamFragment.java

@Override public View getView(int position,View convertView,ViewGroup parent){ View v=convertView; if (v == null) { v=getActivity().getLayoutInflater().inflate(R.layout.tweets_items,null); } Tweet tweet=tweets.get(position); if (tweet != null) { TextView username=(TextView)v.findViewById(R.id.username); TextView message=(TextView)v.findViewById(R.id.tweet_msg); message.setAutoLinkMask(Linkify.WEB_URLS); ImageView image=(ImageView)v.findViewById(R.id.tweet_avatar); if (username != null) { username.setText(tweet.username); } if (message != null) { message.setText(Html.fromHtml(tweet.message)); } if (image != null) { image.setImageBitmap(getBitmap(tweet.image_url)); } } return v; }
Example 36
From project devoxx-france-android-in-fine, under directory /src/com/infine/android/devoxx/util/.
Source file: UIUtils.java

/** * Format and return the given {@link Blocks} and {@link Rooms} values using{@link #CONFERENCE_TIME_ZONE}. */ public static Spanned formatSessionSubtitle(long blockStart,long blockEnd,String roomName,Context context){ TimeZone.setDefault(CONFERENCE_TIME_ZONE); final CharSequence timeString=DateUtils.formatDateRange(context,blockStart,blockEnd,TIME_FLAGS); if (roomName == null || roomName == "null") { roomName="N/A"; } return Html.fromHtml(timeString + " @ <u><b>" + roomName+ "</b></u>"); }
Example 37
From project Diktofon, under directory /app/src/kaljurand_at_gmail_dot_com/diktofon/activity/.
Source file: AboutActivity.java

@Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.about); TextView textview=(TextView)findViewById(R.id.tv_about); textview.setMovementMethod(LinkMovementMethod.getInstance()); String about=String.format(getString(R.string.about),getString(R.string.app_name),getVersionName()); textview.setText(Html.fromHtml(about)); }
Example 38
From project droidparts, under directory /sample/modern/src/org/droidparts/gram/adapter/.
Source file: ImageListAdapter.java

private Spanned buildDescription(Image img){ StringBuilder sb=new StringBuilder(); sb.append("<b>").append(img.filter.name).append("</b>"); sb.append(" "); sb.append(join(img.tags,", ",null)); return Html.fromHtml(sb.toString()); }
Example 39
From project Dual-Battery-Widget, under directory /src/org/flexlabs/widgets/dualbattery/app/.
Source file: FeedbackFragment.java

public static void sendFeedback(Context context,CharSequence feedback){ Intent intent=new Intent(Intent.ACTION_SEND,Uri.parse("mailto:")); intent.putExtra(Intent.EXTRA_EMAIL,new String[]{Constants.FeedbackDestination}); intent.putExtra(Intent.EXTRA_SUBJECT,"Dual Battery Widget Feedback (v" + Constants.VERSION + ")"); intent.putExtra(Intent.EXTRA_TEXT,Html.fromHtml(getDeviceDetails(context,feedback))); intent.setType("message/rfc822"); context.startActivity(Intent.createChooser(intent,"Email")); }
Example 40
From project external-replicaisland, under directory /src/com/replica/replicaisland/.
Source file: MainMenuActivity.java

@Override protected Dialog onCreateDialog(int id){ Dialog dialog; if (id == WHATS_NEW_DIALOG) { dialog=new AlertDialog.Builder(this).setTitle(R.string.whats_new_dialog_title).setPositiveButton(R.string.whats_new_dialog_ok,null).setMessage(R.string.whats_new_dialog_message).create(); } else if (id == TILT_TO_SCREEN_CONTROLS_DIALOG) { dialog=new AlertDialog.Builder(this).setTitle(R.string.onscreen_tilt_dialog_title).setPositiveButton(R.string.onscreen_tilt_dialog_ok,new DialogInterface.OnClickListener(){ public void onClick( DialogInterface dialog, int whichButton){ SharedPreferences prefs=getSharedPreferences(PreferenceConstants.PREFERENCE_NAME,MODE_PRIVATE); SharedPreferences.Editor editor=prefs.edit(); editor.putBoolean(PreferenceConstants.PREFERENCE_SCREEN_CONTROLS,true); editor.commit(); } } ).setNegativeButton(R.string.onscreen_tilt_dialog_cancel,null).setMessage(R.string.onscreen_tilt_dialog_message).create(); } else if (id == CONTROL_SETUP_DIALOG) { String messageFormat=getResources().getString(R.string.control_setup_dialog_message); String message=String.format(messageFormat,mSelectedControlsString); CharSequence sytledMessage=Html.fromHtml(message); dialog=new AlertDialog.Builder(this).setTitle(R.string.control_setup_dialog_title).setPositiveButton(R.string.control_setup_dialog_ok,null).setNegativeButton(R.string.control_setup_dialog_change,new DialogInterface.OnClickListener(){ public void onClick( DialogInterface dialog, int whichButton){ Intent i=new Intent(getBaseContext(),SetPreferencesActivity.class); i.putExtra("controlConfig",true); startActivity(i); } } ).setMessage(sytledMessage).create(); } else { dialog=super.onCreateDialog(id); } return dialog; }
Example 41
From project fanfoudroid, under directory /src/com/ch_linghu/fanfoudroid/util/.
Source file: TextHelper.java

public static void setTweetText(TextView textView,String text){ String processedText=preprocessText(text); textView.setText(Html.fromHtml(processedText),BufferType.SPANNABLE); Linkify.addLinks(textView,Linkify.WEB_URLS | Linkify.EMAIL_ADDRESSES); linkifyUsers(textView); linkifyTags(textView); _userLinkMapping.clear(); }
Example 42
From project farebot, under directory /src/com/codebutler/farebot/activities/.
Source file: SupportedCardsActivity.java

@Override public View getView(int position,View convertView,ViewGroup group){ if (convertView == null) { convertView=getLayoutInflater().inflate(R.layout.supported_card,null); } CardInfo info=getItem(position); ((ImageView)convertView.findViewById(R.id.image)).setImageResource(info.getImageId()); ((TextView)convertView.findViewById(R.id.text)).setText(Html.fromHtml(String.format("<b>%s</b><br>%s",info.getName(),info.getLocation()))); return convertView; }
Example 43
From project FBReaderJ, under directory /src/org/geometerplus/android/fbreader/.
Source file: FBUtil.java

public static void shareBook(Activity activity,Book book){ try { final ZLPhysicalFile file=book.File.getPhysicalFile(); if (file == null) { return; } final CharSequence sharedFrom=Html.fromHtml(ZLResource.resource("sharing").getResource("sharedFrom").getValue()); activity.startActivity(new Intent(Intent.ACTION_SEND).setType(FileTypeCollection.Instance.simplifiedMimeType(file).Name).putExtra(Intent.EXTRA_SUBJECT,book.getTitle()).putExtra(Intent.EXTRA_TEXT,sharedFrom).putExtra(Intent.EXTRA_STREAM,Uri.fromFile(file.javaFile()))); } catch ( ActivityNotFoundException e) { } }
Example 44
From project FlipDroid, under directory /app/src/com/goal98/flipdroid2/model/.
Source file: Article.java

public void setContent(String content){ this.content=content; thumbnailText=Html.fromHtml(content.replaceAll("(<br/>)|(</h[1-6]+>)|(<h[1-6]+>)|(<img.*?>)|(<blockquote>)|(</blockquote>)|(hack</img>)","")); Spannable spannable=Spannable.Factory.getInstance().newSpannable(thumbnailText); TextPaintUtil.removeUnderlines(spannable); thumbnailText=spannable; }
Example 45
From project friendica-for-android, under directory /libpulltorefresh/src/com/handmark/pulltorefresh/library/internal/.
Source file: LoadingLayout.java

public void reset(){ mHeaderText.setText(Html.fromHtml(mPullLabel)); mHeaderImage.setVisibility(View.VISIBLE); mHeaderImage.clearAnimation(); resetImageRotation(); if (TextUtils.isEmpty(mSubHeaderText.getText())) { mSubHeaderText.setVisibility(View.GONE); } else { mSubHeaderText.setVisibility(View.VISIBLE); } }
Example 46
From project gauges-android, under directory /app/src/main/java/com/github/mobile/gauges/authenticator/.
Source file: GaugesAuthenticatorActivity.java

@Override public void onCreate(Bundle bundle){ super.onCreate(bundle); accountManager=AccountManager.get(this); final Intent intent=getIntent(); email=intent.getStringExtra(PARAM_USERNAME); authTokenType=intent.getStringExtra(PARAM_AUTHTOKEN_TYPE); requestNewAccount=email == null; confirmCredentials=intent.getBooleanExtra(PARAM_CONFIRMCREDENTIALS,false); setContentView(layout.login_activity); emailText.setAdapter(new ArrayAdapter<String>(this,simple_dropdown_item_1line,userEmailAccounts())); passwordText.setOnKeyListener(new OnKeyListener(){ public boolean onKey( View v, int keyCode, KeyEvent event){ if (event != null && ACTION_DOWN == event.getAction() && keyCode == KEYCODE_ENTER && signinButton.isEnabled()) { handleLogin(signinButton); return true; } return false; } } ); passwordText.setOnEditorActionListener(new OnEditorActionListener(){ public boolean onEditorAction( TextView v, int actionId, KeyEvent event){ if (actionId == IME_ACTION_DONE && signinButton.isEnabled()) { handleLogin(signinButton); return true; } return false; } } ); emailText.addTextChangedListener(watcher); passwordText.addTextChangedListener(watcher); TextView signupText=(TextView)findViewById(id.tv_signup); signupText.setMovementMethod(LinkMovementMethod.getInstance()); signupText.setText(Html.fromHtml(getString(string.signup_link))); }
Example 47
From project gddsched2, under directory /trunk/android/src/com/google/android/apps/iosched2/util/.
Source file: UIUtils.java

/** * Populate the given {@link TextView} with the requested text, formattingthrough {@link Html#fromHtml(String)} when applicable. Also sets{@link TextView#setMovementMethod} so inline links are handled. */ public static void setTextMaybeHtml(TextView view,String text){ if (TextUtils.isEmpty(text)) { view.setText(""); return; } if (text.contains("<") && text.contains(">")) { view.setText(Html.fromHtml(text)); view.setMovementMethod(LinkMovementMethod.getInstance()); } else { view.setText(text); } }
Example 48
From project gh4a, under directory /src/com/gh4a/adapter/.
Source file: DiscussionCommentFeedAdapter.java

@Override public View doGetView(int position,View convertView,ViewGroup parent){ View v=convertView; ViewHolder viewHolder=null; if (v == null) { LayoutInflater vi=(LayoutInflater)LayoutInflater.from(mContext); v=vi.inflate(R.layout.row_gravatar_comment,null); viewHolder=new ViewHolder(); viewHolder.ivGravatar=(ImageView)v.findViewById(R.id.iv_gravatar); viewHolder.tvDesc=(TextView)v.findViewById(R.id.tv_desc); viewHolder.tvExtra=(TextView)v.findViewById(R.id.tv_extra); v.setTag(viewHolder); } else { viewHolder=(ViewHolder)v.getTag(); } final Feed feed=mObjects.get(position); if (feed != null) { viewHolder.ivGravatar.setVisibility(View.GONE); viewHolder.tvDesc.setText(Html.fromHtml(feed.getContent())); viewHolder.tvExtra.setText(feed.getAuthor() + (feed.getPublished() != null ? " | " + sdf.format(feed.getPublished()) : "")); } return v; }
Example 49
From project gmarks-android, under directory /src/main/java/org/thomnichols/android/gmarks/.
Source file: WebViewLoginActivity.java

protected void showTwoFactorAuthDialog(){ dismissWaitDialog(); final Intent launchAuthIntent=new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER).setClassName(AUTHENTICATOR_PACKAGE,"com.google.android.apps.authenticator.AuthenticatorActivity"); ResolveInfo ri=getPackageManager().resolveActivity(launchAuthIntent,0); if (ri == null) { WebViewLoginActivity.this.showAuthenticatorMissingDialog(); return; } Log.d(TAG,"Resolve info: " + ri); new AlertDialog.Builder(this).setTitle(R.string.two_factor_auth_dlg_title).setMessage(Html.fromHtml(getString(R.string.two_factor_auth_dlg_msg))).setCancelable(true).setNegativeButton(R.string.btn_cancel,new OnClickListener(){ public void onClick( DialogInterface dlg, int _){ dlg.dismiss(); } } ).setPositiveButton(R.string.btn_ok,new OnClickListener(){ public void onClick( DialogInterface dlg, int _){ try { startActivity(launchAuthIntent); } catch ( ActivityNotFoundException ex) { Log.d(TAG,"Activity not found",ex); WebViewLoginActivity.this.showAuthenticatorMissingDialog(); } } } ).show(); }
Example 50
From project GraduationProject, under directory /G-Card/src/Hello/Tab/Widget/.
Source file: SetupActivity.java

private void setSetupCompleteScreenContent(){ TextView textView=(TextView)findViewById(R.id.setup_complete_text); textView.setText(Html.fromHtml(getString((R.string.setup_complete_text)))); Button backButton=(Button)findViewById(R.id.back); backButton.setOnClickListener(new OnClickListener(){ public void onClick( View v){ setScreenContent(R.layout.select_launch_mode); } } ); final Context context=this; Button finishButton=(Button)findViewById(R.id.finish); finishButton.setOnClickListener(new OnClickListener(){ public void onClick( View v){ SharedPreferences prefs=Prefs.get(context); SharedPreferences.Editor editor=prefs.edit(); editor.putInt("savedScreenId",R.layout.connected); editor.commit(); finish(); } } ); }
Example 51
From project HapiPodcastJ, under directory /src/info/xuluan/podcast/.
Source file: SearchActivity.java

@Override protected void onListItemClick(ListView l,View v,int position,long id){ final SearchItem item=mItems.get(position); String content=item.content; AlertDialog d=new AlertDialog.Builder(this).setIcon(R.drawable.alert_dialog_icon).setTitle(item.title).setMessage(Html.fromHtml(content)).setPositiveButton(R.string.subscribe,new DialogInterface.OnClickListener(){ public void onClick( DialogInterface dialog, int whichButton){ Subscription sub=new Subscription(item.url); sub.link=item.link; String tags=SearchActivity.this.mEditText.getText().toString(); String content="<tag>" + tags + "</tag>"; content+="<content>" + item.content + "</content>"; sub.comment=content; int rc=sub.subscribe(getContentResolver()); if (rc == Subscription.ADD_FAIL_DUP) { Toast.makeText(SearchActivity.this,getResources().getString(R.string.already_subscribed),Toast.LENGTH_SHORT).show(); } else if (rc == Subscription.ADD_SUCCESS) { Toast.makeText(SearchActivity.this,getResources().getString(R.string.success),Toast.LENGTH_SHORT).show(); } else { Toast.makeText(SearchActivity.this,getResources().getString(R.string.fail),Toast.LENGTH_SHORT).show(); } mServiceBinder.start_update(); } } ).setNegativeButton(R.string.menu_cancel,new DialogInterface.OnClickListener(){ public void onClick( DialogInterface dialog, int whichButton){ } } ).create(); d.show(); }
Example 52
From project iJetty, under directory /console/apk/src/org/mortbay/ijetty/console/.
Source file: InstallerActivity.java

public void onCreate(Bundle icicle){ super.onCreate(icicle); setContentView(R.layout.installer); installButton=(Button)findViewById(R.id.install); versionView=(TextView)findViewById(R.id.version); progressDialog=null; try { PackageInfo pi=getPackageManager().getPackageInfo(getPackageName(),0); versionView.setText(Html.fromHtml(String.format("Version %s (%s)",pi.versionName,pi.versionCode))); } catch ( NameNotFoundException e) { versionView.setText("Version ? (?)"); } installButton.setOnClickListener(new OnClickListener(){ public void onClick( View v){ File jettyDir=getJettyInstallDir(); if (jettyDir == null) { showError(getString(R.string.notInstalled)); } else { File webapp=getWebApp(); if (webapp == null) { install(); } else { showDialog(CONFIRM_DIALOG_ID); } } } } ); }
Example 53
From project iosched, under directory /android/src/com/google/android/apps/iosched/util/.
Source file: UIUtils.java

/** * Populate the given {@link TextView} with the requested text, formattingthrough {@link Html#fromHtml(String)} when applicable. Also sets{@link TextView#setMovementMethod} so inline links are handled. */ public static void setTextMaybeHtml(TextView view,String text){ if (TextUtils.isEmpty(text)) { view.setText(""); return; } if (text.contains("<") && text.contains(">")) { view.setText(Html.fromHtml(text)); view.setMovementMethod(LinkMovementMethod.getInstance()); } else { view.setText(text); } }
Example 54
From project iosched2011, under directory /android/src/com/google/android/apps/iosched/util/.
Source file: UIUtils.java

/** * Populate the given {@link TextView} with the requested text, formattingthrough {@link Html#fromHtml(String)} when applicable. Also sets{@link TextView#setMovementMethod} so inline links are handled. */ public static void setTextMaybeHtml(TextView view,String text){ if (TextUtils.isEmpty(text)) { view.setText(""); return; } if (text.contains("<") && text.contains(">")) { view.setText(Html.fromHtml(text)); view.setMovementMethod(LinkMovementMethod.getInstance()); } else { view.setText(text); } }
Example 55
From project iosched_1, under directory /src/com/google/android/apps/iosched/util/.
Source file: UIUtils.java

/** * Populate the given {@link TextView} with the requested text, formattingthrough {@link Html#fromHtml(String)} when applicable. Also sets{@link TextView#setMovementMethod} so inline links are handled. */ public static void setTextMaybeHtml(TextView view,String text){ if (text.contains("<") && text.contains(">")) { view.setText(Html.fromHtml(text)); view.setMovementMethod(LinkMovementMethod.getInstance()); } else { view.setText(text); } }
Example 56
From project iosched_2, under directory /android/src/com/google/android/apps/iosched/util/.
Source file: UIUtils.java

/** * Populate the given {@link TextView} with the requested text, formattingthrough {@link Html#fromHtml(String)} when applicable. Also sets{@link TextView#setMovementMethod} so inline links are handled. */ public static void setTextMaybeHtml(TextView view,String text){ if (TextUtils.isEmpty(text)) { view.setText(""); return; } if (text.contains("<") && text.contains(">")) { view.setText(Html.fromHtml(text)); view.setMovementMethod(LinkMovementMethod.getInstance()); } else { view.setText(text); } }
Example 57
From project iosched_3, under directory /android/src/com/google/android/apps/iosched/ui/.
Source file: AccountActivity.java

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){ ViewGroup rootView=(ViewGroup)inflater.inflate(R.layout.fragment_login_choose_account,container,false); TextView descriptionView=(TextView)rootView.findViewById(R.id.choose_account_intro); descriptionView.setText(Html.fromHtml(getString(R.string.description_choose_account))); return rootView; }
Example 58
From project IRC-Client, under directory /src/com/redditandroiddevelopers/ircclient/.
Source file: ChannelFragment.java

private void sendMessage(CharSequence msg){ Calendar currentDate=Calendar.getInstance(); SimpleDateFormat formatter=new SimpleDateFormat("hh:mm:ss"); ircClient.sendMessage(channel,msg.toString()); mChatContents.append(Html.fromHtml("<br>(" + formatter.format(currentDate.getTime()) + ") <font color=red><b>"+ ircClient.getNick()+ "</b></font>: "+ msg)); scrollToBottom(); }
Example 59
From project k-9, under directory /src/com/fsck/k9/activity/.
Source file: AccessibleEmailContentActivity.java

/** * Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); String htmlSource=getIntent().getStringExtra("content"); Spanned parsedHtml=Html.fromHtml(htmlSource,null,null); String[] rawListItems=parsedHtml.toString().split("\n"); ArrayList<String> cleanedList=new ArrayList<String>(); for ( String rawListItem : rawListItems) { if (rawListItem.trim().length() > 0) { addToCleanedList(cleanedList,rawListItem); } } String[] listItems=cleanedList.toArray(EMPTY_STRING_ARRAY); setContentView(com.fsck.k9.R.layout.accessible_email_content); setListAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,listItems)); }
Example 60
From project K6nele, under directory /app/src/ee/ioc/phon/android/speak/.
Source file: AboutActivity.java

@Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.about); TextView tvAboutHeader=(TextView)findViewById(R.id.tvAboutHeader); tvAboutHeader.setMovementMethod(LinkMovementMethod.getInstance()); String aboutHeader=String.format(getString(R.string.tvAboutHeader),getString(R.string.labelApp),getString(R.string.descriptionApp),Utils.getVersionName(this)); tvAboutHeader.setText(Html.fromHtml(aboutHeader)); TextView tvAbout=(TextView)findViewById(R.id.tvAbout); tvAbout.setMovementMethod(LinkMovementMethod.getInstance()); String about=String.format(getString(R.string.tvAbout),getString(R.string.labelApp)); tvAbout.setText(Html.fromHtml(about)); }
Example 61
/** * Formats a definition's meanings into a single string * @param examples the examples * @return the formatted string */ public static Spanned examples(List<Example> examples){ StringBuilder sb=new StringBuilder(); for (int e=0; e < examples.size(); ++e) { Example example=examples.get(e); sb.append(example.getUsage() + "<br /><i>" + example.getMeaning()+ "</i>"); if (e < examples.size() - 1) sb.append("<br /><br />"); } return Html.fromHtml(sb.toString()); }
Example 62
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){ if (requestCode == LOGIN_REQUEST_CODE) { mIsResult=true; if (resultCode == Activity.RESULT_OK) { startActivity(new Intent(this,ContactList.class)); finish(); } else if (resultCode == Activity.RESULT_CANCELED) { if (data != null) { String tmp=data.getExtras().getString("message"); Toast.makeText(Login.this,tmp,Toast.LENGTH_SHORT).show(); mTextView.setText(tmp); SharedPreferences mSettings=PreferenceManager.getDefaultSharedPreferences(this); String server=mSettings.getString(BeemApplication.LEVEL_KEY,""); tv_na=(TextView)findViewById(R.id.status_na); tv_eune=(TextView)findViewById(R.id.status_eune); tv_euw=(TextView)findViewById(R.id.status_euw); String text=""; text="<font color='#0099FF'>[US]</font> Checking..."; tv_na.setText(Html.fromHtml(text)); text="<font color='#0099FF'>[EU-NE]</font> Checking..."; tv_eune.setText(Html.fromHtml(text)); text="<font color='#0099FF'>[EU-W]</font> Checking..."; tv_euw.setText(Html.fromHtml(text)); loadServerStatusTask task=new loadServerStatusTask(); task.execute("na"); loadServerStatusTask task2=new loadServerStatusTask(); task2.execute("eune"); loadServerStatusTask task3=new loadServerStatusTask(); task3.execute("euw"); } } } }
Example 63
From project maven-android-plugin-samples, under directory /apidemos-android-10/application/src/main/java/com/example/android/apis/text/.
Source file: Link.java

@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.link); TextView t2=(TextView)findViewById(R.id.text2); t2.setMovementMethod(LinkMovementMethod.getInstance()); TextView t3=(TextView)findViewById(R.id.text3); t3.setText(Html.fromHtml("<b>text3:</b> Text with a " + "<a href=\"http://www.google.com\">link</a> " + "created in the Java source code using HTML.")); t3.setMovementMethod(LinkMovementMethod.getInstance()); SpannableString ss=new SpannableString("text4: Click here to dial the phone."); ss.setSpan(new StyleSpan(Typeface.BOLD),0,6,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ss.setSpan(new URLSpan("tel:4155551212"),13,17,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); TextView t4=(TextView)findViewById(R.id.text4); t4.setText(ss); t4.setMovementMethod(LinkMovementMethod.getInstance()); }
Example 64
From project MIT-Mobile-for-Android, under directory /src/edu/mit/mitmobile2/.
Source file: Helper.java

void sendEmail(String title,String text){ String[] addr={""}; Intent i=new Intent(Intent.ACTION_SEND); i.putExtra(Intent.EXTRA_SUBJECT,title); i.putExtra(android.content.Intent.EXTRA_TEXT,Html.fromHtml(text)); i.putExtra(Intent.EXTRA_EMAIL,addr); i.setType("*/*"); startActivity(Intent.createChooser(i,"Email:")); }
Example 65
From project myPlan, under directory /src/com/conzebit/myplan/android/activity/.
Source file: MainActivity.java

@Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); String termsShown=Settings.getTermsShown(this); if ("no".equals(termsShown)) { this.setContentView(R.layout.terms_and_conditions); TextView textView=(TextView)this.findViewById(R.id.terms_and_conditions_text); textView.setText(Html.fromHtml(getString(R.string.disclaimer_text))); Button button=(Button)this.findViewById(R.id.accept_button); button.setOnClickListener(new View.OnClickListener(){ public void onClick( View v){ Settings.setTermsShown(v.getContext(),"yes"); loadMainView(); } } ); } else { loadMainView(); } }
Example 66
From project npr-android-app, under directory /src/org/npr/android/news/.
Source file: AboutActivity.java

private void populateField(Map<String,String> values,TextView view){ StringBuilder sb=new StringBuilder(); for ( Entry<String,String> entry : values.entrySet()) { String fieldName=entry.getKey(); String fieldValue=entry.getValue(); sb.append(fieldName).append(": ").append("<b>").append(fieldValue).append("</b><br>"); } view.setText(Html.fromHtml(sb.toString())); }
Example 67
From project nuxeo-android, under directory /nuxeo-android/src/org/nuxeo/android/simpleclient/docviews/.
Source file: NoteViewActivity.java

@Override public void onFulfillDisplayObjects(){ if (document != null) { title.setText(document.getTitle()); boolean useWebView=false; if (android.os.Build.VERSION.SDK_INT > 8) { useWebView=true; } String mt=document.getString("note:mime_type","text/plain"); String contentText=document.getString("note:note",""); if ("text/html".equals(mt)) { if (useWebView) { htmlContent.loadDataWithBaseURL(null,contentText,"text/html","utf-8",null); htmlContainer.setVisibility(0); txtContainer.setVisibility(4); } else { content.setText(Html.fromHtml(contentText)); htmlContainer.setVisibility(4); txtContainer.setVisibility(0); } } else { content.setText(contentText); htmlContainer.setVisibility(4); txtContainer.setVisibility(0); } documentBtn.setOnClickListener(new OnClickListener(){ @Override public void onClick( View v){ startActivity(new Intent(NoteViewActivity.this,DocumentViewActivity.class).putExtra(BaseDocumentViewActivity.DOCUMENT,document)); } } ); } }
Example 68
From project ohmagePhone, under directory /src/org/ohmage/activity/.
Source file: CampaignInfoActivity.java

@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); mContext=this; mSharedPreferencesHelper=new SharedPreferencesHelper(this); mImageLoader=ImageLoader.get(this); setContentView(R.layout.campaign_info_details); getLayoutInflater().inflate(R.layout.campaign_info_buttons,mButtonTray,true); mNotetext.setVisibility(View.GONE); mErrorBox=(TextView)findViewById(R.id.campaign_info_errorbox); mDescView=(TextView)findViewById(R.id.campaign_info_desc); mPrivacyValue=(TextView)findViewById(R.id.campaign_info_privacy_value); mStatusValue=(TextView)findViewById(R.id.campaign_info_status_value); mResponsesValue=(TextView)findViewById(R.id.campaign_info_responses_value); mTriggersValue=(TextView)findViewById(R.id.campaign_info_triggers_value); TextView privacyDetails=(TextView)findViewById(R.id.campaign_info_privacy_details); privacyDetails.setText(Html.fromHtml(getString(R.string.campaign_info_privacy_details))); setDetailsExpansionHandler(findViewById(R.id.campaign_info_privacy_row),privacyDetails); TextView statusDetails=(TextView)findViewById(R.id.campaign_info_status_details); statusDetails.setText(Html.fromHtml(getString(R.string.campaign_info_status_details))); setDetailsExpansionHandler(findViewById(R.id.campaign_info_status_row),statusDetails); TextView responsesDetails=(TextView)findViewById(R.id.campaign_info_responses_details); responsesDetails.setText(Html.fromHtml(getString(R.string.campaign_info_responses_details))); setDetailsExpansionHandler(findViewById(R.id.campaign_info_responses_row),responsesDetails); TextView triggersDetails=(TextView)findViewById(R.id.campaign_info_triggers_details); triggersDetails.setText(Html.fromHtml(getString(R.string.campaign_info_triggers_details))); setDetailsExpansionHandler(findViewById(R.id.campaign_info_triggers_row),triggersDetails); setLoadingVisibility(true); getSupportLoaderManager().initLoader(0,null,this); }
Example 69
From project Ohmage_Phone, under directory /src/org/ohmage/activity/.
Source file: CampaignInfoActivity.java

@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); mContext=this; mSharedPreferencesHelper=new SharedPreferencesHelper(this); mImageLoader=ImageLoader.get(this); setContentView(R.layout.campaign_info_details); getLayoutInflater().inflate(R.layout.campaign_info_buttons,mButtonTray,true); mNotetext.setVisibility(View.GONE); mErrorBox=(TextView)findViewById(R.id.campaign_info_errorbox); mDescView=(TextView)findViewById(R.id.campaign_info_desc); mPrivacyValue=(TextView)findViewById(R.id.campaign_info_privacy_value); mStatusValue=(TextView)findViewById(R.id.campaign_info_status_value); mResponsesValue=(TextView)findViewById(R.id.campaign_info_responses_value); mTriggersValue=(TextView)findViewById(R.id.campaign_info_triggers_value); TextView privacyDetails=(TextView)findViewById(R.id.campaign_info_privacy_details); privacyDetails.setText(Html.fromHtml(getString(R.string.campaign_info_privacy_details))); setDetailsExpansionHandler(findViewById(R.id.campaign_info_privacy_row),privacyDetails); TextView statusDetails=(TextView)findViewById(R.id.campaign_info_status_details); statusDetails.setText(Html.fromHtml(getString(R.string.campaign_info_status_details))); setDetailsExpansionHandler(findViewById(R.id.campaign_info_status_row),statusDetails); TextView responsesDetails=(TextView)findViewById(R.id.campaign_info_responses_details); responsesDetails.setText(Html.fromHtml(getString(R.string.campaign_info_responses_details))); setDetailsExpansionHandler(findViewById(R.id.campaign_info_responses_row),responsesDetails); TextView triggersDetails=(TextView)findViewById(R.id.campaign_info_triggers_details); triggersDetails.setText(Html.fromHtml(getString(R.string.campaign_info_triggers_details))); setDetailsExpansionHandler(findViewById(R.id.campaign_info_triggers_row),triggersDetails); setLoadingVisibility(true); getSupportLoaderManager().initLoader(0,null,this); }
Example 70
@Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.about); TextView atvAboutProjectURL=(TextView)findViewById(R.id.atvAboutProjectURL); TextView atvAboutGithubURL=(TextView)findViewById(R.id.atvAboutGithubURL); TextView atvAboutBugURL=(TextView)findViewById(R.id.atvAboutBugURL); TextView atvAboutEmailURL=(TextView)findViewById(R.id.atvAboutEmailURL); atvAboutEmailURL.setText(Html.fromHtml(getString(R.string.about_email_url))); Linkify.addLinks(atvAboutProjectURL,Linkify.ALL); Linkify.addLinks(atvAboutGithubURL,Linkify.ALL); Linkify.addLinks(atvAboutBugURL,Linkify.ALL); Linkify.addLinks(atvAboutEmailURL,Linkify.EMAIL_ADDRESSES); }
Example 71
From project PageTurner, under directory /src/main/java/net/nightwhistler/pageturner/activity/.
Source file: Dialogs.java

public static void showAboutDialog(Context context){ AlertDialog.Builder builder=new AlertDialog.Builder(context); builder.setTitle(R.string.about); builder.setIcon(R.drawable.page_turner); String version=""; try { version=context.getPackageManager().getPackageInfo(context.getPackageName(),0).versionName; } catch ( NameNotFoundException e) { } String html="<h2>" + context.getString(R.string.app_name) + " "+ version+ "</h2>"; html+=context.getString(R.string.about_gpl); html+="<br/><a href='http://pageturner-reader.org'>http://pageturner-reader.org</a>"; builder.setMessage(Html.fromHtml(html)); builder.setNeutralButton(context.getString(android.R.string.ok),new OnClickListener(){ @Override public void onClick( DialogInterface dialog, int which){ dialog.dismiss(); } } ); builder.show(); }
Example 72
From project PinDroid, under directory /src/com/pindroid/fragment/.
Source file: ViewBookmarkFragment.java

@Override protected Article doInBackground(String... args){ if (args.length > 0 && args[0] != null && args[0] != "") { url=args[0]; Article a=NetworkUtilities.getArticleText(url); if (a != null && a.getContent() != null) { Spanned s=Html.fromHtml(a.getContent(),new Html.ImageGetter(){ public Drawable getDrawable( String source){ Drawable d=null; try { InputStream src=imageFetch(source); d=Drawable.createFromStream(src,"src"); if (d != null) { int containerWidth=container.getWidth() - (Integer.parseInt(base.readingMargins) * 2); int width=Math.min(containerWidth,d.getIntrinsicWidth()); int height=d.getIntrinsicHeight(); if (containerWidth < d.getIntrinsicWidth()) { double scale=((double)containerWidth / (double)d.getIntrinsicWidth()); double newWidth=d.getIntrinsicHeight() * scale; height=(int)Math.floor(newWidth); } d.setBounds(0,0,width,height); } } catch ( MalformedURLException e) { e.printStackTrace(); } catch ( IOException e) { e.printStackTrace(); } return d; } } ,null); a.setSpan(s); } return a; } else return null; }
Example 73
public static void showAboutDialog(final PixelArtEditor p){ Log.d("PixelArt","alertz showabout"); AlertDialog.Builder builder=new AlertDialog.Builder(p); builder.setTitle(R.string.about_title); TextView textcontent=new TextView(p); textcontent.setMovementMethod(LinkMovementMethod.getInstance()); textcontent.setText(Html.fromHtml(p.getResources().getString(R.string.about))); textcontent.setLinkTextColor(Color.GREEN); textcontent.setPadding(5,5,5,5); textcontent.setTextSize(15); builder.setView(textcontent); builder.setPositiveButton(R.string.about_button_market,new DialogInterface.OnClickListener(){ public void onClick( DialogInterface dialog, int whichButton){ Intent intent=new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://details?id=" + p.getApplication().getPackageName())); p.startActivity(intent); dialog.dismiss(); } } ); builder.setNegativeButton(R.string.about_button_ok,new DialogInterface.OnClickListener(){ public void onClick( DialogInterface dialog, int whichButton){ dialog.dismiss(); } } ); AlertDialog alert=builder.create(); alert.show(); Log.d("PixelArt","alertz shownew"); }
Example 74
From project platform_frameworks_support, under directory /v4/java/android/support/v4/app/.
Source file: ShareCompat.java

/** * Set an HTML string to be sent as part of the share. If {@link Intent#EXTRA_TEXT EXTRA_TEXT} has not already been supplied,a styled version of the supplied HTML text will be added as EXTRA_TEXT as parsed by {@link android.text.Html#fromHtml(String) Html.fromHtml}. * @param htmlText A string containing HTML markup as a richer version of the textprovided by EXTRA_TEXT. * @return This IntentBuilder for method chaining * @see #setText(CharSequence) */ public IntentBuilder setHtmlText(String htmlText){ mIntent.putExtra(IntentCompat.EXTRA_HTML_TEXT,htmlText); if (!mIntent.hasExtra(Intent.EXTRA_TEXT)) { setText(Html.fromHtml(htmlText)); } return this; }
Example 75
From project platform_packages_apps_contacts, under directory /src/com/android/contacts/detail/.
Source file: ContactDetailDisplayUtils.java

public static Html.ImageGetter getImageGetter(Context context){ if (sImageGetter == null) { sImageGetter=new DefaultImageGetter(context.getPackageManager()); } return sImageGetter; }
Example 76
From project platform_packages_apps_mms, under directory /src/com/android/mms/ui/.
Source file: MessageListItem.java

private CharSequence formatMessage(MessageItem msgItem,String contact,String body,String subject,Pattern highlight,String contentType){ SpannableStringBuilder buf=new SpannableStringBuilder(); boolean hasSubject=!TextUtils.isEmpty(subject); SmileyParser parser=SmileyParser.getInstance(); if (hasSubject) { CharSequence smilizedSubject=parser.addSmileySpans(subject); buf.append(TextUtils.replace(mContext.getResources().getString(R.string.inline_subject),new String[]{"%s"},new CharSequence[]{smilizedSubject})); } if (!TextUtils.isEmpty(body)) { if (contentType != null && ContentType.TEXT_HTML.equals(contentType)) { buf.append("\n"); buf.append(Html.fromHtml(body)); } else { if (hasSubject) { buf.append(" - "); } buf.append(parser.addSmileySpans(body)); } } if (highlight != null) { Matcher m=highlight.matcher(buf.toString()); while (m.find()) { buf.setSpan(new StyleSpan(Typeface.BOLD),m.start(),m.end(),0); } } return buf; }
Example 77
From project platform_packages_apps_settings, under directory /src/com/android/settings/bluetooth/.
Source file: BluetoothDevicePreference.java

private void askDisconnect(){ Context context=getContext(); String name=mCachedDevice.getName(); if (TextUtils.isEmpty(name)) { name=context.getString(R.string.bluetooth_device); } String message=context.getString(R.string.bluetooth_disconnect_all_profiles,name); String title=context.getString(R.string.bluetooth_disconnect_title); DialogInterface.OnClickListener disconnectListener=new DialogInterface.OnClickListener(){ public void onClick( DialogInterface dialog, int which){ mCachedDevice.disconnect(); } } ; mDisconnectDialog=Utils.showDisconnectDialog(context,mDisconnectDialog,disconnectListener,title,Html.fromHtml(message)); }