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


Java OnItemViewClickedListener類代碼示例

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


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

示例1: getDefaultItemClickedListener

import android.support.v17.leanback.widget.OnItemViewClickedListener; //導入依賴的package包/類
private OnItemViewClickedListener getDefaultItemClickedListener() {
    return new OnItemViewClickedListener() {
        @Override
        public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                RowPresenter.ViewHolder rowViewHolder, Row row) {
            if (item instanceof Clip) {
                Toast.makeText(getActivity(), "** toggle selected **",
                        Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(getActivity(), "** add as playlist **",
                        Toast.LENGTH_LONG).show();

            }
        }
    };
}
 
開發者ID:googlesamples,項目名稱:leanback-homescreen-channels,代碼行數:17,代碼來源:TvSearchFragment.java

示例2: setupEventListeners

import android.support.v17.leanback.widget.OnItemViewClickedListener; //導入依賴的package包/類
protected void setupEventListeners() {
    setOnItemViewClickedListener(new OnItemViewClickedListener() {
        @Override
        public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
            if (item instanceof MetaFile2) {
                MetaFile2 file = (MetaFile2) item;
                if (file.isDirectory()) {
                    openDirectory(file);
                } else {
                    String mimeType = MimeUtils.guessMimeTypeFromExtension(file.getExtension());
                    PlayUtils.openAnyFile(file, getActivity());

                }
            } else if (item instanceof Video) {
                openDetailsActivity((Video) item, itemViewHolder);
            } else {
                throw new IllegalArgumentException("Click on an unexpected item type " + item);
            }
        }
    });
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:22,代碼來源:ListingFragment.java

示例3: setupAdapter

import android.support.v17.leanback.widget.OnItemViewClickedListener; //導入依賴的package包/類
private void setupAdapter() {
    VerticalGridPresenter presenter = new VerticalGridPresenter(ZOOM_FACTOR);
    presenter.setNumberOfColumns(COLUMNS);
    setGridPresenter(presenter);

    CardPresenterSelector cardPresenter = new CardPresenterSelector(getActivity());
    mAdapter = new ArrayObjectAdapter(cardPresenter);
    setAdapter(mAdapter);

    setOnItemViewClickedListener(new OnItemViewClickedListener() {
        @Override
        public void onItemClicked(
                Presenter.ViewHolder itemViewHolder,
                Object item,
                RowPresenter.ViewHolder rowViewHolder,
                Row row) {
            Card card = (Card)item;
            Toast.makeText(getActivity(),
                    "Clicked on "+card.getTitle(),
                    Toast.LENGTH_SHORT).show();
        }
    });
}
 
開發者ID:googlesamples,項目名稱:leanback-showcase,代碼行數:24,代碼來源:PageAndListRowFragment.java

示例4: SampleFragmentB

import android.support.v17.leanback.widget.OnItemViewClickedListener; //導入依賴的package包/類
public SampleFragmentB() {
    mRowsAdapter = new ArrayObjectAdapter(new ShadowRowPresenterSelector());

    setAdapter(mRowsAdapter);
    setOnItemViewClickedListener(new OnItemViewClickedListener() {
        @Override
        public void onItemClicked(
                Presenter.ViewHolder itemViewHolder,
                Object item,
                RowPresenter.ViewHolder rowViewHolder,
                Row row) {
            Toast.makeText(getActivity(), "Implement click handler", Toast.LENGTH_SHORT)
                    .show();
        }
    });
}
 
開發者ID:googlesamples,項目名稱:leanback-showcase,代碼行數:17,代碼來源:PageAndListRowFragment.java

示例5: getItemClickedListener

