コード例 #1
0
 @Override
 public void clear() {
   super.clear();
   manager.mSelectedStatusIds.clear();
   manager.mSelectedUserIds.clear();
   manager.onItemsCleared();
 }
コード例 #2
0
 @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;
 }
コード例 #3
0
 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
   }
 }
コード例 #4
0
 @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;
 }
コード例 #5
0
  @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;
        }
    }
  }