mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 03:08:19 +00:00
Account for disparity btw folder preview size and drawable size
-> When there is disparity between the cached icon size and the available space in the preview, the folder preview could appear not as intended (either overly crammed, or overly spacious) issue 27701193 Change-Id: I9f97012ba569d1419b1e3f661cd26761b2a36285
This commit is contained in:
@@ -23,6 +23,7 @@ public class ClippedFolderIconLayoutRule implements FolderIcon.PreviewLayoutRule
|
||||
private float mRadius;
|
||||
private float mIconSize;
|
||||
private boolean mIsRtl;
|
||||
private float mBaselineIconScale;
|
||||
|
||||
@Override
|
||||
public void init(int availableSpace, int intrinsicIconSize, boolean rtl) {
|
||||
@@ -30,6 +31,7 @@ public class ClippedFolderIconLayoutRule implements FolderIcon.PreviewLayoutRule
|
||||
mRadius = ITEM_RADIUS_SCALE_FACTOR * availableSpace / 2f;
|
||||
mIconSize = intrinsicIconSize;
|
||||
mIsRtl = rtl;
|
||||
mBaselineIconScale = availableSpace / (intrinsicIconSize * 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -103,13 +105,16 @@ public class ClippedFolderIconLayoutRule implements FolderIcon.PreviewLayoutRule
|
||||
}
|
||||
|
||||
private float scaleForNumItems(int numItems) {
|
||||
float scale = 1f;
|
||||
if (numItems <= 2) {
|
||||
return MAX_SCALE;
|
||||
scale = MAX_SCALE;
|
||||
} else if (numItems == 3) {
|
||||
return (MAX_SCALE + MIN_SCALE) / 2;
|
||||
scale = (MAX_SCALE + MIN_SCALE) / 2;
|
||||
} else {
|
||||
return MIN_SCALE;
|
||||
scale = MIN_SCALE;
|
||||
}
|
||||
|
||||
return scale * mBaselineIconScale;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user