public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); Point displaySize = new Point( ); Activity.WindowManager.DefaultDisplay.GetSize(displaySize); NoteDiscGuideView.SetBounds(new System.Drawing.RectangleF(0, 0, displaySize.X, displaySize.Y)); }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); PrepareCreateNotes( ); ResultView.SetBounds(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels)); AnimateTutorialScreen(false); }
// Inflate camera controls and update the UI manually upon config changes to avoid removing // and re-adding the view finder from the view hierarchy; this provides a seamless rotation // transition on devices that support it. // // NOTE: The flag is supported starting in Android 8 but there still is a small flash on the // screen for devices that run Android 9 or below. public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); // Redraw the camera UI controls UpdateCameraUi(); // Enable or disable switching between cameras UpdateCameraSwitchButton(); }
protected override async void OnCreate(Bundle bundle) { ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(Android.App.Application.Context); ISharedPreferencesEditor editor = prefs.Edit(); if (prefs.GetString("locale", "") == "") { editor.PutString("locale", "en"); editor.Apply(); } string loc = prefs.GetString("locale", ""); var locale = new Java.Util.Locale(loc); Java.Util.Locale.Default = locale; var config = new Android.Content.Res.Configuration { Locale = locale }; #pragma warning disable CS0618 // Type or member is obsolete BaseContext.Resources.UpdateConfiguration(config, metrics: BaseContext.Resources.DisplayMetrics); #pragma warning restore CS0618 // Type or member is obsolete base.OnCreate(bundle); SetContentView(Resource.Layout.activity_sceduler); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += FabOnClick; DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawer.AddDrawerListener(toggle); toggle.SyncState(); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); navigationView.SetNavigationItemSelectedListener(this); apiClient = new APIClient(); schedulerCollection = await apiClient.GetScheduleAsync(1); schedulerList = schedulerCollection.OrderBy(x => x.Start_date).ToList(); CreateNotificationChannel(); schedule = new SfSchedule(this); CreateAppointments(); schedule.ItemsSource = Orders; schedule.ScheduleView = ScheduleView.WeekView; schedule.CellTapped += schedule_ScheduleCellTapped; LinearLayout linearLayout = FindViewById <LinearLayout>(Resource.Id.scheduler_p); linearLayout.AddView(schedule); PushNotif(); }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { orientation = newConfig.Orientation; this.Finish(); Intent intent = new Intent(this, typeof(MainActivity)); StartActivity(intent); base.OnConfigurationChanged(newConfig); }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { try { base.OnConfigurationChanged(newConfig); } catch (Exception ex) { var e = ex.ToString(); } }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); if (newConfig.Orientation == Android.Content.Res.Orientation.Portrait) { } else if (newConfig.Orientation == Android.Content.Res.Orientation.Landscape) { } }
public static bool IsPortrait( ) { Android.Content.Res.Configuration currConfig = Rock.Mobile.PlatformSpecific.Android.Core.Context.Resources.Configuration; // is our width less? if (currConfig.ScreenWidthDp < currConfig.ScreenHeightDp == true) { return(true); } return(false); }
public static bool IsLandscape( ) { Android.Content.Res.Configuration currConfig = Rock.Mobile.PlatformSpecific.Android.Core.Context.Resources.Configuration; // is our width greater? if (currConfig.ScreenWidthDp > currConfig.ScreenHeightDp == true) { return(true); } return(false); }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); // Do something to _videoPlayer so prepared gets called // Super hacky. The only time OnCofigurationChanged is called is when coming and going from the lock screen // so when going to the lock screen back out to the EpisodeDetailsActivity. // This will launch the EpisodeDetailsActivity just to hide it which is a huge waste of resources (I think) // But then coming back from the lock screen, the episode details activity will show and then the user can pick to continue watching the episode. Intent i = new Intent(this.ApplicationContext, typeof(EpisodeDetailsActivity)); StartActivity(i); }
// инициализация класса "игра" public PacManGame() { // инициализация графики Graphics = new GraphicsDeviceManager(this); var metric = new Android.Util.DisplayMetrics(); Activity.WindowManager.DefaultDisplay.GetMetrics(metric); // установка параметров экрана Graphics.IsFullScreen = true; Graphics.PreferredBackBufferWidth = metric.WidthPixels; Graphics.PreferredBackBufferHeight = metric.HeightPixels; CurrentWidth = Graphics.PreferredBackBufferWidth; CurrentHeigth = Graphics.PreferredBackBufferHeight; Graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight; UpdateScreenAttributies(); string strlocale = Locale.Default.ToString(); strlocale = strlocale.Substring(0, 2); if (strlocale.Equals("ru") || strlocale.Equals("be") || strlocale.Equals("uk") || strlocale.Equals("sr") || strlocale.Equals("kz")) { Language = "ru"; strScore = "Счет: "; strRecord = "Рекорд: "; strScoreAmount = "Число очков: "; strRecordString = "Рекорд "; strRecordNotReached = " не был побит."; strPacmanInjured = "Pacman был ранен о границы поля..."; strNewRecord = "Поставлен рекорд "; } else { Language = "en"; strScore = "Score: "; strRecord = "Record: "; strScoreAmount = "Reached score: "; strRecordString = "Record "; strRecordNotReached = " was not reached."; strPacmanInjured = "Pacman was injured by field border..."; strNewRecord = "New record reached: "; } var locale = new Locale(Language); // languageIso is locale string Locale.Default = locale; var config = new Android.Content.Res.Configuration { Locale = locale }; Activity.Resources.UpdateConfiguration(config, Activity.Resources.DisplayMetrics); }
// Method for limiting the font scale in Accessibility utils public static void AdjustFontScale(Activity context) { Android.Content.Res.Configuration configuration = context.Resources.Configuration; if (configuration.FontScale > 1.25) { configuration.FontScale = 1.25f; DisplayMetrics metrics = context.Resources.DisplayMetrics; IWindowManager wm = Application.Context.GetSystemService(Context.WindowService).JavaCast <IWindowManager>(); wm.DefaultDisplay.GetMetrics(metrics); metrics.ScaledDensity = configuration.FontScale * metrics.Density; context.CreateConfigurationContext(configuration); } }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); var listener = new OnGlobalLayoutListener(); listener.OnGlobalLayoutAction += () => { LayoutGridView(); GridView.ViewTreeObserver.RemoveOnGlobalLayoutListener(listener); }; GridView.ViewTreeObserver.AddOnGlobalLayoutListener(listener); }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { try { base.OnConfigurationChanged(newConfig); mDrawerToggle.OnConfigurationChanged(newConfig); } catch (Exception exception) { InsightsUtils.LogException(exception); } }
/// <summary> /// Returns true if the device is CURRENTLY IN landscape wide mode. /// </summary> public static bool IsLandscapeWide( ) { Android.Content.Res.Configuration currConfig = Rock.Mobile.PlatformSpecific.Android.Core.Context.Resources.Configuration; // if it has the capacity for landscape wide, and is currently in landscape if (MainActivity.SupportsLandscapeWide( ) == true && (currConfig.ScreenWidthDp > currConfig.ScreenHeightDp) == true) { // then yes, we're in landscape wide. return(true); } return(false); }
public override void OnConfigurationChanged( Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); if (newConfig.Orientation == Android.Content.Res.Orientation.Portrait) { _myText.LayoutParameters = _portraitParameters; } else if (newConfig.Orientation == Android.Content.Res.Orientation.Landscape) { _myText.LayoutParameters = _landscapeParameters; } }
public override void OnConfigurationChanged (Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged (newConfig); Console.WriteLine ("config changed"); if (newConfig.Orientation == Android.Content.Res.Orientation.Portrait) { _tv.LayoutParameters = _layoutParamsPortrait; _tv.Text = "Changed to portrait. Timestamp = " + _timestamp; } else if (newConfig.Orientation == Android.Content.Res.Orientation.Landscape) { _tv.LayoutParameters = _layoutParamsLandscape; _tv.Text = "Changed to landscape. Timestamp = " + _timestamp; } }
/// <summary> /// Returns true if the device CAN display in landscape wide mode. This doesn't /// necessarily mean it IS in landscape wide mode. /// </summary> public static bool SupportsLandscapeWide(Context contextArg = null) { Context currContext = contextArg == null ? Rock.Mobile.PlatformSpecific.Android.Core.Context : contextArg; // get the current device configuration Android.Content.Res.Configuration currConfig = currContext.Resources.Configuration; if ((currConfig.ScreenLayout & Android.Content.Res.ScreenLayout.SizeMask) >= Android.Content.Res.ScreenLayout.SizeLarge) { return(true); } return(false); }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); GrialKit.NotifyConfigurationChanged(newConfig); if ((int)Build.VERSION.SdkInt <= 19 && !locale.Equals(newConfig.Locale)) { // Need to recreate the activity when locale has changed for APIs 18 and 19 // as changes in ConfigChanges.Locale break images used in the app Recreate(); } }
protected override async void OnCreate(Bundle savedInstanceState) { ISharedPreferences prefs1 = PreferenceManager.GetDefaultSharedPreferences(Android.App.Application.Context); ISharedPreferencesEditor editor1 = prefs1.Edit(); if (prefs1.GetString("locale", "") == "") { editor1.PutString("locale", "en"); editor1.Apply(); } string loc = prefs1.GetString("locale", ""); var locale = new Java.Util.Locale(loc); Java.Util.Locale.Default = locale; var config = new Android.Content.Res.Configuration { Locale = locale }; #pragma warning disable CS0618 // Type or member is obsolete BaseContext.Resources.UpdateConfiguration(config, metrics: BaseContext.Resources.DisplayMetrics); #pragma warning restore CS0618 // Type or member is obsolete base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_map_search); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += FabOnClick; DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawer.AddDrawerListener(toggle); toggle.SyncState(); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); navigationView.SetNavigationItemSelectedListener(this); Markers = new Dictionary <int, List <Workplace> >(); ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(Android.App.Application.Context); searchingViewModel = JsonConvert.DeserializeObject <SearchingViewModel>(prefs.GetString("searchingViewModel", "")); apiClient = new APIClient(); findedWorkplaces = await apiClient.SearcForWorcplacesAsync(searchingViewModel); var mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.frag); mapFragment.GetMapAsync(this); }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); LinearLayout linearLayout = FindViewById <LinearLayout>(Resource.Id.linearLayout); if (newConfig.Orientation == Android.Content.Res.Orientation.Portrait) { linearLayout.Orientation = Orientation.Vertical; } else if (newConfig.Orientation == Android.Content.Res.Orientation.Landscape) { linearLayout.Orientation = Orientation.Horizontal; } }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); if (newConfig.Orientation == Android.Content.Res.Orientation.Portrait) { //_tv.LayoutParameters = _layoutParamsPortrait; //_tv.Text = "Changed to portrait"; } else if (newConfig.Orientation == Android.Content.Res.Orientation.Landscape) { //_tv.LayoutParameters = _layoutParamsLandscape; //_tv.Text = "Changed to landscape"; } }
protected async override void OnCreate(Bundle savedInstanceState) { ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(Android.App.Application.Context); ISharedPreferencesEditor editor = prefs.Edit(); if (prefs.GetString("locale", "") == "") { editor.PutString("locale", "en"); editor.Apply(); } string loc = prefs.GetString("locale", ""); var locale = new Java.Util.Locale(loc); Java.Util.Locale.Default = locale; var config = new Android.Content.Res.Configuration { Locale = locale }; #pragma warning disable CS0618 // Type or member is obsolete BaseContext.Resources.UpdateConfiguration(config, metrics: BaseContext.Resources.DisplayMetrics); #pragma warning restore CS0618 // Type or member is obsolete base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_home); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += FabOnClick; DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawer.AddDrawerListener(toggle); toggle.SyncState(); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); navigationView.SetNavigationItemSelectedListener(this); apiClient = new APIClient(); client = await apiClient.GetClientByIdAsync(0); FindLayoutControls(); ManageLayoutData(); SetControlsClick(); }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); if (newConfig.Orientation == Android.Content.Res.Orientation.Portrait) { Window.ClearFlags(WindowManagerFlags.ForceNotFullscreen); Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); } else if (newConfig.Orientation == Android.Content.Res.Orientation.Landscape) { Window.ClearFlags(WindowManagerFlags.ForceNotFullscreen); Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); } }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); Point displaySize = new Point( ); Activity.WindowManager.DefaultDisplay.GetSize(displaySize); if (MapView != null) { MapView.LayoutParameters.Height = (int)(displaySize.Y * .50f); } BlockerView.SetBounds(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels)); SearchPage.LayoutChanged(new System.Drawing.RectangleF(0, 0, NavbarFragment.GetCurrentContainerDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels)); }
/// <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; } }
public override bool OnOptionsItemSelected(IMenuItem item) { int id = item.ItemId; if (id == Resource.Id.menu_save) { ManageLayoutData(); return(true); } else if (id == Resource.Id.menu_main_lang) { ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(Android.App.Application.Context); ISharedPreferencesEditor editor = prefs.Edit(); if (prefs.GetString("locale", "") == "en") { editor.PutString("locale", "uk"); } else { editor.PutString("locale", "en"); } editor.Apply(); string loc = prefs.GetString("locale", ""); var locale = new Java.Util.Locale(loc); var config = new Android.Content.Res.Configuration { Locale = locale }; #pragma warning disable CS0618 // Type or member is obsolete BaseContext.Resources.UpdateConfiguration(config, metrics: BaseContext.Resources.DisplayMetrics); #pragma warning restore CS0618 // Type or member is obsolete //ava.Util.Locale.Default = locale; this.Recreate(); return(true); } else if (id == Resource.Id.menu_main_logout) { var intent = new Intent(this, typeof(MainActivity)); StartActivity(intent); return(true); } return(base.OnOptionsItemSelected(item)); }
protected override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); //Hide the Status Bar when in full screen. if (newConfig.Orientation == Android.Content.Res.Orientation.Landscape) { // StatusBarHelper.DecorView.SystemUiVisibility = StatusBarVisibility.Hidden; //If you have an ActionBar, uncomment the line below //StatusBarHelper.AppActionBar.Hide (); } else { //StatusBarHelper.DecorView.SystemUiVisibility = StatusBarVisibility.Visible; //If you have an ActionBar, uncomment the line below //StatusBarHelper.AppActionBar.Show (); } }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); mPublisher.StopEncode(); //mPublisher.StopRecord(); //btnRecord.Text = "Record"; mPublisher.SetScreenOrientation((int)newConfig.Orientation); if (btnPublish.Text == "Stop") { mPublisher.StartEncode(); } mPublisher.StartCamera(); }
/// <inheritdoc/> public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { if (Ultraviolet != null && !Ultraviolet.Disposed) { var display = Ultraviolet.GetPlatform().Displays[0]; var rotation = (ScreenRotation)WindowManager.DefaultDisplay.Rotation; if (rotation != display.Rotation) { AndroidScreenRotationService.UpdateScreenRotation(rotation); var messageData = Ultraviolet.Messages.CreateMessageData <OrientationChangedMessageData>(); messageData.Display = display; Ultraviolet.Messages.Publish(UltravioletMessages.OrientationChanged, messageData); } } base.OnConfigurationChanged(newConfig); }
private Texture2D TextureTargetBad; // шестеренка #endregion Fields #region Constructors // инициализация класса "игра" public PacManGame() { // инициализация графики Graphics = new GraphicsDeviceManager(this); var metric = new Android.Util.DisplayMetrics(); Activity.WindowManager.DefaultDisplay.GetMetrics(metric); // установка параметров экрана Graphics.IsFullScreen = true; Graphics.PreferredBackBufferWidth = metric.WidthPixels; Graphics.PreferredBackBufferHeight = metric.HeightPixels; CurrentWidth = Graphics.PreferredBackBufferWidth; CurrentHeigth = Graphics.PreferredBackBufferHeight; Graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight; UpdateScreenAttributies(); string strlocale = Locale.Default.ToString(); strlocale = strlocale.Substring(0, 2); if (strlocale.Equals("ru") || strlocale.Equals("be") || strlocale.Equals("uk") || strlocale.Equals("sr") || strlocale.Equals("kz")) { Language = "ru"; strScore = "Счет: "; strRecord = "Рекорд: "; strScoreAmount = "Число очков: "; strRecordString = "Рекорд "; strRecordNotReached = " не был побит."; strPacmanInjured = "Pacman был ранен о границы поля..."; strNewRecord = "Поставлен рекорд "; } else { Language = "en"; strScore = "Score: "; strRecord = "Record: "; strScoreAmount = "Reached score: "; strRecordString = "Record "; strRecordNotReached = " was not reached."; strPacmanInjured = "Pacman was injured by field border..."; strNewRecord = "New record reached: "; } var locale = new Locale(Language); // languageIso is locale string Locale.Default = locale; var config = new Android.Content.Res.Configuration {Locale = locale}; Activity.Resources.UpdateConfiguration(config, Activity.Resources.DisplayMetrics); }