Merge "Allow icons to take up full width in all cases where width > height." into tm-dev

This commit is contained in:
TreeHugger Robot
2022-03-08 19:08:59 +00:00
committed by Android (Google) Code Review
3 changed files with 19 additions and 22 deletions

View File

@@ -43,6 +43,7 @@ import androidx.annotation.UiThread;
import androidx.annotation.WorkerThread;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.InsettableFrameLayout;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
@@ -82,7 +83,6 @@ public class FloatingIconView extends FrameLayout implements
private final Launcher mLauncher;
private final boolean mIsRtl;
private boolean mIsVerticalBarLayout = false;
private boolean mIsOpening;
private IconLoadResult mIconLoadResult;
@@ -150,7 +150,7 @@ public class FloatingIconView extends FrameLayout implements
float shapeProgressStart, float cornerRadius, boolean isOpening) {
setAlpha(alpha);
mClipIconView.update(rect, progress, shapeProgressStart, cornerRadius, fgIconAlpha,
isOpening, this, mLauncher.getDeviceProfile(), mIsVerticalBarLayout);
isOpening, this, mLauncher.getDeviceProfile());
}
@Override
@@ -320,11 +320,11 @@ public class FloatingIconView extends FrameLayout implements
@UiThread
private void setIcon(@Nullable Drawable drawable, @Nullable Drawable badge,
@Nullable Drawable btvIcon, int iconOffset) {
final DeviceProfile dp = mLauncher.getDeviceProfile();
final InsettableFrameLayout.LayoutParams lp =
(InsettableFrameLayout.LayoutParams) getLayoutParams();
mBadge = badge;
mClipIconView.setIcon(drawable, iconOffset, lp, mIsOpening, mIsVerticalBarLayout,
mLauncher.getDeviceProfile());
mClipIconView.setIcon(drawable, iconOffset, lp, mIsOpening, dp);
if (drawable instanceof AdaptiveIconDrawable) {
final int originalHeight = lp.height;
final int originalWidth = lp.width;
@@ -332,7 +332,7 @@ public class FloatingIconView extends FrameLayout implements
mFinalDrawableBounds.set(0, 0, originalWidth, originalHeight);
float aspectRatio = mLauncher.getDeviceProfile().aspectRatio;
if (mIsVerticalBarLayout) {
if (dp.isLandscape) {
lp.width = (int) Math.max(lp.width, lp.height * aspectRatio);
} else {
lp.height = (int) Math.max(lp.height, lp.width * aspectRatio);
@@ -565,7 +565,6 @@ public class FloatingIconView extends FrameLayout implements
view.recycle();
// Init properties before getting the drawable.
view.mIsVerticalBarLayout = launcher.getDeviceProfile().isVerticalBarLayout();
view.mIsOpening = isOpening;
view.mOriginalIcon = originalView;
view.mPositionOut = positionOut;