Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e07e9f47 authored by Kshitij's avatar Kshitij
Browse files

Merge branch 'epic114-t-tabletmode' into 'v1-t-tablet'

BlissLauncher3: Tablet Mode

See merge request e/os/BlissLauncher3!42
parents 4a8a8d46 7f01d335
Loading
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ class BlurViewDelegate(

    private val context = view.context
    private val blurWallpaperProvider by lazy { BlurWallpaperProvider.getInstanceNoCreate() }
    private var orientation: Int = -1

    private var fullBlurDrawable: BlurDrawable? = null
    var blurAlpha = 255
@@ -222,6 +223,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
+7 −2
Original line number Diff line number Diff line
@@ -63,6 +63,8 @@ class BlurWallpaperProvider(val context: Context) {

    private var isLiveWallpaper = false

    private var lastOffset = 0.5f

    init {
        isEnabled = getEnabledStatus()
        updateAsync()
@@ -120,7 +122,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) }
        }
@@ -214,7 +216,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

+24 −16
Original line number Diff line number Diff line
@@ -169,20 +169,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() {
@@ -195,6 +198,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;
@@ -253,7 +261,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) {
@@ -264,7 +272,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();
@@ -274,12 +282,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));
        }
+0 −23
Original line number Diff line number Diff line
@@ -7,8 +7,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
@@ -19,9 +17,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
@@ -42,24 +37,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)
}
+12 −0
Original line number Diff line number Diff line
/*
 * Copyright © MURENA SAS 2023.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 */
package foundation.e.bliss.utils

interface OnDataChangedListener {
    fun onDataChanged()
}
Loading