mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Merge "Fix big icon when dragging Toast by isolating the previous QL fix display to SEARCH_RESULT_APP_ROW" into udc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
28ae77df37
@@ -16,8 +16,6 @@
|
||||
|
||||
package com.android.launcher3.appprediction;
|
||||
|
||||
import static com.android.launcher3.BubbleTextView.DISPLAY_PREDICTION_ROW;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
@@ -189,7 +187,7 @@ public class PredictionRowView<T extends Context & ActivityContext>
|
||||
LayoutInflater inflater = mActivityContext.getAppsView().getLayoutInflater();
|
||||
while (getChildCount() < mNumPredictedAppsPerRow) {
|
||||
BubbleTextView icon = (BubbleTextView) inflater.inflate(
|
||||
R.layout.all_apps_icon, this, false);
|
||||
R.layout.all_apps_prediction_row_icon, this, false);
|
||||
icon.setOnClickListener(mActivityContext.getItemOnClickListener());
|
||||
icon.setOnLongClickListener(mActivityContext.getAllAppsItemLongClickListener());
|
||||
icon.setLongPressTimeoutFactor(1f);
|
||||
@@ -211,7 +209,6 @@ public class PredictionRowView<T extends Context & ActivityContext>
|
||||
icon.reset();
|
||||
if (predictionCount > i) {
|
||||
icon.setVisibility(View.VISIBLE);
|
||||
icon.setDisplay(DISPLAY_PREDICTION_ROW);
|
||||
icon.applyFromWorkspaceItem(mPredictedApps.get(i));
|
||||
} else {
|
||||
icon.setVisibility(predictionCount == 0 ? GONE : INVISIBLE);
|
||||
|
||||
20
res/layout/all_apps_prediction_row_icon.xml
Normal file
20
res/layout/all_apps_prediction_row_icon.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?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.BubbleTextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:launcher="http://schemas.android.com/apk/res-auto"
|
||||
style="@style/BaseIcon.AllApps"
|
||||
android:id="@+id/icon"
|
||||
launcher:iconDisplay="prediction_row"
|
||||
launcher:centerVertically="true" />
|
||||
@@ -86,6 +86,7 @@
|
||||
<enum name="search_result_tall" value="6" />
|
||||
<enum name="search_result_small" value="7" />
|
||||
<enum name="prediction_row" value="8" />
|
||||
<enum name="search_result_app_row" value="9" />
|
||||
</attr>
|
||||
<attr name="centerVertically" format="boolean" />
|
||||
</declare-styleable>
|
||||
|
||||
@@ -99,8 +99,9 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
private static final int DISPLAY_FOLDER = 2;
|
||||
protected static final int DISPLAY_TASKBAR = 5;
|
||||
public static final int DISPLAY_SEARCH_RESULT = 6;
|
||||
private static final int DISPLAY_SEARCH_RESULT_SMALL = 7;
|
||||
public static final int DISPLAY_SEARCH_RESULT_SMALL = 7;
|
||||
public static final int DISPLAY_PREDICTION_ROW = 8;
|
||||
public static final int DISPLAY_SEARCH_RESULT_APP_ROW = 9;
|
||||
|
||||
private static final float MIN_LETTER_SPACING = -0.05f;
|
||||
private static final int MAX_SEARCH_LOOP_COUNT = 20;
|
||||
@@ -214,7 +215,8 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
setCompoundDrawablePadding(grid.iconDrawablePaddingPx);
|
||||
defaultIconSize = grid.iconSizePx;
|
||||
setCenterVertically(grid.iconCenterVertically);
|
||||
} else if (mDisplay == DISPLAY_ALL_APPS || mDisplay == DISPLAY_PREDICTION_ROW) {
|
||||
} else if (mDisplay == DISPLAY_ALL_APPS || mDisplay == DISPLAY_PREDICTION_ROW
|
||||
|| mDisplay == DISPLAY_SEARCH_RESULT_APP_ROW) {
|
||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.allAppsIconTextSizePx);
|
||||
setCompoundDrawablePadding(grid.allAppsIconDrawablePaddingPx);
|
||||
defaultIconSize = grid.allAppsIconSizePx;
|
||||
@@ -1104,8 +1106,13 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
|
||||
}
|
||||
|
||||
public boolean isDisplaySearchResult() {
|
||||
return mDisplay == DISPLAY_SEARCH_RESULT ||
|
||||
mDisplay == DISPLAY_SEARCH_RESULT_SMALL;
|
||||
return mDisplay == DISPLAY_SEARCH_RESULT
|
||||
|| mDisplay == DISPLAY_SEARCH_RESULT_SMALL
|
||||
|| mDisplay == DISPLAY_SEARCH_RESULT_APP_ROW;
|
||||
}
|
||||
|
||||
public int getIconDisplay() {
|
||||
return mDisplay;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.launcher3.graphics;
|
||||
|
||||
import static com.android.launcher3.BubbleTextView.DISPLAY_SEARCH_RESULT_APP_ROW;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
@@ -100,7 +102,8 @@ public class DragPreviewProvider {
|
||||
height = mView.getHeight();
|
||||
}
|
||||
|
||||
if (mView instanceof BubbleTextView) {
|
||||
if (mView instanceof BubbleTextView btv
|
||||
&& btv.getIconDisplay() == DISPLAY_SEARCH_RESULT_APP_ROW) {
|
||||
FastBitmapDrawable icon = ((BubbleTextView) mView).getIcon();
|
||||
Drawable drawable = icon.getConstantState().newDrawable();
|
||||
float xInset = (float) blurSizeOutline / (float) (width + blurSizeOutline);
|
||||
|
||||
Reference in New Issue
Block a user