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

Commit ea529083 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Using view elevation for shadow during click feedback instead of

creating a shadow bitmap

Change-Id: I331186664c3c448596af3172e0e080921a6a1908
parent 4d52411c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
        android:textColor="?android:attr/textColorPrimary"
        android:fontFamily="sans-serif"
        launcher:layoutHorizontal="true"
        launcher:deferShadowGeneration="true"
        launcher:iconDisplay="shortcut_popup"
        launcher:iconSizeOverride="@dimen/deep_shortcut_icon_size" />

+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
        android:fontFamily="sans-serif"
        launcher:iconDisplay="shortcut_popup"
        launcher:layoutHorizontal="true"
        launcher:deferShadowGeneration="true"
        android:focusable="false" />

    <View
+4 −1
Original line number Diff line number Diff line
@@ -15,6 +15,9 @@
-->

<resources>

    <dimen name="click_shadow_elevation">4dp</dimen>

    <!-- Dynamic Grid -->
    <dimen name="dynamic_grid_edge_margin">8dp</dimen>
    <dimen name="dynamic_grid_min_page_indicator_size">32dp</dimen>
+24 −9
Original line number Diff line number Diff line
@@ -21,9 +21,12 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.LauncherActivityInfo;
import android.os.Build;
import android.os.Process;
import android.os.UserHandle;

import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.PackageManagerHelper;

@@ -59,17 +62,12 @@ public class AppInfo extends ItemInfoWithIcon {
        this.componentName = info.getComponentName();
        this.container = ItemInfo.NO_ID;
        this.user = user;
        if (PackageManagerHelper.isAppSuspended(info.getApplicationInfo())) {
            runtimeStatusFlags |= ShortcutInfo.FLAG_DISABLED_SUSPENDED;
        }
        if (quietModeEnabled) {
            runtimeStatusFlags |= ShortcutInfo.FLAG_DISABLED_QUIET_USER;
        }

        intent = makeLaunchIntent(info);
        runtimeStatusFlags |= (info.getApplicationInfo().flags & ApplicationInfo.FLAG_SYSTEM) == 0
                ? FLAG_SYSTEM_NO : FLAG_SYSTEM_YES;

        if (quietModeEnabled) {
            runtimeStatusFlags |= FLAG_DISABLED_QUIET_USER;
        }
        updateRuntimeFlagsForActivityTarget(this, info);
    }

    public AppInfo(AppInfo info) {
@@ -102,4 +100,21 @@ public class AppInfo extends ItemInfoWithIcon {
                .setComponent(cn)
                .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
    }

    public static void updateRuntimeFlagsForActivityTarget(
            ItemInfoWithIcon info, LauncherActivityInfo lai) {
        ApplicationInfo appInfo = lai.getApplicationInfo();
        if (PackageManagerHelper.isAppSuspended(appInfo)) {
            info.runtimeStatusFlags |= FLAG_DISABLED_SUSPENDED;
        }
        info.runtimeStatusFlags |= (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0
                ? FLAG_SYSTEM_NO : FLAG_SYSTEM_YES;

        if (FeatureFlags.LEGACY_ICON_TREATMENT && Utilities.ATLEAST_OREO
                && appInfo.targetSdkVersion >= Build.VERSION_CODES.O
                && Process.myUserHandle().equals(lai.getUser())) {
            // The icon for a non-primary user is badged, hence it's not exactly an adaptive icon.
            info.runtimeStatusFlags |= FLAG_ADAPTIVE_ICON;
        }
    }
}
+1 −10
Original line number Diff line number Diff line
@@ -385,16 +385,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {

    @Override
    public void setPressedIcon(BubbleTextView icon, Bitmap background) {
        if (icon == null || background == null) {
            mTouchFeedbackView.setBitmap(null);
            mTouchFeedbackView.animate().cancel();
        } else {
            if (mTouchFeedbackView.setBitmap(background)) {
                mTouchFeedbackView.alignWithIconView(icon, mShortcutsAndWidgets,
                        null /* clipAgainstView */);
                mTouchFeedbackView.animateShadow();
            }
        }
        mTouchFeedbackView.setPressedIcon(icon, background);
    }

    void setIsDragOverlapping(boolean isDragOverlapping) {
Loading