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


Java Prefs类代码示例

本文整理汇总了Java中com.google.android.apps.muzei.settings.Prefs的典型用法代码示例。如果您正苦于以下问题:Java Prefs类的具体用法?Java Prefs怎么用?Java Prefs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Prefs类属于com.google.android.apps.muzei.settings包,在下文中一共展示了Prefs类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onSharedPreferenceChanged

import com.google.android.apps.muzei.settings.Prefs; //导入依赖的package包/类
@Override
public void onSharedPreferenceChanged(final SharedPreferences sp, final String key) {
    if (Prefs.PREF_DISABLE_BLUR_WHEN_LOCKED.equals(key)) {
        if (sp.getBoolean(Prefs.PREF_DISABLE_BLUR_WHEN_LOCKED, false)) {
            IntentFilter intentFilter = new IntentFilter();
            intentFilter.addAction(Intent.ACTION_USER_PRESENT);
            intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
            intentFilter.addAction(Intent.ACTION_SCREEN_ON);
            mContext.registerReceiver(mLockScreenVisibleReceiver, intentFilter);
            mIsLockScreenVisibleReceiverRegistered = true;
            // If the user is not yet unlocked (i.e., using Direct Boot), we should
            // immediately send the lock screen visible callback
            if (!UserManagerCompat.isUserUnlocked(mContext)) {
                mEngine.lockScreenVisibleChanged(true);
            }
        } else if (mIsLockScreenVisibleReceiverRegistered) {
            mContext.unregisterReceiver(mLockScreenVisibleReceiver);
            mIsLockScreenVisibleReceiverRegistered = false;
        }
    }
}
 
开发者ID:romannurik,项目名称:muzei,代码行数:22,代码来源:LockscreenObserver.java

示例2: recomputeMaxPrescaledBlurPixels

import com.google.android.apps.muzei.settings.Prefs; //导入依赖的package包/类
public void recomputeMaxPrescaledBlurPixels() {
    // Compute blur sizes
    float maxBlurRadiusOverScreenHeight = PreferenceManager
            .getDefaultSharedPreferences(mContext).getInt(Prefs.PREF_BLUR_AMOUNT, DEFAULT_BLUR)
            * 0.0001f;
    DisplayMetrics dm = mContext.getResources().getDisplayMetrics();
    int maxBlurPx = (int) (dm.heightPixels * maxBlurRadiusOverScreenHeight);
    mBlurredSampleSize = 4;
    while (maxBlurPx / mBlurredSampleSize > ImageBlurrer.MAX_SUPPORTED_BLUR_PIXELS) {
        mBlurredSampleSize <<= 1;
    }
    mMaxPrescaledBlurPixels = maxBlurPx / mBlurredSampleSize;
}
 
开发者ID:chrislacy,项目名称:AndroidLiveWallpaperHelloWorld,代码行数:14,代码来源:MuzeiBlurRenderer.java

示例3: onCreate

import com.google.android.apps.muzei.settings.Prefs; //导入依赖的package包/类
@Override
public void onCreate(@NonNull final LifecycleOwner owner) {
    SharedPreferences sp = Prefs.getSharedPreferences(mContext);
    sp.registerOnSharedPreferenceChangeListener(mLockScreenPreferenceChangeListener);
    // Trigger the initial registration if needed
    mLockScreenPreferenceChangeListener.onSharedPreferenceChanged(sp,
            Prefs.PREF_DISABLE_BLUR_WHEN_LOCKED);
}
 
开发者ID:romannurik,项目名称:muzei,代码行数:9,代码来源:LockscreenObserver.java

示例4: onDestroy

import com.google.android.apps.muzei.settings.Prefs; //导入依赖的package包/类
@Override
public void onDestroy(@NonNull final LifecycleOwner owner) {
    if (mIsLockScreenVisibleReceiverRegistered) {
        mContext.unregisterReceiver(mLockScreenVisibleReceiver);
    }
    Prefs.getSharedPreferences(mContext)
            .unregisterOnSharedPreferenceChangeListener(mLockScreenPreferenceChangeListener);
}
 
开发者ID:romannurik,项目名称:muzei,代码行数:9,代码来源:LockscreenObserver.java

示例5: recomputeMaxPrescaledBlurPixels

