Пример #1
0
        private void MusicControllerKitkat_MediaMetadataChanged(object sender, MediaMetadataChangedKitkatEventArgs e)
        {
            Activity?.RunOnUiThread(() =>
            {
                tvTitle.Text        = e.Title;
                tvAlbum.Text        = e.Album;
                tvArtist.Text       = e.Artist;
                skbSeekSongTime.Max = (int)e.Duration;
                int opacitylevel    = configurationManager.RetrieveAValue(ConfigurationParameters.AlbumArtOpacityLevel, 255);
                int blurLevel       = configurationManager.RetrieveAValue(ConfigurationParameters.AlbumArtBlurLevel, 1); //Never used (for now)
                CurrentAlbumArt     = new BitmapDrawable(Resources, e.AlbumArt);

                if (configurationManager.RetrieveAValue(ConfigurationParameters.ShowAlbumArt))
                {
                    WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs
                    {
                        Wallpaper       = new BitmapDrawable(Resources, e.AlbumArt),
                        OpacityLevel    = (short)opacitylevel,
                        BlurLevel       = 0,                          //Causes a crash That currently I cant debug, damn, thats why is 0. (No blur) and ignoring the value the used have setted.
                        WallpaperPoster = WallpaperPoster.MusicPlayer //We must nutify WallpaperPublisher who is posting the wallpaper, otherwise it'll be ignored.
                    });
                }
                GC.Collect(0);
            });
        }
Пример #2
0
        private void MusicController_MediaMetadataChanged(object sender, MediaMetadataChangedEventArgs e)
        {
            Activity?.RunOnUiThread(() =>
            {
                activityIntent      = e.ActivityIntent;
                tvTitle.Text        = e.MediaMetadata.GetString(MediaMetadata.MetadataKeyTitle);
                tvAlbum.Text        = e.MediaMetadata.GetString(MediaMetadata.MetadataKeyAlbum);
                tvArtist.Text       = e.MediaMetadata.GetString(MediaMetadata.MetadataKeyArtist);
                skbSeekSongTime.Max = (int)e.MediaMetadata.GetLong(MediaMetadata.MetadataKeyDuration);
                ThreadPool.QueueUserWorkItem(m =>
                {
                    var albumart     = e.MediaMetadata.GetBitmap(MediaMetadata.MetadataKeyAlbumArt);
                    var wallpaper    = new BitmapDrawable(Activity.Resources, albumart);
                    int opacitylevel = configurationManager.RetrieveAValue(ConfigurationParameters.AlbumArtOpacityLevel, 255);
                    int blurLevel    = configurationManager.RetrieveAValue(ConfigurationParameters.AlbumArtBlurLevel, 1); //Never used (for now)
                    CurrentAlbumArt  = wallpaper;

                    if (configurationManager.RetrieveAValue(ConfigurationParameters.ShowAlbumArt))
                    {
                        WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs
                        {
                            Wallpaper       = wallpaper,
                            OpacityLevel    = (short)opacitylevel,
                            BlurLevel       = 0,                          //Causes a crash That currently I cant debug, damn, thats why is 0. (No blur) and ignoring the value the used have setted.
                            WallpaperPoster = WallpaperPoster.MusicPlayer //We must nutify WallpaperPublisher who is posting the wallpaper, otherwise it'll be ignored.
                        });
                    }
                });
            });
        }
