@Nullable public static String getBestBannerUrl(@Nullable final String baseUrl, final int width) { if (baseUrl == null) return null; final String type = getBestBannerType(width); final String authority = PreviewMediaExtractor.getAuthority(baseUrl); return authority != null && authority.endsWith(".twimg.com") ? baseUrl + "/" + type : baseUrl; }
@Override public boolean supports(@NonNull String link) { final String authority = PreviewMediaExtractor.getAuthority(link); return "pbs.twimg.com".equals(authority) || "abs.twing.com".equals(authority); }
@Override public void onLinkClick( final String link, final String orig, final long accountId, final long extraId, final int type, final boolean sensitive, final int start, final int end) { if (manager != null && manager.isActive()) return; if (!isPrivateData()) { // BEGIN HotMobi final LinkEvent event = LinkEvent.create(context, link, type); HotMobiLogger.getInstance(context).log(accountId, event); // END HotMobi } switch (type) { case TwidereLinkify.LINK_TYPE_MENTION: { IntentUtils.openUserProfile(context, accountId, -1, link, null, true); break; } case TwidereLinkify.LINK_TYPE_HASHTAG: { Utils.openTweetSearch(context, accountId, "#" + link); break; } case TwidereLinkify.LINK_TYPE_LINK: { if (PreviewMediaExtractor.isSupported(link)) { openMedia(accountId, extraId, sensitive, link, start, end); } else { openLink(link); } break; } case TwidereLinkify.LINK_TYPE_LIST: { final String[] mentionList = link.split("/"); if (mentionList.length != 2) { break; } Utils.openUserListDetails(context, accountId, -1, -1, mentionList[0], mentionList[1]); break; } case TwidereLinkify.LINK_TYPE_CASHTAG: { Utils.openTweetSearch(context, accountId, link); break; } case TwidereLinkify.LINK_TYPE_USER_ID: { IntentUtils.openUserProfile( context, accountId, NumberUtils.toLong(link, -1), null, null, true); break; } case TwidereLinkify.LINK_TYPE_STATUS: { Utils.openStatus(context, accountId, NumberUtils.toLong(link, -1)); break; } } }