Example #1
0
 public override void DidFinishLaunching(NSNotification notification)
 {
     FormsWebViewRenderer.Initialize();
     Forms.Init();
     LoadApplication(new App());
     base.DidFinishLaunching(notification);
 }
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            this.SetUpIoc();

            FormsWebViewRenderer.Initialize();

            FormsWebViewRenderer.OnControlChanged += (sender, webView) => {
                webView.SetLayerType(LayerType.Software, null);
                webView.Settings.LoadWithOverviewMode = true;
                webView.Settings.UseWideViewPort      = true;
            };

            Plugin.CurrentActivity.CrossCurrentActivity.Current.Init(this, bundle);

            global::Xamarin.Forms.Forms.SetFlags("FastRenderers_Experimental");
            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());

            Window.SetSoftInputMode(SoftInput.AdjustResize);

            _batteryBroadcastReceiver = new BatteryBroadcastReceiver();
            Application.Context.RegisterReceiver(_batteryBroadcastReceiver, new IntentFilter(Intent.ActionBatteryChanged));
        }
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;
                FormsWebViewRenderer.Initialize();
                Xamarin.Forms.Forms.Init(e);

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
Example #4
0
        private void InitPlugins()
        {
            //初始化WebView插件
            FormsWebViewRenderer.Initialize();

            //初始化SfListView
            SfListViewRenderer.Init();
        }
Example #5
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            FormsWebViewRenderer.Initialize();
            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);
            FormsWebViewRenderer.Initialize();
            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());
        }
Example #7
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();
            FormsWebViewRenderer.Initialize();
            Toolkit.Init();
            TopTabbedRenderer.Init();
            CachedImageRenderer.Init();
            LoadApplication(new XamCnblogs.UI.App());

            return(base.FinishedLaunching(app, options));
        }
Example #8
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity);
            FormsWebViewRenderer.Initialize();
            global::Xamarin.Forms.Forms.Init(this, bundle);

            LoadApplication(new App());
        }
Example #9
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;
            UserDialogs.Init(this);
            base.OnCreate(savedInstanceState);
            FormsWebViewRenderer.Initialize();
            CrossCurrentActivity.Current.Init(this, savedInstanceState);
            await CrossMedia.Current.Initialize();

            Forms.Init(this, savedInstanceState);
            CachedImageRenderer.Init(true);
            LoadApplication(new App());
        }
Example #10
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            FormsWebViewRenderer.Initialize();
            Toolkit.Init();
            CachedImageRenderer.Init(true);
            Shares.Init(this);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new HT.APPStore.App());
        }
Example #11
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            HtmlLabelRenderer.Initialize();
            FormsWebViewRenderer.Initialize();
            FFImageLoading.Forms.Platform.CachedImageRenderer.Init();
            global::Xamarin.Forms.Forms.Init();

            //TODO Trial Mode only allows 15 seconds of playback see
            //https://github.com/adamfisher/Xamarin.Forms.VideoPlayer/blob/master/GettingStarted.md
            //FormsVideoPlayer.Init();

            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
Example #12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            CarouselViewRenderer.Init();
            ZXing.Net.Mobile.Forms.Android.Platform.Init();
            Plugin.Iconize.Iconize.Init(Resource.Id.toolbar, Resource.Id.sliding_tabs);
            FormsWebViewRenderer.Initialize();
            FFImageLoading.Forms.Platform.CachedImageRenderer.Init(enableFastRenderer: true);
            Window.SetStatusBarColor(Color.ParseColor("#b44800"));
            // AnimationViewRenderer.Init();
            LoadApplication(new App());
        }
Example #13
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            FormsWebViewRenderer.Initialize();

            // 对控件进行修改,注意位置
            FormsWebViewRenderer.OnControlChanged += FormsWebViewRenderer_OnControlChanged;

            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());

            OnNewIntent(Intent);
        }
Example #14
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            FormsWebViewRenderer.Init();
            FormsWebViewRenderer.OnControlChanging += (sender, element, control) =>
            {
                // Sender - The WebView triggering this event
                // Element - The Xamarin.Forms abstraction view
                // Control - WKWebView, WebKit.WebView or UI.WebView depending on platform, please case this accordingly.

                var webView = control as WKWebView;
            };

            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
Example #15
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            FormsWebViewRenderer.Initialize();

            FormsWebViewRenderer.OnControlChanged += FormsWebViewRenderer_OnControlChanged;

            AiForms.Renderers.iOS.SettingsViewInit.Init(); //need to write here

            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new App());

            // 后台播放音乐
            AVAudioSession avSession = AVAudioSession.SharedInstance();

            avSession.SetCategory(AVAudioSessionCategory.Playback);

            return(base.FinishedLaunching(app, options));
        }
