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

Commit 6847c9f1 authored by fbaron's avatar fbaron
Browse files

Add entry point for home gardening

Bug: 277817921
Test: Turn on flag MULTI_SELECT_EDIT_MODE and verify that a new button shows up that says "Edit Home Screen"
Change-Id: Ic8027ab80604faf5bdc63a44319ecffc047a495c
parent f8e0e727
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
<!--
Copyright (C) 2023 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="?android:attr/textColorPrimary">
    <path
        android:fillColor="@android:color/white"
        android:pathData="M5,19H6.4L16.45,8.975L15.75,8.25L15.025,7.55L5,17.6ZM3,21V16.75L16.45,3.325Q17.025,2.75 17.863,2.75Q18.7,2.75 19.275,3.325L20.675,4.75Q21.25,5.325 21.25,6.15Q21.25,6.975 20.675,7.55L7.25,21ZM19.25,6.15 L17.85,4.75ZM16.45,8.975 L15.75,8.25 15.025,7.55 16.45,8.975Z"/>
</vector>
+2 −0
Original line number Diff line number Diff line
@@ -250,6 +250,8 @@
    <string name="wallpaper_button_text">Wallpapers</string>
    <!-- Text for wallpaper change button [CHAR LIMIT=30]-->
    <string name="styles_wallpaper_button_text">Wallpaper &amp; style</string>
    <!-- Text for edit home screen button [CHAR LIMIT=30]-->
    <string name="edit_home_screen">Edit Home Screen</string>
    <!-- Text for settings button [CHAR LIMIT=20]-->
    <string name="settings_button_text">Home settings</string>
    <!-- Message shown when a feature is disabled by the administrator -->
+12 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.launcher3.views;
import static androidx.core.content.ContextCompat.getColorStateList;

import static com.android.launcher3.config.FeatureFlags.ENABLE_MATERIAL_U_POPUP;
import static com.android.launcher3.config.FeatureFlags.MULTI_SELECT_EDIT_MODE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SETTINGS_BUTTON_TAP_OR_LONGPRESS;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGETSTRAY_BUTTON_TAP_OR_LONGPRESS;
@@ -205,6 +206,13 @@ public class OptionsPopupView extends ArrowPopup<Launcher>
                    LAUNCHER_WIDGETSTRAY_BUTTON_TAP_OR_LONGPRESS,
                    OptionsPopupView::onWidgetsClicked));
        }
        if (MULTI_SELECT_EDIT_MODE.get()) {
            options.add(new OptionItem(launcher,
                    R.string.edit_home_screen,
                    R.drawable.enter_home_gardening_icon,
                    LAUNCHER_SETTINGS_BUTTON_TAP_OR_LONGPRESS,
                    OptionsPopupView::enterHomeGardening));
        }
        options.add(new OptionItem(launcher,
                R.string.settings_button_text,
                R.drawable.ic_setting,
@@ -213,6 +221,10 @@ public class OptionsPopupView extends ArrowPopup<Launcher>
        return options;
    }

    private static boolean enterHomeGardening(View view) {
        return true;
    }

    private static boolean onWidgetsClicked(View view) {
        return openWidgets(Launcher.getLauncher(view.getContext())) != null;
    }