Example #1
0
        public Settings()
        {
            InitializeComponent();
            BackgroundColor = Color.FromHex(Settings.MainBackgroundColor);
            if (Device.RuntimePlatform == Device.UWP)
            {
                OffBar.IsVisible = false;
                OffBar.IsEnabled = false;
            }
            else
            {
                OffBar.Source = App.GetImageSource("gradient.png"); OffBar.HeightRequest = 3; OffBar.HorizontalOptions = LayoutOptions.Fill; OffBar.ScaleX = 100; OffBar.Opacity = 0.3; OffBar.TranslationY = 9;
            }

            //Main.print("COLOR: "+ BlackBgToggle.OnColor);
            //  if (Device.RuntimePlatform == Device.UWP) {
            BindingContext = this;
            // }
            StarMe.Clicked += (o, e) => {
                App.OpenBrowser("https://github.com/LagradOst/CloudStream-2");
            };
            BuildNumber.Text = "Build Version: " + App.GetBuildNumber();
            Apper();

            ViewHistoryToggle.OnChanged += (o, e) => {
                ViewHistory = !e.Value;
            };
            DubToggle.OnChanged += (o, e) => {
                DefaultDub = e.Value;
            };
            BlackBgToggle.OnChanged += (o, e) => {
                BlackBg = e.Value;
            };
            SubtitesToggle.OnChanged += (o, e) => {
                SubtitlesEnabled = e.Value;
            };
            EpsDecToggle.OnChanged += (o, e) => {
                EpDecEnabled = e.Value;
            };
            DecToggle.OnChanged += (o, e) => {
                MovieDecEnabled = e.Value;
            };
            SearchToggle.OnChanged += (o, e) => {
                SearchEveryCharEnabled = e.Value;
            };
            CacheToggle.OnChanged += (o, e) => {
                CacheData = e.Value;
            };
            TopToggle.OnChanged += (o, e) => {
                Top100Enabled = e.Value;
            };

            UpdateBtt.Clicked += (o, e) => {
                if (NewGithubUpdate)
                {
                    App.DownloadNewGithubUpdate(githubUpdateTag);
                }
            };
            if (Device.RuntimePlatform != Device.Android)
            {
                for (int i = 0; i < SettingsTable.Count; i++)
                {
                    if (i >= SettingsTable.Count)
                    {
                        break;
                    }
                    if (SettingsTable[i][0] is TextCell)
                    {
                        if (((TextCell)(SettingsTable[i][0])).DetailColor == Color.Transparent)
                        {
                            SettingsTable.RemoveAt(i);
                            i--;
                        }
                    }
                }
            }
        }