Loading bliss/src/foundation/e/bliss/blur/BlurViewDelegate.kt +7 −1 Original line number Diff line number Diff line Loading @@ -40,9 +40,10 @@ class BlurViewDelegate( private val context = view.context private val blurWallpaperProvider by lazy { BlurWallpaperProvider.getInstanceNoCreate() } private var orientation: Int = -1 private var fullBlurDrawable: BlurDrawable? = null private var blurAlpha = 255 var blurAlpha = 255 private val blurDrawableCallback by lazy { object : Drawable.Callback { Loading Loading @@ -232,6 +233,11 @@ class BlurViewDelegate( } private fun updateOffsets() { val newOrientation = context.resources.configuration.orientation if (orientation != newOrientation) { BlurWallpaperProvider.getInstanceNoCreate().setWallpaperOffset(null) orientation = newOrientation } fullBlurDrawable?.setOffsets( previousScrollX.toFloat() + parentOffsetX, previousScrollY.toFloat() + parentOffsetY Loading bliss/src/foundation/e/bliss/blur/BlurWallpaperProvider.kt +17 −15 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ class BlurWallpaperProvider(val context: Context) { private val mWallpaperManager: WallpaperManager = WallpaperManager.getInstance(context) private val mListeners = ArrayList<Listener>() private val mDisplaySize = DisplayController.INSTANCE.get(context).info.currentSize private var mDisplaySize = DisplayController.INSTANCE.get(context).info.currentSize var wallpapers: BlurSizes? = null private set(value) { Loading Loading @@ -73,6 +73,8 @@ class BlurWallpaperProvider(val context: Context) { private var isLiveWallpaper = false private var lastOffset = 0.5f init { isEnabled = getEnabledStatus() updateAsync() Loading @@ -95,6 +97,7 @@ class BlurWallpaperProvider(val context: Context) { return } mDisplaySize = DisplayController.INSTANCE.get(context).info.currentSize val width = mDisplaySize.x val height = mDisplaySize.y Loading Loading @@ -129,7 +132,7 @@ class BlurWallpaperProvider(val context: Context) { mWallpaperWidth = wallpaper.width val offsetY: Float if (wallpaper.height > height) { if (wallpaper.height >= height) { offsetY = (wallpaper.height - height) * 0.5f mListeners.forEach { it.onOffsetChanged(offsetY) } } Loading Loading @@ -177,21 +180,17 @@ class BlurWallpaperProvider(val context: Context) { } private fun applyVibrancy(wallpaper: Bitmap): Bitmap { val width = wallpaper.width val height = wallpaper.height val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888) val canvas = Canvas() canvas.setBitmap(bitmap) mVibrancyPaint.colorFilter = ColorMatrixColorFilter(ColorMatrix().apply { setSaturation(1.25f) }) val colorMatrix = ColorMatrix() colorMatrix.setSaturation(1.25f) val filter = ColorMatrixColorFilter(colorMatrix) mVibrancyPaint.colorFilter = filter canvas.drawBitmap(wallpaper, 0f, 0f, mVibrancyPaint) val bitmap = Bitmap.createBitmap(wallpaper) Canvas().apply { setBitmap(bitmap) drawBitmap(wallpaper, 0f, 0f, mVibrancyPaint) } wallpaper.recycle() return bitmap } Loading Loading @@ -223,7 +222,10 @@ class BlurWallpaperProvider(val context: Context) { fun createBlurDrawable(config: BlurConfig = blurConfigDock) = BlurDrawable(this, config) fun setWallpaperOffset(offset: Float) { fun setWallpaperOffset(inputOffset: Float?) { val offset = inputOffset ?: lastOffset lastOffset = offset if (!isEnabled) return if (wallpapers == null) return Loading Loading @@ -287,7 +289,7 @@ class BlurWallpaperProvider(val context: Context) { @JvmField val blurConfigBackground = BlurConfig({ it.background }, 2, 8) @JvmField val blurConfigDock = BlurConfig({ it.dock }, 2, 0) @JvmField val blurConfigDock = BlurConfig({ it.dock }, 2, 8) @JvmField val blurConfigAppGroup = BlurConfig({ it.appGroup }, 6, 8) Loading bliss/src/foundation/e/bliss/folder/GridFolder.java +24 −16 Original line number Diff line number Diff line Loading @@ -179,20 +179,23 @@ public class GridFolder extends Folder implements OnAlarmListener { @Override public void onFolderOpenStart() { if (mLauncher != null) { mLastStateBeforeOpen = mLauncher.getStateManager().getState(); if (!mLauncher.isInState(NORMAL)) { mLauncher.getStateManager().goToState(LauncherState.NORMAL, false); mLauncher.getStateManager().goToState(NORMAL, false); if (isCanRestoredState(mLastStateBeforeOpen)) { mNeedResetState = true; } } showOrHideDesktop(mLauncher, true); if (mLauncher.getWorkspace().isWobbling()) { wobbleFolder(true); } else if (isFolderWobbling) { wobbleFolder(false); } } else { mNeedResetState = true; } } public boolean isFolderWobbling() { Loading @@ -205,6 +208,11 @@ public class GridFolder extends Folder implements OnAlarmListener { @Override protected void handleClose(boolean animate) { if (mLauncher == null) { super.handleClose(animate); return; } if (!mLauncher.isInState(mLastStateBeforeOpen)) { if (mLauncher.getDragController().isDragging()) { mNeedResetState = false; Loading Loading @@ -263,7 +271,7 @@ public class GridFolder extends Folder implements OnAlarmListener { AnimatorSet set = new AnimatorSet(); Workspace<?> workspace = launcher.getWorkspace(); Workspace<?> workspace = launcher == null ? null : launcher.getWorkspace(); if (workspace != null) { play(set, getAnimator(workspace, 1f, 0f, hide)); if (workspace.getPageIndicator() != null) { Loading @@ -274,7 +282,7 @@ public class GridFolder extends Folder implements OnAlarmListener { } } Hotseat hotseat = launcher.getHotseat(); Hotseat hotseat = launcher == null ? null : launcher.getHotseat(); if (hotseat != null) { play(set, getAnimator(hotseat, 1f, 0f, hide)); View qsb = hotseat.getQsb(); Loading @@ -284,12 +292,12 @@ public class GridFolder extends Folder implements OnAlarmListener { } ScrimView scrimView = launcher.findViewById(R.id.scrim_view); ScrimView scrimView = launcher == null ? null : launcher.findViewById(R.id.scrim_view); if (scrimView != null) { play(set, getAnimator(scrimView, 1f, 0f, hide)); } BlurBackgroundView blur = launcher.mBlurLayer; BlurBackgroundView blur = launcher == null ? null : launcher.mBlurLayer; if (blur != null) { play(set, getAnimator(blur, 0f, 1f, hide)); } Loading bliss/src/foundation/e/bliss/utils/BlissUtils.kt +0 −23 Original line number Diff line number Diff line Loading @@ -17,8 +17,6 @@ */ package foundation.e.bliss.utils import android.animation.ArgbEvaluator import android.animation.ValueAnimator import android.content.ComponentName import android.content.Context import android.content.Intent Loading @@ -29,9 +27,6 @@ import android.content.pm.PackageManager import android.os.Handler import android.os.Looper import android.os.UserHandle import android.view.Window import android.view.animation.LinearInterpolator import androidx.core.graphics.ColorUtils import com.android.launcher3.Launcher import com.android.launcher3.LauncherSettings import com.android.launcher3.model.data.ItemInfo Loading @@ -53,24 +48,6 @@ fun <T> resourcesToMap(array: List<T>): Map<T, T> { return map } fun createNavbarColorAnimator(window: Window): ValueAnimator { val navColor: Int = window.navigationBarColor or 0x26000000 val colorAnimation = ValueAnimator.ofObject( ArgbEvaluator(), navColor, ColorUtils.setAlphaComponent(navColor, 160) ) colorAnimation.apply { duration = 400 interpolator = LinearInterpolator() addUpdateListener { window.navigationBarColor = it.animatedValue as Int } } return colorAnimation } fun runOnMainThread(r: () -> Unit) { runOnThread(mainHandler, r) } Loading bliss/src/foundation/e/bliss/utils/OnDataChangedListener.kt 0 → 100644 +22 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 MURENA SAS * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ package foundation.e.bliss.utils interface OnDataChangedListener { fun onDataChanged() } Loading
bliss/src/foundation/e/bliss/blur/BlurViewDelegate.kt +7 −1 Original line number Diff line number Diff line Loading @@ -40,9 +40,10 @@ class BlurViewDelegate( private val context = view.context private val blurWallpaperProvider by lazy { BlurWallpaperProvider.getInstanceNoCreate() } private var orientation: Int = -1 private var fullBlurDrawable: BlurDrawable? = null private var blurAlpha = 255 var blurAlpha = 255 private val blurDrawableCallback by lazy { object : Drawable.Callback { Loading Loading @@ -232,6 +233,11 @@ class BlurViewDelegate( } private fun updateOffsets() { val newOrientation = context.resources.configuration.orientation if (orientation != newOrientation) { BlurWallpaperProvider.getInstanceNoCreate().setWallpaperOffset(null) orientation = newOrientation } fullBlurDrawable?.setOffsets( previousScrollX.toFloat() + parentOffsetX, previousScrollY.toFloat() + parentOffsetY Loading
bliss/src/foundation/e/bliss/blur/BlurWallpaperProvider.kt +17 −15 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ class BlurWallpaperProvider(val context: Context) { private val mWallpaperManager: WallpaperManager = WallpaperManager.getInstance(context) private val mListeners = ArrayList<Listener>() private val mDisplaySize = DisplayController.INSTANCE.get(context).info.currentSize private var mDisplaySize = DisplayController.INSTANCE.get(context).info.currentSize var wallpapers: BlurSizes? = null private set(value) { Loading Loading @@ -73,6 +73,8 @@ class BlurWallpaperProvider(val context: Context) { private var isLiveWallpaper = false private var lastOffset = 0.5f init { isEnabled = getEnabledStatus() updateAsync() Loading @@ -95,6 +97,7 @@ class BlurWallpaperProvider(val context: Context) { return } mDisplaySize = DisplayController.INSTANCE.get(context).info.currentSize val width = mDisplaySize.x val height = mDisplaySize.y Loading Loading @@ -129,7 +132,7 @@ class BlurWallpaperProvider(val context: Context) { mWallpaperWidth = wallpaper.width val offsetY: Float if (wallpaper.height > height) { if (wallpaper.height >= height) { offsetY = (wallpaper.height - height) * 0.5f mListeners.forEach { it.onOffsetChanged(offsetY) } } Loading Loading @@ -177,21 +180,17 @@ class BlurWallpaperProvider(val context: Context) { } private fun applyVibrancy(wallpaper: Bitmap): Bitmap { val width = wallpaper.width val height = wallpaper.height val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888) val canvas = Canvas() canvas.setBitmap(bitmap) mVibrancyPaint.colorFilter = ColorMatrixColorFilter(ColorMatrix().apply { setSaturation(1.25f) }) val colorMatrix = ColorMatrix() colorMatrix.setSaturation(1.25f) val filter = ColorMatrixColorFilter(colorMatrix) mVibrancyPaint.colorFilter = filter canvas.drawBitmap(wallpaper, 0f, 0f, mVibrancyPaint) val bitmap = Bitmap.createBitmap(wallpaper) Canvas().apply { setBitmap(bitmap) drawBitmap(wallpaper, 0f, 0f, mVibrancyPaint) } wallpaper.recycle() return bitmap } Loading Loading @@ -223,7 +222,10 @@ class BlurWallpaperProvider(val context: Context) { fun createBlurDrawable(config: BlurConfig = blurConfigDock) = BlurDrawable(this, config) fun setWallpaperOffset(offset: Float) { fun setWallpaperOffset(inputOffset: Float?) { val offset = inputOffset ?: lastOffset lastOffset = offset if (!isEnabled) return if (wallpapers == null) return Loading Loading @@ -287,7 +289,7 @@ class BlurWallpaperProvider(val context: Context) { @JvmField val blurConfigBackground = BlurConfig({ it.background }, 2, 8) @JvmField val blurConfigDock = BlurConfig({ it.dock }, 2, 0) @JvmField val blurConfigDock = BlurConfig({ it.dock }, 2, 8) @JvmField val blurConfigAppGroup = BlurConfig({ it.appGroup }, 6, 8) Loading
bliss/src/foundation/e/bliss/folder/GridFolder.java +24 −16 Original line number Diff line number Diff line Loading @@ -179,20 +179,23 @@ public class GridFolder extends Folder implements OnAlarmListener { @Override public void onFolderOpenStart() { if (mLauncher != null) { mLastStateBeforeOpen = mLauncher.getStateManager().getState(); if (!mLauncher.isInState(NORMAL)) { mLauncher.getStateManager().goToState(LauncherState.NORMAL, false); mLauncher.getStateManager().goToState(NORMAL, false); if (isCanRestoredState(mLastStateBeforeOpen)) { mNeedResetState = true; } } showOrHideDesktop(mLauncher, true); if (mLauncher.getWorkspace().isWobbling()) { wobbleFolder(true); } else if (isFolderWobbling) { wobbleFolder(false); } } else { mNeedResetState = true; } } public boolean isFolderWobbling() { Loading @@ -205,6 +208,11 @@ public class GridFolder extends Folder implements OnAlarmListener { @Override protected void handleClose(boolean animate) { if (mLauncher == null) { super.handleClose(animate); return; } if (!mLauncher.isInState(mLastStateBeforeOpen)) { if (mLauncher.getDragController().isDragging()) { mNeedResetState = false; Loading Loading @@ -263,7 +271,7 @@ public class GridFolder extends Folder implements OnAlarmListener { AnimatorSet set = new AnimatorSet(); Workspace<?> workspace = launcher.getWorkspace(); Workspace<?> workspace = launcher == null ? null : launcher.getWorkspace(); if (workspace != null) { play(set, getAnimator(workspace, 1f, 0f, hide)); if (workspace.getPageIndicator() != null) { Loading @@ -274,7 +282,7 @@ public class GridFolder extends Folder implements OnAlarmListener { } } Hotseat hotseat = launcher.getHotseat(); Hotseat hotseat = launcher == null ? null : launcher.getHotseat(); if (hotseat != null) { play(set, getAnimator(hotseat, 1f, 0f, hide)); View qsb = hotseat.getQsb(); Loading @@ -284,12 +292,12 @@ public class GridFolder extends Folder implements OnAlarmListener { } ScrimView scrimView = launcher.findViewById(R.id.scrim_view); ScrimView scrimView = launcher == null ? null : launcher.findViewById(R.id.scrim_view); if (scrimView != null) { play(set, getAnimator(scrimView, 1f, 0f, hide)); } BlurBackgroundView blur = launcher.mBlurLayer; BlurBackgroundView blur = launcher == null ? null : launcher.mBlurLayer; if (blur != null) { play(set, getAnimator(blur, 0f, 1f, hide)); } Loading
bliss/src/foundation/e/bliss/utils/BlissUtils.kt +0 −23 Original line number Diff line number Diff line Loading @@ -17,8 +17,6 @@ */ package foundation.e.bliss.utils import android.animation.ArgbEvaluator import android.animation.ValueAnimator import android.content.ComponentName import android.content.Context import android.content.Intent Loading @@ -29,9 +27,6 @@ import android.content.pm.PackageManager import android.os.Handler import android.os.Looper import android.os.UserHandle import android.view.Window import android.view.animation.LinearInterpolator import androidx.core.graphics.ColorUtils import com.android.launcher3.Launcher import com.android.launcher3.LauncherSettings import com.android.launcher3.model.data.ItemInfo Loading @@ -53,24 +48,6 @@ fun <T> resourcesToMap(array: List<T>): Map<T, T> { return map } fun createNavbarColorAnimator(window: Window): ValueAnimator { val navColor: Int = window.navigationBarColor or 0x26000000 val colorAnimation = ValueAnimator.ofObject( ArgbEvaluator(), navColor, ColorUtils.setAlphaComponent(navColor, 160) ) colorAnimation.apply { duration = 400 interpolator = LinearInterpolator() addUpdateListener { window.navigationBarColor = it.animatedValue as Int } } return colorAnimation } fun runOnMainThread(r: () -> Unit) { runOnThread(mainHandler, r) } Loading
bliss/src/foundation/e/bliss/utils/OnDataChangedListener.kt 0 → 100644 +22 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 MURENA SAS * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ package foundation.e.bliss.utils interface OnDataChangedListener { fun onDataChanged() }