コード例 #1
0
        async void OnAlbumItemClicked(object sender, AdapterView.ItemClickEventArgs e)
        {
            var selectedEpisode = _album.Episodes [e.Position];

            if (AndroidAudioDownloader.ViewsDownloadInProgressByAudioId.ContainsKey(selectedEpisode.RemoteUrl))
            {
                return;
            }

            if (AudioDownloader.HasLocalFile(selectedEpisode.RemoteUrl, selectedEpisode.FileSize))
            {
                var resultIntent = new Intent();
                ExtraUtils.PutEpisode(resultIntent, selectedEpisode.Id);
                ExtraUtils.PutAlbum(resultIntent, _album.Id);
                ExtraUtils.PutSelectedTab(resultIntent, (int)MainActivity.TabTitle.Player);
                SetResult(Result.Ok, resultIntent);

                StartService(PlayerService.CreateIntent(
                                 this,
                                 PlayerService.ACTION_PLAY,
                                 _album.Id,
                                 selectedEpisode.Id
                                 ));

                Finish();
            }
            else
            {
                await AndroidAudioDownloader.StartDownloadAsync(e.Position, selectedEpisode.RemoteUrl, ListView);
            }
        }
コード例 #2
0
ファイル: PlayerService.cs プロジェクト: puncsky/DrunkAudible
        public static Intent CreateIntent(Context context, String action, int albumID, int episodeID)
        {
            var intent = CreateIntent(context, action);

            ExtraUtils.PutAlbum(intent, albumID);
            ExtraUtils.PutEpisode(intent, episodeID);
            return(intent);
        }
コード例 #3
0
        public static Intent CreateIntent(Context context, int albumID, int currentEpisodeID)
        {
            var intent = new Intent(context, typeof(MainActivity));

            ExtraUtils.PutAlbum(intent, albumID);
            ExtraUtils.PutEpisode(intent, currentEpisodeID);
            return(intent);
        }
コード例 #4
0
        public static Intent CreateIntent(Context context, int albumID, int episodeId = -1)
        {
            var intent = new Intent(context, typeof(AudioListActivity));

            ExtraUtils.PutAlbum(intent, albumID);
            if (episodeId != -1)
            {
                ExtraUtils.PutEpisode(intent, episodeId);
            }
            return(intent);
        }