Пример #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var info = FamiStudioForm.Instance != null ? FamiStudioForm.Instance.ActiveDialog as PropertyDialogActivityInfo : null;

            if (savedInstanceState != null || info == null)
            {
                Finish();
                return;
            }

            dlg = info.Dialog;
            dlg.CloseRequested += Dlg_CloseRequested;

            var appBarLayoutParams = new AppBarLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, DroidUtils.GetSizeAttributeInPixel(this, Android.Resource.Attribute.ActionBarSize));

            appBarLayoutParams.ScrollFlags = 0;

            toolbar = new AndroidX.AppCompat.Widget.Toolbar(new ContextThemeWrapper(this, Resource.Style.ToolbarTheme));
            toolbar.LayoutParameters = appBarLayoutParams;
            toolbar.SetTitleTextAppearance(this, Resource.Style.LightGrayTextMediumBold);
            SetSupportActionBar(toolbar);

            ActionBar actionBar = SupportActionBar;

            if (actionBar != null)
            {
                actionBar.SetDisplayHomeAsUpEnabled(true);
                actionBar.SetHomeButtonEnabled(true);
                actionBar.SetHomeAsUpIndicator(Android.Resource.Drawable.IcMenuCloseClearCancel);
                actionBar.Title = dlg.Title;
            }

            appBarLayout = new AppBarLayout(this);
            appBarLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            appBarLayout.AddView(toolbar);

            fragmentView = new FragmentContainerView(this);
            fragmentView.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            fragmentView.Id = FragmentViewId;

            var scrollViewLayoutParams = new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);

            scrollViewLayoutParams.Behavior = new AppBarLayout.ScrollingViewBehavior(this, null);

            scrollView = new NestedScrollView(new ContextThemeWrapper(this, Resource.Style.DarkBackgroundStyle));
            scrollView.LayoutParameters = scrollViewLayoutParams;
            scrollView.AddView(fragmentView);

            coordLayout = new CoordinatorLayout(this);
            coordLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            coordLayout.AddView(appBarLayout);
            coordLayout.AddView(scrollView);

            SetContentView(coordLayout);

            SupportFragmentManager.BeginTransaction().SetReorderingAllowed(true).Add(fragmentView.Id, dlg.Properties, "PropertyDialog").Commit();
        }
        protected override void OnCreate(Bundle?savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var mauiApp = MauiApplication.Current.Application;

            if (mauiApp == null)
            {
                throw new InvalidOperationException($"The {nameof(IApplication)} instance was not found.");
            }

            var services = MauiApplication.Current.Services;

            if (mauiApp == null)
            {
                throw new InvalidOperationException($"The {nameof(IServiceProvider)} instance was not found.");
            }

            var mauiContext = new MauiContext(services, this);

            var state  = new ActivationState(mauiContext, savedInstanceState);
            var window = mauiApp.CreateWindow(state);

            window.MauiContext = mauiContext;

            var content = (window.Page as IView) ?? window.Page.View;

            CoordinatorLayout parent = new CoordinatorLayout(this);

            SetContentView(parent, new ViewGroup.LayoutParams(CoordinatorLayout.LayoutParams.MatchParent, CoordinatorLayout.LayoutParams.MatchParent));

            //AddToolbar(parent);

            parent.AddView(content.ToNative(window.MauiContext), new CoordinatorLayout.LayoutParams(CoordinatorLayout.LayoutParams.MatchParent, CoordinatorLayout.LayoutParams.MatchParent));
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);

            var coordinatorLayout = new CoordinatorLayout(this);

            coordinatorLayout.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);

            coordinatorLayout.AddView(CreateFab(this));

            SetContentView(coordinatorLayout);
        }
