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

Commit 6f22413c authored by PETER LIANG's avatar PETER LIANG Committed by Android (Google) Code Review
Browse files

Merge changes from topic "edit_menu_v2" into rvc-dev

* changes:
  Update the edit shortcut menu (4/n).
  Update the edit shortcut menu (3/n).
  Update the edit shortcut menu (2/n).
parents 02ee003a baf4f053
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -28,8 +28,6 @@ public final class ShortcutConstants {
    private ShortcutConstants() {}

    public static final char SERVICES_SEPARATOR = ':';
    public static final float DISABLED_ALPHA = 0.5f;
    public static final float ENABLED_ALPHA = 1.0f;

    /**
     * Annotation for different user shortcut type UI type.
@@ -79,6 +77,21 @@ public final class ShortcutConstants {
        int BOUNCE = 3;
    }

    /**
     * Annotation for different shortcut target.
     */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({
            TargetType.ACCESSIBILITY_SERVICE,
            TargetType.ACCESSIBILITY_ACTIVITY,
            TargetType.WHITE_LISTING,
    })
    public @interface TargetType {
        int ACCESSIBILITY_SERVICE = 0;
        int ACCESSIBILITY_ACTIVITY = 1;
        int WHITE_LISTING = 2;
    }

    /**
     * Annotation for different shortcut menu mode.
     *
+27 −0
Original line number Diff line number Diff line
@@ -38,6 +38,33 @@ public final class ShortcutUtils {
    private static final TextUtils.SimpleStringSplitter sStringColonSplitter =
            new TextUtils.SimpleStringSplitter(SERVICES_SEPARATOR);

    /**
     * Opts in component name into colon-separated {@link UserShortcutType}
     * key's string in Settings.
     *
     * @param context The current context.
     * @param shortcutType The preferred shortcut type user selected.
     * @param componentId The component id that need to be opted out from Settings.
     */
    public static void optInValueToSettings(Context context, @UserShortcutType int shortcutType,
            String componentId) {
        final StringJoiner joiner = new StringJoiner(String.valueOf(SERVICES_SEPARATOR));
        final String targetKey = convertToKey(shortcutType);
        final String targetString = Settings.Secure.getString(context.getContentResolver(),
                targetKey);

        if (hasValueInSettings(context, shortcutType, componentId)) {
            return;
        }

        if (!TextUtils.isEmpty(targetString)) {
            joiner.add(targetString);
        }
        joiner.add(componentId);

        Settings.Secure.putString(context.getContentResolver(), targetKey, joiner.toString());
    }

    /**
     * Opts out component name into colon-separated {@code shortcutType} key's string in Settings.
     *
+243 −135

File changed.

Preview size limit exceeded, changes collapsed.

+26 −0
Original line number Diff line number Diff line
<!--
    Copyright (C) 2020 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.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24"
    android:tint="?attr/colorControlNormal">
  <path
      android:pathData="M23,5.5V20c0,2.2 -1.8,4 -4,4h-7.3c-1.08,0 -2.1,-0.43 -2.85,-1.19L1,14.83c0,0 1.26,-1.23 1.3,-1.25c0.22,-0.19 0.49,-0.29 0.79,-0.29c0.22,0 0.42,0.06 0.6,0.16C3.73,13.46 8,15.91 8,15.91V4c0,-0.83 0.67,-1.5 1.5,-1.5S11,3.17 11,4v7h1V1.5C12,0.67 12.67,0 13.5,0S15,0.67 15,1.5V11h1V2.5C16,1.67 16.67,1 17.5,1S19,1.67 19,2.5V11h1V5.5C20,4.67 20.67,4 21.5,4S23,4.67 23,5.5z"
      android:fillColor="#FFFFFF"/>
</vector>
+2 −2
Original line number Diff line number Diff line
@@ -21,6 +21,6 @@
    android:viewportHeight="24"
    android:tint="?attr/colorControlNormal">
  <path
      android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"
      android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"
      android:fillColor="#FFFFFF"/>
</vector>
Loading