Пример #3
0
        private void MusicControllerKitkat_MediaMetadataChanged(object sender, MediaMetadataChangedKitkatEventArgs e)
        {
            Activity?.RunOnUiThread(() =>
            {
                tvTitle.Text        = e.Title;
                tvAlbum.Text        = e.Album;
                tvArtist.Text       = e.Artist;
                skbSeekSongTime.Max = (int)e.Duration / 1000;

                int opacitylevel = configurationManager.RetrieveAValue(ConfigurationParameters.AlbumArtOpacityLevel, ConfigurationParameters.DefaultAlbumartOpacityLevel);
                int blurLevel    = configurationManager.RetrieveAValue(ConfigurationParameters.AlbumArtBlurLevel, ConfigurationParameters.DefaultAlbumartBlurLevel);
                CurrentAlbumArt  = new BitmapDrawable(Resources, e.AlbumArt);

                if (configurationManager.RetrieveAValue(ConfigurationParameters.ShowAlbumArt))
                {
                    WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs
                    {
                        Wallpaper       = new BitmapDrawable(Resources, e.AlbumArt),
                        OpacityLevel    = (short)opacitylevel,
                        BlurLevel       = (short)blurLevel,
                        WallpaperPoster = WallpaperPoster.MusicPlayer //We must nutify WallpaperPublisher who is posting the wallpaper, otherwise it'll be ignored.
                    });
                }
                GC.Collect(0);
            });
        }
        private void ItemClicked(object sender, NotificationItemClickedEventArgs e)
        {
            position = e.Position;
            using (OpenNotification openNotification = new OpenNotification(e.Position))
            {
                ThreadPool.QueueUserWorkItem(method =>
                {
                    var notificationBigPicture = new BitmapDrawable(Resources, openNotification.GetBigPicture());
                    WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs {
                        Wallpaper = notificationBigPicture, OpacityLevel = 125, SecondsOfAttention = 5
                    });
                });
                titulo.Text  = openNotification.GetTitle();
                texto.Text   = openNotification.GetText();
                appName.Text = openNotification.GetAppName();
                when.Text    = openNotification.GetWhen();
                notificationActions.RemoveAllViews();

                if (openNotification.NotificationHasActionButtons() == true)
                {
                    var actions = openNotification.RetrieveActions();
                    foreach (var a in actions)
                    {
                        OpenAction openAction = new OpenAction(a);
                        float      weight     = (float)1 / actions.Count;

                        Button anActionButton = new Button(Application.Context)
                        {
                            LayoutParameters = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MatchParent, weight),
                            Text             = openAction.GetTitle()
                        };
                        anActionButton.TransformationMethod = null;
                        anActionButton.SetTypeface(Typeface.Create("sans-serif-condensed", TypefaceStyle.Normal), TypefaceStyle.Normal);
                        anActionButton.SetMaxLines(1);
                        anActionButton.SetTextColor(Color.White);
                        anActionButton.Click += (o, eventargs) =>
                        {
                            openAction.ClickAction();
                        };
                        anActionButton.Gravity = GravityFlags.CenterVertical;
                        TypedValue outValue = new TypedValue();
                        Application.Context.Theme.ResolveAttribute(Android.Resource.Attribute.SelectableItemBackgroundBorderless, outValue, true);
                        anActionButton.SetBackgroundResource(outValue.ResourceId);
                        anActionButton.SetCompoundDrawablesRelativeWithIntrinsicBounds(openAction.GetActionIcon(), null, null, null);
                        notificationActions.AddView(anActionButton);
                    }
                    ;
                }
            }
            if (notification.Visibility != ViewStates.Visible)
            {
                notification.Visibility = ViewStates.Visible;
                StartTimeout();
            }

            NotificationClicked?.Invoke(null, EventArgs.Empty);
        }
        private void LoadWallpaper(ConfigurationManager configurationManager)
        {
            int savedblurlevel    = configurationManager.RetrieveAValue(ConfigurationParameters.BlurLevel, ConfigurationParameters.DefaultBlurLevel);
            int savedOpacitylevel = configurationManager.RetrieveAValue(ConfigurationParameters.OpacityLevel, ConfigurationParameters.DefaultOpacityLevel);

            switch (configurationManager.RetrieveAValue(ConfigurationParameters.ChangeWallpaper, "1"))
            {
            case "0":

                if (Checkers.ThisAppHasReadStoragePermission())
                {
                    WallpaperManager.GetInstance(Application.Context).ForgetLoadedWallpaper();
                    var wallpaper = WallpaperManager.GetInstance(Application.Context).Drawable;
                    WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs {
                        Wallpaper = (BitmapDrawable)wallpaper, OpacityLevel = 0, BlurLevel = 0, WallpaperPoster = WallpaperPoster.Lockscreen
                    });
                }
                break;

            case "1":
                if (Checkers.ThisAppHasReadStoragePermission())
                {
                    WallpaperManager.GetInstance(Application.Context).ForgetLoadedWallpaper();
                    var wallpaper = WallpaperManager.GetInstance(Application.Context).Drawable;
                    WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs {
                        Wallpaper = (BitmapDrawable)wallpaper, OpacityLevel = (short)savedOpacitylevel, BlurLevel = (short)savedblurlevel, WallpaperPoster = WallpaperPoster.Lockscreen
                    });
                }
                else
                {
                    RunOnUiThread(() => Toast.MakeText(Application.Context, "You have set the system wallpaper, but the app can't read it, try to change the Wallpaper option again", ToastLength.Long).Show());
                }
                break;

            case "2":

                var imagePath = configurationManager.RetrieveAValue(ConfigurationParameters.ImagePath, "");
                if (imagePath != "")
                {
                    ThreadPool.QueueUserWorkItem(m =>
                    {
                        Bitmap bitmap           = BitmapFactory.DecodeFile(configurationManager.RetrieveAValue(ConfigurationParameters.ImagePath, imagePath));
                        BitmapDrawable drawable = new BitmapDrawable(Resources, bitmap);
                        WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs {
                            Wallpaper = drawable, OpacityLevel = (short)savedOpacitylevel, BlurLevel = (short)savedblurlevel, WallpaperPoster = WallpaperPoster.Lockscreen
                        });
                    });
                }
                break;

            default:
                Window.DecorView.SetBackgroundColor(Color.Black);
                break;
            }
        }
