Ejemplo n.º 1
0
 private void stopDownloadingOtherPicturesOnWifiNetworkEnvironment() {
   if (backgroundWifiDownloadPicThread != null) {
     backgroundWifiDownloadPicThread.interrupt();
     backgroundWifiDownloadPicThread = null;
     AppLogger.i(
         "WifiAutoDownloadPictureRunnable stopDownloadingOtherPicturesOnWifiNetworkEnvironment");
   }
 }
  @Override
  public int onStartCommand(Intent intent, int flags, int startId) {

    AccountBean accountBean = intent.getParcelableExtra(NotificationServiceHelper.ACCOUNT_ARG);

    if (accountBean == null) {
      throw new IllegalArgumentException(
          "you must use BigTextNotificationService newIntent method");
    }

    ValueWrapper valueWrapper = valueBagHashMap.get(accountBean.getUid());

    if (valueWrapper == null) {
      valueWrapper = new ValueWrapper();
    }

    valueWrapper.accountBean = intent.getParcelableExtra(NotificationServiceHelper.ACCOUNT_ARG);
    valueWrapper.mentionsWeibo =
        intent.getParcelableExtra(NotificationServiceHelper.MENTIONS_WEIBO_ARG);
    valueWrapper.commentsToMe =
        intent.getParcelableExtra(NotificationServiceHelper.COMMENTS_TO_ME_ARG);
    valueWrapper.mentionsComment =
        intent.getParcelableExtra(NotificationServiceHelper.MENTIONS_COMMENT_ARG);
    valueWrapper.unreadBean = intent.getParcelableExtra(NotificationServiceHelper.UNREAD_ARG);
    valueWrapper.currentIndex = intent.getIntExtra(NotificationServiceHelper.CURRENT_INDEX_ARG, 0);
    valueWrapper.clickToOpenAppPendingIntentInner =
        intent.getParcelableExtra(NotificationServiceHelper.PENDING_INTENT_INNER_ARG);
    valueWrapper.ticker = intent.getStringExtra(NotificationServiceHelper.TICKER);

    ArrayList<Parcelable> notificationItems = new ArrayList<Parcelable>();
    if (valueWrapper.commentsToMe != null) {
      notificationItems.addAll(valueWrapper.commentsToMe.getItemList());
    }
    if (valueWrapper.mentionsComment != null) {
      notificationItems.addAll(valueWrapper.mentionsComment.getItemList());
    }
    if (valueWrapper.mentionsWeibo != null) {
      notificationItems.addAll(valueWrapper.mentionsWeibo.getItemList());
    }
    valueWrapper.notificationItems = notificationItems;
    valueBagHashMap.put(valueWrapper.accountBean.getUid(), valueWrapper);

    AppLogger.i("service account name=" + valueWrapper.accountBean.getUsernick());

    buildNotification(valueWrapper.accountBean.getUid());

    stopSelf();

    return super.onStartCommand(intent, flags, startId);
  }
Ejemplo n.º 3
0
 private void startDownloadingOtherPicturesOnWifiNetworkEnvironment() {
   if (backgroundWifiDownloadPicThread == null
       && Utility.isWifi(getActivity())
       && SettingUtility.getEnableBigPic()
       && SettingUtility.isWifiAutoDownloadPic()) {
     final int position = getListView().getFirstVisiblePosition();
     int listVewOrientation = ((VelocityListView) getListView()).getTowardsOrientation();
     WifiAutoDownloadPictureRunnable runnable =
         new WifiAutoDownloadPictureRunnable(getList(), position, listVewOrientation);
     backgroundWifiDownloadPicThread = new Thread(runnable);
     backgroundWifiDownloadPicThread.start();
     AppLogger.i(
         "WifiAutoDownloadPictureRunnable startDownloadingOtherPicturesOnWifiNetworkEnvironment");
   }
 }
  @Override
  public int onStartCommand(Intent intent, int flags, int startId) {

    ValueWrapper valueWrapper = new ValueWrapper();

    valueWrapper.accountBean = intent.getParcelableExtra(NotificationServiceHelper.ACCOUNT_ARG);

    valueWrapper.unreadBean = intent.getParcelableExtra(NotificationServiceHelper.UNREAD_ARG);

    valueWrapper.clickToOpenAppPendingIntentInner =
        intent.getParcelableExtra(NotificationServiceHelper.PENDING_INTENT_INNER_ARG);
    valueWrapper.ticker = intent.getStringExtra(NotificationServiceHelper.TICKER);

    valueBagHashMap.put(valueWrapper.accountBean.getUid(), valueWrapper);

    AppLogger.i("service account name=" + valueWrapper.accountBean.getUsernick());

    buildNotification(valueWrapper.accountBean.getUid());

    stopSelf();

    return super.onStartCommand(intent, flags, startId);
  }