当前位置: 首页>>代码示例>>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;未经允许,请勿转载。