mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 10:48:19 +00:00
Adding an upper bound to all-apps width on larger devices
Change-Id: I16a0d8fb7c5023045d0a6b9e8089e0ab6a476d6d
This commit is contained in:
@@ -594,4 +594,19 @@ public class DeviceProfile {
|
||||
? Math.min(widthPx, heightPx)
|
||||
: Math.max(widthPx, heightPx);
|
||||
}
|
||||
|
||||
|
||||
public static final int getMaxContainerWidth(Context context, int availableWidth) {
|
||||
Resources res = context.getResources();
|
||||
|
||||
int maxSize = res.getDimensionPixelSize(R.dimen.container_max_width);
|
||||
int minMargin = res.getDimensionPixelSize(R.dimen.container_min_margin);
|
||||
|
||||
if (maxSize > 0) {
|
||||
return Math.max(minMargin, (availableWidth - maxSize) / 2);
|
||||
} else {
|
||||
return Math.max(minMargin,
|
||||
(int) res.getFraction(R.fraction.container_margin, availableWidth, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user