示例#1
0
        public void OnItemClick(AdapterView parent, View view, int position, long id)
        {
            IntentItem clickedIntentItem = (IntentItem)intentItems[position];

            Intent intent;

            switch (clickedIntentItem.Type)
            {
            case IntentType.PLAY_VIDEO:
                intent = YouTubeIntents.CreatePlayVideoIntentWithOptions(this, VIDEO_ID, true, false);
                StartActivity(intent);
                break;

            case IntentType.OPEN_PLAYLIST:
                intent = YouTubeIntents.CreateOpenPlaylistIntent(this, PLAYLIST_ID);
                StartActivity(intent);
                break;

            case IntentType.PLAY_PLAYLIST:
                intent = YouTubeIntents.CreatePlayPlaylistIntent(this, PLAYLIST_ID);
                StartActivity(intent);
                break;

            case IntentType.OPEN_SEARCH:
                intent = YouTubeIntents.CreateSearchIntent(this, USER_ID);
                StartActivity(intent);
                break;

            case IntentType.OPEN_USER:
                intent = YouTubeIntents.CreateUserIntent(this, USER_ID);
                StartActivity(intent);
                break;

            case IntentType.OPEN_CHANNEL:
                intent = YouTubeIntents.CreateChannelIntent(this, CHANNEL_ID);
                StartActivity(intent);
                break;

            case IntentType.UPLOAD_VIDEO:
                // This will load a picker view in the users' gallery.
                // The upload activity is started in the function onActivityResult.
                intent = new Intent(Intent.ActionPick, null).SetType("video/*");
                intent.PutExtra(EXTRA_LOCAL_ONLY, true);
                StartActivityForResult(intent, SELECT_VIDEO_REQUEST);
                break;
            }
        }
        private void OnItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            var clickedIntentItem = (IntentItem)intentItems[e.Position];

            Intent intent;

            switch (clickedIntentItem.Type)
            {
            case IntentType.PlayVideo:
                intent = YouTubeIntents.CreatePlayVideoIntentWithOptions(this, VideoId, true, false);
                StartActivity(intent);
                break;

            case IntentType.OpenPlaylist:
                intent = YouTubeIntents.CreateOpenPlaylistIntent(this, PlaylistId);
                StartActivity(intent);
                break;

            case IntentType.PlayPlaylist:
                intent = YouTubeIntents.CreatePlayPlaylistIntent(this, PlaylistId);
                StartActivity(intent);
                break;

            case IntentType.OpenSearch:
                intent = YouTubeIntents.CreateSearchIntent(this, UserId);
                StartActivity(intent);
                break;

            case IntentType.OpenUser:
                intent = YouTubeIntents.CreateUserIntent(this, UserId);
                StartActivity(intent);
                break;

            case IntentType.OpenChannel:
                intent = YouTubeIntents.CreateChannelIntent(this, ChannelId);
                StartActivity(intent);
                break;

            case IntentType.UploadVideo:
                // This will load a picker view in the users' gallery.
                // The upload activity is started in the function onActivityResult.
                intent = new Intent(Intent.ActionPick, null).SetType("video/*");
                intent.PutExtra(Intent.ExtraLocalOnly, true);
                StartActivityForResult(intent, SelectVideoRequest);
                break;
            }
        }
示例#3
0
        void OnListItemClick(object sender, Android.Widget.AdapterView.ItemClickEventArgs e)
        {
            Intent intent;

            switch (intentItems [e.Position].Type)
            {
            case IntentType.PlayVideo:
                intent = YouTubeIntents.CreatePlayVideoIntentWithOptions(this, videoId, true, false);
                StartActivity(intent);
                break;

            case IntentType.OpenPlaylist:
                intent = YouTubeIntents.CreateOpenPlaylistIntent(this, playlistId);
                StartActivity(intent);
                break;

            case IntentType.PlayPlaylist:
                intent = YouTubeIntents.CreatePlayPlaylistIntent(this, playlistId);
                StartActivity(intent);
                break;

            case IntentType.OpenSearch:
                intent = YouTubeIntents.CreateSearchIntent(this, userId);
                StartActivity(intent);
                break;

            case IntentType.OperUser:
                intent = YouTubeIntents.CreateUserIntent(this, userId);
                StartActivity(intent);
                break;

            case IntentType.UploadVideo:
                // This will load a picker view in the users' gallery.
                // The upload activity is started in the function onActivityResult.
                intent = new Intent(Intent.ActionPick, null).SetType("video/*");
                intent.PutExtra(extraLocalOnly, true);
                StartActivityForResult(intent, selectVideoRequest);
                break;
            }
        }