예제 #1
0
 private void CleanupDialog()
 {
     AndroidUtilities.HideKeyboard();
     _tagsDialogBindings?.ForEach(binding => binding.Detach());
     _tagsDialog?.Dismiss();
     MainActivity.CurrentContext.DialogToCollapseOnBack = null;
 }
예제 #2
0
 private static void CleanupTagsDialog()
 {
     ViewModelLocator.NavMgr.ResetOneTimeMainOverride();
     _tagsDialogBindings.ForEach(binding => binding.Detach());
     _tagsDialog?.Dismiss();
     _scoreDialog = null;
 }
예제 #3
0
        public void ShowDialog(Context context, ProfileData data, ProfilePageGeneralTabFragment parent)
        {
            var dialogBuilder = DialogPlus.NewDialog(context);

            dialogBuilder.SetGravity((int)GravityFlags.Center);
            dialogBuilder.SetContentHolder(new ViewHolder(Resource.Layout.FriendRequestDialog));
            dialogBuilder.SetContentBackgroundResource(global::Android.Resource.Color.Transparent);
            dialogBuilder.SetOnDismissListener(
                new DialogDismissedListener(() => ViewModelLocator.NavMgr.ResetOneTimeOverride()));

            _dialog = dialogBuilder.Create();

            var dialogView = _dialog.HolderView;

            dialogView.FindViewById <ImageViewAsync>(Resource.Id.Image).Into(data.User.ImgUrl, new CircleTransformation());

            dialogView.FindViewById(Resource.Id.SubmitButton).SetOnClickListener(new OnClickListener(view =>
            {
                ViewModelLocator.ProfilePage.SendFriendRequestCommand.Execute(dialogView
                                                                              .FindViewById <EditText>(Resource.Id.TextBox).Text);
                _dialog.Dismiss();
                parent.ProfilePageGeneralTabSendRequestButton.Visibility = ViewStates.Gone;
            }));
            _dialog.Show();
        }
예제 #4
0
 private static void CleanupVideosDialog()
 {
     _videosDialogBindings.ForEach(binding => binding.Detach());
     _videosDialogBindings = new List <Binding>();
     _videosDialog?.Dismiss();
     _videosDialog = null;
 }
 private static void CleanupVideosDialog()
 {
     ViewModelLocator.NavMgr.ResetOneTimeMainOverride();
     _videosDialogBindings.ForEach(binding => binding.Detach());
     _videosDialogBindings = new List <Binding>();
     _videosDialog?.Dismiss();
     _videosDialog = null;
 }
예제 #6
0
 private static void CleanupWatchedDialog()
 {
     ViewModelLocator.NavMgr.ResetOneTimeMainOverride();
     _watchedDialogBindings.ForEach(binding => binding.Detach());
     _watchedDialogBindings = new List <Binding>();
     _watchedDialog?.Dismiss();
     _watchedDialog        = null;
     _watchedDialogContext = null;
     _watchedDialogAction  = null;
 }
 private static void CleanupForumPostTextInputDialog(bool success)
 {
     if (_forumTextInputDialog == null)
     {
         return;
     }
     AndroidUtilities.HideKeyboard();
     _success = success;
     _semaphoreForumTextInput.Release();
     _forumTextInputDialog.Dismiss();
     _forumTextInputDialog.Dispose();
     _forumTextInputDialog = null;
 }
예제 #8
0
 private static void CleanupWatchedDialog()
 {
     if (_watchedDialog != null)
     {
         AndroidUtilities.HideKeyboard();
         _watchedDialog.Dismiss();
     }
     _watchedDialogBindings.ForEach(binding => binding.Detach());
     _watchedDialogBindings = new List <Binding>();
     _watchedDialog         = null;
     _watchedDialogContext  = null;
     _watchedDialogAction   = null;
     MainActivity.CurrentContext.DialogToCollapseOnBack = null;
 }
 private static void CleanupTextInputDialog(bool success)
 {
     if (_textInputDialog == null)
     {
         return;
     }
     _success = success;
     AndroidUtilities.HideKeyboard();
     ViewModelLocator.NavMgr.ResetOneTimeOverride();
     _semaphoreTextInput.Release();
     _textInputDialog.Dismiss();
     _textInputDialog.Dispose();
     _textInputDialog = null;
 }
예제 #10
0
        private static void CleanupGoPageDialog(DialogResult success)
        {
            if (_goPageDialog == null)
            {
                return;
            }
            AndroidUtilities.HideKeyboard();
            switch (success)
            {
            case DialogResult.Cancel:
                _result = null;
                break;

            case DialogResult.LastPage:
                _result = -2;
                break;

            case DialogResult.FirstPage:
                _result = -1;
                break;

            case DialogResult.InputPage:
                var text = _goPageDialog.HolderView.FindViewById <EditText>(Resource.Id.ForumGoToPageDialogTextBox)
                           .Text;
                if (int.TryParse(text, NumberStyles.Any, CultureInfo.InvariantCulture, out int page))
                {
                    _result = page;
                }
                else
                {
                    _result = null;
                }
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(success), success, null);
            }

            GoPageSemaphore.Release();
            _goPageDialog.Dismiss();
            _goPageDialog.Dispose();
            _goPageDialog = null;
        }