Пример #4
0
        protected override void OnCreate(Bundle?savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var mauiApp = MauiApplication.Current.Application;

            if (mauiApp == null)
            {
                throw new InvalidOperationException($"The {nameof(IApplication)} instance was not found.");
            }

            var services = MauiApplication.Current.Services;

            if (mauiApp == null)
            {
                throw new InvalidOperationException($"The {nameof(IServiceProvider)} instance was not found.");
            }

            var mauiContext = new MauiContext(services, this);

            var state  = new ActivationState(mauiContext, savedInstanceState);
            var window = mauiApp.CreateWindow(state);

            window.MauiContext = mauiContext;

            var matchParent = ViewGroup.LayoutParams.MatchParent;

            // Create the root native layout and set the Activity's content to it
            CoordinatorLayout nativeRootLayout = new CoordinatorLayout(this);

            SetContentView(nativeRootLayout, new ViewGroup.LayoutParams(matchParent, matchParent));

            //AddToolbar(parent);

            var page = window.Page;

            // This currently relies on IPage : IView, which may not exactly be right
            // we may have to add another handler extension that works for Page
            // Also, AbstractViewHandler is set to work for IView (obviously); if IPage is not IView,
            // then we'll need to change it to AbstractFrameworkElementHandler or create a separate
            // abstract handler for IPage
            // TODO ezhart Think about all this stuff ^^

            var nativePage = page.ToNative(window.MauiContext);

            // Add the IPage to the root layout; use match parent so the page automatically has the dimensions of the activity
            nativeRootLayout.AddView(nativePage, new CoordinatorLayout.LayoutParams(matchParent, matchParent));
        }
        public NativeDroidAppWindow(BareActivity activity)
        {
            Activity   = activity;
            _presenter = new GenericViewModelPresenter(activity)
            {
                LayoutParameters = new CoordinatorLayout.LayoutParams(CoordinatorLayout.LayoutParams.MatchParent, CoordinatorLayout.LayoutParams.MatchParent)
            };

            // CoordinatorLayout is needed so snackbars can be swipeable
            _coordinatorLayout = new CoordinatorLayout(activity);
            _coordinatorLayout.AddView(_presenter);
            activity.SetContentView(_coordinatorLayout);

            activity.BackPressed += Activity_BackPressed;

            SnackbarManager.OnShow  += SnackbarManager_OnShow;
            SnackbarManager.OnClose += SnackbarManager_OnClose;
        }
Пример #6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_main);


            canvas = new DrawCanvas(this);


            CoordinatorLayout layout = (CoordinatorLayout)FindViewById(Resource.Id.mainlayout);

            layout.AddView(canvas);


            System.Timers.Timer timer = new System.Timers.Timer();
            timer.Interval = 50;
            timer.Elapsed += OnTimedEvent;
            timer.Enabled  = true;
        }
Пример #7
0
        /// <summary>
        /// See Android App lifecycle diagram to know when Android call this event hadler
        /// https://developer.android.com/guide/components/activities/activity-lifecycle
        /// </summary>
        /// <param name="savedInstanceState">use this to store global app variables and objects when ardroid reLaunch application</param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            //Set Resources/layout/activity_main.axml as this activity content view (see android:id="@+id/mainlayout")
            SetContentView(Resource.Layout.activity_main);

            //After content view created, main layout view (component) is Created, get pointer at
            CoordinatorLayout layout = (CoordinatorLayout)FindViewById(Resource.Id.mainlayout);

            //Create our owned View object to access Canvas class and OnDraw method from here (see DrawCanvas.cs)
            canvas = new DrawCanvas(this);
            //Set our View object as main layout child
            layout.AddView(canvas);

            //Prepare and customise timer to put android to call OnDraw method for our View OnDraw event hadler calls
            System.Timers.Timer timer = new System.Timers.Timer();
            timer.Interval = 100;          //draw each 0.1 secons
            timer.Elapsed += OnTimedEvent; //see OnTimedEvent method
            timer.Enabled  = true;
        }
Пример #8
0
        protected override void OnCreate(Bundle?savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            if (App.Current as MauiApp == null)
            {
                throw new InvalidOperationException($"App is not {nameof(MauiApp)}");
            }

            var mauiApp = (MauiApp)App.Current;

            if (mauiApp.Services == null)
            {
                throw new InvalidOperationException("App was not initialized");
            }

            var mauiContext = new MauiContext(mauiApp.Services, this);
            var state       = new ActivationState(mauiContext, savedInstanceState);
            var window      = mauiApp.CreateWindow(state);

            window.MauiContext = mauiContext;

            //Hack for now we set this on the App Static but this should be on IFrameworkElement
            App.Current.SetHandlerContext(window.MauiContext);

            var content = (window.Page as IView) ??
                          window.Page.View;

            CoordinatorLayout parent = new CoordinatorLayout(this);

            SetContentView(parent, new ViewGroup.LayoutParams(CoordinatorLayout.LayoutParams.MatchParent, CoordinatorLayout.LayoutParams.MatchParent));

            //AddToolbar(parent);

            parent.AddView(content.ToNative(window.MauiContext), new CoordinatorLayout.LayoutParams(CoordinatorLayout.LayoutParams.MatchParent, CoordinatorLayout.LayoutParams.MatchParent));
        }