Пример #6
0
 private void MusicControllerKitkat_MediaMetadataChanged(object sender, MediaMetadataChangedKitkatEventArgs e)
 {
     tvTitle.Text        = e.Title;
     tvAlbum.Text        = e.Album;
     tvArtist.Text       = e.Artist;
     skbSeekSongTime.Max = (int)e.Duration;
     WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs
     {
         Wallpaper = new BitmapDrawable(Resources, e.AlbumArt)
     });
     GC.Collect(0);
 }
Пример #7
0
        public BigPictureStyleNotification(OpenNotification openNotification, ref LinearLayout notificationView, AndroidX.Fragment.App.Fragment notificationFragment)
            : base(openNotification, ref notificationView, notificationFragment)
        {
            var notificationBigPicture = new BitmapDrawable(Resources, OpenNotification.BigPicture());

            WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs
            {
                BlurLevel          = 5,
                OpacityLevel       = 125,
                SecondsOfAttention = 5,
                Wallpaper          = notificationBigPicture,
                WallpaperPoster    = WallpaperPoster.Notification,
            });
        }
Пример #8
0
        private void MusicController_MediaMetadataChanged(object sender, MediaMetadataChangedEventArgs e)
        {
            bool shouldChangeArtwork = true;

            if (configurationManager.RetrieveAValue(ConfigurationParameters.DisableArtworkUpdateOnSameAlbum) &&
                (tvAlbum?.Text != null && tvAlbum?.Text == e.MediaMetadata?.GetString(MediaMetadata.MetadataKeyAlbum)))
            {
                shouldChangeArtwork = false;
            }

            if (shouldChangeArtwork)
            {
                ThreadPool.QueueUserWorkItem(m =>
                {
                    var albumart     = e.MediaMetadata?.GetBitmap(MediaMetadata.MetadataKeyAlbumArt);
                    var wallpaper    = new BitmapDrawable(Resources, albumart);
                    int opacitylevel = configurationManager.RetrieveAValue(ConfigurationParameters.AlbumArtOpacityLevel, ConfigurationParameters.DefaultAlbumartOpacityLevel);
                    int blurLevel    = configurationManager.RetrieveAValue(ConfigurationParameters.AlbumArtBlurLevel, ConfigurationParameters.DefaultAlbumartBlurLevel);
                    CurrentAlbumArt  = wallpaper;

                    if (configurationManager.RetrieveAValue(ConfigurationParameters.ShowAlbumArt))
                    {
                        WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs
                        {
                            Wallpaper       = wallpaper,
                            OpacityLevel    = (short)opacitylevel,
                            BlurLevel       = (short)blurLevel,
                            WallpaperPoster = WallpaperPoster.MusicPlayer //We must nutify WallpaperPublisher who is posting the wallpaper, otherwise it'll be ignored.
                        });
                    }
                });
            }

            Activity?.RunOnUiThread(() =>
            {
                activityIntent      = e.ActivityIntent;
                tvTitle.Text        = e.MediaMetadata?.GetString(MediaMetadata.MetadataKeyTitle);
                tvAlbum.Text        = e.MediaMetadata?.GetString(MediaMetadata.MetadataKeyAlbum);
                tvArtist.Text       = e.MediaMetadata?.GetString(MediaMetadata.MetadataKeyArtist);
                skbSeekSongTime.Max = (int)e.MediaMetadata?.GetLong(MediaMetadata.MetadataKeyDuration) / 1000;
                openNotificationId  = e.OpenNotificationId;
                if (e.AppName != string.Empty)
                {
                    sourceApp.Text = string.Format(Resources.GetString(Resource.String.playing_from_template), e.AppName);
                }
            });
        }
        } = false;                                           //Default value, though, this should be linked somehow with the current status of the view, to ensure robustness.

        public MediaStyleNotification(OpenNotification openNotification, ref LinearLayout notificationView, AndroidX.Fragment.App.Fragment notificationFragment)
            : base(openNotification, ref notificationView, notificationFragment)
        {
            var notificationMediaArtwork = new BitmapDrawable(Application.Context.Resources, OpenNotification.MediaArtwork());

            //Only post the Artwork if this notification isn't the one that keeps the Music Widget Active (because in that case it will cause redundancy, the Music Widget
            //will be already showing the Artwork)
            if (MusicController.MediaSessionAssociatedWThisNotification(openNotification.GetCustomId()) == false)
            {
                WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs
                {
                    BlurLevel          = 1,
                    OpacityLevel       = 125,
                    SecondsOfAttention = 5,
                    Wallpaper          = notificationMediaArtwork,
                    WallpaperPoster    = WallpaperPoster.Notification,
                });
            }
        }
