private void OnMenuSelected(int i) { if (_menuContext == null) { return; } switch (i) { case 0: _menuContext.SaveCommand.Execute(null); break; case 1: _menuContext.CopyAndWaifuCommand.Execute(null); break; case 2: _menuContext.OpenRedditCommand.Execute(null); break; case 3: _menuContext.CopyLinkCommand.Execute(null); break; } _menu?.Dismiss(true); _menu = null; _menuContext = null; }
private void DataTemplateBasic(View view, int i2, WallpaperItemViewModel arg3) { view.FindViewById <TextView>(Resource.Id.WallpapersPageItemDate).Text = arg3.Created; view.FindViewById <TextView>(Resource.Id.WallpapersPageItemSubreddit).Text = $"/r/{arg3.Data.Source}"; view.FindViewById <TextView>(Resource.Id.WallpapersPageItemTitle).Text = arg3.Data.Title; view.FindViewById <TextView>(Resource.Id.WallpapersPageItemUpvotes).Text = arg3.Data.Upvotes.ToString(); view.FindViewById(Resource.Id.WallpapersPageItemRootContainer).Tag = arg3.Wrap(); }
private void DataTemplateFull(View view, int i2, WallpaperItemViewModel arg3) { var img = view.FindViewById <ImageViewAsync>(Resource.Id.WallpapersPageItemImage); if (img.Tag == null || (string)img.Tag != arg3.Data.FileUrl) { img.Into(arg3.Data.Thumb, arg3.IsBlurred ? new BlurredTransformation(40) : null, null, 350); } }
private void DataTemplateFling(View view, int i2, WallpaperItemViewModel arg3) { var img = view.FindViewById <ImageViewAsync>(Resource.Id.WallpapersPageItemImage); if (!img.IntoIfLoaded(arg3.Data.FileUrl, arg3.IsBlurred ? new BlurredTransformation(40) : null)) { img.Visibility = ViewStates.Gone; } }
//private void OnCompleted(ImageViewAsync imageViewAsync) //{ // Activity?.RunOnUiThread(() => // { // try // { // var parent = (imageViewAsync.Parent as View); // var vm = parent.Tag.Unwrap<WallpaperItemViewModel>(); // if (!string.IsNullOrEmpty(vm.Resolution)) // return; // var bounds = imageViewAsync.Drawable.Bounds; // vm.Resolution = $"{bounds.Right}x{bounds.Bottom}"; // parent.FindViewById<TextView>(Resource.Id.WallpapersPageItemResolution).Text = vm.Resolution; // imageViewAsync.Visibility = ViewStates.Visible; // } // catch (Exception) // { // // user navigated out and image has loaded in background // } // }); //} private void OnLongClickAction(View view) { _menuContext = view.Tag.Unwrap <WallpaperItemViewModel>(); _menu = FlyoutMenuBuilder.BuildGenericFlyout(Context, view, new List <string> { "Save", "Copy link & open waifu2x", "Open on reddit", "Copy link", }, OnMenuSelected); _menu.Show(); }