Пример #9
0
        public CLIView(int id, CoordinatorLayout parentView, Activity ThisActivity, Android.Graphics.Color BackColor)
        {
            ID       = id;
            activity = ThisActivity;

            Parent = new CoordinatorLayout(activity);
            parentView.AddView(Parent, new CoordinatorLayout.LayoutParams(CoordinatorLayout.LayoutParams.MatchParent, CoordinatorLayout.LayoutParams.MatchParent));

            Parent.SetBackgroundColor(DefaultBackColor);

            PageParent = new RelativeLayout(activity);
            Parent.AddView(PageParent, new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));

            ScrollViewParent = new RelativeLayout(activity)
            {
                Id = 12345
            };
            ScrollViewParent.SetBackgroundColor(DefaultBackColor);

            PageParent.AddView(ScrollViewParent, new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent));


            scrollView = new ScrollView(activity);
            //scrollView.SetBackgroundColor(Android.Graphics.Color.DarkGreen);

            ScrollViewParent.AddView(scrollView, new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));

            console = new EditText(activity)
            {
                InputType                = Android.Text.InputTypes.Null,
                Focusable                = false,
                OverScrollMode           = OverScrollMode.Always,
                ScrollBarStyle           = ScrollbarStyles.InsideInset,
                VerticalScrollBarEnabled = true
            };
            console.SetTextIsSelectable(false);
            console.SetSingleLine(false);
            console.SetBackgroundColor(DefaultBackColor);
            console.SetTextColor(Android.Graphics.Color.White);

            console.Text = " Starting ConsoleDroid... ";

            scrollView.AddView(console, new ScrollView.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent));



            BottomParent = new LinearLayout(activity)
            {
                Id = 12346
            };
            //BottomParent.SetBackgroundColor(Android.Graphics.Color.Cyan);
            PageParent.AddView(BottomParent, new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent));

            var ScrollParams = ScrollViewParent.LayoutParameters as RelativeLayout.LayoutParams;
            var BottomParams = BottomParent.LayoutParameters as RelativeLayout.LayoutParams;

            ScrollParams.AddRule(LayoutRules.AlignParentTop);
            ScrollParams.AddRule(LayoutRules.Above, 12346);
            BottomParams.AddRule(LayoutRules.AlignParentBottom);

            promptPanel = new FlowLayout(activity);
            // promptPanel.SetBackgroundColor(Android.Graphics.Color.Blue);

            BottomParent.AddView(promptPanel, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent));
            LinearLayout.LayoutParams promptPanelParams = promptPanel.LayoutParameters as LinearLayout.LayoutParams;
            promptPanelParams.Gravity = GravityFlags.Top;

            promptPanel.Visibility = ViewStates.Invisible;


            promptQ = new EditText(activity)
            {
                InputType = Android.Text.InputTypes.Null,
                Focusable = true
            };
            promptQ.SetTextIsSelectable(true);
            promptQ.SetSingleLine(false);
            promptQ.SetBackgroundColor(BackColor);
            promptQ.SetTextColor(Android.Graphics.Color.Yellow);
            promptQ.Text = "How old are you?";
            // promptQ.SetBackgroundColor(Android.Graphics.Color.Blue);

            promptPanel.AddView(promptQ, new FlowLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent));

            promptA = new EditText(activity)
            {
                InputType = Android.Text.InputTypes.ClassText,
                Focusable = true
            };

            promptA.SetBackgroundColor(BackColor);
            promptA.SetTextColor(Android.Graphics.Color.LightGoldenrodYellow);
            promptA.SetImeActionLabel("enter", Android.Views.InputMethods.ImeAction.Send);
            promptA.EditorAction += PromptA_EditorAction;
            // promptA.SetBackgroundColor(Android.Graphics.Color.DarkBlue);

            promptPanel.AddView(promptA, new FlowLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent));

            promptPanel.Visibility = ViewStates.Gone;



            Status = new TextView(activity)
            {
                TextAlignment = TextAlignment.Center,
                Gravity       = GravityFlags.Bottom,
                Text          = "status"
            };

            Status.SetBackgroundColor(BackColor);
            Status.SetTextColor(Android.Graphics.Color.Azure);
            BottomParent.AddView(Status, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent));

            LinearLayout.LayoutParams statusParams = Status.LayoutParameters as LinearLayout.LayoutParams;
            statusParams.Gravity = GravityFlags.Bottom;


            FAB = new FloatingActionButton(activity);
            FAB.SetBackgroundColor(BackColor);
            FAB.SetColorFilter(BackColor);
            FAB.SetOutlineSpotShadowColor(BackColor);
            FAB.SetOutlineAmbientShadowColor(BackColor);

            Parent.AddView(FAB);
            CoordinatorLayout.LayoutParams FABLayout = FAB.LayoutParameters as CoordinatorLayout.LayoutParams;
            FABLayout.Width = -2; FABLayout.Height = -2;
            FABLayout.SetMargins(160, 160, 20, 240);
            FABLayout.Gravity = (int)(GravityFlags.Center | GravityFlags.End);
            FAB.SetImageResource(Resource.Drawable.round_pause_circle_filled_24);
            FAB.Click += FabOnClick;



            CLI = new UniUI.ManagedCLI(SetConsoleText, SetStatus, Prompt);

            HeartBeat          = new Timer(3000);
            HeartBeat.Elapsed += HeartBeat_Elapsed;
            HeartBeat.Start();
        }
