本文整理汇总了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;
}
示例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);
}
示例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));
}
});
}