예제 #11
0
        public void ShowDialog(Context context, string link)
        {
            var animeLink = AnimeImageExtensions.GetImgUrl(link);

            if (animeLink == null || link == "https://myanimelist.cdn-dena.com/images/anime//0.jpg")
            {
                ResourceLocator.SnackbarProvider.ShowText("Failed obatining image.");
                return;
            }
            var dialogBuilder = DialogPlus.NewDialog(context);

            dialogBuilder.SetGravity((int)GravityFlags.Center);
            dialogBuilder.SetContentHolder(new ViewHolder(Resource.Layout.AnimeDetailsKeyImageDialog));
            dialogBuilder.SetContentBackgroundResource(global::Android.Resource.Color.Transparent);
            dialogBuilder.SetOnDismissListener(
                new DialogDismissedListener(() => ViewModelLocator.NavMgr.ResetOneTimeOverride()));

            _dialog = dialogBuilder.Create();

            var dialogView = _dialog.HolderView;


            dialogView.FindViewById <ImageViewAsync>(Resource.Id.Image).Into(animeLink, null,
                                                                             async =>
            {
                var zoomable      = async as ZoomableImageView;
                zoomable.bmHeight = (async.Drawable as SelfDisposingBitmapDrawable).Bitmap.Height;
                zoomable.bmWidth  = (async.Drawable as SelfDisposingBitmapDrawable).Bitmap.Width;
            });
            dialogView.FindViewById(Resource.Id.SaveButton).SetOnClickListener(
                new OnClickListener(view => ViewModelLocator.AnimeDetails.SaveImageCommand.Execute(null)));

            ViewModelLocator.NavMgr.RegisterOneTimeMainOverride(new RelayCommand(() => _dialog.Dismiss()));
            _dialog.Show();
        }
예제 #12
0
        public void ShowDialog(Context context, View rootView, string html)
        {
            var dialogBuilder = DialogPlus.NewDialog(context);

            dialogBuilder.SetGravity((int)GravityFlags.Center);
            dialogBuilder.SetContentHolder(new ViewHolder(Resource.Layout.ProfileDescriptionDialog));
            dialogBuilder.SetContentBackgroundResource(global::Android.Resource.Color.Transparent);
            dialogBuilder.SetOnDismissListener(
                new DialogDismissedListener(() => ViewModelLocator.NavMgr.ResetOneTimeOverride()));

            dialogBuilder.SetMargin(0, 0, 0, 0);
            _dialog = dialogBuilder.Create();

            var dialogView = _dialog.HolderView;

            dialogView.LayoutParameters.Height = rootView.Height - DimensionsHelper.DpToPx(16 * 2);
            dialogView.SetMargins(0, 16, 0, 0);
            var webView = dialogView.FindViewById <WebView>(Resource.Id.WebView);
            var client  = new ListenableWebClient {
                NavigationInterceptOpportunity = NavigationInterceptOpportunity
            };

            webView.Settings.JavaScriptEnabled = true;
            webView.Settings.SetSupportZoom(true);
            webView.Settings.DisplayZoomControls = false;
            webView.SetWebViewClient(client);
            webView.Settings.BuiltInZoomControls = true;
            webView.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.SingleColumn);
            webView.SetBackgroundColor(new Color(ResourceExtension.BrushAnimeItemInnerBackground));

            webView.Post(() =>
            {
                var scale = (100 - 735 * 100 / (dialogView.Width == 0 ? 300 : dialogView.Width)) + 100;
                webView.SetInitialScale(scale);
                //WebView.SetPadding(DimensionsHelper.DpToPx(15),0,0,0);
            });

            webView.LoadDataWithBaseURL(null,
                                        ResourceLocator.CssManager.WrapWithCss(html, false, 800),
                                        "text/html; charset=utf-8", "UTF-8", null);
            ViewModelLocator.NavMgr.RegisterOneTimeMainOverride(new RelayCommand(() => _dialog.Dismiss()));
            _dialog.Show();
        }
예제 #13
0
 private static void CleanupStatusDialog()
 {
     ViewModelLocator.NavMgr.ResetOneTimeMainOverride();
     _statusDialog?.Dismiss();
     _statusDialog = null;
 }
예제 #14
0
 private static void CleanupChangelogDialog()
 {
     _changelogDialog.Dismiss();
 }
예제 #15
0
        public static void BuildChangelogDialog(IChangeLogProvider changeLogProvider)
        {
            var dialogBuilder = DialogPlus.NewDialog(MainActivity.CurrentContext);

            dialogBuilder.SetGravity((int)(GravityFlags.Top));
            dialogBuilder.SetMargin(DimensionsHelper.DpToPx(40), DimensionsHelper.DpToPx(75), DimensionsHelper.DpToPx(2), 0);
            dialogBuilder.SetContentHolder(new ViewHolder(Resource.Layout.ChangelogDialog));
            dialogBuilder.SetContentBackgroundResource(Resource.Color.Transparent);
            dialogBuilder.SetOnDismissListener(
                new DialogDismissedListener(() => ViewModelLocator.NavMgr.ResetOneTimeOverride()));
            ViewModelLocator.NavMgr.RegisterOneTimeMainOverride(new RelayCommand(CleanupChangelogDialog));
            _changelogDialog = dialogBuilder.Create();
            var dialogView = _changelogDialog.HolderView;

            dialogView.FindViewById <TextView>(Resource.Id.ChangelogDialogHeader).Text = changeLogProvider.DateWithVersion;
            dialogView.FindViewById(Resource.Id.ChangelogDialogCloseButton).SetOnClickListener(new OnClickListener(view => _changelogDialog.Dismiss()));
            dialogView.FindViewById <LinearLayout>(Resource.Id.ChangelogDialogChangesList).SetAdapter(changeLogProvider.Changelog.GetAdapter(
                                                                                                          (i, s, arg3) =>
            {
                var view = new TextView(MainActivity.CurrentContext);
                view.SetTextColor(new Color(ResourceExtension.BrushText));
                view.Text = $"• {s}";
                return(view);
            }));

            _changelogDialog.Show();
        }