public TasksPage() { InitializeComponent(); Debug.WriteLine("===== IN TASKS PAGE"); database = SQLite_Android.GetConnection(); GoToHabit = new Command(MoveToTask); render_tasks(); var scrollView = new ScrollView { Content = grid }; this.Content = scrollView; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource. This is what the user will see when the program opens. SetContentView(Resource.Layout.Main); //Prepares and installs the database on first load if the DB isn't set up. SQLite_Android.NewDatabase(); //Initializes the text views to ready them to accept and show data. calculatorTop = FindViewById <TextView>(Resource.Id.calculator_top_view); calculatorMiddle = FindViewById <TextView>(Resource.Id.calculator_middle_view); calculatorBottom = FindViewById <TextView>(Resource.Id.calculator_bottom_view); db_return = FindViewById <TextView>(Resource.Id.db_return); //pulls up the zip code entry point for the user so the information can be //passed to the search of the database and back to be displayed at the top of the screen. Button button = FindViewById <Button>(Resource.Id.Zip); button.Click += delegate { LayoutInflater layoutInflater = LayoutInflater.From(this); View view = layoutInflater.Inflate(Resource.Layout.Get_Zip, null); AlertDialog.Builder zipAlert = new AlertDialog.Builder(this); zipAlert.SetView(view); var zip_Code = view.FindViewById <EditText>(Resource.Id.editZip); zipAlert.SetCancelable(false); zipAlert.SetPositiveButton("Submit", delegate { zipCode = zip_Code.Text; Toast.MakeText(this, "Submit Input: " + zip_Code.Text, ToastLength.Short).Show(); GetTaxes(); }); zipAlert.SetNegativeButton("Cancel", delegate { zipAlert.Dispose(); }); AlertDialog dialog = zipAlert.Create(); dialog.Show(); }; }
public SQLiteController() { database = SQLite_Android.GetConnection(); }
public override void OnReceive(Context context, Intent intent) { var message = intent.GetStringExtra("message"); var title = intent.GetStringExtra("title"); var id = intent.GetStringExtra("id"); if (title == "Um Minuto de Presença") { id = id.Remove(id.Length - 1); var notIntent = new Intent(context, typeof(MainActivity)); var contentIntent = PendingIntent.GetActivity(context, 0, notIntent, PendingIntentFlags.CancelCurrent); var manager = NotificationManagerCompat.From(context); SQLite_Android sqlite = new SQLite_Android(); PlatformNotifier pf = new PlatformNotifier(); NotificacaoDAO dao = new NotificacaoDAO(sqlite.GetConnection(), pf); ObservableCollection <Notificacao> notificacoes = dao.Notificacoes; var numero = Convert.ToInt32(id); var notificacao = (from not in notificacoes where not.ID == numero select not).FirstOrDefault <Notificacao>(); if (!notificacao.Repetir) { dao.DesativarNotificacao(notificacao); } //gerando notificacao para disparo var builder = new Notification.Builder(context) .SetContentIntent(contentIntent) .SetSmallIcon(Resource.Drawable.ic_notification) .SetContentTitle(title) .SetContentText(message) .SetWhen(Java.Lang.JavaSystem.CurrentTimeMillis()) .SetAutoCancel(true); if (notificacao.Vibrar) { builder.SetDefaults(NotificationDefaults.Vibrate); } if (notificacao.Som) { builder.SetSound(Android.Net.Uri.Parse("android.resource://" + context.ApplicationContext.PackageName + "/Raw/" + Resource.Raw.som_notificacao)); } var notification = builder.Build(); manager.Notify(0, notification); } else { SQLite_Android sqlite = new SQLite_Android(); PlatformNotifier pf = new PlatformNotifier(); NotificacaoDAO dao = new NotificacaoDAO(sqlite.GetConnection(), pf); ObservableCollection <Notificacao> notificacoes = dao.Notificacoes; for (int i = 0; i < notificacoes.Count; i++) { if (notificacoes[i].Ativado) { dao.AtivarNotificacao(notificacoes[i]); } } } }
public void callCustomDialog(bool hummingMaximo, bool umdpMaximo, MeditacaoUMDPViewModel umdpvm) { SQLite_Android sqlite = new SQLite_Android(); MeditacaoDAO dao = new MeditacaoDAO(sqlite.GetConnection()); Meditacao tempos = dao.TemposMeditacao[0]; umdp = umdpvm; hummingConcluido = !hummingMaximo; umdpConcluido = !umdpMaximo; var context = Android.App.Application.Context; var inflater = context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater; var view = inflater.Inflate(Resource.Layout.layout1, null); var layoutHumming = view.FindViewById <Android.Widget.LinearLayout>(Resource.Id.layoutHumming); var layoutUMDP = view.FindViewById <Android.Widget.LinearLayout>(Resource.Id.layoutUMDP); var layoutPrincipal = view.FindViewById <Android.Widget.LinearLayout>(Resource.Id.layoutPrincipal); btHummingSim = view.FindViewById <Android.Widget.Button>(Resource.Id.btHummingSim); btHummingNao = view.FindViewById <Android.Widget.Button>(Resource.Id.btHummingNao); btUMDPSim = view.FindViewById <Android.Widget.Button>(Resource.Id.btUMDPSim); btUMDPNao = view.FindViewById <Android.Widget.Button>(Resource.Id.btUMDPNao); btHummingSim.Click += (sender, args) => { tempos.TempoMaximoHumming += 5; dao.AtualizarMeditacao(tempos); acoesBotoesHumming(); }; btHummingNao.Click += (sender, args) => { acoesBotoesHumming(); }; btUMDPSim.Click += (sender, args) => { tempos.TempoMaximoUMDP += 5; dao.AtualizarMeditacao(tempos); acoesBotoesUMDP(); }; btUMDPNao.Click += (sender, args) => { acoesBotoesUMDP(); }; if (!hummingMaximo) { layoutPrincipal.RemoveView(layoutHumming); //layoutHumming.Visibility = ViewStates.Invisible; } if (!umdpMaximo) { layoutPrincipal.RemoveView(layoutUMDP); //layoutUMDP.Visibility = ViewStates.Invisible; } AlertDialog.Builder builder = new AlertDialog.Builder(Forms.Context) .SetView(view); alert = builder.Create(); alert.SetCanceledOnTouchOutside(false); alert.Show(); }