Exemple #1
0
        protected override void OnCreate(Bundle bundle)
        {
            Console.WriteLine("PlaylistActivity - OnCreate");
            base.OnCreate(bundle);

            _navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            SetContentView(Resource.Layout.Playlist);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            _btnNew = FindViewById<Button>(Resource.Id.playlist_btnNew);
            _btnNew.Click += BtnNewOnClick;
            _btnShuffle = FindViewById<Button>(Resource.Id.playlist_btnNew);
            _btnShuffle.Click += BtnShuffleOnClick;
            
            _listView = FindViewById<CustomListView>(Resource.Id.playlist_listView);
            _itemListAdapter = new PlaylistItemListAdapter(this, _listView, new Playlist());
            _listView.SetAdapter(_itemListAdapter);
            _listView.ItemClick += ListViewOnItemClick;
            _listView.ItemLongClick += ListViewOnItemLongClick;

            // Save the source activity type for later (for providing Up navigation)
            _sourceActivityType = Intent.GetStringExtra("sourceActivity");

            // Since the onViewReady action could not be added to an intent, tell the NavMgr the view is ready
            //((AndroidNavigationManager)_navigationManager).SetPlaylistActivityInstance(this);
            _navigationManager.BindPlaylistView(null, this);
        }
Exemple #2
0
        protected override void OnCreate(Bundle bundle)
        {
            Console.WriteLine("AboutActivity - OnCreate");
            base.OnCreate(bundle);

            _navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            SetContentView(Resource.Layout.About);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            _progressBar = FindViewById<ProgressBar>(Resource.Id.about_progressBar);
            _lblLoading = FindViewById<TextView>(Resource.Id.about_lblLoading);
            _webView = FindViewById<WebView>(Resource.Id.about_webView);
            _webViewClient = new MyWebViewClient();
            _webViewClient.PageFinished += (sender, args) => {
                Animation anim = AnimationUtils.LoadAnimation(this, Resource.Animation.fade_out);
                anim.AnimationEnd += (animSender, animArgs) => {
                    _lblLoading.Visibility = ViewStates.Gone;
                };
                _lblLoading.StartAnimation(anim);

                Animation anim2 = AnimationUtils.LoadAnimation(this, Resource.Animation.fade_out);
                anim2.AnimationEnd += (animSender, animArgs) => {
                    _progressBar.Visibility = ViewStates.Gone;
                };
                _progressBar.StartAnimation(anim2);
            };
            _webView.SetWebViewClient(_webViewClient);

            // Since the onViewReady action could not be added to an intent, tell the NavMgr the view is ready
            //((AndroidNavigationManager)_navigationManager).SetAboutActivityInstance(this);
            _navigationManager.BindAboutView(this);
        }
        protected override void OnCreate(Bundle bundle)
        {
            Console.WriteLine("EqualizerPresetsActivity - OnCreate");
            base.OnCreate(bundle);

            _navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            SetContentView(Resource.Layout.EqualizerPresets);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            _seekBarVolume = FindViewById<SeekBar>(Resource.Id.equalizerPresets_seekBarVolume);
            _seekBarVolume.ProgressChanged += (sender, args) => OnSetVolume(1);

            _btnBypass = FindViewById<ToggleButton>(Resource.Id.equalizerPresets_btnBypass);
            _btnBypass.Click += (sender, args) => OnBypassEqualizer();

            _outputMeter = FindViewById<OutputMeterView>(Resource.Id.equalizerPresets_outputMeterView);

            _listView = FindViewById<ListView>(Resource.Id.equalizerPresets_listView);
            _listAdapter = new EqualizerPresetsListAdapter(this, _listView, new List<EQPreset>());
            _listView.SetAdapter(_listAdapter);
            _listView.ItemClick += ListViewOnItemClick;
            _listView.ItemLongClick += ListViewOnItemLongClick;

            // Save the source activity type for later (for providing Up navigation)
            _sourceActivityType = Intent.GetStringExtra("sourceActivity");

            // Since the onViewReady action could not be added to an intent, tell the NavMgr the view is ready
            //((AndroidNavigationManager)_navigationManager).SetEqualizerPresetsActivityInstance(this);
            _navigationManager.BindEqualizerPresetsView(null, this);
        }
        protected override void OnCreate(Bundle bundle)
        {
            Console.WriteLine("MarkerDetailsActivity - OnCreate");
            base.OnCreate(bundle);

            _navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            SetContentView(Resource.Layout.MarkerDetails);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            // Since the onViewReady action could not be added to an intent, tell the NavMgr the view is ready
            //((AndroidNavigationManager)_navigationManager).SetMarkerDetailsActivityInstance(this);
            //_navigationManager.BindMarkerDetailsView(this, );
        }
        protected override void OnCreate(Bundle bundle)
        {
            Console.WriteLine("SyncWebBrowserActivity - OnCreate");
            base.OnCreate(bundle);

            _navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            SetContentView(Resource.Layout.SyncWebBrowser);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            _lblUrl = FindViewById<TextView>(Resource.Id.syncWebBrowser_lblUrl);
            _lblCode = FindViewById<TextView>(Resource.Id.syncWebBrowser_lblCode);

            // Since the onViewReady action could not be added to an intent, tell the NavMgr the view is ready
            //((AndroidNavigationManager)_navigationManager).SetSyncWebBrowserActivityInstance(this);
            _navigationManager.BindSyncWebBrowserView(this);
        }
        protected override void OnCreate(Bundle bundle)
        {
            Console.WriteLine("ResumePlaybackActivity - OnCreate");
            base.OnCreate(bundle);

            _navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            SetContentView(Resource.Layout.ResumePlayback);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            _listView = FindViewById<ListView>(Resource.Id.resumePlayback_listView);
            _listAdapter = new ResumePlaybackListAdapter(this, new List<ResumePlaybackEntity>());
            _listView.SetAdapter(_listAdapter);
            _listView.ItemClick += ListViewOnItemClick;

            // Since the onViewReady action could not be added to an intent, tell the NavMgr the view is ready
            //((AndroidNavigationManager)_navigationManager).SetResumePlaybackActivityInstance(this);
            _navigationManager.BindResumePlaybackView(this);
        }
        protected override void OnCreate(Bundle bundle)
        {
            Console.WriteLine("SyncDownloadActivity - OnCreate");
            base.OnCreate(bundle);

            _navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            SetContentView(Resource.Layout.SyncDownload);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            _lblTitle = FindViewById<TextView>(Resource.Id.syncDownload_lblTitle);
            _lblFileName = FindViewById<TextView>(Resource.Id.syncDownload_lblFileName);
            _lblCompletedValue = FindViewById<TextView>(Resource.Id.syncDownload_lblCompletedValue);
            _lblCurrentFileProgressValue = FindViewById<TextView>(Resource.Id.syncDownload_lblCurrentFileProgressValue);
            _lblDownloadSpeedValue = FindViewById<TextView>(Resource.Id.syncDownload_lblDownloadSpeedValue);            
            _lblErrorsValue = FindViewById<TextView>(Resource.Id.syncDownload_lblErrorsValue); 
            _lblFilesDownloadedValue = FindViewById<TextView>(Resource.Id.syncDownload_lblFilesDownloadedValue);            
            _lblTotalFilesValue = FindViewById<TextView>(Resource.Id.syncDownload_lblTotalFilesValue);
            
            // Since the onViewReady action could not be added to an intent, tell the NavMgr the view is ready
            //((AndroidNavigationManager)_navigationManager).SetSyncDownloadActivityInstance(this);
        }
