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

Commit 87805cd9 authored by Samuel Fufa's avatar Samuel Fufa Committed by Android (Google) Code Review
Browse files

Merge "Introduce support for Hero app Section" into ub-launcher3-master

parents 4ade3fd5 4a53c70c
Loading
Loading
Loading
Loading
+74 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->
<com.android.launcher3.views.HeroSearchResultView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:gravity="center_vertical"
    android:padding="@dimen/dynamic_grid_edge_margin">

    <FrameLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_gravity="center_vertical"
        android:layout_weight="1">
        <com.android.launcher3.BubbleTextView
            android:id="@+id/bubble_text"
            style="@style/BaseIcon"
            android:drawablePadding="@dimen/dynamic_grid_icon_drawable_padding"
            android:gravity="start|center_vertical"
            android:textAlignment="viewStart"
            android:textColor="?android:attr/textColorPrimary"
            android:textSize="16sp"
            android:layout_height="wrap_content"
            launcher:iconDisplay="hero_app"
            launcher:layoutHorizontal="true"/>

        <View
            android:id="@+id/icon"
            android:layout_width="@dimen/deep_shortcut_icon_size"
            android:layout_height="@dimen/deep_shortcut_icon_size"
            android:layout_gravity="start|center_vertical"
            android:background="@drawable/ic_deepshortcut_placeholder"/>
    </FrameLayout>

    <com.android.launcher3.BubbleTextView
        android:id="@+id/shortcut_0"
        style="@style/BaseIcon"
        android:layout_width="@dimen/deep_shortcut_icon_size"
        android:layout_height="match_parent"
        android:gravity="start|center_vertical"
        android:textAlignment="center"
        launcher:iconDisplay="shortcut_popup"
        android:textSize="12sp"
        launcher:iconSizeOverride="@dimen/deep_shortcut_icon_size"
        launcher:layoutHorizontal="false"/>

    <com.android.launcher3.BubbleTextView
        android:id="@+id/shortcut_1"
        style="@style/BaseIcon"
        android:layout_width="@dimen/deep_shortcut_icon_size"
        android:layout_height="match_parent"
        android:gravity="start|center_vertical"
        android:textAlignment="center"
        launcher:iconDisplay="shortcut_popup"
        android:textSize="12sp"
        launcher:iconSizeOverride="@dimen/deep_shortcut_icon_size"
        launcher:layoutHorizontal="false"/>

</com.android.launcher3.views.HeroSearchResultView>
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@
            <enum name="folder" value="2" />
            <enum name="widget_section" value="3" />
            <enum name="shortcut_popup" value="4" />
            <enum name="hero_app" value="5" />
        </attr>
        <attr name="centerVertically" format="boolean" />
    </declare-styleable>
+0 −2
Original line number Diff line number Diff line
@@ -35,8 +35,6 @@

    <color name="icon_background">#E0E0E0</color> <!-- Gray 300 -->

    <color name="all_apps_bg_hand_fill">#E5E5E5</color>
    <color name="all_apps_bg_hand_fill_dark">#9AA0A6</color>
    <color name="all_apps_section_fill">#327d7d7d</color>

    <color name="gesture_tutorial_ripple_color">#A0C2F9</color> <!-- Light Blue -->
+3 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
    private static final int DISPLAY_WORKSPACE = 0;
    private static final int DISPLAY_ALL_APPS = 1;
    private static final int DISPLAY_FOLDER = 2;
    private static final int DISPLAY_HERO_APP = 5;

    private static final int[] STATE_PRESSED = new int[] {android.R.attr.state_pressed};

@@ -178,6 +179,8 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
            setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.folderChildTextSizePx);
            setCompoundDrawablePadding(grid.folderChildDrawablePaddingPx);
            defaultIconSize = grid.folderChildIconSizePx;
        } else if (mDisplay == DISPLAY_HERO_APP) {
            defaultIconSize = grid.allAppsIconSizePx;
        } else {
            // widget_selection or shortcut_popup
            defaultIconSize = grid.iconSizePx;
+15 −1
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import com.android.launcher3.R;
import com.android.launcher3.allapps.AlphabeticalAppsList.AdapterItem;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.util.PackageManagerHelper;
import com.android.launcher3.views.HeroSearchResultView;

import java.util.List;

@@ -68,6 +69,8 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.

    public static final int VIEW_TYPE_SEARCH_CORPUS_TITLE = 1 << 5;

    public static final int VIEW_TYPE_SEARCH_HERO_APP = 1 << 6;

    // Common view type masks
    public static final int VIEW_TYPE_MASK_DIVIDER = VIEW_TYPE_ALL_APPS_DIVIDER;
    public static final int VIEW_TYPE_MASK_ICON = VIEW_TYPE_ICON;
@@ -279,6 +282,10 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
            case VIEW_TYPE_SEARCH_CORPUS_TITLE:
                return new ViewHolder(
                        mLayoutInflater.inflate(R.layout.search_section_title, parent, false));

            case VIEW_TYPE_SEARCH_HERO_APP:
                return new ViewHolder(mLayoutInflater.inflate(
                        R.layout.search_result_hero_app, parent, false));
            default:
                throw new RuntimeException("Unexpected view type");
        }
@@ -311,6 +318,13 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
                TextView titleView = (TextView) holder.itemView;
                titleView.setText(mApps.getAdapterItems().get(position).searchSectionInfo.getTitle(
                        titleView.getContext()));
                break;
            case VIEW_TYPE_SEARCH_HERO_APP:
                HeroSearchResultView heroView = (HeroSearchResultView) holder.itemView;
                heroView.prepareUsingAdapterItem(
                        (AlphabeticalAppsList.HeroAppAdapterItem) mApps.getAdapterItems().get(
                                position));
                break;
            case VIEW_TYPE_ALL_APPS_DIVIDER:
                // nothing to do
                break;
Loading