/** * Add a predefined Element that opens the users default email client with a new email to the * email address passed as parameter * * @param email the email address to send to * @param title the title string to display on this item * @return this AboutPage instance for builder pattern support */ public AboutPage addEmail(String email, String title) { Element emailElement = new Element(); emailElement.setTitle(title); emailElement.setIconDrawable(R.drawable.about_icon_email); emailElement.setIconTint(R.color.about_item_icon_color); Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:")); intent.putExtra(Intent.EXTRA_EMAIL, new String[]{email}); emailElement.setIntent(intent); addItem(emailElement); return this; }
/** * Add a predefined Element that the opens the a browser and displays the specified GitHub * users profile page. * * @param id the GitHub user to link to * @param title the title to display on this item * @return this AboutPage instance for builder pattern support */ public AboutPage addGitHub(String id, String title) { Element gitHubElement = new Element(); gitHubElement.setTitle(title); gitHubElement.setIconDrawable(R.drawable.about_icon_github); gitHubElement.setIconTint(R.color.about_github_color); gitHubElement.setValue(id); Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_BROWSABLE); intent.setData(Uri.parse(String.format("https://github.com/%s", id))); gitHubElement.setIntent(intent); addItem(gitHubElement); return this; }
facebookElement.setIntent(intent);
/** * Add a predefined Element that the opens the Twitter app with a deep link to the specified user id * If the Twitter application is not installed this will open a web page instead. * * @param id the id of the Twitter user to display in the Twitter app * @param title the title to display on this item * @return this AboutPage instance for builder pattern support */ public AboutPage addTwitter(String id, String title) { Element twitterElement = new Element(); twitterElement.setTitle(title); twitterElement.setIconDrawable(R.drawable.about_icon_twitter); twitterElement.setIconTint(R.color.about_twitter_color); twitterElement.setValue(id); Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_BROWSABLE); if (AboutPageUtils.isAppInstalled(mContext, "com.twitter.android")) { intent.setPackage("com.twitter.android"); intent.setData(Uri.parse(String.format("twitter://user?screen_name=%s", id))); } else { intent.setData(Uri.parse(String.format("http://twitter.com/intent/user?screen_name=%s", id))); } twitterElement.setIntent(intent); addItem(twitterElement); return this; }
/** * Add a predefined Element that the opens a browser and loads the specified URL * * @param url the URL to open in a browser * @param title the title to display on this item * @return this AboutPage instance for builder pattern support */ public AboutPage addWebsite(String url, String title) { if (!url.startsWith("http://") && !url.startsWith("https://")) { url = "http://" + url; } Element websiteElement = new Element(); websiteElement.setTitle(title); websiteElement.setIconDrawable(R.drawable.about_icon_link); websiteElement.setIconTint(R.color.about_item_icon_color); websiteElement.setValue(url); Uri uri = Uri.parse(url); Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri); websiteElement.setIntent(browserIntent); addItem(websiteElement); return this; }
/** * Add a predefined Element that the opens the Youtube app with a deep link to the * specified channel id. * <p> * If the Youtube app is not installed this will open the Youtube web page instead. * * @param id the id of the channel to deep link to * @param title the title to display on this item * @return this AboutPage instance for builder pattern support */ public AboutPage addYoutube(String id, String title) { Element youtubeElement = new Element(); youtubeElement.setTitle(title); youtubeElement.setIconDrawable(R.drawable.about_icon_youtube); youtubeElement.setIconTint(R.color.about_youtube_color); youtubeElement.setValue(id); Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse(String.format("http://youtube.com/channel/%s", id))); if (AboutPageUtils.isAppInstalled(mContext, "com.google.android.youtube")) { intent.setPackage("com.google.android.youtube"); } youtubeElement.setIntent(intent); addItem(youtubeElement); return this; }
/** * Add a predefined Element that the opens the Instagram app with a deep link to the * specified user id. * <p> * If the Instagram app is not installed this will open the Intagram web page instead. * * @param id the user id to deep link to * @param title the title to display on this item * @return this AboutPage instance for builder pattern support */ public AboutPage addInstagram(String id, String title) { Element instagramElement = new Element(); instagramElement.setTitle(title); instagramElement.setIconDrawable(R.drawable.about_icon_instagram); instagramElement.setIconTint(R.color.about_instagram_color); instagramElement.setValue(id); Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse("http://instagram.com/_u/" + id)); if (AboutPageUtils.isAppInstalled(mContext, "com.instagram.android")) { intent.setPackage("com.instagram.android"); } instagramElement.setIntent(intent); addItem(instagramElement); return this; }
/** * Add a predefined Element that the opens the PlayStore app with a deep link to the * specified app application id. * * @param id the package id of the app to display * @param title the title to display on this item * @return this AboutPage instance for builder pattern support */ public AboutPage addPlayStore(String id, String title) { Element playStoreElement = new Element(); playStoreElement.setTitle(title); playStoreElement.setIconDrawable(R.drawable.about_icon_google_play); playStoreElement.setIconTint(R.color.about_play_store_color); playStoreElement.setValue(id); Uri uri = Uri.parse("market://details?id=" + id); Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri); playStoreElement.setIntent(goToMarket); addItem(playStoreElement); return this; }
tox_link.setTitle("What is Tox?"); Intent tox_faq_page = new Intent(Intent.ACTION_VIEW, Uri.parse("https://tox.zoff.cc")); tox_link.setIntent(tox_faq_page); aboutPage.addItem(tox_link); el2.setTitle("com.github.gfx.android.orma"); link2 = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/gfx/Android-Orma")); el2.setIntent(link2); aboutPage.addItem(el2); el2.setTitle("info.guardianproject.iocipher:IOCipher"); link2 = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/guardianproject/IOCipher")); el2.setIntent(link2); aboutPage.addItem(el2); el2.setTitle("com.l4digital.fastscroll:fastscroll"); link2 = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/L4Digital/FastScroll")); el2.setIntent(link2); aboutPage.addItem(el2); el2.setTitle("com.github.bumptech.glide"); link2 = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/bumptech/glide")); el2.setIntent(link2); aboutPage.addItem(el2); el2.setTitle("info.guardianproject.netcipher"); link2 = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/guardianproject/NetCipher")); el2.setIntent(link2); aboutPage.addItem(el2);