void Transform_Clicked(object sender, System.EventArgs e) { var grayscale = new GrayscaleTransformation(); var blur = new BlurredTransformation(5); var corners = new CornersTransformation(4, CornerTransformType.AllCut); Image.Transformations.Add(grayscale); Image.Transformations.Add(blur); Image.Transformations.Add(corners); Image.ReloadImage(); }
public void ApplyFilter(CustomImageView imageView, ImageFilter imageFilter, Activity activity, ProgressBar progressbar) { ITransformation transform = null; switch (imageFilter.FilterName) { case "Circle crop": transform = new CropCircleTransformation(activity); break; case "Grayscale": transform = new GrayscaleTransformation(); break; case "Inverted colors": transform = new InvertColorsTransformation(); break; case "Blurred": transform = new BlurTransformation(activity); break; case "Alpha fade": transform = new AlphaFade(activity); break; case "Inverse circle crop": transform = new InvertCropCircleTransformation(activity); break; default: break; } Action onSucces = delegate { Animation fadeOut = new AlphaAnimation(0, 1); fadeOut.Interpolator = new AccelerateInterpolator(); fadeOut.Duration = 1000; imageView.StartAnimation(fadeOut); progressbar.Visibility = ViewStates.Gone; }; Action onError = delegate { }; if (transform != null) { Picasso.With(activity.ApplicationContext) .Load(imageFilter.ImageUrl) .Resize(IMAGE_SIZE, IMAGE_SIZE) .Transform(transform) .NoFade() .Into(imageView, onSucces, onError); } else { Picasso.With(activity.ApplicationContext) .Load(imageFilter.ImageUrl) .Resize(IMAGE_SIZE, IMAGE_SIZE) .NoFade() .Into(imageView, onSucces, onError); } }
//XFormsApplicationDelegate public override bool FinishedLaunching(UIApplication app, NSDictionary options) { this.SetIoc(); CachedImageRenderer.Init(); var ignore = new GrayscaleTransformation(); Rg.Plugins.Popup.IOS.Popup.Init(); //JPUSHService.SetDebugMode(); Xamarin.Behaviors.Infrastructure.Init(); RegistUpdateNavigationBar(); global::Xamarin.Forms.Forms.Init(); CopyLocalDB(); LoadApplication(new App()); Xamarin.Forms.Forms.ViewInitialized += (sender, e) => { if (!string.IsNullOrWhiteSpace(e.View.StyleId)) { e.NativeView.AccessibilityIdentifier = e.View.StyleId; } }; /***** * //jpush init start * //string advertisingId = ASIdentifierManager.SharedManager.AdvertisingIdentifier.ToString(); * if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0)) * { * //JPUSHRegisterEntity pushEntity = new JPUSHRegisterEntity(); * //pushEntity.Types = 4 | 1 | 2; * //JPushNotifyEvent notifyEvent = new JPushNotifyEvent(); * //JPUSHService.RegisterForRemoteNotificationConfig(pushEntity, notifyEvent); * } * else if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) * { * JPUSHService.RegisterForRemoteNotificationTypes(4 | 1 | 2, new NSSet()); * } * else * { * JPUSHService.RegisterForRemoteNotificationTypes(4 | 1 | 2, new NSSet()); * } * * try * { * if (options == null) * { * options = new NSDictionary("_j_msgid", "-1", "aps", * new NSDictionary("alert", "12345", "badge", "0", "sound", "default")); * //options.SetValueForKey(new NSString("-1"), new NSString("_j_msgid")); * //NSDictionary subDic = new NSDictionary(); * //subDic.SetValueForKey(new NSString("alert"), new NSString("123456")); * //subDic.SetValueForKey(new NSString("badge"), new NSString("1")); * //subDic.SetValueForKey(new NSString("sound"), new NSString("default")); * //options.SetValueForKey(subDic, new NSString("aps")); * * JPUSHService.SetupWithOption(options, "35d7e27236095f67b93966b3", "", false, ""); * //JPUSHService.SetupWithOption(options, "5af3416249f70699720994dd", "", true, ""); * } * else * { * JPUSHService.SetupWithOption(options, "35d7e27236095f67b93966b3", "", false, ""); * //JPUSHService.SetupWithOption(options, "5af3416249f70699720994dd", "", true, ""); * } * } * catch (Exception) * { * * } ******/ if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0)) { // Request notification permissions from the user UNUserNotificationCenter.Current.RequestAuthorization(UNAuthorizationOptions.Alert | UNAuthorizationOptions.Sound | UNAuthorizationOptions.Badge, (approved, err) => { // Handle approval if (approved) { UIApplication.SharedApplication.BeginInvokeOnMainThread(() => { UIApplication.SharedApplication.RegisterForRemoteNotifications(); UNUserNotificationCenter.Current.Delegate = new NotificationDelegate(); }); } }); } else if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var pushSettings = UIUserNotificationSettings.GetSettingsForTypes( UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, new NSSet()); UIApplication.SharedApplication.RegisterUserNotificationSettings(pushSettings); UIApplication.SharedApplication.RegisterForRemoteNotifications(); } else { UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound; UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes); } UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0; //jpush init end //app.ApplicationIconBadgeNumber = 0; //JPUSHService.ResetBadge(); ConfigureApplicationTheming(); App.ScreenHeight = int.Parse(UIScreen.MainScreen.Bounds.Height.ToString()); App.ScreenWidth = int.Parse(UIScreen.MainScreen.Bounds.Width.ToString()); return(base.FinishedLaunching(app, options)); }