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

Commit 9af03389 authored by Charlie Anderson's avatar Charlie Anderson Committed by Android (Google) Code Review
Browse files

Merge "adding the new Material U App Shortcut Popup design" into tm-qpr-dev

parents 190992e6 8ad9144c
Loading
Loading
Loading
Loading
+24 −12
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.launcher3.taskbar;

import static com.android.launcher3.config.FeatureFlags.ENABLE_MATERIAL_U_POPUP;
import static com.android.launcher3.util.SplitConfigurationOptions.getLogEventForPosition;

import android.content.Intent;
@@ -56,6 +57,7 @@ import com.android.quickstep.util.LogUtils;

import java.io.PrintWriter;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@@ -152,9 +154,28 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
            return null;
        }

        final PopupContainerWithArrow<BaseTaskbarContext> container =
                (PopupContainerWithArrow<BaseTaskbarContext>) context.getLayoutInflater().inflate(
        PopupContainerWithArrow<BaseTaskbarContext> container;
        int deepShortcutCount = mPopupDataProvider.getShortcutCountForItem(item);
        // TODO(b/198438631): add support for INSTALL shortcut factory
        List<SystemShortcut> systemShortcuts = getSystemShortcuts()
                .map(s -> s.getShortcut(context, item, icon))
                .filter(Objects::nonNull)
                .collect(Collectors.toList());

        if (ENABLE_MATERIAL_U_POPUP.get()) {
            container = (PopupContainerWithArrow) context.getLayoutInflater().inflate(
                    R.layout.popup_container_material_u, context.getDragLayer(), false);
            container.populateAndShowRowsMaterialU(icon, deepShortcutCount, systemShortcuts);
        } else {
            container = (PopupContainerWithArrow) context.getLayoutInflater().inflate(
                    R.layout.popup_container, context.getDragLayer(), false);
            container.populateAndShow(
                    icon,
                    deepShortcutCount,
                    mPopupDataProvider.getNotificationKeysForItem(item),
                    systemShortcuts);
        }

        container.addOnAttachStateChangeListener(
                new PopupLiveUpdateHandler<BaseTaskbarContext>(context, container) {
                    @Override
@@ -165,15 +186,6 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
        // TODO (b/198438631): configure for taskbar/context
        container.setPopupItemDragHandler(new TaskbarPopupItemDragHandler());
        mControllers.taskbarDragController.addDragListener(container);

        container.populateAndShow(icon,
                mPopupDataProvider.getShortcutCountForItem(item),
                mPopupDataProvider.getNotificationKeysForItem(item),
                // TODO (b/198438631): add support for INSTALL shortcut factory
                getSystemShortcuts()
                        .map(s -> s.getShortcut(context, item, icon))
                        .filter(Objects::nonNull)
                        .collect(Collectors.toList()));
        container.requestFocus();

        // Make focusable to receive back events
+20 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="?attr/popupColorPrimary"/>
    <corners android:radius="@dimen/dialogCornerRadius"/>
</shape>
 No newline at end of file
+24 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/deep_shortcuts_container"
    android:background="@drawable/popup_background_material_u"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:tag="@string/popup_container_iterate_children"
    android:elevation="@dimen/deep_shortcuts_elevation"
    android:orientation="vertical"/>
 No newline at end of file
+50 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->
<com.android.launcher3.shortcuts.DeepShortcutView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res-auto"
    android:id="@+id/deep_shortcut_material"
    android:layout_width="@dimen/bg_popup_item_width"
    android:layout_height="@dimen/bg_popup_item_height"
    android:elevation="@dimen/deep_shortcuts_elevation"
    android:background="@drawable/middle_item_primary"
    android:theme="@style/PopupItem" >

    <com.android.launcher3.shortcuts.DeepShortcutTextView
        style="@style/BaseIcon"
        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:drawablePadding="@dimen/deep_shortcut_drawable_padding"
        android:singleLine="true"
        android:ellipsize="end"
        android:textSize="14sp"
        android:textColor="?android:attr/textColorPrimary"
        launcher:layoutHorizontal="true"
        launcher:iconDisplay="shortcut_popup"
        launcher:iconSizeOverride="@dimen/deep_shortcut_icon_size" />

    <View
        android:id="@+id/icon"
        android:layout_width="@dimen/deep_shortcut_icon_size"
        android:layout_height="@dimen/deep_shortcut_icon_size"
        android:layout_marginStart="@dimen/popup_padding_start"
        android:layout_gravity="start|center_vertical"
        android:background="@drawable/ic_deepshortcut_placeholder"/>
</com.android.launcher3.shortcuts.DeepShortcutView>
 No newline at end of file
+21 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->
<com.android.launcher3.popup.PopupContainerWithArrow
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/popup_container"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"/>
 No newline at end of file
Loading