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


Java DetailsOverviewRow.setImageBitmap方法代码示例

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


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

示例1: doInBackground

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
@Override
protected DetailsOverviewRow doInBackground(Movie... movies) {
    mSelectedMovie = movies[0];

    DetailsOverviewRow row = new DetailsOverviewRow(mSelectedMovie);
    try {
        Bitmap poster = Picasso.with(getActivity())
                               .load(mSelectedMovie.getCardImageUrl())
                               .resize(Utils.convertDpToPixel(getActivity().getApplicationContext(),
                                               DETAIL_THUMB_WIDTH),
                                       Utils.convertDpToPixel(getActivity().getApplicationContext(),
                                               DETAIL_THUMB_HEIGHT))
                               .centerCrop()
                               .get();
        row.setImageBitmap(getActivity(), poster);
    } catch (IOException e) {
    }

    row.addAction(new Action(ACTION_WATCH_TRAILER, getResources().getString(
            R.string.watch_trailer_1), getResources().getString(R.string.watch_trailer_2)));
    row.addAction(new Action(ACTION_RENT, getResources().getString(R.string.rent_1),
            getResources().getString(R.string.rent_2)));
    row.addAction(new Action(ACTION_BUY, getResources().getString(R.string.buy_1),
            getResources().getString(R.string.buy_2)));
    return row;
}
 
开发者ID:CesarValiente,项目名称:tldrlegal,代码行数:27,代码来源:VideoDetailsFragment.java

示例2: 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

示例3: doInBackground

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
@Override
protected DetailsOverviewRow doInBackground(Movie... movies) {
    mSelectedMovie = movies[0];

    DetailsOverviewRow row = new DetailsOverviewRow(mSelectedMovie);
    try {
        Bitmap poster = Picasso.with(getActivity())
                .load(mSelectedMovie.getCardImageUrl())
                .resize(Utils.convertDpToPixel(getActivity().getApplicationContext(), DETAIL_THUMB_WIDTH),
                        Utils.convertDpToPixel(getActivity().getApplicationContext(), DETAIL_THUMB_HEIGHT))
                .centerCrop()
                .get();
        row.setImageBitmap(getActivity(), poster);
    } catch (IOException e) {
    }

    row.addAction(new Action(ACTION_WATCH_TRAILER, getResources().getString(
            R.string.watch_trailer_1), getResources().getString(R.string.watch_trailer_2)));
    row.addAction(new Action(ACTION_RENT, getResources().getString(R.string.rent_1),
            getResources().getString(R.string.rent_2)));
    row.addAction(new Action(ACTION_BUY, getResources().getString(R.string.buy_1),
            getResources().getString(R.string.buy_2)));
    return row;
}
 
开发者ID:MizzleDK,项目名称:Mizuu-Android-TV,代码行数:25,代码来源:VideoDetailsFragment.java

示例4: doInBackground

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
@Override
protected DetailsOverviewRow doInBackground(Movie... movies) {
    selectedMovie = movies[0];

    DetailsOverviewRow row = new DetailsOverviewRow(selectedMovie);
    try {
        Bitmap poster = Picasso.with(getActivity())
                .load(selectedMovie.getCardImageUrl())
                .resize(dpToPx(DETAIL_THUMB_WIDTH, getActivity().getApplicationContext()),
                        dpToPx(DETAIL_THUMB_HEIGHT, getActivity().getApplicationContext()))
                .centerCrop()
                .get();
        row.setImageBitmap(getActivity(), poster);
    } catch (IOException e) {
    }

    row.addAction(new Action(ACTION_WATCH_TRAILER, getResources().getString(
            R.string.watch_trailer_1), getResources().getString(R.string.watch_trailer_2)));
    row.addAction(new Action(ACTION_RENT, getResources().getString(R.string.rent_1),
            getResources().getString(R.string.rent_2)));
    row.addAction(new Action(ACTION_BUY, getResources().getString(R.string.buy_1),
            getResources().getString(R.string.buy_2)));
    return row;
}
 
开发者ID:dextorer,项目名称:BuildingForAndroidTV,代码行数:25,代码来源:TVVideoDetailsFragment.java

示例5: configureDetailsOverviewRow

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private DetailsOverviewRow configureDetailsOverviewRow(CardInfo cardInfo, Bitmap bitmap) {
  final DetailsOverviewRow row = new DetailsOverviewRow(cardInfo);
  row.setImageBitmap(getActivity(), bitmap);
  row.addAction(new Action(VD_CALL_ACTION_ID, getString(R.string.vd_call_action_title)));
  row.addAction(new Action(CALL_ACTION_ID, getString(R.string.call_action_title)));
  row.addAction(new Action(CHAT_ACTION_ID, getString(R.string.chat_action_title)));
  row.addAction(new Action(EDIT_ACTION_ID, getString(R.string.edit_action_title)));
  return row;
}
 