import com.google.android.apps.muzei.settings.Prefs; //导入依赖的package包/类
public void recomputeMaxPrescaledBlurPixels() {
    // Compute blur sizes
    int blurAmount = mDemoMode
            ? DEMO_BLUR
            : Prefs.getSharedPreferences(mContext)
            .getInt(Prefs.PREF_BLUR_AMOUNT, DEFAULT_BLUR);
    float maxBlurRadiusOverScreenHeight = blurAmount * 0.0001f;
    DisplayMetrics dm = mContext.getResources().getDisplayMetrics();
    int maxBlurPx = (int) (dm.heightPixels * maxBlurRadiusOverScreenHeight);
    mBlurredSampleSize = 4;
    while (maxBlurPx / mBlurredSampleSize > ImageBlurrer.MAX_SUPPORTED_BLUR_PIXELS) {
        mBlurredSampleSize <<= 1;
    }
    mMaxPrescaledBlurPixels = maxBlurPx / mBlurredSampleSize;
}
 
开发者ID:romannurik,项目名称:muzei,代码行数:16,代码来源:MuzeiBlurRenderer.java

示例6: onSharedPreferenceChanged

import com.google.android.apps.muzei.settings.Prefs; //导入依赖的package包/类
@Override
public void onSharedPreferenceChanged(SharedPreferences sp, String key) {
    if (Prefs.PREF_BLUR_AMOUNT.equals(key)) {
        mRenderer.recomputeMaxPrescaledBlurPixels();
        throttledForceReloadCurrentArtwork();
    } else if (Prefs.PREF_DIM_AMOUNT.equals(key)) {
        mRenderer.recomputeMaxDimAmount();
        throttledForceReloadCurrentArtwork();
    } else if (Prefs.PREF_GREY_AMOUNT.equals(key)) {
        mRenderer.recomputeGreyAmount();
        throttledForceReloadCurrentArtwork();
    }
}
 
开发者ID:romannurik,项目名称:muzei,代码行数:14,代码来源:RenderController.java

示例7: RenderController

import com.google.android.apps.muzei.settings.Prefs; //导入依赖的package包/类
public RenderController(Context context, MuzeiBlurRenderer renderer, Callbacks callbacks) {
    mRenderer = renderer;
    mContext = context;
    mCallbacks = callbacks;
    Prefs.getSharedPreferences(context)
            .registerOnSharedPreferenceChangeListener(mOnSharedPreferenceChangeListener);
}
 
开发者ID:romannurik,项目名称:muzei,代码行数:8,代码来源:RenderController.java

示例8: destroy

import com.google.android.apps.muzei.settings.Prefs; //导入依赖的package包/类
public void destroy() {
    if (mQueuedBitmapRegionLoader != null) {
        mQueuedBitmapRegionLoader.destroy();
    }
    Prefs.getSharedPreferences(mContext)
            .unregisterOnSharedPreferenceChangeListener(mOnSharedPreferenceChangeListener);
    mExecutorService.shutdownNow();
}
 
开发者ID:romannurik,项目名称:muzei,代码行数:9,代码来源:RenderController.java

示例9: recomputeMaxDimAmount

import com.google.android.apps.muzei.settings.Prefs; //导入依赖的package包/类
public void recomputeMaxDimAmount() {
    mMaxDim = PreferenceManager
            .getDefaultSharedPreferences(mContext).getInt(
                    Prefs.PREF_DIM_AMOUNT, DEFAULT_MAX_DIM);
}
 
开发者ID:chrislacy,项目名称:AndroidLiveWallpaperHelloWorld,代码行数:6,代码来源:MuzeiBlurRenderer.java

示例10: recomputeGreyAmount

import com.google.android.apps.muzei.settings.Prefs; //导入依赖的package包/类
public void recomputeGreyAmount() {
    mMaxGrey = mDemoMode
            ? DEMO_GREY
            : PreferenceManager.getDefaultSharedPreferences(mContext)
            .getInt(Prefs.PREF_GREY_AMOUNT, DEFAULT_GREY);
}
 
开发者ID:chrislacy,项目名称:AndroidLiveWallpaperHelloWorld,代码行数:7,代码来源:MuzeiBlurRenderer.java

示例11: recomputeMaxDimAmount

import com.google.android.apps.muzei.settings.Prefs; //导入依赖的package包/类
public void recomputeMaxDimAmount() {
    mMaxDim = Prefs.getSharedPreferences(mContext).getInt(
                    Prefs.PREF_DIM_AMOUNT, DEFAULT_MAX_DIM);
}
 
开发者ID:romannurik,项目名称:muzei,代码行数:5,代码来源:MuzeiBlurRenderer.java

示例12: recomputeGreyAmount

import com.google.android.apps.muzei.settings.Prefs; //导入依赖的package包/类
public void recomputeGreyAmount() {
    mMaxGrey = mDemoMode
            ? DEMO_GREY
            : Prefs.getSharedPreferences(mContext)
            .getInt(Prefs.PREF_GREY_AMOUNT, DEFAULT_GREY);
}
 
开发者ID:romannurik,项目名称:muzei,代码行数:7,代码来源:MuzeiBlurRenderer.java


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