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

Commit e8bea3ea authored by Samuel Fufa's avatar Samuel Fufa
Browse files

Allow search results decoration [part 2/3]

[Video attached to bug report]

Bug: 162480567
Test: Manual
Change-Id: Iff285abde5b2a3f3f3a63e7318020cfe7572af49
parent ab98166c
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
/**
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -42,6 +42,7 @@ import com.android.launcher3.R;
import com.android.launcher3.allapps.FloatingHeaderRow;
import com.android.launcher3.allapps.FloatingHeaderView;
import com.android.launcher3.anim.PropertySetter;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.statemanager.StateManager.StateListener;
import com.android.launcher3.util.Themes;

@@ -90,7 +91,8 @@ public class AppsDividerView extends View implements StateListener<LauncherState
        mLauncher = Launcher.getLauncher(context);

        boolean isMainColorDark = Themes.getAttrBoolean(context, R.attr.isMainColorDark);
        mPaint.setStrokeWidth(getResources().getDimensionPixelSize(R.dimen.all_apps_divider_height));
        mPaint.setStrokeWidth(
                getResources().getDimensionPixelSize(R.dimen.all_apps_divider_height));

        mStrokeColor = ContextCompat.getColor(context, isMainColorDark
                ? R.color.all_apps_prediction_row_separator_dark
@@ -181,6 +183,11 @@ public class AppsDividerView extends View implements StateListener<LauncherState
    }

    private void updateViewVisibility() {
        // hide divider since we have item decoration for prediction row
        if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
            setVisibility(GONE);
            return;
        }
        setVisibility(mDividerType == DividerType.NONE
                ? GONE
                : (mIsScrolledOut ? INVISIBLE : VISIBLE));
+17 −0
Original line number Diff line number Diff line
@@ -45,10 +45,12 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.allapps.AllAppsSectionDecorator;
import com.android.launcher3.allapps.FloatingHeaderRow;
import com.android.launcher3.allapps.FloatingHeaderView;
import com.android.launcher3.anim.AlphaUpdateListener;
import com.android.launcher3.anim.PropertySetter;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.keyboard.FocusIndicatorHelper;
import com.android.launcher3.keyboard.FocusIndicatorHelper.SimpleFocusIndicatorHelper;
import com.android.launcher3.logging.StatsLogUtils.LogContainerProvider;
@@ -110,6 +112,8 @@ public class PredictionRowView extends LinearLayout implements

    private boolean mPredictionsEnabled = false;

    AllAppsSectionDecorator.SectionDecorationHandler mDecorationHandler;

    public PredictionRowView(@NonNull Context context) {
        this(context, null);
    }
@@ -128,6 +132,11 @@ public class PredictionRowView extends LinearLayout implements
        mIconFullTextAlpha = Color.alpha(mIconTextColor);
        mIconCurrentTextAlpha = mIconFullTextAlpha;

        if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
            mDecorationHandler = new AllAppsSectionDecorator.SectionDecorationHandler(getContext(),
                    false);
        }

        updateVisibility();
    }

@@ -153,6 +162,14 @@ public class PredictionRowView extends LinearLayout implements

    @Override
    protected void dispatchDraw(Canvas canvas) {
        if (mDecorationHandler != null) {
            mDecorationHandler.reset();
            int childrenCount = getChildCount();
            for (int i = 0; i < childrenCount; i++) {
                mDecorationHandler.extendBounds(getChildAt(i));
            }
            mDecorationHandler.onDraw(canvas);
        }
        mFocusHelper.draw(canvas);
        super.dispatchDraw(canvas);
    }
+1 −3
Original line number Diff line number Diff line
@@ -19,7 +19,5 @@
          android:fontFamily="@style/TextHeadline"
          android:layout_width="wrap_content"
          android:textColor="?android:attr/textColorPrimary"
          android:layout_marginLeft="16dp"
          android:layout_marginRight="16dp"
          android:paddingTop="8dp"
          android:padding="4dp"
          android:layout_height="wrap_content"/>
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
@@ -35,6 +35,10 @@

    <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 -->
    <color name="gesture_tutorial_fake_task_view_color">#6DA1FF</color> <!-- Light Blue -->
    <color name="gesture_tutorial_action_button_label_color">#FFFFFFFF</color>
+9 −1
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ import com.android.launcher3.Insettable;
import com.android.launcher3.InsettableFrameLayout;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.keyboard.FocusedItemDecorator;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
@@ -538,6 +539,10 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
        int padding = mHeader.getMaxTranslation();
        for (int i = 0; i < mAH.length; i++) {
            mAH[i].padding.top = padding;
            if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && mUsingTabs) {
                //add extra space between tabs and recycler view
                mAH[i].padding.top += mLauncher.getDeviceProfile().edgeMarginPx;
            }
            mAH[i].applyPadding();
        }
    }
@@ -652,6 +657,9 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
            applyVerticalFadingEdgeEnabled(verticalFadingEdge);
            applyPadding();
            setupOverlay();
            if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
                recyclerView.addItemDecoration(new AllAppsSectionDecorator(getApps()));
            }
        }

        void setupOverlay() {
Loading