Exemple #8
0
        protected override void OnCreate(Bundle bundle)
        {
            Console.WriteLine("SyncActivity - OnCreate");
            base.OnCreate(bundle);

            _navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            SetContentView(Resource.Layout.Sync);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            _lblIPAddress = FindViewById<TextView>(Resource.Id.sync_lblIPAddress);
            _lblStatus = FindViewById<TextView>(Resource.Id.sync_lblStatus);
            _btnConnectManually = FindViewById<Button>(Resource.Id.sync_btnConnectManually);
            _btnConnectManually.Click += BtnConnectManuallyOnClick;
            
            _listView = FindViewById<ListView>(Resource.Id.sync_listView);
            _listAdapter = new SyncListAdapter(this, new List<SyncDevice>());
            _listView.SetAdapter(_listAdapter);
            _listView.ItemClick += ListViewOnItemClick;

            // Since the onViewReady action could not be added to an intent, tell the NavMgr the view is ready
            //((AndroidNavigationManager)_navigationManager).SetSyncActivityInstance(this);
            _navigationManager.BindSyncView(this);
        }
Exemple #9
0
        protected override void OnCreate(Bundle bundle)
        {
            Console.WriteLine("LockScreenActivity - OnCreate");
            base.OnCreate(bundle);

            _playerService = Bootstrapper.GetContainer().Resolve<IPlayerService>();
            _messengerHub = Bootstrapper.GetContainer().Resolve<ITinyMessengerHub>();

            // Create bitmap cache
            int maxMemory = (int)(Runtime.GetRuntime().MaxMemory() / 1024);
            int cacheSize = maxMemory / 16;
            _bitmapCache = new BitmapCache(null, cacheSize, 800, 800);

            // Create layout and get controls
            _navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            SetContentView(Resource.Layout.LockScreen);
            _lblArtistName = FindViewById<TextView>(Resource.Id.lockScreen_lblArtistName);
            _lblAlbumTitle = FindViewById<TextView>(Resource.Id.lockScreen_lblAlbumTitle);
            _lblSongTitle = FindViewById<TextView>(Resource.Id.lockScreen_lblSongTitle);
            _lblPosition = FindViewById<TextView>(Resource.Id.lockScreen_lblPosition);
            _lblLength = FindViewById<TextView>(Resource.Id.lockScreen_lblLength);
            _btnPrevious = FindViewById<ImageButton>(Resource.Id.lockScreen_btnPrevious);
            _btnPlayPause = FindViewById<ImageButton>(Resource.Id.lockScreen_btnPlayPause);
            _btnNext = FindViewById<ImageButton>(Resource.Id.lockScreen_btnNext);
            _btnShuffle = FindViewById<ImageButton>(Resource.Id.lockScreen_btnShuffle);
            _btnRepeat = FindViewById<ImageButton>(Resource.Id.lockScreen_btnRepeat);
            _btnClose = FindViewById<ImageButton>(Resource.Id.lockScreen_btnClose);
            _btnClose.SetOnTouchListener(this);
            _btnPlayPause.SetOnTouchListener(this);
            _btnPrevious.SetOnTouchListener(this);
            _btnNext.SetOnTouchListener(this);
            _btnRepeat.SetOnTouchListener(this);
            _btnShuffle.SetOnTouchListener(this);

            _imageAlbum = FindViewById<ImageView>(Resource.Id.lockScreen_imageAlbum);
            _seekBar = FindViewById<SeekBar>(Resource.Id.lockScreen_seekBar);
            _seekBar.StartTrackingTouch += SeekBarOnStartTrackingTouch;
            _seekBar.StopTrackingTouch += SeekBarOnStopTrackingTouch;
            _seekBar.ProgressChanged += SeekBarOnProgressChanged;

            _btnClose.Click += (sender, args) => Finish();
            _btnPrevious.Click += (sender, args) => OnPlayerPrevious();
            _btnPlayPause.Click += (sender, args) => OnPlayerPlayPause();
            _btnNext.Click += (sender, args) => OnPlayerNext();
            _btnShuffle.Click += (sender, args) => OnPlayerShuffle();
            _btnRepeat.Click += (sender, args) => OnPlayerRepeat();
            //_btnPlaylist.Click += (sender, args) => {
            //    Intent intent = new Intent(this, typeof (PlaylistActivity));
            //    intent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.SingleTop);
            //    StartActivity(intent);
            //};

            _timerSongPosition = new Timer();
            _timerSongPosition.Interval = 100;
            _timerSongPosition.Elapsed += (sender, args) => {
                if (_isPositionChanging)
                    return;

                RunOnUiThread(() => {
                    try
                    {
                        var position = _playerService.GetPosition();
                        //Console.WriteLine("LockScreenActivity - timerSongPosition - position: {0}", position);
                        _lblPosition.Text = position.Position;
                        float percentage = ((float)position.PositionBytes / (float)_playerService.CurrentPlaylistItem.LengthBytes) * 10000f;
                        _seekBar.Progress = (int)percentage;
                    }
                    catch
                    {
                        // Just ignore exception. It's not really worth it to start/stop the timer when the player is playing.
                        // TODO: In fact reuse the last position instead of returning 0.
                        _lblPosition.Text = "0:00.000";
                        _seekBar.Progress = 0;
                    }
                });
            };
            _timerSongPosition.Start();

            // Since the onViewReady action could not be added to an intent, tell the NavMgr the view is ready
            ((AndroidNavigationManager)_navigationManager).SetLockScreenActivityInstance(this);
        }
