@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(TAG, "onActivityResult"); super.onActivityResult(requestCode, resultCode, data); if (data == null) { Log.d(TAG, "onActivityResult but data is null"); return; } switch (requestCode) { case SelectLeagueActivity.ACTION_SELECT_LEAGUE: { // handle select league result (return a league id list) ArrayList<String> selectedList = null; selectedList = data.getStringArrayListExtra(SelectLeagueActivity.KEY_SELECTED_LEAGUE); if (selectedList == null) { Log.d(TAG, "onActivityResult but select league list is null"); return; } Log.d(TAG, "onActivityResult, select league list is " + selectedList); // Set<String> selectedSet = new HashSet<String>(); selectedSet.clear(); selectedSet.addAll(selectedList); leagueManager.setFilterLeagueSet(selectedSet); oddsManager.setFilterLeagueIdList(selectedList); this.reloadListDataAndView(); } break; case SelectCompanyActivity.ACTION_SELECT_COMPANY: { // handle companyId here ArrayList<String> selectedList = null; selectedList = data.getStringArrayListExtra(SelectCompanyActivity.KEY_SELECTED_COMPANY); if (selectedList == null) { Log.d(TAG, "onActivityResult but select company list is null"); return; } Log.d(TAG, "onActivityResult, select company list is " + selectedList); setCompanyIdFromList(selectedList); loadAllOddsData(); this.reloadListDataAndView(); } break; default: break; } }
private void selectTopLeagues() { List<String> filterLeagueIdList2 = new ArrayList<String>(); for (League league : topLeagues) { filterLeagueIdList2.add(league.getLeagueId()); } Set<String> selectedSet2 = new HashSet<String>(); selectedSet2.addAll(filterLeagueIdList2); leagueManager.setLeagueList(topLeagues); leagueManager.setFilterLeagueSet(selectedSet2); oddsManager.setFilterLeagueIdList(filterLeagueIdList2); }
private void reloadListDataAndView() { if (firstLoad) { // 默认一级赛事 List<String> filterLeagueIdList = new ArrayList<String>(); for (League league : topLeagues) { filterLeagueIdList.add(league.getLeagueId()); } oddsManager.setFilterLeagueIdList(filterLeagueIdList); // 设置筛选的联赛 leagueManager.setLeagueList(topLeagues); Set<String> filterSet = new HashSet<String>(); filterSet.addAll(filterLeagueIdList); leagueManager.setFilterLeagueSet(filterSet); firstLoad = false; } matchOddsMap = oddsManager.filterOddsByOddsType(companyManager.getOddsType()); updateMatchOddsMap(); updateNoOddsTextView(); adapter.notifyDataSetChanged(); }
@Override public void loadOddsDataFinish(ResultCodeType resultCode) { switch (resultCode) { case SUCCESS: topLeagues = leagueManager.findAllTopLeagues(); allLeagues = leagueManager.findAllLeagues(); // for refresh if (selectedSet != null && selectedSet.size() > 0) { List<String> selectedlist = new ArrayList<String>(); selectedlist.addAll(selectedSet); oddsManager.setFilterLeagueIdList(selectedlist); } else { switch (oddsManager.getFilterScoreType()) { case FIRST: selectTopLeagues(); break; case ALL: selectAllLeagues(); break; case DANCHANGE: selectAllLeagues(); break; case JINGCAI: selectAllLeagues(); break; case ZUCAI: selectAllLeagues(); default: break; } } this.reloadListDataAndView(); break; default: break; } }