當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。