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


Java DreamService类代码示例

本文整理汇总了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();
    }
}
 
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:22,代码来源:DayDreamService.java

示例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;
}
 
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:33,代码来源:AlternateDreamFragment.java

示例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);
}
 
开发者ID:adamsp,项目名称:DreamInTweets,代码行数:14,代码来源:TwitterStreamAdapter.java

示例4: DreamLinkMovementMethod

import android.service.dreams.DreamService; //导入依赖的package包/类
public DreamLinkMovementMethod(DreamService dream) {
    mDream = dream;
}
 
开发者ID:adamsp,项目名称:DreamInTweets,代码行数:4,代码来源:DreamLinkMovementMethod.java


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