protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Webview); wv = (WebView)FindViewById(Resource.Id.WV); wv.SetWebChromeClient(new WebChromeClient()); wv.SetWebViewClient(new WebViewClient()); wv.Settings.JavaScriptEnabled = true; wv.Settings.DomStorageEnabled = true; wv.Settings.SetSupportZoom(true); wv.Settings.DisplayZoomControls = false; wv.Settings.BuiltInZoomControls = true; wv.Settings.CacheMode = CacheModes.Default; wv.Settings.UseWideViewPort = true; wv.Settings.LoadWithOverviewMode = true; wv.SetInitialScale(1); hh = new AppPreferences(this); if (savedInstanceState == null) { wv.LoadUrl(hh.getAccessKey("SP_WEBVIEW_PREFS", "file:///android_asset/index.html"), null); MainActivity.fa.Finish(); } }
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 OnCreate(Bundle bundle) { base.OnCreate(bundle); // this.Window.AddFlags(WindowManagerFlags.Fullscreen); mXWalkInitializer = new XWalkInitializer(this, this); mXWalkInitializer.InitAsync(); SetContentView(Resource.Layout.XWalkView); xwv = (Org.Xwalk.Core.XWalkView)FindViewById(Resource.Id.xwalkview); hh = new AppPreferences(this); }
public void getdiag(AppPreferences hh) { // setup the alert builder AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetTitle("اختر نوع المتصفح الذي تفضله:"); // add a radio button list String[] animals = { "المتصفح الداخلي الذي يأتي مع الاندرويد...", "المتصفح كروسوك المستقل يحتاج للتثبيت مرة واحدة فقط..." }; int checkedItem = 0; // cow builder.SetSingleChoiceItems(animals, checkedItem, (s, e) => { checkedItem = e.Which; Log.Debug("hhhhhhhh", e.Which.ToString()); }); builder.SetPositiveButton("ok", (s, e) => { if (checkedItem == 0) { Toast.MakeText(this, "notCross ", ToastLength.Short).Show(); hh.saveAccessKey("notCross", "PREFERENCE_WEBVIEW_TYPE"); StartActivity(new Intent(Application.Context, typeof(WvActivity)).AddFlags(ActivityFlags.NoAnimation)); } else { Toast.MakeText(this, "Cross ", ToastLength.Short).Show(); hh.saveAccessKey("Cross", "PREFERENCE_WEBVIEW_TYPE"); StartActivity(new Intent(Application.Context, typeof(CrossActivity)).AddFlags(ActivityFlags.NoAnimation)); } }); AlertDialog dialog = builder.Create(); dialog.Show(); dialog.SetCanceledOnTouchOutside(false); }