Пример #10
0
        private void WallpaperPublisher_CurrentWallpaperHasBeenCleared(object sender, CurrentWallpaperClearedEventArgs e)
        {
            if (e.PreviousWallpaperPoster == WallpaperPoster.MusicPlayer)
            {
                int opacitylevel = configurationManager.RetrieveAValue(ConfigurationParameters.AlbumArtOpacityLevel, 255);
                int blurLevel    = configurationManager.RetrieveAValue(ConfigurationParameters.AlbumArtBlurLevel, 1); //Never used (for now)

                if (configurationManager.RetrieveAValue(ConfigurationParameters.ShowAlbumArt))
                {
                    WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs
                    {
                        Wallpaper       = CurrentAlbumArt,
                        OpacityLevel    = (short)opacitylevel,
                        BlurLevel       = 0,                          //Causes a crash That currently I cant debug, damn, thats why is 0. (No blur) and ignoring the value the used have setted.
                        WallpaperPoster = WallpaperPoster.MusicPlayer //We must nutify WallpaperPublisher who is posting the wallpaper, otherwise the wallpaper will be ignored.
                    });
                }
            }
        }
Пример #11
0
        private void WallpaperPublisher_CurrentWallpaperHasBeenCleared(object sender, CurrentWallpaperClearedEventArgs e)
        {
            if (e.PreviousWallpaperPoster == WallpaperPoster.MusicPlayer)
            {
                int opacitylevel = configurationManager.RetrieveAValue(ConfigurationParameters.AlbumArtOpacityLevel, ConfigurationParameters.DefaultAlbumartOpacityLevel);
                int blurLevel    = configurationManager.RetrieveAValue(ConfigurationParameters.AlbumArtBlurLevel, ConfigurationParameters.DefaultAlbumartBlurLevel);

                if (configurationManager.RetrieveAValue(ConfigurationParameters.ShowAlbumArt))
                {
                    WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs
                    {
                        Wallpaper       = CurrentAlbumArt,
                        OpacityLevel    = (short)opacitylevel,
                        BlurLevel       = (short)blurLevel,
                        WallpaperPoster = WallpaperPoster.MusicPlayer //We must nutify WallpaperPublisher who is posting the wallpaper, otherwise the wallpaper will be ignored.
                    });
                }
            }
        }