import android.support.v17.leanback.widget.OnItemViewClickedListener; //導入依賴的package包/類
private OnItemViewClickedListener getItemClickedListener() {
    return new OnItemViewClickedListener() {
        @Override
        public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
            Log.d(TAG, "Clicked item:" + item);
            if (item instanceof EpisodeBaseModel) {
                EpisodeBaseModel ep = (EpisodeBaseModel) item;
                Intent intent = new Intent(getActivity(), getPlayerActivityClass());
                intent.putExtra(ContentManagerBase.CONTENT_ID, ep);
                String[] others = getOtherEpisodeUrls().toArray(new String[getOtherEpisodeUrls().size()]);
                intent.putExtra(ContentManagerBase.OTHER_EPISODES, others);
                startActivity(intent);
            }
        }
    };
}
 
開發者ID:nextux,項目名稱:sbs-android-tv,代碼行數:17,代碼來源:DetailsFragment.java

示例6: initUi

import android.support.v17.leanback.widget.OnItemViewClickedListener; //導入依賴的package包/類
private void initUi() {
  PlaybackControlsRowPresenter presenter = mediaControllerHelper.createControlsRowAndPresenter();
  rows = new ArrayObjectAdapter(presenter);
  rows.add(mediaControllerHelper.getControlsRow());
  setAdapter(rows);
  setOnItemViewClickedListener(new OnItemViewClickedListener() {

    @Override
    public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                              RowPresenter.ViewHolder rowViewHolder, Row row) {
      if (item instanceof Action) {
        mediaControllerHelper.onActionClicked((Action) item);
      }
    }
  });
}
 
開發者ID:mkjensen,項目名稱:danish-media-license,代碼行數:17,代碼來源:PlaybackFragment.java

示例7: onCreate

import android.support.v17.leanback.widget.OnItemViewClickedListener; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
    setSearchResultProvider(this);
    setOnItemViewClickedListener(new OnItemViewClickedListener() {
        @Override
        public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
            if (!(item instanceof BaseRowItem)) return;
            ItemLauncher.launch((BaseRowItem) item, TvApp.getApplication(), getActivity(), itemViewHolder);
        }
    });
    mDelayedLoad = new SearchRunnable();

    prepareBackgroundManager();
}
 
開發者ID:henrytrager,項目名稱:MediaBrowser.AndroidTv,代碼行數:18,代碼來源:MySearchFragment.java

示例8: onActivityCreated

import android.support.v17.leanback.widget.OnItemViewClickedListener; //導入依賴的package包/類
@Override
public void onActivityCreated(Bundle savedInstanceState) {
	super.onActivityCreated(savedInstanceState);

	loadVideoData();
	setCustomPadding();
	setOnItemViewClickedListener(new OnItemViewClickedListener() {
		@Override
		public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
			Movie movie = (Movie) item;
			Intent intent = new Intent(getActivity(), MovieDetailsActivity.class);
			intent.putExtra(MovieDetailsActivity.MOVIE, movie);

			Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
					getActivity(),
					((ImageCardView) itemViewHolder.view).getMainImageView(),
					MovieDetailsActivity.SHARED_ELEMENT_NAME).toBundle();
			getActivity().startActivity(intent, bundle);
		}
	});
}
 
開發者ID:dextorer,項目名稱:BuildingForAndroidTV,代碼行數:22,代碼來源:CustomRowsFragment.java

示例9: onCreate

import android.support.v17.leanback.widget.OnItemViewClickedListener; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mScraper = new Scraper(getActivity());
    mSearchExecutor = new SerialExecutor();

    ClassPresenterSelector rowsPresenterSelector = new ClassPresenterSelector();
    rowsPresenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
    rowsPresenterSelector.addClassPresenter(ShadowLessListRow.class, new ShadowLessRowPresenter());
    mRowsAdapter = new ArrayObjectAdapter(rowsPresenterSelector);

    setBadgeDrawable(getResources().getDrawable(R.mipmap.video2));
    setSearchResultProvider(this);
    setOnItemViewClickedListener(new OnItemViewClickedListener() {
        @Override
        public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
            if (item instanceof BaseTags) {
                saveTagsAndFinish((BaseTags) item);
            }
        }
    });
    mSpeechRecognitionCallback = new SpeechRecognitionCallback() {

        @Override
        public void recognizeSpeech() {

            // ACTION_RECOGNIZE_SPEECH
            try{
                startActivityForResult(getRecognizerIntent(), SEARCH_REQUEST_CODE);
            }catch (ActivityNotFoundException e){/*non google device*/}
        }
    };
    setSpeechRecognitionCallback(mSpeechRecognitionCallback);
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:36,代碼來源:ManualScrappingSearchFragment.java

