public void sendFeedbackTask() {
   NewsHttpGetTask task = new NewsHttpGetTask(Constants.CONFIG_ID_FEEDBACK);
   task.executeOnExecutor(
       AsyncTask.THREAD_POOL_EXECUTOR,
       NewsArticleVector.getArticlesWithFeedback(NewsArticleVector.getList1()),
       NewsArticleVector.getArticlesWithFeedback(NewsArticleVector.getList2()));
 }
  public void requestPersonalization(HashMap<String, Object> payload) {
    String url, result;
    int endPos;

    // Communication with Emma's server
    List<NewsArticle> tempList = null;
    if (rankingOption == 1 || rankingOption == 3) {
      url =
          Util.loadConfigAssets(mApp, Constants.CONFIG_NEWS_PROPERTIES)
              .getProperty(Constants.CONFIG_PERSONALIZATION_MULTIBANDIT_LEARNING);
      result = HttpController.getHttpPostResponse(url, payload, null, 0);
      NewsArticleVector.setList1(NewsArticleVector.fromJson(result, false));
      tempList = NewsArticleVector.getList1();
    }
    // Communication with William's server
    if (rankingOption == 2 || rankingOption == 3) {
      url =
          Util.loadConfigAssets(mApp, Constants.CONFIG_NEWS_PROPERTIES)
              .getProperty(Constants.CONFIG_PERSONALIZATION_LEARNING_FROM_ADVISE);
      result = HttpController.getHttpPostResponse(url, payload, null, 0);
      NewsArticleVector.setList2(NewsArticleVector.fromJson(result, false));
      tempList = NewsArticleVector.getList2();
    }

    if (rankingOption == 3) {
      tempList = NewsArticleVector.mergeLists();
    }
    endPos = tempList.size();
    NewsArticleVector.sortNews(tempList);
    NewsArticleVector.setIsRecommendedBy(tempList);
    NewsArticleVector.increaseEndPosBatch(endPos);

    sendRefreshNewsEvent();
  }
 public HashMap<String, String> createPersonalizationRequest() {
   HashMap<String, String> map = new HashMap<>();
   map.put("news", Util.toJson(NewsArticleVector.getInstance().getRemaining()));
   map.put("user_info", Util.toJson(userProfile));
   map.put("num_articles", "" + NewsArticleVector.getBatchArticlesToShow());
   map.put("device_id", deviceId);
   return map;
 }
 public static void sendRefreshNewsEvent() {
   RefreshNewsListEvent event = new RefreshNewsListEvent();
   NewsArticleVector vector = NewsArticleVector.getArticlesPerView();
   event.setArticleList(vector);
   EventBus.getDefault().post(event);
   loadImages();
   Log.e("", "5.6...");
 }
 @Override
 protected Void doInBackground(Object... params) {
   if (id.equals(Constants.CONFIG_ID_PERSONALIZATION)) {
     requestPersonalization((HashMap) params[0]);
   } else if (id.equals(Constants.CONFIG_ID_FEEDBACK)) {
     sendFeedback((String) params[0], (String) params[1]);
     NewsArticleVector.resetVisitedArt();
   }
   return null;
 }