Пример #12
0
 private void MusicController_MediaMetadataChanged(object sender, MediaMetadataChangedEventArgs e)
 {
     tvTitle.Text        = e.MediaMetadata.GetString(MediaMetadata.MetadataKeyTitle);
     tvAlbum.Text        = e.MediaMetadata.GetString(MediaMetadata.MetadataKeyAlbum);
     tvArtist.Text       = e.MediaMetadata.GetString(MediaMetadata.MetadataKeyArtist);
     skbSeekSongTime.Max = (int)e.MediaMetadata.GetLong(MediaMetadata.MetadataKeyDuration);
     using (var albumart = e.MediaMetadata.GetBitmap(MediaMetadata.MetadataKeyAlbumArt))
     {
         using (var wallpaper = new BitmapDrawable(Resources, albumart))
         {
             int opacitylevel = configurationManager.RetrieveAValue(ConfigurationParameters.OpacityLevel, 255);
             WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs
             {
                 Wallpaper    = wallpaper,
                 OpacityLevel = (short)opacitylevel
             });
         }
     }
     GC.Collect();
 }
        private void LoadConfiguration()
        {
            //Load configurations based on User configs.
            using (ConfigurationManager configurationManager = new ConfigurationManager(PreferenceManager.GetDefaultSharedPreferences(Application.Context)))
            {
                switch (configurationManager.RetrieveAValue(ConfigurationParameters.ChangeWallpaper, "0"))
                {
                case "0":

                    WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs {
                        Wallpaper = null
                    });
                    break;

                case "1":
                    using (var wallpaper = (BitmapDrawable)WallpaperManager.GetInstance(Application.Context).Drawable)
                    {
                        int       savedblurlevel    = configurationManager.RetrieveAValue(ConfigurationParameters.BlurLevel, 1);
                        int       savedOpacitylevel = configurationManager.RetrieveAValue(ConfigurationParameters.OpacityLevel, 255);
                        BlurImage blurImage         = new BlurImage(Application.Context);
                        blurImage.Load(wallpaper.Bitmap).Intensity(savedblurlevel).Async(true);
                        var blurredwallpaper = new BitmapDrawable(Resources, blurImage.GetImageBlur());
                        WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs {
                            Wallpaper = blurredwallpaper, OpacityLevel = (short)savedOpacitylevel
                        });
                        blurImage = null;
                    }

                    break;

                case "2":
                    //using (Bitmap bm = BitmapFactory.DecodeFile(configurationManager.RetrieveAValue(ConfigurationParameters.imagePath, "")))
                    //{
                    //    using (var backgroundFactory = new BackgroundFactory())
                    //    {
                    //        using (BackgroundFactory blurImage = new BackgroundFactory())
                    //        {
                    //            var drawable = blurImage.Difuminar(bm, sa);
                    //            RunOnUiThread(() =>
                    //            Window.DecorView.Background = drawable);
                    //            drawable.Dispose();
                    //        }
                    //    }
                    //}
                    break;

                default:
                    Window.DecorView.SetBackgroundColor(Color.Black);
                    break;
                }
                if (configurationManager.RetrieveAValue(ConfigurationParameters.MusicWidgetEnabled) == true)
                {
                    CheckIfMusicIsPlaying(); //This method is the main entry for the music widget and the floating notification.
                }
                int interval = int.Parse(configurationManager.RetrieveAValue(ConfigurationParameters.TurnOffScreenDelayTime, "5000"));
                watchDog.Interval = interval;
                if (configurationManager.RetrieveAValue(ConfigurationParameters.TurnOnUserMovement) == true)
                {
                    StartAwakeService();
                }
            }
        }