示例10: onCreate

import android.support.v17.leanback.widget.OnItemViewClickedListener; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setTopOffsetRatio(0.6f);

    final Intent intent = getActivity().getIntent();
    mShowId = intent.getLongExtra(EXTRA_TVSHOW_ID, -1);
    mColor = ContextCompat.getColor(getActivity(), R.color.leanback_details_background);
    mOverviewRowPresenter = new DetailsOverviewRowPresenter(new TvshowMoreDetailsDescriptionPresenter());
    mOverviewRowPresenter.setSharedElementEnterTransition(getActivity(), SHARED_ELEMENT_NAME, 1000);
    mOverviewRowPresenter.setBackgroundColor(getResources().getColor(R.color.leanback_details_background));
    mOverviewRowPresenter.setStyleLarge(false);
    mOverviewRowPresenter.setOnActionClickedListener(null);



    setOnItemViewClickedListener(new OnItemViewClickedListener() {
        @Override
        public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
            if (item instanceof ScraperImage) {
                if (row == mPostersRow) {
                    mShowPosterSaverTask = new ShowPosterSaverTask().execute((ScraperImage) item);
                }
                else if (row == mBackdropsRow) {
                    mBackdropSaverTask = new BackdropSaverTask().execute((ScraperImage) item);
                }
            }
            else if (item instanceof WebPageLink) {
                WebPageLink link = (WebPageLink)item;
                WebUtils.openWebLink(getActivity(), link.getUrl());
            }
        }
    });

    // WORKAROUND: at least one instance of BackdropTask must be created soon in the process (onCreate ?)
    // else it does not work later.
    // --> This instance of BackdropTask() will not be used but it must be created here!
    mBackdropTask = new BackdropTask(getActivity(), VideoInfoCommonClass.getDarkerColor(mColor));
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:41,代碼來源:TvshowMoreDetailsFragment.java

示例11: setOnItemViewClickedListener

import android.support.v17.leanback.widget.OnItemViewClickedListener; //導入依賴的package包/類
/**
 * Sets an item clicked listener.
 */
public void setOnItemViewClickedListener(OnItemViewClickedListener listener) {
    mOnItemViewClickedListener = listener;
    if (mGridPresenter != null) {
        mGridPresenter.setOnItemViewClickedListener(mOnItemViewClickedListener);
    }
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:10,代碼來源:MyVerticalGridFragment.java

示例12: getDefaultItemClickedListener

import android.support.v17.leanback.widget.OnItemViewClickedListener; //導入依賴的package包/類
protected OnItemViewClickedListener getDefaultItemClickedListener() {
	return new OnItemViewClickedListener() {
		@Override public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object object, RowPresenter.ViewHolder rowViewHolder,
				Row row) {
			if (object instanceof MediaCardPresenter.MediaCardItem) {
				MediaCardPresenter.MediaCardItem item = (MediaCardPresenter.MediaCardItem) object;
				Media media = item.getMedia();
				PTVMediaDetailActivity.startActivity(getActivity(), media);
			}
		}
	};
}
 
開發者ID:PTCE,項目名稱:popcorn-android,代碼行數:13,代碼來源:PTVSearchFragment.java

示例13: setupUi

