Пример #1
0
        /// <summary>
        /// Ons the configuration changed.
        /// </summary>
        /// <param name="newConfig">New config.</param>
        public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig)
        {
            base.OnConfigurationChanged(newConfig);

            System.Diagnostics.Debug.WriteLine("MainActivity: Orientation changed. " + newConfig.Orientation);

            switch (newConfig.Orientation)
            {
            case Android.Content.Res.Orientation.Portrait:
                OrientationPage.NotifyOrientationChange(Portable.Enums.Orientation.Portrait);
                break;

            case Android.Content.Res.Orientation.Landscape:
                OrientationPage.NotifyOrientationChange(Portable.Enums.Orientation.LandscapeLeft);
                break;
            }
        }
Пример #2
0
        /// <summary>
        /// Dids the change status bar orientation.
        /// </summary>
        /// <param name="application">Application.</param>
        /// <param name="oldStatusBarOrientation">Old status bar orientation.</param>
        public override void DidChangeStatusBarOrientation(UIApplication application, UIInterfaceOrientation oldStatusBarOrientation)
        {
            // change listview opacity based upon orientation
            switch (UIApplication.SharedApplication.StatusBarOrientation)
            {
            case UIInterfaceOrientation.Portrait:
            case UIInterfaceOrientation.PortraitUpsideDown:
                OrientationPage.NotifyOrientationChange(Orientation.Portrait);
                break;

            case UIInterfaceOrientation.LandscapeLeft:
                OrientationPage.NotifyOrientationChange(Orientation.LandscapeLeft);
                break;

            case UIInterfaceOrientation.LandscapeRight:
                OrientationPage.NotifyOrientationChange(Orientation.LandscapeRight);
                break;
            }
        }