本文整理汇总了Java中android.service.dreams.DreamService类的典型用法代码示例。如果您正苦于以下问题:Java DreamService类的具体用法?Java DreamService怎么用?Java DreamService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DreamService类属于android.service.dreams包,在下文中一共展示了DreamService类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindAltDream
import android.service.dreams.DreamService; //导入依赖的package包/类
/**
* Performs bind on alt dream service
*/
//@DebugLog
private void bindAltDream() {
ComponentName altDream = mDreamPrefs.getAltDreamComponent();
if (altDream != null) {
Intent intent = new Intent(DreamService.SERVICE_INTERFACE)
.setComponent(altDream)
.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
try {
bindService(intent, mAltDreamConnection, BIND_AUTO_CREATE);
} catch (SecurityException e) {
Timber.w("Altdream: %s requires permission we can't obtain", altDream.flattenToString());
mDreamPrefs.removeAltDreamComponent();
switchToSaverView();
}
} else {
setupSaverView();
}
}
示例2: getDreamInfos
import android.service.dreams.DreamService; //导入依赖的package包/类
/**
* Pulls list of dream infos from installed packages
* from AOSP Settings#DreamBackend.java
* @return
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public List<DreamInfo> getDreamInfos() {
PackageManager pm = getActivity().getPackageManager();
Intent dreamIntent = new Intent(DreamService.SERVICE_INTERFACE);
List<ResolveInfo> resolveInfos = pm.queryIntentServices(dreamIntent, PackageManager.GET_META_DATA);
List<DreamInfo> dreamInfos = new ArrayList<DreamInfo>(resolveInfos.size());
for (ResolveInfo resolveInfo : resolveInfos) {
if (resolveInfo.serviceInfo == null)
continue;
if (VersionUtils.hasLollipop()
&& "android.permission.BIND_DREAM_SERVICE".equals(resolveInfo.serviceInfo.permission)) {
Timber.w("Ignoring protected daydream %s", getDreamComponentName(resolveInfo).flattenToString());
continue;
}
DreamInfo dreamInfo = new DreamInfo();
dreamInfo.caption = resolveInfo.loadLabel(pm);
dreamInfo.icon = resolveInfo.loadIcon(pm);
dreamInfo.componentName = getDreamComponentName(resolveInfo);
dreamInfo.isActive = dreamInfo.componentName.equals(activeDream);
// Dont add ourselves
if (new ComponentName(getActivity().getPackageName(),
DayDreamService.class.getName()).equals(dreamInfo.componentName))
continue;
dreamInfos.add(dreamInfo);
}
return dreamInfos;
}
示例3: TwitterStreamAdapter
import android.service.dreams.DreamService; //导入依赖的package包/类
public TwitterStreamAdapter(DreamService dream, ImageView contentImageLargeView) {
mDream = dream;
mContentImageLargeView = contentImageLargeView;
mContentImageLargeView.setOnClickListener(contentImageLargeClickListener);
mFadeInAnimator = AnimatorInflater.loadAnimator(mDream, android.R.animator.fade_in);
mFadeInAnimator.addListener(mFadeInListener);
mFadeInAnimator.setTarget(mContentImageLargeView);
mFadeOutAnimator = AnimatorInflater.loadAnimator(mDream, android.R.animator.fade_out);
mFadeOutAnimator.addListener(mFadeOutListener);
mFadeOutAnimator.setTarget(mContentImageLargeView);
}
示例4: DreamLinkMovementMethod
import android.service.dreams.DreamService; //导入依赖的package包/类
public DreamLinkMovementMethod(DreamService dream) {
mDream = dream;
}