當前位置: 首頁>>代碼示例>>Java>>正文


Java RowPresenter.ViewHolder方法代碼示例

本文整理匯總了Java中android.support.v17.leanback.widget.RowPresenter.ViewHolder方法的典型用法代碼示例。如果您正苦於以下問題:Java RowPresenter.ViewHolder方法的具體用法?Java RowPresenter.ViewHolder怎麽用?Java RowPresenter.ViewHolder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v17.leanback.widget.RowPresenter的用法示例。


在下文中一共展示了RowPresenter.ViewHolder方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onItemClicked

import android.support.v17.leanback.widget.RowPresenter; //導入方法依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Movie) {
        Movie movie = (Movie) item;
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(getResources().getString(R.string.movie), mSelectedMovie);
        intent.putExtra(getResources().getString(R.string.should_start), true);
        startActivity(intent);


        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
 
開發者ID:bassaer,項目名稱:HelloTV,代碼行數:21,代碼來源:VideoDetailsFragment.java

示例2: onItemClicked

import android.support.v17.leanback.widget.RowPresenter; //導入方法依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Movie) {
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(getResources().getString(R.string.movie), mSelectedMovie);

        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
 
開發者ID:alphater,項目名稱:garras,代碼行數:17,代碼來源:VideoDetailsFragment.java

示例3: createRowViewHolder

import android.support.v17.leanback.widget.RowPresenter; //導入方法依賴的package包/類
@Override
protected RowPresenter.ViewHolder createRowViewHolder(ViewGroup parent) {
    mR = parent.getResources();

    // We create the base class view holder first
    FullWidthRowPresenter.ViewHolder fullWidthViewHolder = (FullWidthRowPresenter.ViewHolder)super.createRowViewHolder(parent);

    // We expand the info view and put it inside the parent fullwidth container
    ViewGroup fullwidthContainer = (ViewGroup)fullWidthViewHolder.getMainContainer();
    View detailsView = LayoutInflater.from(parent.getContext()).inflate(R.layout.androidtv_detailled_info_group, fullwidthContainer, false);
    fullwidthContainer.addView(detailsView);

    fullwidthContainer.setBackgroundColor(mColor);

    return new FileDetailsViewHolder(fullWidthViewHolder, detailsView);
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:17,代碼來源:FileDetailsRowPresenter.java

示例4: onBindRowViewHolder

import android.support.v17.leanback.widget.RowPresenter; //導入方法依賴的package包/類
@Override
protected void onBindRowViewHolder(RowPresenter.ViewHolder holder, Object item) {
    super.onBindRowViewHolder(holder, item);
    PlotAndGenresViewHolder vh = (PlotAndGenresViewHolder) holder;
    vh.mFullWidthViewHolder.getMainContainer().setBackgroundColor(mColor);

    PlotAndGenresRow row = (PlotAndGenresRow) item;

    vh.mPlotTv.setText(row.getPlot());

    if (row.getGenres()!=null && !row.getGenres().isEmpty()) {
        vh.mGenresTv.setText(row.getGenres());
        vh.mGenresTv.setVisibility(View.VISIBLE);
    } else {
        vh.mGenresTv.setVisibility(View.GONE);
    }
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:18,代碼來源:PlotAndGenresRowPresenter.java

示例5: onItemClicked

import android.support.v17.leanback.widget.RowPresenter; //導入方法依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
        RowPresenter.ViewHolder rowViewHolder, Row row) {
    if (isAdded()) {
        if (item instanceof Clip) {
            Clip clip = (Clip) item;
            Intent intent = new Intent(getActivity(), PlaybackActivity.class);
            intent.putExtra(PlaybackActivity.EXTRA_CLIP, clip);
            startActivity(intent);
            final long programId = clip.getProgramId();
            if (programId != 0) {
                // This clip is published as a program. Increment the view count for the
                // program to demonstrate updating.
                new SetViewCountInBackground(programId, clip.incrementViewCount());
            }
        }
    }
}
 
開發者ID:googlesamples,項目名稱:leanback-homescreen-channels,代碼行數:19,代碼來源:MainFragment.java

示例6: onItemSelected

import android.support.v17.leanback.widget.RowPresenter; //導入方法依賴的package包/類
@SuppressWarnings("SuspiciousMethodCalls")
@Override
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
    if (item instanceof MediaCardPresenter.MediaCardItem) {
        MediaCardPresenter.MediaCardItem overviewItem = (MediaCardPresenter.MediaCardItem) item;
        if (overviewItem.isLoading()) return;

        mBackgroundUpdater.updateBackgroundAsync(((MediaCardPresenter.MediaCardItem) item).getMedia().headerImage);
    }

    //really hacky way of making and 'endless' adapter

    //trigger items to update
    int itemPosition = mItems.indexOf(item);

    //when we are within 3 rows of the end, load more items
    if (itemPosition>getAdapter().size()-(NUM_COLUMNS*3)){
        Timber.d("Loading more items: page "+mCurrentPage);
        loadMore();
    }
}
 