开发者ID:pedrovgs,项目名称:TuentiTV,代码行数:10,代码来源:DetailFragment.java

示例6: doInBackground

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
@Override
protected DetailsOverviewRow doInBackground(Video... videos) {
    mVideo = videos[0];

    DetailsOverviewRow row = new DetailsOverviewRow(mVideo);
    try {
        Bitmap poster = Picasso.with(mActivity)
                .load(mVideo.getCardImageUrl())
                .resize(Utils.dpToPx(DETAIL_THUMB_WIDTH, mActivity.getApplicationContext()),
                        Utils.dpToPx(DETAIL_THUMB_HEIGHT, mActivity.getApplicationContext()))
                .centerCrop()
                .get();
        row.setImageBitmap(mActivity, poster);
    } catch (IOException e) {
        e.printStackTrace();
    }

    if (mShowPlayButton) {
        row.addAction(new Action(ACTION_PLAY, mActivity.getString(R.string.play)));
    }

    if (mVideo.getMovie() != null && !TextUtils.isEmpty(mVideo.getMovie().getTrailer())) {
        row.addAction(
                new Action(ACTION_VIEW_TRAILER, mActivity.getString(R.string.watch_trailer)));
    }

    return row;
}
 
开发者ID:jerrellmardis,项目名称:Amphitheatre,代码行数:29,代码来源:DetailRowBuilderTask.java

示例7: onCreate

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final String displayNumber = getActivity().getIntent().getStringExtra(
            RichFeedUtil.EXTRA_DISPLAY_NUMBER);

    DetailsOverviewRowPresenter dorPresenter = new DetailsOverviewRowPresenter(
            new DetailsDescriptionPresenter());
    dorPresenter.setSharedElementEnterTransition(getActivity(), "RichAppLinkDetailsFragment");

    DetailsOverviewRow row = new DetailsOverviewRow(displayNumber);
    Resources res = getResources();
    Bitmap bitmap = BitmapFactory.decodeResource(res, R.drawable.nejnettv);
    int length = Math.min(bitmap.getWidth(), bitmap.getHeight());
    Bitmap croppedBitmap = Bitmap.createBitmap(bitmap,
            (bitmap.getWidth() - length) / 2,
            (bitmap.getHeight() - length) / 2,
            length, length);
    row.setImageBitmap(getActivity(), croppedBitmap);

    Action action1 = new Action(0, res.getString(R.string.details_fragment_action_1));
    Action action2 = new Action(1, res.getString(R.string.details_fragment_action_2));
    row.addAction(action1);
    row.addAction(action2);

    ClassPresenterSelector presenterSelector = new ClassPresenterSelector();
    dorPresenter.setBackgroundColor(res.getColor(R.color.detail_background));
    dorPresenter.setStyleLarge(true);

    dorPresenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            getActivity().finish();
        }
    });

    presenterSelector.addClassPresenter(DetailsOverviewRow.class, dorPresenter);
    presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
    ArrayObjectAdapter adapter = new ArrayObjectAdapter(presenterSelector);
    adapter.add(row);

    setAdapter(adapter);
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:44,代码来源:RichAppLinkDetailsFragment.java

示例8: initUIs

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
private void initUIs(Bitmap bitmap) {
    DetailsOverviewRowPresenter dorPresenter =
            new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter());
    dorPresenter.setSharedElementEnterTransition(getActivity(), "SetUpFragment");

    mAddChannelAction = new Action(ACTION_ADD_CHANNELS,
            getResources().getString(R.string.rich_setup_add_channel));
    Action cancelAction = new Action(ACTION_CANCEL,
            getResources().getString(R.string.rich_setup_cancel));
    mInProgressAction = new Action(ACTION_IN_PROGRESS,
            getResources().getString(R.string.rich_setup_in_progress));

    DetailsOverviewRow row = new DetailsOverviewRow(mTvListing);
    if (bitmap != null) {
        int length = Math.min(bitmap.getWidth(), bitmap.getHeight());
        Bitmap croppedBitmap = Bitmap.createBitmap(bitmap,
                (bitmap.getWidth() - length) / 2,
                (bitmap.getHeight() - length) / 2,
                length, length);
        row.setImageBitmap(getActivity(), croppedBitmap);
    }
    row.addAction(mAddChannelAction);
    row.addAction(cancelAction);

    ClassPresenterSelector presenterSelector = new ClassPresenterSelector();
    // set detail background and style
    dorPresenter.setBackgroundColor(getResources().getColor(R.color.detail_background));
    dorPresenter.setStyleLarge(true);

    dorPresenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            if (action.getId() == ACTION_ADD_CHANNELS) {
                setupChannels(mInputId);
            } else if (action.getId() == ACTION_CANCEL) {
                getActivity().finish();
            }
        }
    });

    presenterSelector.addClassPresenter(DetailsOverviewRow.class, dorPresenter);
    presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
    mAdapter = new ArrayObjectAdapter(presenterSelector);
    mAdapter.add(row);

    setAdapter(mAdapter);

    BackgroundManager backgroundManager = BackgroundManager.getInstance(getActivity());
    backgroundManager.attach(getActivity().getWindow());
    if (bitmap != null) {
        backgroundManager.setBitmap(bitmap);
    } else {
        backgroundManager.setDrawable(
                getActivity().getDrawable(R.drawable.default_background));
    }
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:57,代码来源:RichSetupFragment.java

