Exemple #1
0
        private void Fab_Click(object sender, EventArgs e)
        {
            Log.Debug(TAG, $"{nameof(Fab_Click)} - try to show ReportFragment like dialog - START");

            // DialogFragment.show() will take care of adding the fragment
            // in a transaction.  We also want to remove any currently showing
            // dialog, so make our own transaction and take care of that here.
            FragmentTransaction ft   = FragmentManager.BeginTransaction();
            Fragment            prev = FragmentManager.FindFragmentByTag("dialog");

            if (prev != null)
            {
                ft.Remove(prev);
            }
            ft.AddToBackStack(null);


            // Create and show the dialog.
            DialogFragment newFragment = ReportFragment.NewInstance(null, delegate()
            {
                var r = LoadData();

                this.Activity.RunOnUiThread(() =>
                {
                    InitLayout(true, false);
                });
            });

            newFragment.Show(ft, "dialog");

            Log.Debug(TAG, $"{nameof(Fab_Click)} - try to show ReportFragment like dialog - END");
        }
Exemple #2
0
        private void OnListItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            Log.Debug(TAG, nameof(OnListItemClick));

            var item = listData.ElementAt(e.Position);
            FragmentTransaction ft   = FragmentManager.BeginTransaction();
            Fragment            prev = FragmentManager.FindFragmentByTag("dialog");

            if (prev != null)
            {
                ft.Remove(prev);
            }
            ft.AddToBackStack(null);

            Log.Debug(TAG, $"{nameof(OnListItemClick)} - try to show ReportFragment like dialog - START");
            // Create and show the dialog.
            DialogFragment newFragment = ReportFragment.NewInstance(item.IncludeObjects(db), delegate()
            {
                var r = LoadData(((JavaLangObjectWrapper <DateTime>)dateFrom_button.Tag).Value, ((JavaLangObjectWrapper <DateTime>)dateTo_button.Tag).Value, costs_checkBox.Checked, earnings_checkBox.Checked);//.Result;
            });


            newFragment.Show(ft, "dialog");
            Log.Debug(TAG, $"{nameof(OnListItemClick)} - try to show ReportFragment like dialog - END");
        }
Exemple #3
0
        public static ReportFragment NewInstance(Record selectedItem, Action onContinueWith)
        {
            Log.Debug(TAG, $"{nameof(NewInstance)} - {nameof(selectedItem)}:{selectedItem?.ToString()}");

            var frag = new ReportFragment();

            //frag.itemSelectedHandler = onItemSelected;
            frag.SelectedItem          = selectedItem;
            frag.onContinueWithHandler = onContinueWith;
            return(frag);
        }
Exemple #4
0
        private void OnListItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e)
        {
            Log.Debug(TAG, nameof(OnListItemLongClick));

            var item = listData.ElementAt(e.Position);

            Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this.Activity);
            builder.SetMessage(item.ToString())
            .SetPositiveButton(this.Activity.Resources.GetString(Resource.String.Edit), (s, args) =>
            {
                // DialogFragment.show() will take care of adding the fragment
                // in a transaction.  We also want to remove any currently showing
                // dialog, so make our own transaction and take care of that here.
                FragmentTransaction ft = FragmentManager.BeginTransaction();
                Fragment prev          = FragmentManager.FindFragmentByTag("dialog");
                if (prev != null)
                {
                    ft.Remove(prev);
                }
                ft.AddToBackStack(null);

                Log.Debug(TAG, $"{nameof(OnListItemLongClick)} - try to show ReportFragment like dialog - START");
                // Create and show the dialog.
                DialogFragment newFragment = ReportFragment.NewInstance(item.IncludeObjects(db), delegate()
                {
                    var r = LoadData(((JavaLangObjectWrapper <DateTime>)dateFrom_button.Tag).Value, ((JavaLangObjectWrapper <DateTime>)dateTo_button.Tag).Value, costs_checkBox.Checked, earnings_checkBox.Checked);  //.Result;
                });


                newFragment.Show(ft, "dialog");
                Log.Debug(TAG, $"{nameof(OnListItemLongClick)} - try to show ReportFragment like dialog - END");
            })
            //.SetNegativeButton("No", dialogClickListener)
            .SetNegativeButton(this.Activity.Resources.GetString(Resource.String.Delete), (s, args) =>
            {
                if (db.Delete(item).Result)
                {
                    Toast.MakeText(this.Activity, Resources.GetString(Resource.String.Deleted), ToastLength.Short).Show();

                    var r = LoadData(((JavaLangObjectWrapper <DateTime>)dateFrom_button.Tag).Value, ((JavaLangObjectWrapper <DateTime>)dateTo_button.Tag).Value, costs_checkBox.Checked, earnings_checkBox.Checked);  //.Result;
                }
                else
                {
                    Toast.MakeText(this.Activity, Resources.GetString(Resource.String.WasntDeleted), ToastLength.Short).Show();
                }
            })
            .Show();
        }