public override void OnReceive(Context context, Intent intent) { bool bootCompleted; string action = intent.Action; //TODO Switch to UserManagerCompat, BuildCompat Log.Info(TAG, $"Recieved action {action}, user unlocked: "); //{UserManagerCompat.IsUserUnlocked (context))}"); if (Build.VERSION.SdkInt > BuildVersionCodes.M) { bootCompleted = Intent.ActionLockedBootCompleted == action; } else { bootCompleted = Intent.ActionBootCompleted == action; } if (!bootCompleted) { return; } var util = new AlarmUtil(context); var alarmStorage = new AlarmStorage(context); foreach (Alarm alarm in alarmStorage.GetAlarms()) { util.ScheduleAlarm(alarm); } }
public override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); var fab = (FloatingActionButton)view.FindViewById(Resource.Id.fab_add_alarm); fab.Click += delegate { var fragment = TimePickerFragment.NewInstance(); fragment.SetAlarmAddListener(new AlarmAddListenerImpl(this)); fragment.Show(FragmentManager, FRAGMENT_TIME_PICKER_TAG); }; TextViewIntroMessage = (TextView)view.FindViewById(Resource.Id.text_intro_message); var alarmStorage = new AlarmStorage(Activity); AlarmAdapter = new AlarmAdapter(Activity, alarmStorage.GetAlarms()); if (AlarmAdapter.ItemCount == 0) { TextViewIntroMessage.Visibility = ViewStates.Visible; } var recyclerView = (RecyclerView)view.FindViewById(Resource.Id.recycler_view_alarms); recyclerView.SetLayoutManager(new LinearLayoutManager(Activity)); recyclerView.SetAdapter(AlarmAdapter); recyclerView.AddItemDecoration(new DividerItemDecorrection(Activity)); AlarmUtil = new AlarmUtil(Activity); }
public override void OnReceive(Context context, Intent intent) { bool bootCompleted; string action = intent.Action; //TODO Switch to UserManagerCompat, BuildCompat Log.Info (TAG, $"Recieved action {action}, user unlocked: "); //{UserManagerCompat.IsUserUnlocked (context))}"); if (Build.VERSION.SdkInt > BuildVersionCodes.M) bootCompleted = Intent.ActionLockedBootCompleted == action; else bootCompleted = Intent.ActionBootCompleted == action; if (!bootCompleted) return; var util = new AlarmUtil (context); var alarmStorage = new AlarmStorage (context); foreach (Alarm alarm in alarmStorage.GetAlarms ()) util.ScheduleAlarm (alarm); }
public override void OnViewCreated (View view, Bundle savedInstanceState) { base.OnViewCreated (view, savedInstanceState); var fab = (FloatingActionButton)view.FindViewById (Resource.Id.fab_add_alarm); fab.Click += delegate { var fragment = TimePickerFragment.NewInstance (); fragment.SetAlarmAddListener (new AlarmAddListenerImpl (this)); fragment.Show (FragmentManager, FRAGMENT_TIME_PICKER_TAG); }; TextViewIntroMessage = (TextView)view.FindViewById (Resource.Id.text_intro_message); var alarmStorage = new AlarmStorage (Activity); AlarmAdapter = new AlarmAdapter (Activity, alarmStorage.GetAlarms ()); if (AlarmAdapter.ItemCount == 0) TextViewIntroMessage.Visibility = ViewStates.Visible; var recyclerView = (RecyclerView)view.FindViewById (Resource.Id.recycler_view_alarms); recyclerView.SetLayoutManager (new LinearLayoutManager (Activity)); recyclerView.SetAdapter (AlarmAdapter); recyclerView.AddItemDecoration (new DividerItemDecorrection (Activity)); AlarmUtil = new AlarmUtil (Activity); }