示例9: doInBackground

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
@Override
protected DetailsOverviewRow doInBackground(BaseItemDto... baseItem) {


    DetailsOverviewRow row = new DetailsOverviewRow(mBaseItem);
    try {
        Bitmap poster = Picasso.with(getActivity())
                .load(Utils.getPrimaryImageUrl(mBaseItem, mApiClient, true, false, Utils.convertDpToPixel(mApplication, DETAIL_THUMB_HEIGHT)))
                        .resize(Utils.convertDpToPixel(mApplication,DETAIL_THUMB_WIDTH),
                                Utils.convertDpToPixel(mApplication, DETAIL_THUMB_HEIGHT))
                        .centerInside()
                        .get();
        row.setImageBitmap(getActivity(), poster);
    } catch (IOException e) {
    }

    UserItemDataDto userData = mBaseItem.getUserData();
    if (userData != null && userData.getPlaybackPositionTicks() > 0) {
        row.addAction(new Action(ACTION_RESUME, "Resume"));
    }

    switch (mBaseItem.getType()) {
        case "Person":
        case "Photo":
            break;
        default:
            if (mBaseItem.getIsFolder() && Utils.CanPlay(mBaseItem)) {
                row.addAction(new Action(ACTION_PLAY, "Play All"));
                row.addAction(new Action(ACTION_SHUFFLE, "Shuffle All"));

            } else  {
                if (Utils.CanPlay(mBaseItem)) row.addAction(new Action(ACTION_PLAY, "Play"));
                if (mProgramInfo != null && TvApp.getApplication().getCurrentUser().getPolicy().getEnableLiveTvManagement()) {
                    //Add record buttons
                    if (mProgramInfo.getTimerId() != null) {
                        //existing recording
                        row.addAction(new Action(ACTION_CANCEL_RECORD, "Cancel"));
                    } else {
                        row.addAction(new Action(ACTION_RECORD, "Record"));
                    }
                }
                row.addAction(new Action(ACTION_DETAILS, "Details"));
            }

    }
    return row;
}
 
开发者ID:henrytrager,项目名称:MediaBrowser.AndroidTv,代码行数:48,代码来源:BaseItemDetailsFragment.java

示例10: onCreate

import android.support.v17.leanback.widget.DetailsOverviewRow; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final String displayNumber = getActivity().getIntent().getStringExtra(
            RichFeedUtil.EXTRA_DISPLAY_NUMBER);

    DetailsOverviewRowPresenter dorPresenter = new DetailsOverviewRowPresenter(
            new DetailsDescriptionPresenter());
    dorPresenter.setSharedElementEnterTransition(getActivity(), "RichAppLinkDetailsFragment");

    DetailsOverviewRow row = new DetailsOverviewRow(displayNumber);
    Resources res = getResources();
    Bitmap bitmap = BitmapFactory.decodeResource(res, R.drawable.your_company);
    int length = Math.min(bitmap.getWidth(), bitmap.getHeight());
    Bitmap croppedBitmap = Bitmap.createBitmap(bitmap,
            (bitmap.getWidth() - length) / 2,
            (bitmap.getHeight() - length) / 2,
            length, length);
    row.setImageBitmap(getActivity(), croppedBitmap);

    Action action1 = new Action(0, res.getString(R.string.details_fragment_action_1));
    Action action2 = new Action(1, res.getString(R.string.details_fragment_action_2));
    row.addAction(action1);
    row.addAction(action2);

    ClassPresenterSelector presenterSelector = new ClassPresenterSelector();
    dorPresenter.setBackgroundColor(ContextCompat.getColor(getActivity(),
            R.color.detail_background));
    dorPresenter.setStyleLarge(true);

    dorPresenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            getActivity().finish();
        }
    });

    presenterSelector.addClassPresenter(DetailsOverviewRow.class, dorPresenter);
    presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
    ArrayObjectAdapter adapter = new ArrayObjectAdapter(presenterSelector);
    adapter.add(row);

    setAdapter(adapter);
}
 
开发者ID:googlesamples,项目名称:androidtv-sample-inputs,代码行数:45,代码来源:RichAppLinkDetailsFragment.java


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