当前位置: 首页>>代码示例>>Java>>正文


Java DetailsOverviewRow.setActionsAdapter方法代码示例

本文整理汇总了Java中android.support.v17.leanback.widget.DetailsOverviewRow.setActionsAdapter方法的典型用法代码示例。如果您正苦于以下问题:Java DetailsOverviewRow.setActionsAdapter方法的具体用法?Java DetailsOverviewRow.setActionsAdapter怎么用?Java DetailsOverviewRow.setActionsAdapter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v17.leanback.widget.DetailsOverviewRow的用法示例。


在下文中一共展示了DetailsOverviewRow.setActionsAdapter方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doInBackground

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
@Override
protected DetailsOverviewRow doInBackground(Video... videos) {
    DetailsOverviewRow row = new DetailsOverviewRow(videos[0]);
    try {
        Bitmap poster = Picasso.with(getActivity())
                .load(videos[0].getThumbUrl())
                .resize(dpToPx(DETAIL_THUMB_WIDTH, getActivity().getApplicationContext()),
                        dpToPx(DETAIL_THUMB_HEIGHT, getActivity().getApplicationContext()))
                .centerCrop()
                .get();
        row.setImageBitmap(getActivity(), poster);
    } catch (IOException e) {
        Log.e("VideoDetailsFragment", "Cannot load thumbnail for " + videos[0].getId(), e);
    }

    SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter();
    adapter.set(ACTION_PLAY, new Action(ACTION_PLAY, getResources().getString(
            R.string.action_play)));
    adapter.set(ACTION_WATCH_LATER, new Action(ACTION_WATCH_LATER, getResources().getString(R.string.action_watch_later)));
    row.setActionsAdapter(adapter);

    return row;
}
 
开发者ID:googlecodelabs,项目名称:android-tv-leanback,代码行数:24,代码来源:VideoDetailsFragment.java

