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