Пример #1
0
        private void OpenDeleteDialog(int position)
        {
            var builder = new MaterialAlertDialogBuilder(this);

            builder.SetMessage(Resource.String.confirmAuthenticatorDelete);
            builder.SetTitle(Resource.String.warning);
            builder.SetPositiveButton(Resource.String.delete, async delegate
            {
                var auth = _authSource.Get(position);
                await TryCleanupCustomIcon(auth.Icon);

                await _authSource.Delete(position);
                _authListAdapter.NotifyItemRemoved(position);

                await NotifyWearAppOfChange();
                CheckEmptyState();
            });

            builder.SetNegativeButton(Resource.String.cancel, delegate { });
            builder.SetCancelable(true);

            var dialog = builder.Create();

            dialog.Show();
        }
        private void OnDeleteClick(object item, int position)
        {
            var builder = new MaterialAlertDialogBuilder(this);

            builder.SetMessage(Resource.String.confirmCategoryDelete);
            builder.SetTitle(Resource.String.warning);
            builder.SetCancelable(true);

            builder.SetPositiveButton(Resource.String.delete, async delegate
            {
                try
                {
                    await _categorySource.Delete(position);
                }
                catch
                {
                    ShowSnackbar(Resource.String.genericError, Snackbar.LengthShort);
                    return;
                }

                RunOnUiThread(delegate
                {
                    _categoryListAdapter.NotifyItemRemoved(position);
                    CheckEmptyState();
                });
            });

            builder.SetNegativeButton(Resource.String.cancel, delegate { });

            var dialog = builder.Create();

            dialog.Show();
        }
Пример #3
0
            public ErrorReportDialog(Context context, IUpdateChecker server, Exception exception)
            {
                _exception    = exception;
                _updateServer = server;

                var builder = new MaterialAlertDialogBuilder(context);

                builder.SetTitle(Resource.String.title_error);
#if DEBUG
                builder.SetMessage(exception.ToString());
#else
                builder.SetMessage(exception.Message);
#endif
                builder.SetPositiveButton(Resource.String.button_text_report, OnPositiveButtonClick);
                builder.SetNegativeButton(Android.Resource.String.Cancel, (sender, args) => { });
                _dialog = builder.Create();
            }
Пример #4
0
        //loading progress dialog

        public void OnFailure(Java.Lang.Exception e)
        {
            MaterialAlertDialogBuilder alert = new MaterialAlertDialogBuilder(context);

            //Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(context);
            alert.SetTitle("Error");
            alert.SetMessage(e.Message);
            alert.SetNeutralButton("OK", delegate
            {
                alert.Dispose();
            });
            alert.Show();
        }
Пример #5
0
        public void OnComplete(Task task)
        {
            MaterialAlertDialogBuilder alert = new MaterialAlertDialogBuilder(context);

            //Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(context);
            alert.SetTitle("Done");
            alert.SetMessage(task.ToString());
            alert.SetNeutralButton("OK", delegate
            {
                alert.Dispose();
            });
            alert.Show(); loadingDialog.Dismiss();
            BtnRegister.Enabled = true;
        }
Пример #6
0
        public void OnFailure(Java.Lang.Exception e)
        {
            MaterialAlertDialogBuilder alert = new MaterialAlertDialogBuilder(context);

            alert.SetTitle("Error");
            alert.SetMessage(e.ToString());
            alert.SetNeutralButton("OK", delegate
            {
                alert.Dispose();
            });
            alert.Show();

            Console.WriteLine(e);
        }
Пример #7
0
        private void ShowDatabaseErrorDialog()
        {
            var builder = new MaterialAlertDialogBuilder(this);

            builder.SetMessage(Resource.String.databaseError);
            builder.SetTitle(Resource.String.warning);
            builder.SetPositiveButton(Resource.String.quit, delegate
            {
                Finish();
            });
            builder.SetCancelable(true);

            var dialog = builder.Create();

            dialog.Show();
        }
        private void ShowUnencryptedWarning(int warningRes, EventHandler onContinue)
        {
            var builder = new MaterialAlertDialogBuilder(Activity);

            builder.SetTitle(Resource.String.warning);
            builder.SetMessage(warningRes);
            builder.SetCancelable(true);

            builder.SetNegativeButton(Resource.String.cancel, delegate { });
            builder.SetPositiveButton(Resource.String.ok, delegate
            {
                onContinue.Invoke(this, EventArgs.Empty);
            });

            builder.Create().Show();
        }
Пример #9
0
        private void OnDeleteClick(object item, int position)
        {
            var builder = new MaterialAlertDialogBuilder(this);

            builder.SetMessage(Resource.String.confirmCategoryDelete);
            builder.SetTitle(Resource.String.warning);
            builder.SetCancelable(true);

            builder.SetPositiveButton(Resource.String.delete, async delegate
            {
                var category = _categorySource.Get(position);

                if (category == null)
                {
                    return;
                }

                if (_preferences.DefaultCategory == category.Id)
                {
                    SetDefaultCategory(null);
                }

                try
                {
                    await _categorySource.Delete(position);
                }
                catch (Exception e)
                {
                    Logger.Error(e);
                    ShowSnackbar(Resource.String.genericError, Snackbar.LengthShort);
                    return;
                }

                RunOnUiThread(delegate
                {
                    _categoryListAdapter.NotifyItemRemoved(position);
                    CheckEmptyState();
                });
            });

            builder.SetNegativeButton(Resource.String.cancel, delegate { });

            var dialog = builder.Create();

            dialog.Show();
        }
        private void OnDeleteClick(object item, int position)
        {
            var builder = new MaterialAlertDialogBuilder(this);

            builder.SetMessage(Resource.String.confirmCategoryDelete);
            builder.SetTitle(Resource.String.warning);
            builder.SetCancelable(true);

            builder.SetPositiveButton(Resource.String.delete, async(sender, args) =>
            {
                await _categorySource.Delete(position);
                _categoryListAdapter.NotifyItemRemoved(position);
                CheckEmptyState();
            });

            builder.SetNegativeButton(Resource.String.cancel, (sender, args) => { });

            var dialog = builder.Create();

            dialog.Show();
        }
Пример #11
0
        private void TaskAwaiter_TaskDone(object sender, EventArgs e)
        {
            _adapter.NotifyDataSetChanged();

            if (!_didRefresh)
            {
                _didRefresh = true;
                if (((IPreferenceContainer)Activity).GetBoolean(PreferenceKeyAutoRefresh, true))
                {
                    _taskAwaiter.AwaitTask(((IInstagramAccounts)Activity).RefreshAsync());
                    return;
                }
            }

            if (_adapter.ItemCount <= 0)
            {
                ((IFragmentContainer)Activity).ShowEmptyView();

                // Push LoginFragment on first run
                if (!_hasPushedToLoginFragment)
                {
                    ((IFragmentContainer)Activity).PushFragment(new LoginFragment());
                    _hasPushedToLoginFragment = true;
                }
            }
            else if (!_tipShown)
            {
                // Show tip on first run
                var dialog = new MaterialAlertDialogBuilder(Activity);
                dialog.SetTitle(Resource.String.title_tip);
                dialog.SetMessage(Resource.String.msg_tip);
                dialog.Show();

                ((IPreferenceContainer)Activity).SetBoolean(PreferenceKeyTipIsShown, true);

                _tipShown = true;
            }
        }