async public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); webService = new WlcWebService(); var prefs = Activity.GetSharedPreferences("wlcPrefs", FileCreationMode.Private); var myStatsUrl = prefs.GetString("statsUrl", ""); var challengeProfile = prefs.GetString("challengeProfile", ""); csrfToken = prefs.GetString("csrfToken", ""); adapter = new StatsColorBarAdapter(Activity); try { profile = Newtonsoft.Json.JsonConvert.DeserializeObject <ChallengeProfile> (challengeProfile, new Newtonsoft.Json.JsonSerializerSettings() { NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore }); var contentStr = await webService.GetStats(StoredCookies, "/profiles/" + profile.id.ToString() + "/stats_calendar"); myStats = WlcHelpers.GetStats(contentStr); ((StatsColorBarAdapter)adapter).Stats = myStats.OrderByDescending(x => x.StatDate).ToList(); // today = await webService.GetRecord(StoredCookies, "today.json", csrfToken); if (!Activity.IsFinishing) { UpdateView(); } } catch (Exception ex) { } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var v = inflater.Inflate(Resource.Layout.fragment_overview, container, false); headerView = inflater.Inflate(Resource.Layout.list_header, null, false); statsList = v.FindViewById <ListView> (Resource.Id.stats_list); // statsList.AddHeaderView (headerView); statsList.Adapter = adapter; refreshView = v.FindViewById <Android.Support.V4.Widget.SwipeRefreshLayout> (Resource.Id.refreshView); averageScoreView = headerView.FindViewById <RadialProgress.RadialProgressView> (Resource.Id.progressView); totalScoreView = headerView.FindViewById <TextView> (Resource.Id.totalScoreView); refreshView.Refresh += async delegate { var contentStr = await webService.GetStats(StoredCookies, "/profiles/" + profile.id.ToString() + "/stats_calendar"); myStats = WlcHelpers.GetStats(contentStr); ((StatsColorBarAdapter)adapter).Stats = myStats.OrderByDescending(x => x.StatDate).ToList(); refreshView.Refreshing = false; UpdateView(); }; UpdateView(); return(v); }