Example #16
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            FormsWebViewRenderer.Initialize();
            Plugin.CurrentActivity.CrossCurrentActivity.Current.Init(this, savedInstanceState);
            global::ZXing.Net.Mobile.Forms.Android.Platform.Init();

            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App());

            global::Android.Webkit.WebView.SetWebContentsDebuggingEnabled(true);
        }
Example #17
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();
            CarouselViewRenderer.Init();
            ZXing.Net.Mobile.Forms.iOS.Platform.Init();
            AnimationViewRenderer.Init();
            FormsWebViewRenderer.Initialize();
            FFImageLoading.Forms.Platform.CachedImageRenderer.Init();
            UINavigationBar.Appearance.TintColor    = UIColor.White;
            UINavigationBar.Appearance.BarTintColor = new UIColor(red: 0.91f, green: 0.35f, blue: 0.21f, alpha: 1.0f);
            UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes()
            {
                TextColor = UIColor.White
            });
            LoadApplication(new App());


            return(base.FinishedLaunching(app, options));
        }
Example #18
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            FormsWebViewRenderer.Init();
            FormsWebViewRenderer.OnControlChanging += (sender, element, control) =>
            {
                var webView = control as Android.Webkit.WebView;
                webView.SetLayerType(LayerType.Software, null);
                webView.Settings.LoadWithOverviewMode = true;
                webView.Settings.UseWideViewPort      = true;
            };

            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());
        }
Example #19
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            FormsWebViewRenderer.Initialize();
            Toolkit.Init();
            CachedImageRenderer.Init(true);

            Shares.Init(this);

            XGPushConfig.EnableDebug(this, !BuildConfig.Debug);
            XGPushManager.RegisterPush(this, this);

            global::Xamarin.Forms.Forms.Init(this, bundle);

            LoadApplication(new App());
        }
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            FormsWebViewRenderer.Initialize();
            HtmlLabelRenderer.Initialize();
            FFImageLoading.Forms.Platform.CachedImageRenderer.Init(enableFastRenderer: true);
            global::Xamarin.Forms.Forms.Init(this, bundle);

            //init libraries
            Xamarin.Essentials.Platform.Init(this, bundle);

            //TODO Trial Mode only allows 15 seconds of playback see
            //https://github.com/adamfisher/Xamarin.Forms.VideoPlayer/blob/master/GettingStarted.md
            //FormsVideoPlayer.Init();

            LoadApplication(new App());
        }
Example #21
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            ////////// 启动引擎
            AppEngine.Init()
            .RegisterComponent <IPlatformService, iOSPlatformService>(LifeCycleEnum.Singleton)
            .UseOlliixAppConfigurations()
            .Start();

            ////////// 初始化浏览器
            FormsWebViewRenderer.Initialize();
            FormsWebViewRenderer.OnControlChanged += FormsWebViewRenderer_OnControlChanged;

            ////////// 初始化扫描器
            ZXing.Net.Mobile.Forms.iOS.Platform.Init();

            // 强制竖屏

            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
Example #22
0
 public FormsWKNavigationDelegate(FormsWebViewRenderer renderer, FormsWebView element)
 {
     Renderer = renderer;
     Element  = element;
 }
Example #23
0
 public FormsWebViewJsBridge(FormsWebViewRenderer renderer)
 {
     Renderer = new WeakReference <FormsWebViewRenderer>(renderer);
 }
Example #24
0
 public LocalFileStreamResolver(FormsWebViewRenderer renderer)
 {
     Renderer = renderer;
 }
Example #25
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.Camera) != Permission.Granted && ContextCompat.CheckSelfPermission(this, Manifest.Permission.AccessFineLocation) != Permission.Granted)
            {
                ActivityCompat.RequestPermissions(this, new[] {
                    Manifest.Permission.Camera,
                    Manifest.Permission.AccessCoarseLocation,
                    Manifest.Permission.AccessFineLocation,
                }, PERMISSION_REQUEST_ID);
                //// Should we show an explanation?
                //if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.Camera))
                //{

                //    // Show an expanation to the user *asynchronously* -- don't block
                //    // this thread waiting for the user's response! After the user
                //    // sees the explanation, try again to request the permission.

                //}
                //else
                //{

                //    // No explanation needed, we can request the permission.

                //    ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.Camera }, MY_PERMISSIONS_REQUEST_Camera);

                //    // MY_PERMISSIONS_REQUEST_Camera is an
                //    // app-defined int constant. The callback method gets the
                //    // result of the request.
                //}
            }
            else if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.Camera) != Permission.Granted)
            {
                ActivityCompat.RequestPermissions(this, new[] {
                    Manifest.Permission.Camera,
                }, PERMISSION_REQUEST_ID);
            }
            else if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.AccessFineLocation) != Permission.Granted)
            {
                ActivityCompat.RequestPermissions(this, new[] {
                    Manifest.Permission.AccessCoarseLocation,
                    Manifest.Permission.AccessFineLocation,
                }, PERMISSION_REQUEST_ID);
            }

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;
            ////////// 强制竖屏
            this.RequestedOrientation = ScreenOrientation.Portrait;

            base.OnCreate(savedInstanceState);

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

            ////////// 初始化扫描器
            ZXing.Mobile.MobileBarcodeScanner.Initialize(Application);
            ZXing.Net.Mobile.Forms.Android.Platform.Init();

            ////////// 初始化浏览器
            FormsWebViewRenderer.Initialize();
            FormsWebViewRenderer.OnControlChanged += FormsWebViewRenderer_OnControlChanged;

            ////////// 初始化对话框组件
            Acr.UserDialogs.UserDialogs.Init(this);

            LoadApplication(new App());
        }
