facebookElement.setTitle(title); facebookElement.setIconDrawable(R.drawable.about_icon_facebook); facebookElement.setIconTint(R.color.about_facebook_color);
/** * 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 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; }
/** * 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; }
Element getCopyRightsElement() { Element copyRightsElement = new Element(); final String copyrights = String.format(getString(R.string.copy_right), Calendar.getInstance().get(Calendar.YEAR)); copyRightsElement.setTitle(copyrights); copyRightsElement.setIconDrawable(R.drawable.about_icon_copy_right); copyRightsElement.setIconTint(mehdi.sakout.aboutpage.R.color.about_item_icon_color); copyRightsElement.setIconNightTint(android.R.color.white); copyRightsElement.setGravity(Gravity.CENTER); copyRightsElement.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(MainActivity.this, copyrights, Toast.LENGTH_SHORT).show(); } }); return copyRightsElement; }
/** * 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; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); simulateDayNight(/* DAY */ 0); Element adsElement = new Element(); adsElement.setTitle("Advertise with us"); View aboutPage = new AboutPage(this) .isRTL(false) .setImage(R.drawable.dummy_image) .addItem(new Element().setTitle("Version 6.2")) .addItem(adsElement) .addGroup("Connect with us") .addEmail("elmehdi.sakout@gmail.com") .addWebsite("http://medyo.github.io/") .addFacebook("the.medy") .addTwitter("medyo80") .addYoutube("UCdPQtdWIsg7_pi4mrRu46vA") .addPlayStore("com.ideashower.readitlater.pro") .addInstagram("medyo80") .addGitHub("medyo") .addItem(getCopyRightsElement()) .create(); setContentView(aboutPage); }
private Element getBcryptElement() { Element ret = new Element(); ret.setTitle(getString(R.string.about_bcrypt)); return ret; } }
e001.setTitle("send Crash report via Email"); e001.setOnClickListener(new View.OnClickListener() 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); el2.setTitle("used libraries:"); el2.setIconDrawable(R.drawable.about_icon_github); aboutPage.addItem(el2); el2.setTitle("com.github.gfx.android.orma"); link2 = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/gfx/Android-Orma")); el2.setIntent(link2); el2.setTitle("info.guardianproject.iocipher:IOCipher"); link2 = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/guardianproject/IOCipher")); el2.setIntent(link2); el2.setTitle("com.l4digital.fastscroll:fastscroll"); link2 = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/L4Digital/FastScroll")); el2.setIntent(link2); el2.setTitle("com.github.bumptech.glide"); link2 = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/bumptech/glide")); el2.setIntent(link2); el2.setTitle("info.guardianproject.netcipher"); link2 = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/guardianproject/NetCipher"));