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


Java BackgroundManager.isAttached方法代码示例

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


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

示例1: onCreate

import android.support.v17.leanback.app.BackgroundManager; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "onCreate " + savedInstanceState);
    super.onCreate(savedInstanceState);

    mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
    mDisplayMode = readDisplayModePref(mPrefs);

    BackgroundManager bgMngr = BackgroundManager.getInstance(getActivity());
    if(!bgMngr.isAttached())
        bgMngr.attach(getActivity().getWindow());
    bgMngr.setColor(getResources().getColor(R.color.leanback_background));

    setTitle(getArguments().getString(ARG_TITLE));
    mUri = getArguments().getParcelable(ARG_URI);
    mIsRoot = getArguments().getBoolean(ARG_IS_ROOT, false);

    setupEventListeners();

    // NOTE: onCreate is called only when the fragment is first created, not when it is back from backstack
    initGridOrList();

    mRefreshOnNextResume = true;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:25,代码来源:ListingFragment.java

示例2: BackdropTask

import android.support.v17.leanback.app.BackgroundManager; //导入方法依赖的package包/类
public BackdropTask(Activity activity, int backgroundDefaultColor) {
    super();
    mContext = activity;
    mMetrics = new DisplayMetrics();
    mDefaultBackground = new ColorDrawable(backgroundDefaultColor);
    activity.getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
    BackgroundManager backgroundManager = BackgroundManager.getInstance(activity);
    if(!backgroundManager.isAttached())
    backgroundManager.attach(activity.getWindow());
    mBackgroundTarget = new PicassoBackgroundManagerTarget(backgroundManager);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:12,代码来源:BackdropTask.java

示例3: loadAndSetBackgroundImageParameter

import android.support.v17.leanback.app.BackgroundManager; //导入方法依赖的package包/类
private void loadAndSetBackgroundImageParameter(VideoEntity selectedVideo,
        final Activity activity, DisplayMetrics metrics,
        final BackgroundManager backgroundManager, RequestOptions defaultPlaceHolder,
        Drawable defualtDrawble) {
    if (selectedVideo == null) {
        return;
    }
    String url1 = selectedVideo.getVideoBgImageLocalStorageUrl();
    String url2 = selectedVideo.getBgImageUrl();
    String loadedUri;
    if (url1.isEmpty()) {
        loadedUri = url2;
    } else {
        loadedUri = url1;
    }

    // wait until runtime the activity has window
    if (!backgroundManager.isAttached()) {
        backgroundManager.attach(activity.getWindow());
    }

    // glide on error
    Glide.with(activity)
            .asBitmap()
            .load(loadedUri)
            .apply(defaultPlaceHolder)
            .into(new SimpleTarget<Bitmap>(metrics.widthPixels, metrics.heightPixels) {
                @Override
                public void onResourceReady(Bitmap resource,
                        Transition<? super Bitmap> glideAnimation) {
                    backgroundManager.setDrawable(
                            new BitmapDrawable(activity.getResources(), resource));
                }
            });
}
 
开发者ID:googlesamples,项目名称:leanback-showcase,代码行数:36,代码来源:ListenerModule.java


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