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

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

            _webView = FindViewById <WebView>(Resource.Id.webView);
            _webView.Settings.JavaScriptEnabled = true;

            // Use subclassed WebViewClient to intercept hybrid native calls
            _viewClient = new HybridWebViewClient();
            _webView.SetWebViewClient(_viewClient);
            _webView.LongClick += (object sender, View.LongClickEventArgs e) => { e.Handled = true; };

            if (_soundPool == null)
            {
                _soundPool   = new SoundPool(6, Stream.Music, 0);
                _soundIds    = new int[6];
                _soundIds[0] = _soundPool.Load(Application, Resource.Raw.E6, 1);
                _soundIds[1] = _soundPool.Load(Application, Resource.Raw.A5, 1);
                _soundIds[2] = _soundPool.Load(Application, Resource.Raw.D4, 1);
                _soundIds[3] = _soundPool.Load(Application, Resource.Raw.G3, 1);
                _soundIds[4] = _soundPool.Load(Application, Resource.Raw.B2, 1);
                _soundIds[5] = _soundPool.Load(Application, Resource.Raw.E1, 1);
            }
            if (_bundle == null)
            {
                _viewClient.ShowChord(_webView, new NameValueCollection());
            }
            else
            {
                _webView.RestoreState(_bundle);
            }
        }