Пример #10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var info = FamiStudioForm.Instance != null ? FamiStudioForm.Instance.ActiveDialog as TutorialDialogActivityInfo : null;

            if (savedInstanceState != null || info == null)
            {
                Finish();
                return;
            }

            var appBarLayoutParams = new AppBarLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, DroidUtils.GetSizeAttributeInPixel(this, Android.Resource.Attribute.ActionBarSize));

            appBarLayoutParams.ScrollFlags = 0;

            toolbar = new AndroidX.AppCompat.Widget.Toolbar(new ContextThemeWrapper(this, Resource.Style.ToolbarTheme));
            toolbar.LayoutParameters = appBarLayoutParams;
            toolbar.SetTitleTextAppearance(this, Resource.Style.LightGrayTextMediumBold);
            SetSupportActionBar(toolbar);

            ActionBar actionBar = SupportActionBar;

            if (actionBar != null)
            {
                actionBar.Title = "Welcome to FamiStudio!";
            }

            appBarLayout = new AppBarLayout(this);
            appBarLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            appBarLayout.AddView(toolbar);

            var margin = DroidUtils.DpToPixels(10);

            var linearLayoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);

            linearLayoutParams.Gravity = GravityFlags.Center;
            linearLayoutParams.SetMargins(margin, margin, margin, margin);

            textView                  = new TextView(new ContextThemeWrapper(this, Resource.Style.LightGrayTextMedium));
            textView.Text             = TutorialMessages[0];
            textView.LayoutParameters = linearLayoutParams;

            webView = new MaxHeightWebView(this);
            webView.LayoutParameters = linearLayoutParams;

            var coordLayoutParams = new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);;

            coordLayoutParams.Behavior = new AppBarLayout.ScrollingViewBehavior(this, null);

            var linearLayout = new LinearLayout(new ContextThemeWrapper(this, Resource.Style.DarkBackgroundStyle));

            linearLayout.LayoutParameters = coordLayoutParams;
            linearLayout.Orientation      = Android.Widget.Orientation.Vertical;
            linearLayout.AddView(textView);
            linearLayout.AddView(webView);

            coordLayout = new CoordinatorLayout(this);
            coordLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            coordLayout.AddView(appBarLayout);
            coordLayout.AddView(linearLayout);

            RefreshPage();

            SetContentView(coordLayout);
        }