Exemple #10
0
        protected override void OnCreate(Bundle bundle)
        {
            Console.WriteLine("PlayerActivity - OnCreate");

            _messengerHub = Bootstrapper.GetContainer().Resolve<ITinyMessengerHub>(); 
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Player);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            _navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            _fragments = new List<Fragment>();
            _viewPager = FindViewById<ViewPager>(Resource.Id.player_pager);
            _viewPager.OffscreenPageLimit = 4;
            _viewPagerAdapter = new ViewPagerAdapter(FragmentManager, _fragments, _viewPager);
            _viewPagerAdapter.OnPageChanged += ViewPagerAdapterOnOnPageChanged;
            _viewPager.Adapter = _viewPagerAdapter;
            _viewPager.SetOnPageChangeListener(_viewPagerAdapter);

            _waveFormScrollView = FindViewById<WaveFormScrollView>(Resource.Id.player_waveFormScrollView);
            _imageViewAlbumArt = FindViewById<SquareImageView>(Resource.Id.player_imageViewAlbumArt);
            _lblPosition = FindViewById<TextView>(Resource.Id.player_lblPosition);
            _lblLength = FindViewById<TextView>(Resource.Id.player_lblLength);
            _btnPlayPause = FindViewById<ImageButton>(Resource.Id.player_btnPlayPause);
            _btnPrevious = FindViewById<ImageButton>(Resource.Id.player_btnPrevious);
            _btnNext = FindViewById<ImageButton>(Resource.Id.player_btnNext);
            _btnShuffle = FindViewById<ImageButton>(Resource.Id.player_btnShuffle);
            _btnRepeat = FindViewById<ImageButton>(Resource.Id.player_btnRepeat);
            _btnPlaylist = FindViewById<ImageButton>(Resource.Id.player_btnPlaylist);
            _seekBar = FindViewById<SeekBar>(Resource.Id.player_seekBar);
            _carrouselDot1 = FindViewById<Button>(Resource.Id.player_carrouselDot1);
            _carrouselDot2 = FindViewById<Button>(Resource.Id.player_carrouselDot2);
            _carrouselDot3 = FindViewById<Button>(Resource.Id.player_carrouselDot3);
            _carrouselDot4 = FindViewById<Button>(Resource.Id.player_carrouselDot4);
            _carrouselDot5 = FindViewById<Button>(Resource.Id.player_carrouselDot5);
            _btnPlayPause.Click += BtnPlayPauseOnClick;            
            _btnPrevious.Click += BtnPreviousOnClick;
            _btnNext.Click += BtnNextOnClick;
            _btnPlaylist.Click += BtnPlaylistOnClick;
            _btnRepeat.Click += BtnRepeatOnClick;
            _btnShuffle.Click += BtnShuffleOnClick;
            _btnPlayPause.SetOnTouchListener(this);
            _btnPrevious.SetOnTouchListener(this);
            _btnNext.SetOnTouchListener(this);
            _btnPlaylist.SetOnTouchListener(this);
            _btnRepeat.SetOnTouchListener(this);
            _btnShuffle.SetOnTouchListener(this);
            _seekBar.StartTrackingTouch += SeekBarOnStartTrackingTouch;
            _seekBar.StopTrackingTouch += SeekBarOnStopTrackingTouch;
            _seekBar.ProgressChanged += SeekBarOnProgressChanged;

            // Get screen size
            Point size = new Point();
            WindowManager.DefaultDisplay.GetSize(size);

            // Create bitmap cache
            int maxMemory = (int)(Runtime.GetRuntime().MaxMemory() / 1024);
            int cacheSize = maxMemory / 12;
            _bitmapCache = new BitmapCache(this, cacheSize, size.X, size.X); // The album art takes the whole screen width

            // Match height with width (cannot do that in xml)
            //_imageViewAlbumArt.LayoutParameters = new ViewGroup.LayoutParams(_imageViewAlbumArt.Width, _imageViewAlbumArt.Width);

            if (bundle != null)
            {
                string state = bundle.GetString("key", "value");
                Console.WriteLine("PlayerActivity - OnCreate - State is {0} - isInitialized: {1}", state, _isInitialized);
            }
            else
            {

                Console.WriteLine("PlayerActivity - OnCreate - State is null - isInitialized: {0}", _isInitialized);
            }

            // Don't try to check the bundle contents, if the activity wasn't destroyed, it will be null.
            //if (bundle != null)
            //    Console.WriteLine("PlayerActivity - OnCreate - Bundle isn't null - value: {0}", bundle.GetString("key", "null"));
            //else
            //    Console.WriteLine("PlayerActivity - OnCreate - Bundle is null!");

            // When Android stops an activity, it recalls OnCreate after, even though the activity is not destroyed (OnDestroy). It actually goes through creating a new object (the ctor is called).
            //((AndroidNavigationManager)_navigationManager).SetPlayerActivityInstance(this);
            _navigationManager.BindPlayerView(MobileNavigationTabType.Playlists, this);

            // Activate lock screen if not already activated
            _messengerHub.PublishAsync<ActivateLockScreenMessage>(new ActivateLockScreenMessage(this, true));

            _messengerHub.Subscribe<ApplicationCloseMessage>(message =>
            {
                Console.WriteLine("PlayerActivity - Received ApplicationCloseMessage; closing activity of type {0}", this.GetType().FullName);
            });

        }