public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); var metrics = Resources.DisplayMetrics; screenWidth = metrics.WidthPixels; screenHeight = metrics.HeightPixels; density = metrics.Density; // System.Diagnostics.Debug.WriteLine("**** MainActivity sw,sh,sd,swdp,shdp " + screenWidth + " " + screenHeight + " " + // density); if (newConfig.Orientation == Android.Content.Res.Orientation.Portrait) { // System.Diagnostics.Debug.WriteLine("**** Orientation: portrait"); if (screenWidth > screenHeight) { int temp = screenWidth; screenWidth = screenHeight; screenHeight = temp; } } else if (newConfig.Orientation == Android.Content.Res.Orientation.Landscape) { // System.Diagnostics.Debug.WriteLine("**** Orientation: landscape"); if (screenWidth < screenHeight) { int temp = screenWidth; screenWidth = screenHeight; screenHeight = temp; } } }
protected override void OnCreate(Bundle bundle) { //Locale locale = new Locale("ar"); var languageIso = "ar"; var locale = new Java.Util.Locale(languageIso);// languageIso is locale string Java.Util.Locale.Default = locale; var config = new Android.Content.Res.Configuration { Locale = locale }; BaseContext.Resources.UpdateConfiguration(config, BaseContext.Resources.DisplayMetrics); base.OnCreate(bundle); SetContentView(Resource.Layout.Main); fa = this; int currentapiVersion = (int)(Build.VERSION.SdkInt); AppPreferences hh = new AppPreferences(this); if (currentapiVersion >= 19) { if (hh.getAccessKey("PREFERENCE_WEBVIEW_TYPE", "null").Equals("null")) { getdiag(hh); } else { if (hh.getAccessKey("PREFERENCE_WEBVIEW_TYPE", "null").Equals("notCross")) { StartActivity(new Intent(Application.Context, typeof(WvActivity)).AddFlags(ActivityFlags.NoAnimation)); } else { StartActivity(new Intent(Application.Context, typeof(CrossActivity)).AddFlags(ActivityFlags.NoAnimation)); } } } else { StartActivity(new Intent(Application.Context, typeof(CrossActivity)).AddFlags(ActivityFlags.NoAnimation)); } }
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); hideKeyBoard(); //Toast.MakeText(this, "called OnConfigurationChanged", ToastLength.Long).Show(); //if (newConfig.Orientation == Android.Content.Res.Orientation.Landscape) //{ // //Toast.MakeText(this, "landscape", ToastLength.Long).Show(); // var img = FindViewById<ImageView>(Resource.Id.imageView1); // img.Layout(10, 0, 0, 0); //} //else //{ // Toast.MakeText(this, "portrait", ToastLength.Long).Show(); //} }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); //UpdateTheme(newConfig); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); context = Application.Context; #region Мова ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(context); ISharedPreferencesEditor editor = prefs.Edit(); languagesId = prefs.GetInt("key_languageId", 1); if (languagesId == 1) { LanguageCodevalue = "en"; } else if (languagesId == 2) { LanguageCodevalue = "fr"; } else if (languagesId == 3) { LanguageCodevalue = "de"; } else if (languagesId == 4) { LanguageCodevalue = "it"; } else if (languagesId == 5) { LanguageCodevalue = "es"; } else if (languagesId == 6) { LanguageCodevalue = "pt"; } else if (languagesId == 7) { LanguageCodevalue = "cs"; } else if (languagesId == 8) { LanguageCodevalue = "pl"; } else if (languagesId == 9) { LanguageCodevalue = "ru"; } else if (languagesId == 10) { LanguageCodevalue = "uk"; } else if (languagesId == 11) { LanguageCodevalue = "ja"; } else if (languagesId == 12) { LanguageCodevalue = "ko"; } Android.Content.Res.Resources res = this.Resources; DisplayMetrics Dm = res.DisplayMetrics; Android.Content.Res.Configuration conf = res.Configuration; if (LanguageCodevalue != null) { conf.SetLocale(new Locale(LanguageCodevalue)); } else { conf.SetLocale(new Locale("en")); } res.UpdateConfiguration(conf, Dm); #endregion Window.AddFlags(WindowManagerFlags.Fullscreen); SetContentView(Resource.Layout._splashScreenNew); gifImageView = FindViewById <GifImageView>(Resource.Id.gifSplashScreen); var assets1 = Assets.List(string.Empty); if (assets1.Any()) { var videoFilename = assets1.FirstOrDefault(a => a.EndsWith(".gif")); if (!string.IsNullOrWhiteSpace(videoFilename)) { var fileDescriptor = Assets.OpenFd(videoFilename); using (var input = this.Assets.Open(videoFilename, Access.Streaming)) { byte[] buffer; using (Stream s = input) { long length = fileDescriptor.Length; buffer = new byte[length]; s.Read(buffer, 0, (int)length); gifImageView.SetBytes(buffer); gifImageView.StartAnimation(); } } } } System.Timers.Timer timer = new System.Timers.Timer(); timer.Interval = 1400; timer.AutoReset = false; timer.Elapsed += Timer_Elapsed; timer.Start(); }
protected override void OnConfigurationChanged(Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); SoftKeyboardVisible = newConfig.HardKeyboardHidden == Res.HardKeyboardHidden.No; }
protected override void OnConfigurationChanged(ARes.Configuration newConfig) { base.OnConfigurationChanged(newConfig); orientationChanged = true; viewOrientation = newConfig.Orientation; }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); mDrawerToggle.OnConfigurationChanged(newConfig); }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { newConfig.Orientation = Orientation.Portrait; base.OnConfigurationChanged(newConfig); }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { base.OnConfigurationChanged(newConfig); LockRotation(Orientation.Portrait); }
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig) { OnOrientationChange?.Invoke(newConfig.Orientation == Android.Content.Res.Orientation.Portrait ? "Portrait" : "Landscape"); base.OnConfigurationChanged(newConfig); }