Пример #11
0
        public void ShowMenu()
        {
            IsMenuShown = true;

            activity.RunOnUiThread(() =>
            {
                Parent.RemoveAllViews();
                Parent.AddView(scrollView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent));

                combo.SetSelection(0, false);

                flowLayout.RemoveAllViews();
                foreach (var fl in ProgramMenu.Values)
                {
                    fl.Dispose();
                }


                flowLayout.AddView(NewProg, new FlowLayout.LayoutParams(FlowLayout.LayoutParams.MatchParent, FlowLayout.LayoutParams.WrapContent));

                ProgramMenu = new Dictionary <int, FlowLayout>();

                foreach (var prog in Programs)
                {
                    FlowLayout pfl = new FlowLayout(activity);
                    pfl.SetBackgroundColor(prog.Value.Color);
                    flowLayout.AddView(pfl, new FlowLayout.LayoutParams(FlowLayout.LayoutParams.MatchParent, FlowLayout.LayoutParams.WrapContent));

                    TextView pname = new TextView(activity)
                    {
                        Text = prog.Key.ToString() + ". " + prog.Value.name
                    };
                    pfl.AddView(pname, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));


                    Button BtnOpen = new Button(activity)
                    {
                        Text = "Open", Tag = prog.Key
                    };
                    pfl.AddView(BtnOpen, new FlowLayout.LayoutParams(FlowLayout.LayoutParams.MatchParent, FlowLayout.LayoutParams.MatchParent));

                    BtnOpen.Click += ((object sender, EventArgs e) =>
                    {
                        HideMenu();
                        ShowCLI(prog.Key);
                    });

                    Button BtnKill = new Button(activity)
                    {
                        Text = "Terminate", Tag = prog.Key
                    };
                    pfl.AddView(BtnKill, new FlowLayout.LayoutParams(FlowLayout.LayoutParams.MatchParent, FlowLayout.LayoutParams.MatchParent));

                    BtnKill.Click += ((object sender, EventArgs e) =>
                    {
                        RemoveCLI(prog.Key);
                    });


                    ProgramMenu.Add(prog.Key, pfl);
                }
            });
        }
