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

Commit e1ef8e8d authored by Brian Isganitis's avatar Brian Isganitis Committed by Automerger Merge Worker
Browse files

Merge "Adding support for overriding long-press menu in Launcher" into sc-v2-dev am: bb6bb5bb

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15433782

Change-Id: I1df5db465f747ceb32c91b7952a122fc87fdae6d
parents 4ed4ca3e bb6bb5bb
Loading
Loading
Loading
Loading
+1 −25
Original line number Original line Diff line number Diff line
@@ -16,36 +16,12 @@


<com.android.launcher3.shortcuts.DeepShortcutView
<com.android.launcher3.shortcuts.DeepShortcutView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res-auto"
    android:layout_width="@dimen/bg_popup_item_width"
    android:layout_width="@dimen/bg_popup_item_width"
    android:layout_height="@dimen/bg_popup_item_height"
    android:layout_height="@dimen/bg_popup_item_height"
    android:elevation="@dimen/deep_shortcuts_elevation"
    android:elevation="@dimen/deep_shortcuts_elevation"
    android:background="@drawable/middle_item_primary"
    android:background="@drawable/middle_item_primary"
    android:theme="@style/PopupItem" >
    android:theme="@style/PopupItem" >


    <com.android.launcher3.BubbleTextView
    <include layout="@layout/system_shortcut_content" />
        style="@style/BaseIconUnBounded"
        android:id="@+id/bubble_text"
        android:background="?android:attr/selectableItemBackground"
        android:gravity="start|center_vertical"
        android:textAlignment="viewStart"
        android:paddingStart="@dimen/deep_shortcuts_text_padding_start"
        android:paddingEnd="@dimen/popup_padding_end"
        android:textSize="14sp"
        android:minLines="1"
        android:maxLines="2"
        android:ellipsize="end"
        android:textColor="?android:attr/textColorPrimary"
        launcher:iconDisplay="shortcut_popup"
        launcher:layoutHorizontal="true"
        android:focusable="false" />

    <View
        android:id="@+id/icon"
        android:layout_width="@dimen/system_shortcut_icon_size"
        android:layout_height="@dimen/system_shortcut_icon_size"
        android:layout_marginStart="@dimen/system_shortcut_margin_start"
        android:layout_gravity="start|center_vertical"
        android:backgroundTint="?android:attr/textColorPrimary"/>


</com.android.launcher3.shortcuts.DeepShortcutView>
</com.android.launcher3.shortcuts.DeepShortcutView>
+44 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2021 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<merge
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res-auto" >

    <com.android.launcher3.BubbleTextView
        style="@style/BaseIconUnBounded"
        android:id="@+id/bubble_text"
        android:background="?android:attr/selectableItemBackground"
        android:gravity="start|center_vertical"
        android:textAlignment="viewStart"
        android:paddingStart="@dimen/deep_shortcuts_text_padding_start"
        android:paddingEnd="@dimen/popup_padding_end"
        android:textSize="14sp"
        android:minLines="1"
        android:maxLines="2"
        android:ellipsize="end"
        android:textColor="?android:attr/textColorPrimary"
        launcher:iconDisplay="shortcut_popup"
        launcher:layoutHorizontal="true"
        android:focusable="false" />

    <View
        android:id="@+id/icon"
        android:layout_width="@dimen/system_shortcut_icon_size"
        android:layout_height="@dimen/system_shortcut_icon_size"
        android:layout_marginStart="@dimen/system_shortcut_margin_start"
        android:layout_gravity="start|center_vertical"
        android:backgroundTint="?android:attr/textColorPrimary"/>
</merge>
 No newline at end of file
+15 −1
Original line number Original line Diff line number Diff line
@@ -80,6 +80,7 @@ import android.content.res.Configuration;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Build;
import android.os.Build;
import android.os.Bundle;
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.CancellationSignal;
@@ -2870,13 +2871,26 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
                if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
                if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
                    Log.d(TestProtocol.PERMANENT_DIAG_TAG, "Opening options popup on key up");
                    Log.d(TestProtocol.PERMANENT_DIAG_TAG, "Opening options popup on key up");
                }
                }
                OptionsPopupView.showDefaultOptions(this, -1, -1);
                showDefaultOptions(-1, -1);
            }
            }
            return true;
            return true;
        }
        }
        return super.onKeyUp(keyCode, event);
        return super.onKeyUp(keyCode, event);
    }
    }


    /**
     * Shows the default options popup
     */
    public void showDefaultOptions(float x, float y) {
        float halfSize = getResources().getDimension(R.dimen.options_menu_thumb_size) / 2;
        if (x < 0 || y < 0) {
            x = mDragLayer.getWidth() / 2;
            y = mDragLayer.getHeight() / 2;
        }
        RectF target = new RectF(x - halfSize, y - halfSize, x + halfSize, y + halfSize);
        OptionsPopupView.show(this, target, OptionsPopupView.getOptions(this), false);
    }

    @Override
    @Override
    protected void collectStateHandlers(List<StateHandler> out) {
    protected void collectStateHandlers(List<StateHandler> out) {
        out.add(getAllAppsController());
        out.add(getAllAppsController());
+4 −0
Original line number Original line Diff line number Diff line
@@ -255,6 +255,10 @@ public final class FeatureFlags {
            "WIDGETS_IN_LAUNCHER_PREVIEW", true,
            "WIDGETS_IN_LAUNCHER_PREVIEW", true,
            "Enables widgets in Launcher preview for the Wallpaper app.");
            "Enables widgets in Launcher preview for the Wallpaper app.");


    public static final BooleanFlag QUICK_WALLPAPER_PICKER = getDebugFlag(
            "QUICK_WALLPAPER_PICKER", false,
            "Shows quick wallpaper picker in long-press menu");

    public static void initialize(Context context) {
    public static void initialize(Context context) {
        synchronized (sDebugFlags) {
        synchronized (sDebugFlags) {
            for (DebugFlag flag : sDebugFlags) {
            for (DebugFlag flag : sDebugFlags) {
+1 −2
Original line number Original line Diff line number Diff line
@@ -41,7 +41,6 @@ import com.android.launcher3.Workspace;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.views.OptionsPopupView;


/**
/**
 * Helper class to handle touch on empty space in workspace and show options popup on long press
 * Helper class to handle touch on empty space in workspace and show options popup on long press
@@ -175,7 +174,7 @@ public class WorkspaceTouchListener extends GestureDetector.SimpleOnGestureListe
                mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
                mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
                        HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
                        HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
                mLauncher.getStatsLogManager().logger().log(LAUNCHER_WORKSPACE_LONGPRESS);
                mLauncher.getStatsLogManager().logger().log(LAUNCHER_WORKSPACE_LONGPRESS);
                OptionsPopupView.showDefaultOptions(mLauncher, mTouchDownPoint.x, mTouchDownPoint.y);
                mLauncher.showDefaultOptions(mTouchDownPoint.x, mTouchDownPoint.y);
            } else {
            } else {
                cancelLongPress();
                cancelLongPress();
            }
            }
Loading