Example #26
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                var rendererAssemblies = new[] { typeof(HtmlLabelRenderer).GetTypeInfo().Assembly };

                var rendererVideoAssemblies = new[] { typeof(FormsWebViewRenderer).GetTypeInfo().Assembly };

                //webview: https://github.com/SKLn-Rad/Xam.Plugin.Webview
                FormsWebViewRenderer.Initialize();
                FFImageLoading.Forms.Platform.CachedImageRenderer.Init();
                Xamarin.Forms.Forms.Init(e);

                HtmlLabelRenderer.Initialize();



                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                if (e.PreviousExecutionState != ApplicationExecutionState.Running)
                {
                    bool           loadState      = (e.PreviousExecutionState == ApplicationExecutionState.Terminated);
                    ExtendedSplash extendedSplash = new ExtendedSplash(e.SplashScreen, loadState);
                    Window.Current.Content = extendedSplash;
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    // When the navigation stack isn't restored navigate to the first page,
                    // configuring the new page by passing required information as a navigation
                    // parameter
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }
                // Ensure the current window is active

                ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;



                Window.Current.Activate();
            }


            this.ExtendAcrylicIntoTitleBar();
        }
Example #27
0
        protected override void OnCreate(Bundle bundle)
        {
            try
            {
                FormsAppCompatActivity.ToolbarResource   = Resource.Layout.Toolbar;
                FormsAppCompatActivity.TabLayoutResource = Resource.Layout.Tabbar;

                base.OnCreate(bundle);


                if (Settings.TurnFullScreenOn)
                {
                    this.Window.AddFlags(WindowManagerFlags.Fullscreen);
                    this.Window.AddFlags(WindowManagerFlags.KeepScreenOn);
                }

                if (Settings.TurnSecurityProtocolType3072On)
                {
                    ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
                    HttpClient client = new HttpClient(new Xamarin.Android.Net.AndroidClientHandler());
                }

                if (Settings.TurnTrustFailureOn_WebException)
                {
                    //If you are Getting this error >>> System.Net.WebException: Error: TrustFailure /// then Set it to true
                    System.Net.ServicePointManager.ServerCertificateValidationCallback += (o, certificate, chain, errors) => true;
                    System.Security.Cryptography.AesCryptoServiceProvider b = new System.Security.Cryptography.AesCryptoServiceProvider();
                }

                //Methods =>> Copy the text
                AndroidClipboardManager = (ClipboardManager)GetSystemService(ClipboardService);

                CachedImageRenderer.Init();
                var ignore = new CircleTransformation();

                var assembliesToInclude = new List <Assembly>()
                {
                    typeof(CachedImage).GetTypeInfo().Assembly,
                    typeof(CachedImageRenderer).GetTypeInfo().Assembly
                };
                SegmentedControlRenderer.Init();
                PullToRefreshLayoutRenderer.Init();
                FFImageLoading.Forms.Droid.CachedImageRenderer.Init();
                global::Xamarin.Forms.Forms.Init(this, bundle);

                try
                {
                    var  activity      = Xamarin.Forms.Forms.Context;
                    File httpCacheDir  = new File(activity.CacheDir, "http");
                    long httpCacheSize = 10 * 1024 * 1024; // 10 MiB
                    HttpResponseCache.Install(httpCacheDir, httpCacheSize);
                }
                catch (IOException ce)
                {
                }

                UserDialogs.Init(this);

                MobileAds.Initialize(ApplicationContext, Settings.Ad_Unit_ID);

                FormsWebViewRenderer.Initialize();
                LoadApplication(new App());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #28
0
 public FormsWebViewClient(FormsWebView element, FormsWebViewRenderer renderer)
 {
     Element  = element;
     Renderer = renderer;
 }
Example #29
0
 public FormsWebViewChromeClient(FormsWebViewRenderer renderer)
 {
     Renderer = renderer;
 }