/** * 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; }
DrawableCompat.setTint(wrappedDrawable, ContextCompat.getColor(mContext, element.getIconNightTint())); } else { DrawableCompat.setTint(wrappedDrawable, AboutPageUtils.getThemeAccentColor(mContext));
intent.addCategory(Intent.CATEGORY_BROWSABLE); if (AboutPageUtils.isAppInstalled(mContext, "com.facebook.katana")) { intent.setPackage("com.facebook.katana"); int versionCode = 0;
/** * 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; }