開發者ID:PTCE,項目名稱:popcorn-android,代碼行數:22,代碼來源:PTVMediaGridFragment.java

示例7: provideOnItemViewSelectedListener

import android.support.v17.leanback.widget.RowPresenter; //導入方法依賴的package包/類
@PerFragment
@Provides
@IntoMap
@ListenerModuleKey(LiveDataFragment.class)
public OnItemViewSelectedListener provideOnItemViewSelectedListener(final Activity activity,
        final DisplayMetrics metrics, final BackgroundManager backgroundManager,
        final RequestOptions defaultPlaceHolder, final Drawable finalDrawable, final Handler mainHandler) {
    return new OnItemViewSelectedListener() {
        @Override
        public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
                RowPresenter.ViewHolder rowViewHolder, Row row) {
            VideoEntity selectedVideo = (VideoEntity) item;
            RunnableClass backgroundRunnable = new RunnableClass(selectedVideo, activity,
                    metrics, backgroundManager, defaultPlaceHolder, finalDrawable);

            if (lastTime != null) {
                mainHandler.removeCallbacks(lastTime);
            }
            mainHandler.postDelayed(backgroundRunnable, BACKGROUND_UPDATE_DELAY);
            lastTime = backgroundRunnable;
        }
    };
}
 
開發者ID:googlesamples,項目名稱:leanback-showcase,代碼行數:24,代碼來源:ListenerModule.java

示例8: onItemClicked

import android.support.v17.leanback.widget.RowPresenter; //導入方法依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {
    if (item instanceof  VideoCard) {
        VideoCard itemCard = (VideoCard) item;
        MediaMetaData metaData = new MediaMetaData();
        metaData.setMediaSourcePath(itemCard.getVideoSource());
        metaData.setMediaTitle(itemCard.getTitle());
        metaData.setMediaArtistName(itemCard.getDescription());
        metaData.setMediaAlbumArtUrl(itemCard.getImageUrl());
        Intent intent = new Intent(getActivity(), VideoExampleActivity.class);
        intent.putExtra(VideoExampleActivity.TAG, metaData);
        intent.setData(Uri.parse(metaData.getMediaSourcePath()));
        getActivity().startActivity(intent);
    }
}
 
開發者ID:googlesamples,項目名稱:leanback-showcase,代碼行數:17,代碼來源:VideoGridExampleFragment.java

示例9: onItemClicked

import android.support.v17.leanback.widget.RowPresenter; //導入方法依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof GridButton) {
        switch (((GridButton) item).getId()) {
            case ENTER_MANUALLY:
                Utils.EnterManualServerAddress(getActivity());
                break;
            case LOGIN_CONNECT:
                Intent intent = new Intent(getActivity(), ConnectActivity.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
                startActivity(intent);
                break;

            default:
                Toast.makeText(getActivity(), item.toString(), Toast.LENGTH_SHORT)
                        .show();
                break;
        }
    }
}
 
開發者ID:henrytrager,項目名稱:MediaBrowser.AndroidTv,代碼行數:23,代碼來源:SelectServerFragment.java

示例10: onItemClicked

import android.support.v17.leanback.widget.RowPresenter; //導入方法依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object clickedItem,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (clickedItem instanceof MediaSessionCompat.QueueItem) {
        LogHelper.d(TAG, "item: ", clickedItem.toString());

        MediaControllerCompat controller = MediaControllerCompat.getMediaController(getActivity());
        MediaSessionCompat.QueueItem item = (MediaSessionCompat.QueueItem) clickedItem;
        if (!QueueHelper.isQueueItemPlaying(getActivity(), item)
                || controller.getPlaybackState().getState()
                != PlaybackStateCompat.STATE_PLAYING) {
            controller.getTransportControls().skipToQueueItem(item.getQueueId());
        }
    }
}
 
開發者ID:googlesamples,項目名稱:android-UniversalMusicPlayer,代碼行數:17,代碼來源:TvPlaybackFragment.java

示例11: onItemClicked

