public override void OnReceive(Context context, Intent intent) { var prefs = new PreferenceManager (context); if (!prefs.FirstTimeAround && prefs.Enabled) { var actRecognitionHandler = new ActivityRecognitionHandler (context); actRecognitionHandler.SetTrackingEnabled (true); } }
public void Setup() { prefs = new PreferenceManager (context); using (var editor = prefs.Preferences.Edit ()) { editor.Clear (); editor.Commit (); } }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); firstCreate = true; handler = new Handler (); prefs = new PreferenceManager (this); SetContentView (Resource.Layout.Main); circlesLayout = FindViewById (Resource.Id.circlesLayout); notificationPanel = FindViewById (Resource.Id.notificationPanel); rideInfoPanel = FindViewById (Resource.Id.rideInfoPanel); lastTrip = FindViewById<TextView> (Resource.Id.lastTripText); var circles = CircleBadges; circles[0].Distance = prefs.GetLastMeasure ("day", TimeSpan.FromDays (1)); circles[1].Distance = prefs.GetLastMeasure ("week", TimeSpan.FromDays (7)); circles[2].Distance = prefs.GetLastMeasure ("month", TimeSpan.FromDays (30)); circlesLayout.ViewTreeObserver.AddOnGlobalLayoutListener (this); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); firstCreate = true; handler = new Handler (); prefs = new PreferenceManager (this); circlesFragment = new CirclesFragment (); statsFragment = new StatsFragment (); SetContentView (Resource.Layout.Main); pager = FindViewById<Android.Support.V4.View.ViewPager> (Resource.Id.mainPager); pager.Adapter = new StaticFragmentPagerAdapter (SupportFragmentManager, circlesFragment, statsFragment); background = new DynamicGradientDrawable (Resources.GetColor (Resource.Color.top_shade_1), Resources.GetColor (Resource.Color.bottom_shade_1), Resources.GetColor (Resource.Color.top_shade_2), Resources.GetColor (Resource.Color.bottom_shade_2)); pager.SetBackgroundDrawable (background); pager.PageScrolled += HandlePageScrolled; pager.OverScrollMode = OverScrollMode.Never; if (prefs.FirstTimeAround) pager.Touch += DiscardTouchEventHandler; circlesTab = ActionBar.NewTab ().SetIcon (Resource.Drawable.ic_tab_circles); statsTab = ActionBar.NewTab ().SetIcon (Resource.Drawable.ic_tab_stats); circlesTab.TabSelected += (sender, e) => pager.SetCurrentItem (0, true); statsTab.TabSelected += (sender, e) => pager.SetCurrentItem (1, true); ActionBar.AddTab (circlesTab); ActionBar.AddTab (statsTab); pager.PageSelected += (sender, e) => ActionBar.SetSelectedNavigationItem (e.Position); circlesFragment.CirclesReady += OnCirclesReady; }
void Initialize() { if (robotoCondensed == null) LoadTypefaces (Context.Assets); prefs = new PreferenceManager (Context); digitPaint = new Paint { AntiAlias = true, Color = Color.White, TextAlign = Paint.Align.Center, TextScaleX = .85f }; unitPaint = new Paint { AntiAlias = true, Color = Color.Rgb (0xc0, 0xba, 0xb0), TextAlign = Paint.Align.Center, }; descPaint = new Paint { AntiAlias = true, Color = Color.Rgb (0xdb, 0xd7, 0xcf), TextAlign = Paint.Align.Center, }; unitPaint.SetTypeface (robotoCondensed); descPaint.SetTypeface (robotoCondensed); SetBackgroundResource (Resource.Drawable.circle); }
public override void OnCreate() { base.OnCreate (); if (prefs == null) prefs = new PreferenceManager (this); var thread = new HandlerThread ("IntentService[BikrActivityService]"); thread.Start (); serviceLooper = thread.Looper; serviceHandler = new ServiceHandler (this, serviceLooper); }
public override void OnAttach (Android.App.Activity activity) { base.OnAttach (activity); if (prefs == null) prefs = new PreferenceManager (activity); }