public void setNewInstallText(TextView text) { text.setText(getString(R.string.newInstall, getString(R.string.app_name), getString(R.string.menuAbout))); // Link to wiki Pattern wikiText = Pattern.compile(getString(R.string.app_name) +" wiki"); TransformFilter wikiTransformer = new TransformFilter() { @Override public String transformUrl(Matcher match, String url) { return getString(R.string.wikiHowtoUrl); } }; Linkify.addLinks(text, wikiText, "", null, wikiTransformer); }
public void setText(final String txt) { mHandler.post(new Runnable() { /* * A transform filter that simply returns just the text captured by * the first regular expression group. */ TransformFilter idFilter = new TransformFilter() { @Override public final String transformUrl(final Matcher match, String url) { return match.group(1); } }; @Override public void run() { mViewURLButton.setVisibility( TextUtils.isEmpty(txt) ? View.INVISIBLE : View.VISIBLE); mFieldsConnectionsButton.setVisibility(TextUtils.isEmpty(txt) ? View.INVISIBLE : View.VISIBLE); mOutput.setVisibility(TextUtils.isEmpty(txt) ? View.INVISIBLE : View.VISIBLE); mBackParentButton.setVisibility( TextUtils.isEmpty(mParentObjectId) ? View.INVISIBLE : View.VISIBLE); String convertedTxt = txt.replace("\\/", "/"); mOutput.setText(convertedTxt); mScrollView.scrollTo(0, 0); Linkify.addLinks(mOutput, Linkify.WEB_URLS); /* * Linkify the object ids so they can be clicked. match pattern: * "id" : "objectid" (objectid can be int or int_int) */ Pattern pattern = Pattern.compile("\"id\": \"(\\d*_?\\d*)\""); String scheme = "fbGraphEx://"; Linkify.addLinks(mOutput, pattern, scheme, null, idFilter); } }); }
@Override public void onActivityCreated(Bundle savedInstanceState) { // Call the base class method super.onActivityCreated(savedInstanceState); // Get the contact and about views TextView support = (TextView)getActivity().findViewById(R.id.support); TextView about = (TextView)getActivity().findViewById(R.id.about); // Linkify the support view Linkify.addLinks(support, Pattern.compile("(Ice Stream Support Thread)"), "", null, new TransformFilter() { public String transformUrl(Matcher match, String url) { // Return the proper link return "http://forum.icefilms.info/viewtopic.php?t=58350"; } }); // Get the version information String version; try { version = getActivity().getPackageManager().getPackageInfo(getActivity(). getPackageName(), PackageManager.GET_META_DATA).versionName; } catch (PackageManager.NameNotFoundException exception) { version = "?.?.?"; } // Format the about text with the correct info and add it to the view about.setText(String.format(getString(R.string.help_about), getString(R.string.app_name), version)); // Linkify the about view Linkify.addLinks(about, Linkify.WEB_URLS); }
void populateFrom(Cursor c, Database_Two helper) { //cname.setText(helper.getMAINcontactName(c)); cdetail.setText(helper.getMAINcontactDetail(c)); Pattern atMentionPattern = Pattern.compile("@([A-Za-z0-9_]+)"); String atMentionScheme = "profile://"; TransformFilter transformFilter = new TransformFilter() { //skip the first character to filter out '@' public String transformUrl(final Matcher match, String url) { return match.group(1); } }; cname.setText("@"+helper.getMAINcontactName(c)); if(helper.getMAINcontactName(c).equals(utilhelper.getUSER())) { Linkify.addLinks(cname, atMentionPattern, "myprofile://", null, transformFilter); } else { Linkify.addLinks(cname, atMentionPattern, atMentionScheme, null, transformFilter); } stripUnderlines(cname); /*byte[] pimgdata = Base64.decode(helper.getMAINcontactbmp(c), 0); if(pimgdata.length!=0) { cimage.setImageBitmap(RoundedImageView.getCroppedBitmap(BitmapFactory.decodeByteArray(pimgdata, 0, pimgdata.length), 150)); //cimage.setImageBitmap(BitmapFactory.decodeByteArray(pimgdata, 0, pimgdata.length)); } else { cimage.setImageResource(R.drawable.me); }*/ if (imageLoader == null) imageLoader = AppController.getInstance().getImageLoader(); cimage.setImageUrl(LaunchActivity.SERVER+"profile/image/"+"img_"+helper.getMAINcontactUID(c).toString()+".png", imageLoader); if(helper.getMAINFollowing(c).equals("yes")) { cfollowbtn.setText("Unfollow"); } if(helper.getMAINFollowing(c).equals("no")){ cfollowbtn.setText("Follow"); } /*if(helper.getMAINFollowing(c).equals("me")) { //cfollowbtn.setVisibility(View.GONE); lvboolaray5[c.getPosition()] = false; //cfollowbtn.setImageResource(0); cfollowbtn.setLayoutParams(new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); }*/ }
void populateFrom(Cursor c, Database_Two helper) { Pattern atMentionPattern = Pattern.compile("#([A-Za-z0-9_]+)"); String atMentionScheme = "hashtag://"; TransformFilter transformFilter = new TransformFilter() { //skip the first character to filter out '@' public String transformUrl(final Matcher match, String url) { return match.group(1); } }; Trend.setText(helper.getTrendingHash(c)); count.setText(helper.getTrendingCount(c)+" people talking about this"); Linkify.addLinks(Trend, Linkify.ALL); Linkify.addLinks(Trend, atMentionPattern, atMentionScheme, null, transformFilter); stripUnderlines(Trend); }
void populateFrom(Cursor c, Database_Two helper) { cdetail.setText(helper.getcontactDetail(c)); Pattern atMentionPattern = Pattern.compile("@([A-Za-z0-9_]+)"); String atMentionScheme = "profile://"; TransformFilter transformFilter = new TransformFilter() { //skip the first character to filter out '@' public String transformUrl(final Matcher match, String url) { return match.group(1); } }; cname.setText("@"+helper.getcontactName(c)); if(helper.getcontactName(c).equals(utilhelper.getUSER())) { Linkify.addLinks(cname, atMentionPattern, "myprofile://", null, transformFilter); } else { Linkify.addLinks(cname, atMentionPattern, atMentionScheme, null, transformFilter); } stripUnderlines(cname); /*byte[] pimgdata = Base64.decode(helper.getcontactbmp(c), 0); if(pimgdata.length!=0) { cimage.setImageBitmap(RoundedImageView.getCroppedBitmap(BitmapFactory.decodeByteArray(pimgdata, 0, pimgdata.length),150)); } else { cimage.setImageResource(R.drawable.me); }*/ if (imageLoader == null) imageLoader = AppController.getInstance().getImageLoader(); cimage.setImageUrl(LaunchActivity.SERVER+"profile/image/"+"img_"+helper.getcontactUID(c).toString()+".png", imageLoader); if(helper.getFollowing(c).equals("yes")) { cfollowbtn.setText("Unfollow"); //cfollowbtn.setTag("Y"); } else if(helper.getALLFollowing(c).equals("no")){ cfollowbtn.setText("Follow"); //cfollowbtn.setTag("N"); } else { cfollowbtn.setText(""); cfollowbtn.setLayoutParams(new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); } }
void populateFrom(Cursor c, Database_Two helper) { detail.setText(helper.getSearchDetail(c)); Pattern atMentionPattern = Pattern.compile("@([A-Za-z0-9_]+)"); String atMentionScheme = "profile://"; Pattern hashPattern = Pattern.compile("#([A-Za-z0-9_]+)"); String hashScheme = "hashtag://"; TransformFilter transformFilter = new TransformFilter() { //skip the first character to filter out '@' public String transformUrl(final Matcher match, String url) { return match.group(1); } }; title.setText(helper.getSearchTitle(c)); if(helper.getSearchTitle(c).contains("@")) { if(helper.getSearchTitle(c).equals(utilhelper.getUSER())) { Linkify.addLinks(title, atMentionPattern, "myprofile://", null, transformFilter); } else { Linkify.addLinks(title, atMentionPattern, atMentionScheme, null, transformFilter); } } else { Linkify.addLinks(title, hashPattern, hashScheme, null, transformFilter); } stripUnderlines(title); if (imageLoader == null) imageLoader = AppController.getInstance().getImageLoader(); if(helper.getSearchUID(helper.getSearchTitle(c)) != null) { image.setImageUrl(LaunchActivity.SERVER+"profile/image/"+"img_"+helper.getSearchUID(c).toString()+".png", imageLoader); } }
void populateFrom(Cursor c, Database_Two helper) { cdetail.setText(helper.getcontactDetail(c)); Pattern atMentionPattern = Pattern.compile("@([A-Za-z0-9_]+)"); String atMentionScheme = "profile://"; TransformFilter transformFilter = new TransformFilter() { //skip the first character to filter out '@' public String transformUrl(final Matcher match, String url) { return match.group(1); } }; cname.setText("@"+helper.getcontactName(c)); if(helper.getcontactName(c).equals(utilhelper.getUSER())) { Linkify.addLinks(cname, atMentionPattern, "myprofile://", null, transformFilter); } else { Linkify.addLinks(cname, atMentionPattern, atMentionScheme, null, transformFilter); } stripUnderlines(cname); /*byte[] pimgdata = Base64.decode(helper.getcontactbmp(c), 0); if(pimgdata.length!=0) { cimage.setImageBitmap(RoundedImageView.getCroppedBitmap(BitmapFactory.decodeByteArray(pimgdata, 0, pimgdata.length),150)); } else { cimage.setImageResource(R.drawable.me); }*/ if (imageLoader == null) imageLoader = AppController.getInstance().getImageLoader(); cimage.setImageUrl(LaunchActivity.SERVER+"profile/image/"+"img_"+helper.getcontactUID(c).toString()+".png", imageLoader); if(helper.getFollowing(c).equals("yes")) { cfollowbtn.setText("Unfollow"); } else if(helper.getFollowing(c).equals("no")){ cfollowbtn.setText("Follow"); } else { cfollowbtn.setText(""); cfollowbtn.setLayoutParams(new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); } }
void populateFrom(Cursor c, Database_Two helper) { /*Pattern tagMatcher1 = Pattern.compile("[@]+[A-Za-z0-9-_]+\\b"); String newActivityURL = "profile://"; body.setText(helper.getNotifyBody(c)); Linkify.addLinks(body, tagMatcher1, newActivityURL);*/ Pattern atMentionPattern = Pattern.compile("@([A-Za-z0-9_]+)"); String atMentionScheme = "profile://"; TransformFilter transformFilter = new TransformFilter() { //skip the first character to filter out '@' public String transformUrl(final Matcher match, String url) { return match.group(1); } }; body.setText(helper.getNotifyBody(c)); Linkify.addLinks(body, Linkify.ALL); Linkify.addLinks(body, atMentionPattern, atMentionScheme, null, transformFilter); stripUnderlines(body); date.setText(helper.getNotifyDate(c)); if (imageLoader == null) imageLoader = AppController.getInstance().getImageLoader(); nimage.setImageUrl(LaunchActivity.SERVER+"profile/image/"+"img_"+helper.getNotifyUID(c).toString()+".png", imageLoader); }
void populateFrom(Cursor c, Database_One helper) { addphncontact.setText(helper.getAddPhnContact(c)); Pattern atMentionPattern = Pattern.compile("@([A-Za-z0-9_]+)"); String atMentionScheme = "profile://"; TransformFilter transformFilter = new TransformFilter() { //skip the first character to filter out '@' public String transformUrl(final Matcher match, String url) { return match.group(1); } }; addphnuser.setText("@"+helper.getAddPhnUser(c)); Linkify.addLinks(addphnuser, Linkify.ALL); Linkify.addLinks(addphnuser, atMentionPattern, atMentionScheme, null, transformFilter); if(helper.getAddPhnImg(helper.getAddPhnUser(c))!=null) { addphnimg.setImageBitmap(BitmapFactory.decodeByteArray(helper.getAddPhnImg(helper.getAddPhnUser(c)), 0, helper.getAddPhnImg(helper.getAddPhnUser(c)).length)); } else { addphnimg.setImageResource(R.drawable.me);//ic_dummy_img); } if(helper.getAddPhnIsAdd(c).equals("Y")) { addphnchk.setTag("Y"); } else if(helper.getAddPhnIsAdd(c).equals("N")){ addphnchk.setTag("N"); } }
void populateFrom(Cursor c, Database_One helper, Util_Database utilhelper) { if (imageLoader == null) imageLoader = AppController.getInstance().getImageLoader(); image.setImageUrl(LaunchActivity.SERVER+"profile/image/"+"img_"+helper.getProfpostUID(c).toString()+".png", imageLoader); date_time.setText(helper.getProfpostDate(c)); Pattern atMentionPattern = Pattern.compile("@([A-Za-z0-9_]+)"); String atMentionScheme = "profile://"; Pattern HashPattern = Pattern.compile("#([A-Za-z0-9_]+)"); String HashScheme = "hashtag://"; TransformFilter transformFilter = new TransformFilter() { //skip the first character to filter out '@' public String transformUrl(final Matcher match, String url) { return match.group(1); } }; uname.setText("@"+helper.getProfpostName(c)); if(helper.getProfpostName(c).equals(utilhelper.getUSER())) { Linkify.addLinks(uname, atMentionPattern, "myprofile://", null, transformFilter); } else { Linkify.addLinks(uname, atMentionPattern, atMentionScheme, null, transformFilter); } stripUnderlines(uname); if(helper.getProfpostBody(c)!=null) { post_body.setText(helper.getProfpostBody(c)); Linkify.addLinks(post_body, Linkify.ALL); Linkify.addLinks(post_body, atMentionPattern, atMentionScheme, null, transformFilter); Linkify.addLinks(post_body, HashPattern, HashScheme, null, transformFilter); } else { post_body.setText(null); post_body.setVisibility(View.GONE); } if(helper.getProfpostType(c).compareTo("YES")==0) { pimage.setImageBitmap(BitmapFactory.decodeByteArray(helper.getProfpostBmp(c), 0, helper.getProfpostBmp(c).length)); } else { pimage.setVisibility(View.GONE); } RateBar.setRating(Float.parseFloat(helper.getProfpostRating(c))); ratebtn.setText("rate("+helper.getProfpostRateCount(c)+")"); commentbtn.setText("comment("+helper.getProfpostCommentCount(c)+")"); }
void populateFrom(Cursor c, Database_Two helper, Util_Database utilhelper) { //msguname.setText(helper.getMsgListUsername(c)); msgbody.setText(helper.getMsgListBody(c)); msgbody.setUseSystemDefault(false); msgdate.setText(helper.getMsgListSTAMP(c)); Pattern atMentionPattern = Pattern.compile("@([A-Za-z0-9_]+)"); String atMentionScheme = "profile://"; TransformFilter transformFilter = new TransformFilter() { //skip the first character to filter out '@' public String transformUrl(final Matcher match, String url) { return match.group(1); } }; msguname.setText("@"+helper.getMsgListUsername(c)); if(helper.getMsgListUsername(c).equals(utilhelper.getUSER())) { Linkify.addLinks(msguname, atMentionPattern, "myprofile://", null, transformFilter); } else { Linkify.addLinks(msguname, atMentionPattern, atMentionScheme, null, transformFilter); } stripUnderlines(msguname); if (imageLoader == null) imageLoader = AppController.getInstance().getImageLoader(); profimg.setImageUrl(LaunchActivity.SERVER+"profile/image/"+"img_"+helper.getMsgListUID(c).toString()+".png", imageLoader); /*if(utilhelper.getisIMG_MSGLST(helper.getMsgListUsername(c))!=null) { if(utilhelper.getisIMG_MSGLST(helper.getMsgListUsername(c).toString()).equals("YES")) { profimg.setImageBitmap(RoundedImageView.getCroppedBitmap(BitmapFactory.decodeByteArray(utilhelper.getPPIC_MSGLST(helper.getMsgListUsername(c).toString()), 0, utilhelper.getPPIC_MSGLST(helper.getMsgListUsername(c).toString()).length), 150)); //profimg.setImageBitmap(BitmapFactory.decodeByteArray(utilhelper.getPPIC_MSGLST(helper.getMsgListUsername(c).toString()), 0, utilhelper.getPPIC_MSGLST(helper.getMsgListUsername(c).toString()).length)); } else { profimg.setImageResource(R.drawable.me); } } else { profimg.setImageResource(R.drawable.me); }*/ if(helper.getMsgListStatus(c).equals("unread")) { ureadimg.setImageResource(R.drawable.ic_unread_msg); //ureadimg.setVisibility(View.VISIBLE); } else { //ureadimg.setVisibility(View.GONE); } }
void populateFrom(Cursor c, Database_Two helper) { //cname.setText(helper.getALLcontactName(c)); cdetail.setText(helper.getMAINcontactDetail(c)); Pattern atMentionPattern = Pattern.compile("@([A-Za-z0-9_]+)"); String atMentionScheme = "profile://"; TransformFilter transformFilter = new TransformFilter() { //skip the first character to filter out '@' public String transformUrl(final Matcher match, String url) { return match.group(1); } }; cname.setText("@"+helper.getALLcontactName(c)); if(helper.getALLcontactName(c).equals(utilhelper.getUSER())) { Linkify.addLinks(cname, atMentionPattern, "myprofile://", null, transformFilter); } else { Linkify.addLinks(cname, atMentionPattern, atMentionScheme, null, transformFilter); } stripUnderlines(cname); /*byte[] pimgdata = Base64.decode(helper.getALLcontactbmp(c), 0); if(pimgdata.length!=0) { cimage.setImageBitmap(RoundedImageView.getCroppedBitmap(BitmapFactory.decodeByteArray(pimgdata, 0, pimgdata.length),150)); } else { cimage.setImageResource(R.drawable.me); }*/ if (imageLoader == null) imageLoader = AppController.getInstance().getImageLoader(); cimage.setImageUrl(LaunchActivity.SERVER+"profile/image/"+"img_"+helper.getALLcontactUID(c).toString()+".png", imageLoader); if(helper.getALLFollowing(c).equals("yes")) { cfollowbtn.setText("Unfollow"); } if(helper.getALLFollowing(c).equals("no")){ cfollowbtn.setText("Follow"); } /*if(helper.getALLFollowing(c).equals("me")) { //cfollowbtn.setVisibility(View.GONE); lvboolaray2[c.getPosition()] = false; //cfollowbtn.setImageResource(0); cfollowbtn.setLayoutParams(new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); }*/ }