import android.support.v17.leanback.widget.RowPresenter; //導入方法依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof ServerInfo) {
        ServerInfoUtil.connect(getActivity(), (ServerInfo) item);
    } else if (item instanceof Action) {
        Action action = (Action) item;
        if (action.getActionId() == R.id.preferences) {
            Intent i = new Intent(getActivity(), SettingsActivity.class);
            startActivity(i);
        } else if (action.getActionId() == R.id.btn_add_server) {
            // add new server
            AddServerFragment f = AddServerFragment.newInstance("My Server", "");
            f.setRetainInstance(true);
            f.show(getFragmentManager(), "addserver");
        } else {
            Toast.makeText(getActivity(), item.toString(), Toast.LENGTH_SHORT)
                    .show();
        }
    }
}
 
開發者ID:OpenSageTV,項目名稱:sagetv-miniclient,代碼行數:23,代碼來源:MainFragment.java

示例12: onItemSelected

import android.support.v17.leanback.widget.RowPresenter; //導入方法依賴的package包/類
@Override
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
                           RowPresenter.ViewHolder rowViewHolder, Row row) {
    if (item instanceof Action) {
        mBackgroundURI = ((Action) item).getBackground();
        if (mBackgroundURI == null) mBackgroundURI = mDefaultBackgroundNoBackground;
        startBackgroundTimer();
    } else if (item instanceof ServerInfo) {
        if (((ServerInfo) item).isLocatorOnly()) {
            mBackgroundURI = R.drawable.back_film_wall;
            startBackgroundTimer();
        } else {
            mBackgroundURI = R.drawable.back_dark_knight;
            startBackgroundTimer();
        }
    } else {
        mBackgroundURI = mDefaultBackgroundNoBackground;
        startBackgroundTimer();
    }

}
 
開發者ID:OpenSageTV,項目名稱:sagetv-miniclient,代碼行數:22,代碼來源:MainFragment.java

示例13: onItemClicked

import android.support.v17.leanback.widget.RowPresenter; //導入方法依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Movie) {
        Movie movie = (Movie) item;
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(DetailsActivity.MOVIE, movie);

        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
 
開發者ID:MizzleDK,項目名稱:Mizuu-Android-TV,代碼行數:18,代碼來源:VideoDetailsFragment.java

示例14: onItemSelected

import android.support.v17.leanback.widget.RowPresenter; //導入方法依賴的package包/類
@Override
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
                           RowPresenter.ViewHolder rowViewHolder, Row row) {
    if (!(item instanceof BaseRowItem)) {
        //fill in default background
        mBackgroundUrl = null;
        startBackgroundTimer();
        return;
    }

    BaseRowItem rowItem = (BaseRowItem) item;

    //mApplication.getLogger().Debug("Selected Item "+rowItem.getIndex() + " type: "+ (rowItem.getItemType().equals(BaseRowItem.ItemType.BaseItem) ? rowItem.getBaseItem().getType() : "other"));
    ItemRowAdapter adapter = (ItemRowAdapter) ((ListRow)row).getAdapter();
    adapter.loadMoreItemsIfNeeded(rowItem.getIndex());

    mBackgroundUrl = rowItem.getBackdropImageUrl();
    startBackgroundTimer();

}
 
開發者ID:henrytrager,項目名稱:MediaBrowser.AndroidTv,代碼行數:21,代碼來源:StdBrowseFragment.java

示例15: onItemClicked

import android.support.v17.leanback.widget.RowPresenter; //導入方法依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
    if (row.getId() == HEADER_CATEGORIES) {
        if (((CardPresenter.SimpleCard)item).getId() == MusicFragment.CATEGORY_NOW_PLAYING){ //NOW PLAYING CARD
            startActivity(new Intent(this, AudioPlayerActivity.class));
            return;
        }
        CardPresenter.SimpleCard card = (CardPresenter.SimpleCard) item;
        Intent intent = new Intent(mContext, VerticalGridActivity.class);
        intent.putExtra(BROWSER_TYPE, HEADER_CATEGORIES);
        intent.putExtra(MusicFragment.AUDIO_CATEGORY, card.getId());
        startActivity(intent);
    } else if (row.getId() == HEADER_VIDEO)
        TvUtil.openMedia(mContext, item, row);
    else if (row.getId() == HEADER_MISC)
        startActivityForResult(new Intent(this, PreferencesActivity.class), ACTIVITY_RESULT_PREFERENCES);
    else if (row.getId() == HEADER_NETWORK) {
        TvUtil.openMedia(mContext, item, row);
    }
}
 
開發者ID:xuie0000,項目名稱:vlc-android,代碼行數:21,代碼來源:MainTvActivity.java


注:本文中的android.support.v17.leanback.widget.RowPresenter.ViewHolder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。