@Override
 public Integer doInBackground(Void... params) {
   try {
     HttpResponse response;
     String urlForDashboards =
         AccountSetting.getInstance().getDomainName() + ExoConstants.DASHBOARD_PATH;
     /*
      * Checking the session status each time we retrieve dashboard item list.
      * If time out, re logging in
      */
     if (ExoConnectionUtils.checkTimeout(urlForDashboards) != ExoConnectionUtils.LOGIN_SUCCESS)
       return RESULT_TIMEOUT;
     items.clear();
     response = ExoConnectionUtils.getRequestResponse(urlForDashboards);
     dashboardList = dashboardController.getDashboards(response);
     for (int i = 0; i < dashboardList.size(); i++) {
       DashboardItem gadgetTab = dashboardList.get(i);
       try {
         HttpResponse response2 = ExoConnectionUtils.getRequestResponse(gadgetTab.link);
         List<GadgetInfo> gadgets =
             dashboardController.getGadgetInTab(response2, gadgetTab.label, gadgetTab.link);
         if (gadgets != null && gadgets.size() > 0) {
           items.add(new GadgetInfo(gadgetTab.label));
           items.addAll(gadgets);
         }
       } catch (IOException e) {
         Log.e("DashboardLoadTask", e.getMessage());
       }
     }
     return RESULT_OK;
   } catch (IOException e) {
     if (Log.LOGD) Log.d(getClass().getSimpleName(), e.getMessage(), Log.getStackTraceString(e));
     return RESULT_ERROR;
   }
 }
Esempio n. 2
0
 public void launchNewsService() {
   if (ExoConnectionUtils.isNetworkAvailableExt(mContext)) {
     if (mServiceLoadTask == null
         || mServiceLoadTask.getStatus() == SocialServiceLoadTask.Status.FINISHED) {
       mServiceLoadTask =
           (SocialServiceLoadTask) new SocialServiceLoadTask(mContext, this, loaderItem).execute();
     }
   } else {
     new ConnectionErrorDialog(mContext).show();
   }
 }
Esempio n. 3
0
  /**
   * Load a number of activities with specific type
   *
   * @param number
   * @param type
   */
  public void onLoad(int number, int type) {
    if (ExoConnectionUtils.isNetworkAvailableExt(mContext)) {
      if (mLoadTask == null || mLoadTask.getStatus() == SocialLoadTask.Status.FINISHED) {
        mLoadTask =
            (SocialLoadTask)
                new SocialLoadTask(mContext, loaderItem) {

                  @Override
                  protected ArrayList<SocialActivityInfo> getSocialActivityList() {
                    return SocialServiceHelper.getInstance().socialInfoList;
                  }

                  @Override
                  protected RealtimeListAccess<RestActivity> getRestActivityList(
                      RestIdentity identity, QueryParams params) throws SocialClientLibException {
                    return activityService.getFeedActivityStream(identity, params);
                  }
                }.execute(number, type);
      }
    } else {
      new ConnectionErrorDialog(mContext).show();
    }
  }