Esempio n. 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            debugAlertMessage("onafter_OnCreate");

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            debugAlertMessage("onafter_SetContentView");

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            //Toolbar will now take on default actionbar characteristics
            SetActionBar(toolbar);
            if (ActionBar != null)
            {
                ActionBar.Title = "Latest";
            }
            debugAlertMessage("onafter_SetActionBar");

            nextButton = FindViewById <Button>(Resource.Id.nextButton);
            WebView localWebView = FindViewById <WebView>(Resource.Id.LocalWebView);

            localWebView.Settings.JavaScriptEnabled = true;

            debugAlertMessage("onafter_findLocalWebView");

            nextButton.Click += delegate { navigateToNextVideo(); };

            string temp = SecurityHelper.Crypt("http://bestofyoutube.com/index.php?page=");

            // find the retained fragment on activity restarts
            mRetainedFragment = (RetainedFragment)FragmentManager.FindFragmentByTag(TAG_RETAINED_FRAGMENT);
            if (mRetainedFragment != null)
            {
                stateData = mRetainedFragment.getData();
                loadWebViewUrl();
            }
            else
            {
                //First time startup
                refresh();
            }

            debugAlertMessage("onafter_refresh");

            this.Window.AddFlags(WindowManagerFlags.Fullscreen);
            //this.Window.ClearFlags(WindowManagerFlags.Fullscreen); //this restores the notification bar
        }
Esempio n. 2
0
        protected override void OnSaveInstanceState(Bundle outState)
        {
            mRetainedFragment = (RetainedFragment)FragmentManager.FindFragmentByTag(TAG_RETAINED_FRAGMENT);

            // create the fragment and data the first time
            if (mRetainedFragment == null)
            {
                // add the fragment
                mRetainedFragment = new RetainedFragment();
                FragmentManager.BeginTransaction().Add(mRetainedFragment, TAG_RETAINED_FRAGMENT).Commit();
                // load data from a data source or perform any calculation
                mRetainedFragment.setData(stateData);
            }
            else
            {
                mRetainedFragment.setData(stateData);
            }

            base.OnSaveInstanceState(outState);
        }