Пример #14
0
        //This class will be the one that connects to the api and provide Lockscreen with Weather information.
        public static async Task <WeatherRoot> GetWeather(string city, string country, string measurementunit)
        {
            string url = string.Format("http://api.openweathermap.org/data/2.5/weather?q={0},{1}&units={2}&appid=9ca11a6f4426446b991ff390d4f7430f", city, country, measurementunit);

            using (var client = new HttpClient())
            {
                try
                {
                    var json = await client.GetStringAsync(url);

                    if (string.IsNullOrWhiteSpace(json))
                    {
                        return(null);
                    }

                    WeatherRoot weatherRoot =
                        DeserializeObject <WeatherRoot>(json);

                    configurationManager.SaveAValue(ConfigurationParameters.WeatherCity, weatherRoot.Name);
                    configurationManager.SaveAValue(ConfigurationParameters.WeatherDescription, weatherRoot.Weather[0].Description);
                    configurationManager.SaveAValue(ConfigurationParameters.WeatherHumidity, weatherRoot.MainWeather.Humidity.ToString() + "%");
                    configurationManager.SaveAValue(ConfigurationParameters.WeatherLastUpdated, DateTime.Now.ToString("ddd" + "," + "hh:mm"));
                    configurationManager.SaveAValue(ConfigurationParameters.WeatherMaximum, weatherRoot.MainWeather.MaxTemperature.ToString());
                    configurationManager.SaveAValue(ConfigurationParameters.WeatherMaximum, weatherRoot.MainWeather.MinTemperature.ToString());
                    configurationManager.SaveAValue(ConfigurationParameters.WeatherCountryCode, country);
                    configurationManager.SaveAValue(ConfigurationParameters.WeatherCurrent, weatherRoot.MainWeather.Temperature.ToString());
                    string unitsuffix = "°K";
                    switch (measurementunit)
                    {
                    case MeasurementUnits.Fahrenheit:
                        unitsuffix = "°F";
                        break;

                    case MeasurementUnits.Celsius:
                        unitsuffix = "°C";
                        break;

                    case MeasurementUnits.Kelvin:
                        unitsuffix = "°K";
                        break;
                    }
                    configurationManager.SaveAValue(ConfigurationParameters.WeatherTemperatureUnit, unitsuffix);

                    using (var imageGrabClient = new HttpClient())
                    {
                        try
                        {
                            var stream = await imageGrabClient.GetStreamAsync(string.Format(imageURL, weatherRoot.Weather[0].Icon));

                            Drawable drawable = Drawable.CreateFromStream(stream, "image");

                            if (configurationManager.RetrieveAValue(ConfigurationParameters.WeatherUpdateChangesWallpaper))
                            {
                                WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs
                                {
                                    BlurLevel          = 5,
                                    OpacityLevel       = 100,
                                    SecondsOfAttention = 5,
                                    WallpaperPoster    = WallpaperPoster.Weather,
                                    Wallpaper          = (BitmapDrawable)drawable
                                });
                            }
                        }
                        catch
                        {
                            Toast.MakeText(Application.Context, "FAILED TO DOWNLOAD IMAGE", ToastLength.Long).Show();
                        }
                    }

                    return(weatherRoot);
                }
                catch
                {
                    return(null);
                }
            }
        }
