private CharSequence[] getDateList() { String[] dateArray = new String[7]; TimeZone timeZone = TimeZone.getTimeZone("GMT+0800"); Calendar calendar = Calendar.getInstance(timeZone); calendar.setTime(new Date()); Date previousDate; String previousDateString; for (int i = 0; i < dateArray.length; i++) { if (i == 0) { calendar.add(Calendar.DAY_OF_MONTH, 0); } else { calendar.add(Calendar.DAY_OF_MONTH, -1); } previousDate = calendar.getTime(); previousDateString = DateUtil.dateToStringByFormat(previousDate, DATE_FORMAT); dateArray[i] = previousDateString; } dateList = dateArray; return dateArray; }
@Override public void onCreate(Bundle savedInstanceState) { isTopActivity = true; super.onCreate(savedInstanceState); setContentView(R.layout.realindex2); matchManager = getMatchManager(); indexService = getIndexService(); oddsManager = indexService.getOddsManager(); companyManager = indexService.getCompanyManager(); leagueManager = indexService.getLeagueManager(); date = DateUtil.dateToStringByFormat(new Date(), DATE_FORMAT); // 加载赔率公司数据 loadCompanyData(); buttonFilterCompany = (Button) findViewById(R.id.button_filter_company_type); buttonFilterLeague = (Button) findViewById(R.id.button_filter_league); buttonLookBack = (Button) findViewById(R.id.button_lookback); buttonFilterScoreType = (Button) findViewById(R.id.button_filter_score_type); setFilterCompanyButtonOnClickListener(); setFilterLeagueButtonOnClickListener(); setLookBackButtonOnClickListener(); setFilterLevelButtonOnClickListener(); initListView(); // init no match title view noOddsTextView = (TextView) findViewById(R.id.no_real_odds_view); updateNoOddsTextView(); indexService.addOddsLiveUpdateObserver(this); }