public void ShowLastTripNotification(TimeSpan d, int count, double distance) { var tt = d.ToString(d.Hours > 0 ? "hh\\hmm" : "mm\\m\\i\\n"); var dispDistance = prefs.GetDisplayDistance(distance) + prefs.GetUnitForDistance(distance); string msg = null; if (count <= 1) { msg = Resources.GetString(Resource.String.single_trip_notification); } else { msg = Resources.GetString(Resource.String.multiple_trip_notification); } msg = string.Format(msg, count); ShowNotification(msg, duration: tt, distance: dispDistance, delay: 2500); }
public override void Draw(Canvas canvas) { base.Draw(canvas); DrawWater(canvas); var center = Width / 2; descPaint.GetTextBounds(desc, 0, desc.Length, bounds); canvas.DrawText(desc, center, padding + bounds.Height(), descPaint); var dt = prefs.GetDisplayDistance(Distance, strictValue: true); var unit = prefs.GetUnitForDistance(Distance); digitPaint.GetTextBounds(dt, 0, dt.Length, bounds); canvas.Save(); canvas.Scale(1 - currentEffect, (1 - currentEffect) * .4f + .6f, center, Height / 2); digitPaint.Alpha = (int)((1 - currentEffect) * 255); canvas.DrawText(dt, center, Height / 2 + bounds.Height() / 2, digitPaint); canvas.Restore(); canvas.DrawText(unit, center, Height - 1.2f * padding, unitPaint); }
async void LoadStats() { var dataApi = DataApi.Obtain(Activity); var stats = await dataApi.GetAggregatedStats(); /*var stats = new Dictionary<AggregatedStatsKey, double> { * { AggregatedStatsKey.DailyThisWeek, 4000 }, * { AggregatedStatsKey.DailyThisMonth, 5000 }, * { AggregatedStatsKey.BestTripToday, 6000 }, * { AggregatedStatsKey.BestTripInWeek, 7000 }, * { AggregatedStatsKey.BestTripInMonth, 8000 }, * { AggregatedStatsKey.MeanTripToday, 9000 }, * { AggregatedStatsKey.MeanTripInWeek, 10000 }, * { AggregatedStatsKey.MeanTripInMonth, 11000 }, * };*/ var fillScheme = new Tuple <int, AggregatedStatsKey, int>[] { Tuple.Create(0, AggregatedStatsKey.DailyThisWeek, Resource.Id.statEntry1), Tuple.Create(0, AggregatedStatsKey.DailyThisMonth, Resource.Id.statEntry2), Tuple.Create(1, AggregatedStatsKey.BestTripToday, Resource.Id.statEntry1), Tuple.Create(1, AggregatedStatsKey.BestTripInWeek, Resource.Id.statEntry2), Tuple.Create(1, AggregatedStatsKey.BestTripInMonth, Resource.Id.statEntry3), Tuple.Create(2, AggregatedStatsKey.MeanTripToday, Resource.Id.statEntry1), Tuple.Create(2, AggregatedStatsKey.MeanTripInWeek, Resource.Id.statEntry2), Tuple.Create(2, AggregatedStatsKey.MeanTripInMonth, Resource.Id.statEntry3), }; foreach (var fill in fillScheme) { double value = 0; stats.TryGetValue(fill.Item2, out value); sections [fill.Item1].FindViewById(fill.Item3).FindViewById <TextView> (Resource.Id.numericValue).Text = prefs.GetDisplayDistance(value, strictValue: true); sections [fill.Item1].FindViewById(fill.Item3).FindViewById <TextView> (Resource.Id.unitText).Text = prefs.GetUnitForDistance(value); } }