Пример #15
0
        public void ApplyStyle(OpenNotification notification)
        {
            //The progress thing does not require a Style to be applied.
            if (notification.GetProgressMax() > 0)
            {
                notificationProgress.Visibility = ViewStates.Visible;
                if (notification.IsProgressIndeterminate())
                {
                    notificationProgress.Indeterminate = true;
                }
                else
                {
                    notificationProgress.Max      = notification.GetProgressMax();
                    notificationProgress.Progress = notification.GetProgress();
                }
            }
            else
            {
                notificationProgress.Visibility = ViewStates.Gone;
            }

            switch (notification.Style())
            {
            case BigPictureStyle:

                titulo.Text  = notification.Title();
                texto.Text   = notification.Text();
                appName.Text = notification.AppName();
                subtext.Text = notification.SubText();
                when.Text    = notification.When();
                closenotificationbutton.SetTag(DefaultActionIdentificator, notification);
                closenotificationbutton.Click     += Closenotificationbutton_Click;
                togglenotificationcollapse.Click  += Togglenotificationcollapse_Click;
                closenotificationbutton.Visibility = notification.IsRemovable() ? ViewStates.Visible : ViewStates.Invisible;
                var notificationBigPicture = new BitmapDrawable(notification.BigPicture());
                WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs
                {
                    BlurLevel          = 0,
                    OpacityLevel       = 125,
                    SecondsOfAttention = 5,
                    Wallpaper          = notificationBigPicture,
                    WallpaperPoster    = WallpaperPoster.Notification,
                });
                notificationActions.Visibility         = ViewStates.Visible;
                inlineNotificationContainer.Visibility = ViewStates.Invisible;
                ApplyActionsStyle(notification);
                break;

            case InboxStyle:
                titulo.Text = notification.Title();
                texto.SetMaxLines(6);
                texto.Text   = notification.GetTextLines();
                appName.Text = notification.AppName();
                subtext.Text = notification.SubText();
                when.Text    = notification.When();
                closenotificationbutton.SetTag(DefaultActionIdentificator, notification);
                closenotificationbutton.Click += Closenotificationbutton_Click;

                closenotificationbutton.Visibility = notification.IsRemovable() ? ViewStates.Visible : ViewStates.Invisible;
                ApplyActionsStyle(notification);
                break;

            case BigTextStyle:

                titulo.Text = notification.Title();
                texto.SetMaxLines(9);
                texto.Text   = notification.GetBigText();
                appName.Text = notification.AppName();
                subtext.Text = notification.SubText();
                when.Text    = notification.When();
                closenotificationbutton.SetTag(DefaultActionIdentificator, notification);
                closenotificationbutton.Click += Closenotificationbutton_Click;

                closenotificationbutton.Visibility     = notification.IsRemovable() ? ViewStates.Visible : ViewStates.Invisible;
                notificationActions.Visibility         = ViewStates.Visible;
                inlineNotificationContainer.Visibility = ViewStates.Invisible;

                ApplyActionsStyle(notification); break;

            case MediaStyle:

                titulo.Text  = notification.Title();
                texto.Text   = notification.Text();
                appName.Text = notification.AppName();
                subtext.Text = notification.SubText();
                when.Text    = string.Empty;  //The MediaStyle shouldn't show a timestamp.
                closenotificationbutton.SetTag(DefaultActionIdentificator, notification);
                closenotificationbutton.Click += Closenotificationbutton_Click;
                //notification.StartMediaCallback();
                closenotificationbutton.Visibility = notification.IsRemovable() ? ViewStates.Visible : ViewStates.Invisible;

                notificationActions.Visibility         = ViewStates.Visible;
                inlineNotificationContainer.Visibility = ViewStates.Invisible;


                ApplyActionsStyle(notification);
                var notificationMediaArtwork = new BitmapDrawable(notification.MediaArtwork());
                WallpaperPublisher.ChangeWallpaper(new WallpaperChangedEventArgs
                {
                    BlurLevel          = 0,
                    OpacityLevel       = 125,
                    SecondsOfAttention = 5,
                    Wallpaper          = notificationMediaArtwork,
                    WallpaperPoster    = WallpaperPoster.Notification,
                });

                break;

            case MessagingStyle:
                //Only available in API Level 24 and Up.


                titulo.Text  = notification.Title();
                texto.Text   = notification.Text();
                appName.Text = notification.AppName();
                subtext.Text = notification.SubText();
                when.Text    = notification.When();
                closenotificationbutton.SetTag(DefaultActionIdentificator, notification);
                closenotificationbutton.Click += Closenotificationbutton_Click;

                closenotificationbutton.Visibility     = notification.IsRemovable() ? ViewStates.Visible : ViewStates.Invisible;
                notificationActions.Visibility         = ViewStates.Visible;
                inlineNotificationContainer.Visibility = ViewStates.Invisible;
                ApplyActionsStyle(notification);
                break;

            case DecoratedCustomViewStyle:
                //TODO.
                ApplyDefault(notification);
                break;

            default:     //No Style.
                ApplyDefault(notification);
                break;
            }
        }