protected override void InitBindings()
        {
            AboutPageGetItOnWindows.SetOnClickListener(
                new OnClickListener(view => ResourceLocator.SystemControlsLauncherService.LaunchUri(
                                        new Uri("https://www.microsoft.com/store/apps/9NBLGGH5F3BL?ocid=android"))));

            AboutPageViewSourceButton.SetOnClickListener(
                new OnClickListener(view => ResourceLocator.SystemControlsLauncherService.LaunchUri(
                                        new Uri("https://github.com/Drutol/MALClient"))));

            AboutPageIssuesBoard.SetOnClickListener(
                new OnClickListener(view => ResourceLocator.SystemControlsLauncherService.LaunchUri(
                                        new Uri("https://github.com/Drutol/MALClient/issues"))));

            var listener = new OnClickListener(AboutPageDonateButtonOnClick);

            AboutPageDonate1Button.SetOnClickListener(listener);
            AboutPageDonate2Button.SetOnClickListener(listener);
            AboutPageDonate3Button.SetOnClickListener(listener);
            AboutPageDonate4Button.SetOnClickListener(listener);

            AboutPageChangelogButton.SetOnClickListener(
                new OnClickListener(view => ChangelogDialog.BuildChangelogDialog(ResourceLocator.ChangelogProvider)));
        }
Example #2
0
        protected override async void OnCreate(Bundle bundle)
        {
            RequestWindowFeature(WindowFeatures.NoTitle);
            CurrentTheme  = Settings.SelectedTheme;
            CurrentAccent = AndroidColourThemeHelper.CurrentTheme;
            SetRightTheme();
            ResourceExtension.Init();
            base.OnCreate(bundle);
            if (Resources.DisplayMetrics.WidthPixels >= 1080)
            {
                Settings.MakeGridItemsSmaller = true;
            }

            AnimeListPageFragment.RightDrawer = null;
            if (!_addedNavHandlers)
            {
                RegisterIoC();
                SetContentView(Resource.Layout.MainPage);
                InitAdContainer();
                InitBindings();
                ViewModel.MainNavigationRequested += ViewModelOnMainNavigationRequested;
                ViewModel.MainNavigationRequested += ViewModelOnMainNavigationRequestedFirst;
                ViewModel.MediaElementCollapsed   += ViewModelOnMediaElementCollapsed;

                ViewModelLocator.AnimeList.DimensionsProvider = this;

                var args = Intent.Extras?.GetString("launchArgs") ?? Intent.Data?.ToString();
                ProcessLaunchArgs(args, true);
                ViewModel.PerformFirstNavigation();

                DroppyMenuPopup.RequestedElevation = DimensionsHelper.DpToPx(10);

                ResourceLocator.NotificationsTaskManager.StartTask(BgTasks.Notifications);


                //if ((Resources.Configuration.ScreenLayout & ScreenLayout.SizeMask) == ScreenLayout.SizeSmall)
                //{
                //    Settings.PullHigherQualityImages = false;
                //}


                DroppyMenuPopup.OverrideRequested +=
                    (sender, action) => ViewModelLocator.NavMgr.RegisterOneTimeMainOverride(new RelayCommand(action));
                DroppyMenuPopup.ResetOverrideRequested +=
                    (sender, eventArgs) => ViewModelLocator.NavMgr.ResetOneTimeOverride();

                //Check permissions
                var requiredPermission = new List <string>();
                if (ContextCompat.CheckSelfPermission(this,
                                                      Manifest.Permission.ReadExternalStorage)
                    != Permission.Granted)
                {
                    requiredPermission.Add(Manifest.Permission.ReadExternalStorage);
                }

                if (ContextCompat.CheckSelfPermission(this,
                                                      Manifest.Permission.WriteExternalStorage)
                    != Permission.Granted)
                {
                    requiredPermission.Add(Manifest.Permission.WriteExternalStorage);
                }

                if (requiredPermission.Any())
                {
                    ActivityCompat.RequestPermissions(this,
                                                      requiredPermission.ToArray(), 129055);
                }
                _addedNavHandlers = true;
            }

            if (!_staticInitPerformed)
            {
                StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build();
                StrictMode.SetThreadPolicy(policy);

                InitializationRoutines.InitPostUpdate();

                await Task.Delay(1000);

                if (ResourceLocator.ChangelogProvider.NewChangelog)
                {
                    ChangelogDialog.BuildChangelogDialog(ResourceLocator.ChangelogProvider);
                }

                RateReminderPopUp.ProcessRatePopUp();

                MemoryWatcher.Watcher.Resume(true);
                ResourceLocator.TelemetryProvider.Init();

                _staticInitPerformed = true;
            }
        }