@Override public void clear() { super.clear(); manager.mSelectedStatusIds.clear(); manager.mSelectedUserIds.clear(); manager.onItemsCleared(); }
@Override public boolean remove(final Object object) { final boolean ret = super.remove(object); if (object instanceof ParcelableStatus) { manager.mSelectedStatusIds.remove(((ParcelableStatus) object).id); } else if (object instanceof ParcelableUser) { manager.mSelectedUserIds.remove(((ParcelableUser) object).key); } if (ret) { if (isEmpty()) { manager.onItemsCleared(); } else { manager.onItemUnselected(object); } } return ret; }
protected void openLink(final String link) { if (manager != null && manager.isActive()) return; final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(link)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); try { context.startActivity(intent); } catch (final ActivityNotFoundException e) { // TODO } }
@Override public boolean add(final Object object) { if (object instanceof ParcelableStatus) { manager.mSelectedStatusIds.add(((ParcelableStatus) object).id); } else if (object instanceof ParcelableUser) { manager.mSelectedUserIds.add(((ParcelableUser) object).key); } else return false; final boolean ret = super.add(object); manager.onItemSelected(object); return ret; }
@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; } } }