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 void sendFeedback(String list1, String list2) { HashMap<String, Object> payload = new HashMap(); payload.put("user_info", Util.toJson(userProfile)); payload.put("device_id", deviceId); String url; // Emma's server if (list1 != null) { payload.put("news_feedback", list1); url = Util.loadConfigAssets(mApp, Constants.CONFIG_NEWS_PROPERTIES) .getProperty(Constants.CONFIG_FEEDBACK_MULTIBANDIT_LEARNING); HttpController.getHttpPostResponse(url, payload, null, 0); } // William's server if (list2 != null) { payload.put("news_feedback", list2); url = Util.loadConfigAssets(mApp, Constants.CONFIG_NEWS_PROPERTIES) .getProperty(Constants.CONFIG_FEEDBACK_LEARNING_FROM_ADVISE); HttpController.getHttpPostResponse(url, payload, null, 0); } }