private void Wallpaper_NewWallpaperIssued(object sender, WallpaperChangedEventArgs e) { RunOnUiThread(() => { if (e.BlurLevel > 0) { if (e.Wallpaper?.Bitmap != null) { BlurImage blurImage = new BlurImage(Application.Context); blurImage.Load(e.Wallpaper.Bitmap).Intensity(e.BlurLevel); e.Wallpaper = new BitmapDrawable(Resources, blurImage.GetImageBlur()); } } if (configurationManager.RetrieveAValue(ConfigurationParameters.DisableWallpaperChangeAnim) == false) //If the animation is not disabled. { Window.DecorView.Animate().SetDuration(100).Alpha(0.5f); } if (e.Wallpaper == null) { Window.DecorView.SetBackgroundColor(Color.Black); } else { e.Wallpaper.Alpha = e.OpacityLevel; Window.SetBackgroundDrawable(null); //Clear wallpaper first(?) Window.SetBackgroundDrawable(e.Wallpaper); } }); GC.Collect(); }
private void WallpaperPublisher_NewWallpaperIssued(object sender, WallpaperChangedEventArgs e) { if (e.Wallpaper?.Bitmap != null) { RunOnUiThread(() => { Window.DecorView.Background = e.Wallpaper; }); } }
private void Wallpaper_NewWallpaperIssued(object sender, WallpaperChangedEventArgs e) { if (e.SecondsOfAttention != 0) { //ThreadPool.QueueUserWorkItem(m => wallpaper.StartAnimation(fadeoutanimation)); ////Grab the previous wallpaper so after the time has passed I can set the previous wallpaper. //var previousWallpaper = wallpaper.Background; //wallpaper.Background = e.Wallpaper; //ThreadPool.QueueUserWorkItem(method => //{ // Thread.Sleep(e.SecondsOfAttention * 1000); // if (wallpaper != null) // { // RunOnUiThread(() => wallpaper.Background = previousWallpaper); // } //} //); } else { RunOnUiThread(() => { wallpaper.StartAnimation(fadeoutanimation); if (e.Wallpaper == null) { wallpaper.SetBackgroundColor(Color.Black); } else { wallpaper.Background = e.Wallpaper; wallpaper.Background.Alpha = e.OpacityLevel; } }); } GC.Collect(); }
private void Wallpaper_NewWallpaperIssued(object sender, WallpaperChangedEventArgs e) { RunOnUiThread(() => { if (configurationManager.RetrieveAValue(ConfigurationParameters.AwakeCausesBlackWallpaper)) { Window.DecorView.SetBackgroundColor(Color.Black); return; } if (configurationManager.RetrieveAValue(ConfigurationParameters.DisableWallpaperChangeAnim) == false) //If the animation is not disabled. { if (ActivityLifecycleHelper.GetInstance().GetActivityState(typeof(LockScreenActivity)) == ActivityStates.Resumed) { //Animate only when the activity is visible to the user. Window.DecorView.Animate().SetDuration(100).Alpha(0.5f); } } if (e.Wallpaper?.Bitmap != null) { Window.DecorView.Background = e.Wallpaper; } }); }