List of usage examples for android.text Html fromHtml
@Deprecated public static Spanned fromHtml(String source)
From source file:com.thoughtmetric.tl.TLLib.java
public static String parseTextArea(BufferedReader br) throws IOException { String start = "<textarea"; String end = "</textarea>"; String line;//from w w w. j a v a 2 s .com StringBuffer sb = new StringBuffer(); while ((line = br.readLine()) != null) { if (line.contains(start)) { int i = line.indexOf(start); int j = line.indexOf('>', i); int k = line.length(); try { if (line.contains(end)) { k = line.indexOf(end); // The case where the tag is closed on the same line Log.d(TAG, String.format("%d, %d", j + 1, k)); sb.append(Html.fromHtml(line.substring(j + 1, k)).toString()); return sb.toString(); } else { sb.append(Html.fromHtml(line.substring(j + 1, k)).toString()); sb.append("\n"); } } catch (StringIndexOutOfBoundsException e) { // Do nothing } break; } } while ((line = br.readLine()) != null) { if (line.contains(end)) { int i = line.indexOf(end); sb.append(Html.fromHtml(line.substring(0, i)).toString()); break; } sb.append(Html.fromHtml(line).toString()); sb.append("\n"); } return sb.toString(); }
From source file:co.taqat.call.StatusFragment.java
private void formatText(TextView tv, String name, String value) { tv.setText(Html.fromHtml("<b>" + name + " </b>" + value)); }
From source file:gr.scify.newsum.ui.ViewActivity.java
private void Sendmail() { TextView title = (TextView) findViewById(R.id.title); String emailSubject = title.getText().toString(); // track the Send mail action if (getAnalyticsPref()) { EasyTracker.getTracker().sendEvent(SHARING_ACTION, "Send Mail", emailSubject, 0l); }/*w ww .j a v a 2 s. c o m*/ final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("text/html"); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "NewSum app : " + emailSubject); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(sText)); startActivity(Intent.createChooser(emailIntent, "Email:")); }
From source file:com.seatgeek.placesautocompletedemo.MainFragment.java
private void setUiPageViewController(View parent) { dotsLayout = (LinearLayout) parent.findViewById(R.id.viewPagerCountDots); dotsCount = 5;/*from w w w . j a v a2s.c o m*/ dots = new TextView[dotsCount]; for (int i = 0; i < dotsCount; i++) { dots[i] = new TextView(getActivity()); dots[i].setText(Html.fromHtml("•")); dots[i].setTextSize(30); dots[i].setTextColor(getResources().getColor(android.R.color.darker_gray)); dotsLayout.addView(dots[i]); } dots[0].setTextColor(Color.GREEN); }
From source file:org.smilec.smile.student.CourseList.java
public void setAppTitle(int status) { String text = "<html>" + titleSize1 + APP_TAG + " - " + curusername + " "; String my_font = ""; if (status == SERVER_NOT_AVAIL) { // SERVER not connected // setTitleColor(Color.RED); text += "<font color='red'>●●●</font>"; // circle } else if (status == WIFI_NOT_CONNECTED) { // WIFI not connected // setTitleColor(Color.BLUE); text += "<font color='blue'>●●●</font>"; } else if (status == WIFI_CONNECTED || status == SERVER_AVAIL) { // normal // setTitleColor(Color.WHITE); text += "<font color='green'>●●●</font>"; }//from ww w. j av a 2s .com text += titleSize2 + "</html>"; setTitle(Html.fromHtml(text)); }
From source file:com.tingbacke.wearmaps.MobileActivity.java
private Notification getBasicNotification(String stack) { String title = "Vstra Hamnen"; TextView tv = (TextView) findViewById(R.id.textView3); String text = tv.getText().toString(); // Here I determine the vibration pattern for the notification long[] pattern = { 0, 200, 0 }; /*/*from w w w.j av a 2s . co m*/ // This seems only to be for adding longer texts to a notification... NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle(); bigTextStyle.setBigContentTitle(title); */ /* Spannable sb = new SpannableString("Bold this and italic that."); sb.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 0, 4, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); sb.setSpan(new StyleSpan(android.graphics.Typeface.ITALIC), 14, 20, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); */ NotificationCompat.WearableExtender extender = new NotificationCompat.WearableExtender() .setBackground(BitmapFactory.decodeResource(getResources(), R.mipmap.turn)); NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle(); inboxStyle.addLine(Html.fromHtml("<b>Turning Torso</b>")); inboxStyle.addLine(Html.fromHtml("<b>453m away</b>")); return new NotificationCompat.Builder(this).setSmallIcon(R.mipmap.icon_mdpi).setContentTitle(title) .setContentText(text) //.setStyle(bigPic) //.setStyle(inboxStyle) .extend(extender) //.setStyle(bigTextStyle) .setVibrate(pattern).setGroup(stack).build(); }
From source file:com.andfchat.frontend.activities.ChatScreen.java
@Override public void onEvent(Chatroom chatroom, ChatroomEventType type) { if (type == ChatroomEventType.ACTIVE) { actionButton.setVisibility(View.VISIBLE); if (chatroom.isSystemChat()) { toggleSidebarRight.setVisibility(View.GONE); } else {/*w ww. j av a 2 s.c om*/ toggleSidebarRight.setVisibility(View.VISIBLE); if (chatroom.isPrivateChat()) { toggleSidebarRight.setVisibility(View.GONE); } } if (chatroom.isPrivateChat() && chatroom.getRecipient().getStatusMsg() != null) { setChannelTitle(/*chatroom.getName() + " - " + */Html .fromHtml(chatroom.getRecipient().getStatusMsg()).toString()); } else { setChannelTitle(chatroom.getName()); } } }
From source file:com.brodev.socialapp.fragment.EventDetailFragment.java
/** * Function create event adapter//from w w w . ja v a 2 s. c o m */ public void getEventAdapter(String resString) { try { JSONObject mainJSON = new JSONObject(resString); Object intervention = mainJSON.get("output"); if (intervention instanceof JSONObject) { JSONObject outputJson = (JSONObject) intervention; //set event id event.setEventId(outputJson.getString("event_id")); //set event Rsvp if (outputJson.has("rsvp_id") && !outputJson.isNull("rsvp_id")) { event.setRsvpId(Integer.parseInt(outputJson.getString("rsvp_id"))); } //set event image event.setEventImage(outputJson.getString("image_path")); //set event title event.setTitle(Html.fromHtml(outputJson.getString("title")).toString()); //set event start time event.setStartTime(Html.fromHtml(outputJson.getString("event_date")).toString()); //set category if (outputJson.has("categories") && !outputJson.isNull("categories")) { event.setCategory(Html.fromHtml(outputJson.getString("categories")).toString()); } //set location if (outputJson.has("event_location") && !outputJson.isNull("event_location")) { event.setLocation(Html.fromHtml(outputJson.getString("event_location")).toString()); } //set location if (outputJson.has("map_img") && !outputJson.isNull("map_img")) { event.setMap(Html.fromHtml(outputJson.getString("map_img")).toString()); } //set description if (outputJson.has("description") && !outputJson.isNull("description")) { event.setDescription(outputJson.getString("description")); } //set full name event.setFullname(Html.fromHtml(outputJson.getString("full_name")).toString()); //set can post comment event.setCanPostComment(outputJson.getBoolean("can_post_comment")); //set feedback Object obj = outputJson.get("feed_callback"); if (obj instanceof JSONObject) { event.setFeedCallBack(outputJson.getString("feed_callback")); } new FeedLoadTask().execute(String.valueOf(page), event.getFeedCallBack()); } } catch (Exception ex) { ex.printStackTrace(); } }
From source file:ru.orangesoftware.financisto2.export.flowzr.FlowzrSyncEngine.java
public String makeRequest(String tableName, String json) throws ClientProtocolException, IOException, JSONException, Exception { if (isCanceled) { return FLOWZR_MSG_NET_ERROR; }// w ww . j a va 2 s . c om String uri = FlowzrSyncOptions.FLOWZR_API_URL + options.getNamespace() + "/" + tableName + "/"; String strResponse; HttpPost httpPost = new HttpPost(uri); httpPost.setEntity(new StringEntity(json, HTTP.UTF_8)); httpPost.setHeader("Accept", "application/json"); HttpResponse response = http_client.execute(httpPost); HttpEntity entity = response.getEntity(); int code = response.getStatusLine().getStatusCode(); BufferedReader reader = new BufferedReader(new InputStreamReader(entity.getContent())); strResponse = reader.readLine(); JSONArray arr = new JSONArray(); arr = new JSONArray(strResponse); for (int i = 0; i < arr.length(); i++) { JSONObject o = arr.getJSONObject(i); String key = o.getString("key"); int id = o.getInt("id"); ContentValues args = new ContentValues(); args.put("remote_key", key); db.update(tableName, args, String.format("%s = ?", "_id"), new String[] { String.valueOf(id) }); } entity.consumeContent(); if (code != 200) { throw new Exception(Html.fromHtml(strResponse).toString()); } return strResponse; }
From source file:com.android.mail.browse.MessageHeaderView.java
private void setDateText() { if (mIsSnappy) { mDateView.setText(mMessageHeaderItem.getTimestampLong()); mDateView.setOnClickListener(null); } else {/*from w w w . j a v a 2 s . co m*/ mDateView.setMovementMethod(LinkMovementMethod.getInstance()); mDateView.setText(Html.fromHtml(getResources().getString(R.string.date_and_view_details, mMessageHeaderItem.getTimestampLong()))); StyleUtils.stripUnderlinesAndUrl(mDateView); } }