import android.support.v17.leanback.widget.OnItemViewClickedListener; //導入依賴的package包/類
private void setupUi() {
    setHeadersState(HEADERS_ENABLED);
    setHeadersTransitionOnBackEnabled(true);
    setTitle(getString(R.string.card_examples_title));
    setOnSearchClickedListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Toast.makeText(getActivity(), getString(R.string.implement_search),
                    Toast.LENGTH_LONG).show();
        }
    });
    setOnItemViewClickedListener(new OnItemViewClickedListener() {

        @Override
        public void onItemClicked(Presenter.ViewHolder viewHolder, Object item, RowPresenter.ViewHolder viewHolder1, Row row) {
            if (!(item instanceof Card)) return;
            if (!(viewHolder.view instanceof ImageCardView)) return;

            ImageView imageView = ((ImageCardView) viewHolder.view).getMainImageView();
            Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),
                    imageView, DetailViewExampleFragment.TRANSITION_NAME).toBundle();
            Intent intent = new Intent(getActivity().getBaseContext(),
                    DetailViewExampleActivity.class);
            Card card = (Card) item;
            int imageResId = card.getLocalImageResourceId(getContext());
            intent.putExtra(DetailViewExampleFragment.EXTRA_CARD, imageResId);
            startActivity(intent, bundle);
        }

    });

    prepareEntranceTransition();
}
 
開發者ID:googlesamples,項目名稱:leanback-showcase,代碼行數:34,代碼來源:CardExampleFragment.java

示例14: provideOnItemViewClickListenerForLiveDataFragment

import android.support.v17.leanback.widget.OnItemViewClickedListener; //導入依賴的package包/類
@PerFragment
@Provides
@IntoMap
@ListenerModuleKey(LiveDataFragment.class)
public OnItemViewClickedListener provideOnItemViewClickListenerForLiveDataFragment(
        final Activity currentActivity) {
    return new OnItemViewClickedListener() {
        @Override
        public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                RowPresenter.ViewHolder rowViewHolder, Row row) {
            Intent intent;
            Long videoItemId = ((VideoEntity) item).getId();
            intent = new Intent(currentActivity, LiveDataDetailActivity.class);
            intent.putExtra(LiveDataDetailActivity.VIDEO_ID, videoItemId);

            VideoEntity cachedBundle = (VideoEntity) item;

            intent.putExtra(LiveDataDetailActivity.CACHED_CONTENT, cachedBundle);

            // enable the scene transition animation when the detail's activity is launched
            Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                    currentActivity,
                    ((ImageCardView) itemViewHolder.view).getMainImageView(),
                    LiveDataDetailActivity.SHARED_ELEMENT_NAME).toBundle();
            currentActivity.startActivity(intent, bundle);
        }
    };
}
 
開發者ID:googlesamples,項目名稱:leanback-showcase,代碼行數:29,代碼來源:ListenerModule.java

示例15: provideOnItemViewClickListenerForLiveDataDetailFragmentSearch

import android.support.v17.leanback.widget.OnItemViewClickedListener; //導入依賴的package包/類
@PerFragment
@Provides
@IntoMap
@ListenerModuleKey(SearchFragment.class)
public OnItemViewClickedListener provideOnItemViewClickListenerForLiveDataDetailFragmentSearch(
        final Activity currentActivity) {
    return new OnItemViewClickedListener() {
        @Override
        public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                RowPresenter.ViewHolder rowViewHolder, Row row) {
            if (item instanceof VideoEntity) {
                Intent intent;
                Long videoItemId = ((VideoEntity) item).getId();
                intent = new Intent(currentActivity, LiveDataDetailActivity.class);
                intent.putExtra(LiveDataDetailActivity.VIDEO_ID, videoItemId);

                VideoEntity cachedBundle = (VideoEntity) item;

                intent.putExtra(LiveDataDetailActivity.CACHED_CONTENT, cachedBundle);

                // enable the scene transition animation when the detail's activity is launched
                Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                        currentActivity,
                        ((ImageCardView) itemViewHolder.view).getMainImageView(),
                        LiveDataDetailActivity.SHARED_ELEMENT_NAME).toBundle();
                currentActivity.startActivity(intent, bundle);
            }
        }
    };
}
 
開發者ID:googlesamples,項目名稱:leanback-showcase,代碼行數:31,代碼來源:ListenerModule.java


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