本文整理匯總了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));
}
});
}