示例2: setupDetailsOverviewRow

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void setupDetailsOverviewRow() {
    final DetailsOverviewRow row = new DetailsOverviewRow(mSelectedVideo);

    Glide.with(this)
            .load(mSelectedVideo.cardImageUrl)
            .asBitmap()
            .dontAnimate()
            .error(R.drawable.default_background)
            .into(new SimpleTarget<Bitmap>() {
                @Override
                public void onResourceReady(final Bitmap resource,
                        GlideAnimation glideAnimation) {
                    row.setImageBitmap(getActivity(), resource);
                    startEntranceTransition();
                }
            });

    SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter();

    adapter.set(ACTION_WATCH_TRAILER, new Action(ACTION_WATCH_TRAILER, getResources()
            .getString(R.string.watch_trailer_1),
            getResources().getString(R.string.watch_trailer_2)));
    adapter.set(ACTION_RENT, new Action(ACTION_RENT, getResources().getString(R.string.rent_1),
            getResources().getString(R.string.rent_2)));
    adapter.set(ACTION_BUY, new Action(ACTION_BUY, getResources().getString(R.string.buy_1),
            getResources().getString(R.string.buy_2)));
    row.setActionsAdapter(adapter);

    mAdapter.add(row);
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:31,代码来源:VideoDetailsFragment.java

示例3: setupDetailsOverviewRow

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void setupDetailsOverviewRow() {
        final DetailsOverviewRow row = new DetailsOverviewRow(mSelectedVideo);

        Glide.with(this)
                .load(mSelectedVideo.cardImageUrl)
                .asBitmap()
                .dontAnimate()
                .error(R.drawable.default_background)
                .into(new SimpleTarget<Bitmap>() {
                    @Override
                    public void onResourceReady(final Bitmap resource,
                            GlideAnimation glideAnimation) {
                        row.setImageBitmap(getActivity(), resource);
                        startEntranceTransition();
                    }
                });

        SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter();

        adapter.set(ACTION_PLAY_NOW, new Action(ACTION_PLAY_NOW, getResources()
                .getString(R.string.play_now)));
        adapter.set(ACTION_PLAY_FROM, new Action(ACTION_PLAY_FROM, getResources().getString(R.string.play_from)));
//        adapter.set(ACTION_PLAY_TRAILER, new Action(ACTION_PLAY_TRAILER, getResources().getString(R.string.play_trailer)));
        if(Chilly.getInstance(getActivity().getApplicationContext()).userLoggedIn()){
            adapter.set(ACTION_TRAKT, new Action(ACTION_TRAKT, "TRAKT"));
        }

        row.setActionsAdapter(adapter);

        mAdapter.add(row);
    }
 
开发者ID:ad-on-is,项目名称:chilly,代码行数:32,代码来源:VideoDetailsFragment.java

示例4: setupDetailsOverviewRow

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void setupDetailsOverviewRow() {
    final DetailsOverviewRow row = new DetailsOverviewRow(mMovie);

    Glide.with(this)
            .load(mMovie.getCardImage())
            .asBitmap()
            .dontAnimate()
            .error(R.drawable.assistant_tv_banner)
            .into(
                    new SimpleTarget<Bitmap>() {
                        @Override
                        public void onResourceReady(
                                final Bitmap resource, GlideAnimation glideAnimation) {
                            row.setImageBitmap(getActivity(), resource);
                        }
                    });

    SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter();

    adapter.set(
            ACTION_WATCH, new Action(ACTION_WATCH, getResources().getString(R.string.watch)));
    adapter.set(
            ACTION_RENT,
            new Action(
                    ACTION_RENT,
                    getResources().getString(R.string.rent),
                    mMovie.getRentalPrice()));
    adapter.set(
            ACTION_BUY,
            new Action(
                    ACTION_BUY,
                    getResources().getString(R.string.buy),
                    mMovie.getPurchasePrice()));
    row.setActionsAdapter(adapter);

    mAdapter.add(row);
}
 
开发者ID:googlesamples,项目名称:leanback-assistant,代码行数:38,代码来源:VideoDetailsFragment.java

示例5: setDetailsOverviewRow

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
/**
 * Sets details overview.
 */
protected void setDetailsOverviewRow(DetailsContent detailsContent) {
    mDetailsOverview = new DetailsOverviewRow(detailsContent);
    mDetailsOverview.setActionsAdapter(onCreateActionsAdapter());
    mRowsAdapter.add(mDetailsOverview);
    onLoadLogoAndBackgroundImages(detailsContent);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:10,代码来源:DvrDetailsFragment.java

示例6: provideDetailsOverviewRow

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
@Provides
@PerFragment
DetailsOverviewRow provideDetailsOverviewRow(
        @DetailFragmentArrayObjectAdapterForActionsQualifier ArrayObjectAdapter adapter) {
    DetailsOverviewRow row = new DetailsOverviewRow(new Object());
    row.setActionsAdapter(adapter);
    return row;
}
 
开发者ID:googlesamples,项目名称:leanback-showcase,代码行数:9,代码来源:RowModule.java

示例7: createDetailsRow

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void createDetailsRow() {
    actionsAdapter = new ArrayObjectAdapter();
    populateActionsAdapter();
    mDetailsRow = new DetailsOverviewRow(new Object());
    mDetailsRow.setActionsAdapter(actionsAdapter);
    mRowsAdapter.add(0, mDetailsRow);
}
 
开发者ID:sregg,项目名称:spotify-tv,代码行数:8,代码来源:TracksDetailsFragment.java

示例8: setupDetailsOverviewRow

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void setupDetailsOverviewRow() {
    final DetailsOverviewRow row = new DetailsOverviewRow(mSelectedVideo);

    RequestOptions options = new RequestOptions()
            .error(R.drawable.default_background)
            .dontAnimate();

    Glide.with(this)
            .asBitmap()
            .load(mSelectedVideo.cardImageUrl)
            .apply(options)
            .into(new SimpleTarget<Bitmap>() {
                @Override
                public void onResourceReady(
                        Bitmap resource,
                        Transition<? super Bitmap> transition) {
                    row.setImageBitmap(getActivity(), resource);
                    startEntranceTransition();
                }
            });

    SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter();

    adapter.set(ACTION_WATCH_TRAILER, new Action(ACTION_WATCH_TRAILER, getResources()
            .getString(R.string.watch_trailer_1),
            getResources().getString(R.string.watch_trailer_2)));
    adapter.set(ACTION_RENT, new Action(ACTION_RENT, getResources().getString(R.string.rent_1),
            getResources().getString(R.string.rent_2)));
    adapter.set(ACTION_BUY, new Action(ACTION_BUY, getResources().getString(R.string.buy_1),
            getResources().getString(R.string.buy_2)));
    row.setActionsAdapter(adapter);

    mAdapter.add(row);
}
 
开发者ID:googlesamples,项目名称:androidtv-Leanback,代码行数:35,代码来源:VideoDetailsFragment.java

示例9: setupDetailsOverviewRow

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void setupDetailsOverviewRow() {
    Log.d(TAG, "doInBackground: " + mSelectedMovie.toString());
    final DetailsOverviewRow row = new DetailsOverviewRow(mSelectedMovie);
    row.setImageDrawable(
            ContextCompat.getDrawable(getActivity(), R.drawable.default_background));
    int width = convertDpToPixel(getActivity().getApplicationContext(), DETAIL_THUMB_WIDTH);
    int height = convertDpToPixel(getActivity().getApplicationContext(), DETAIL_THUMB_HEIGHT);
    Glide.with(getActivity())
            .load(mSelectedMovie.getCardImageUrl())
            .centerCrop()
            .error(R.drawable.default_background)
            .into(new SimpleTarget<GlideDrawable>(width, height) {
                @Override
                public void onResourceReady(GlideDrawable resource,
                                            GlideAnimation<? super GlideDrawable>
                                                    glideAnimation) {
                    Log.d(TAG, "details overview card image url ready: " + resource);
                    row.setImageDrawable(resource);
                    mAdapter.notifyArrayItemRangeChanged(0, mAdapter.size());
                }
            });

    ArrayObjectAdapter actionAdapter = new ArrayObjectAdapter();

    actionAdapter.add(
            new Action(
                    ACTION_WATCH_TRAILER,
                    getResources().getString(R.string.watch_trailer_1),
                    getResources().getString(R.string.watch_trailer_2)));
    actionAdapter.add(
            new Action(
                    ACTION_RENT,
                    getResources().getString(R.string.rent_1),
                    getResources().getString(R.string.rent_2)));
    actionAdapter.add(
            new Action(
                    ACTION_BUY,
                    getResources().getString(R.string.buy_1),
                    getResources().getString(R.string.buy_2)));
    row.setActionsAdapter(actionAdapter);

    mAdapter.add(row);
}
 
开发者ID:alphater,项目名称:garras,代码行数:44,代码来源:VideoDetailsFragment.java

示例10: setupDetailsOverviewRow

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void setupDetailsOverviewRow() {
    Log.d(TAG, "doInBackground: " + mSelectedApk.toString());
    final DetailsOverviewRow row = new DetailsOverviewRow(mSelectedApk);
    row.setImageDrawable(getResources().getDrawable(R.drawable.default_background));
    int width = Utils.convertDpToPixel(getActivity()
            .getApplicationContext(), DETAIL_THUMB_WIDTH);
    int height = Utils.convertDpToPixel(getActivity()
            .getApplicationContext(), DETAIL_THUMB_HEIGHT);
    Glide.with(getActivity())
            .load(mSelectedApk.getIcon())
            .centerCrop()
            .error(R.drawable.default_background)
            .into(new SimpleTarget<GlideDrawable>(width, height) {
                @Override
                public void onResourceReady(GlideDrawable resource,
                                            GlideAnimation<? super GlideDrawable>
                                                    glideAnimation) {
                    Log.d(TAG, "details overview card image url ready: " + resource);
                    row.setImageDrawable(resource);
                    mAdapter.notifyArrayItemRangeChanged(0, mAdapter.size());
                }
            });

    // See if this is already installed. If so, check if it can be updated.
    // Offer an uninstall option.
    // Add an install button.
    SparseArrayObjectAdapter possibleActions = new SparseArrayObjectAdapter();
    PackageManager packageManager = getActivity().getPackageManager();
    try {
        PackageInfo info = packageManager.getPackageInfo(mSelectedApk.getPackageName(), 0);
        if (info.versionCode < mSelectedApk.getVersionCode()) {
            possibleActions.set(ACTION_UPDATE,
                    new Action(ACTION_UPDATE, getString(R.string.update)));
        }
        possibleActions.set(ACTION_UNINSTALL,
                new Action(ACTION_UNINSTALL, getString(R.string.uninstall)));
    } catch (PackageManager.NameNotFoundException e) {
        // App is not installed
        possibleActions.set(ACTION_INSTALL,
                new Action(ACTION_INSTALL, getString(R.string.install)));
    }
    row.setActionsAdapter(possibleActions);

    mAdapter.add(row);
}
 
开发者ID:ITVlab,项目名称:TvAppRepo,代码行数:46,代码来源:AppDetailsFragment.java

示例11: createActions

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void createActions(DetailsOverviewRow detailsRow) {
  SparseArrayObjectAdapter actionsAdapter = new SparseArrayObjectAdapter();
  actionsAdapter.set(ACTION_PLAY,
      new Action(ACTION_PLAY, getString(R.string.ondemand_details_action_play)));
  detailsRow.setActionsAdapter(actionsAdapter);
}
 
开发者ID:mkjensen,项目名称:danish-media-license,代码行数:7,代码来源:DetailsFragment.java

示例12: setupDetailsOverviewRow

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void setupDetailsOverviewRow() {
    final DetailsOverviewRow row = new DetailsOverviewRow(jsonChannel);
    row.setImageDrawable(getResources().getDrawable(R.drawable.c_background5));
    int width = Utils.convertDpToPixel(getActivity()
            .getApplicationContext(), DETAIL_THUMB_WIDTH);
    int height = Utils.convertDpToPixel(getActivity()
            .getApplicationContext(), DETAIL_THUMB_HEIGHT);
    new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                final Bitmap bitmap = Glide.with(getActivity())
                        .load(ChannelDatabase.getNonNullChannelLogo(jsonChannel))
                        .asBitmap()
                        .fitCenter()
                        .error(R.drawable.c_background5)
                        .into(DETAIL_THUMB_WIDTH, DETAIL_THUMB_HEIGHT)
                        .get();
                new Handler(Looper.getMainLooper()).post(new Runnable() {
                    @Override
                    public void run() {
                        row.setImageBitmap(getActivity(), bitmap);
                        mAdapter.notifyArrayItemRangeChanged(0, mAdapter.size());
                    }
                });
            } catch (InterruptedException | ExecutionException e) {
                e.printStackTrace();
            }
        }
    }).start();

    ArrayObjectAdapter actions = new ArrayObjectAdapter();
    // Add another action IF it isn't a channel you already have:
    ChannelDatabase cdn = ChannelDatabase.getInstance(getActivity());
    if(cdn.findChannelByMediaUrl(jsonChannel.getMediaUrl()) == null) {
        actions.add(new Action(ACTION_ADD, getString(R.string.add_channel_txt)));
    } else {
        actions.add(new Action(ACTION_EDIT, getString(R.string.edit_channel)));
    }
    actions.add(new Action(ACTION_WATCH, getString(R.string.play)));
    row.setActionsAdapter(actions);
    mAdapter.add(row);
}
 
开发者ID:Fleker,项目名称:CumulusTV,代码行数:44,代码来源:VideoDetailsFragment.java


注:本文中的android.support.v17.leanback.widget.DetailsOverviewRow.setActionsAdapter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。