Пример #12
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            CheckForPermissions();

            Instance = this;

            //Window.AddFlags(WindowManagerFlags.Fullscreen); //to show

            Settings.LoadFromFile();
            imageStore.LoadFavorites();

            AdView adView = new AdView(this)
            {
                AdSize   = AdSize.SmartBanner,
                AdUnitId = "ca-app-pub-3940256099942544/6300978111"
            };

            CoordinatorLayout cLayout = FindViewById <CoordinatorLayout>(Resource.Id.coordinatorLayout);

            cLayout.AddView(adView);
            adView.TranslationY = (PhoneHeight - adView.AdSize.GetHeightInPixels(this) - GetStatusBarHeight());

            //SetAdView
            MobileAds.Initialize(this, "ca-app-pub-3940256099942544~3347511713");
            adView.LoadAd(adRequest);

            CrossConnectivity.Current.ConnectivityChanged += (o, e) =>
            {
                RunOnUiThread(() =>
                {
                    //SetAdView when the connection changes
                    MobileAds.Initialize(this, "ca-app-pub-3940256099942544~3347511713");
                    adView.LoadAd(adRequest);
                });
            };

            //Finding Resources
            tagSpinner          = FindViewById <Spinner>(Resource.Id.apiEndPoints);
            imagePanel          = FindViewById <ImageView>(Resource.Id.imageView);
            imageInfoButton     = FindViewById <FloatingActionButton>(Resource.Id.imageInfoButton);
            nextImageButton     = FindViewById <FloatingActionButton>(Resource.Id.nextImageButton);
            previousImageButton = FindViewById <FloatingActionButton>(Resource.Id.previousImageButton);
            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            imageInfoButton.Animate().TranslationY(PhoneHeight);

            //Toolbar Configurations
            SetSupportActionBar(toolbar);
            SupportActionBar.Title = null;

            //Spinner
            tagSpinner.Adapter       = new TagsAdapter(this, Android.Resource.Layout.SimpleListItem1, NekosLife.Instance);
            tagSpinner.ItemSelected += (o, e) =>
            {
                if (Settings.Instance.GenerateNewImageOnTagChange)
                {
                    imageStore.Tag = SelectedTag;
                    Toast.MakeText(this, $"Selected '{SelectedTag}'", ToastLength.Short).Show();
                    //GetNextImage();
                }
            };

            bool infoButtonIsUp = false;

            //Request image download vvv
            imagePanel.LongClick += (o, e) =>
            {
                if (!infoButtonIsUp)
                {
                    infoButtonIsUp = true;
                    imageInfoButton.Animate().TranslationY(-100);
                    Task.Run(() =>
                    {
                        Thread.Sleep(3000);
                        RunOnUiThread(() =>
                        {
                            imageInfoButton.Animate().TranslationY(PhoneHeight);
                            infoButtonIsUp = false;
                        });
                    });
                }
            };

            imageInfoButton.Click += (o, e) =>
            {
                if (imagePanel.Drawable == null)
                {
                    Toast.MakeText(this, "No Images Were Found!", ToastLength.Short).Show();
                    return;
                }

                Android.App.AlertDialog.Builder aDialog;
                aDialog = new Android.App.AlertDialog.Builder(this);
                aDialog.SetTitle("Image Options");
                aDialog.SetPositiveButton("Download Image", delegate
                {
                    Bitmap image = imageStore.GetImage();
                    string path  = Android.Provider.MediaStore.Images.Media.InsertImage(ContentResolver, image, ImageName, "A neko from NekoViewer app");
                    if (path == null)
                    {
                        Toast.MakeText(this, "Couldn't download image", ToastLength.Short).Show();
                        return;
                    }
                    Toast.MakeText(this, $"Downloaded {ImageName}!", ToastLength.Short).Show();
                    NotificationController.CreateDownloadNotification(this, "Download Completed!", ImageName, path, image);
                });
                aDialog.SetNeutralButton("Set As Wallpaper", delegate
                {
                    WallpaperManager.GetInstance(this).SetBitmap(imageStore.GetImage());
                    Toast.MakeText(this, "Wallpaper has been applied!", ToastLength.Short).Show();
                });
                aDialog.Show();
            };

            //Buttons Functions
            nextImageButton.LongClick += (o, e) =>
            {
                Android.App.AlertDialog.Builder aDialog;
                aDialog = new Android.App.AlertDialog.Builder(this);
                aDialog.SetTitle("Choose An Option");
                aDialog.SetNegativeButton("Auto Mode", delegate
                {
                    AutoSlideEnabled = !AutoSlideEnabled;
                    Toast.MakeText(this, $"Auto Mode Is '{AutoSlideEnabled.ToString()}'", ToastLength.Short).Show();
                    DoAutoSlide();
                });
                aDialog.SetPositiveButton("Last Image", delegate
                {
                    if (loading || downloading || AutoSlideEnabled)
                    {
                        Toast.MakeText(this, "An Image Is Being Downloaded or Loading Please Be Patient", ToastLength.Short).Show();
                        return;
                    }

                    Toast.MakeText(this, "Last image", ToastLength.Short).Show();
                    loading = true;
                    imagePanel.Animate().TranslationX(-PhoneWidth);
                    Task.Run(() =>
                    {
                        imageStore.GotoLast();
                        Fix();
                        RunOnUiThread(() =>
                        {
                            ReloadImagePanel(() =>
                            {
                                CheckPreviousImageButton();
                                imagePanel.TranslationX = PhoneWidth;
                                imagePanel.Animate().TranslationX(0);
                            });
                        });
                        loading = false;
                    });
                });
                aDialog.Show();
            };

            nextImageButton.Click += (o, e) =>
            {
                if (AutoSlideEnabled)
                {
                    return;
                }

                GetNextImage();
            };
            previousImageButton.Click += (o, e) =>
            {
                if (AutoSlideEnabled)
                {
                    return;
                }

                GetPreviousImage();
            };

            Settings.Instance.AnimationsEnabled.OnChange += delegate
            {
                //Do something to disable system animations
            };

            previousImageButton.Visibility = ViewStates.Invisible;
        }