From 75df2041c935e09a28810dc5b26ae7c22cf9f9c0 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sat, 15 Dec 2018 21:32:16 +0100 Subject: set min Columns in GridManager to 1 --- src/main/java/de/pixart/messenger/ui/util/GridManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/main/java/de/pixart') diff --git a/src/main/java/de/pixart/messenger/ui/util/GridManager.java b/src/main/java/de/pixart/messenger/ui/util/GridManager.java index ae615b051..0b445f3ec 100644 --- a/src/main/java/de/pixart/messenger/ui/util/GridManager.java +++ b/src/main/java/de/pixart/messenger/ui/util/GridManager.java @@ -48,7 +48,10 @@ public class GridManager { private static ColumnInfo calculateColumnCount(Context context, int availableWidth, @DimenRes int desiredSize) { final float desiredWidth = context.getResources().getDimension(desiredSize); - final int columns = Math.round(availableWidth / desiredWidth); + int columns = Math.round(availableWidth / desiredWidth); + if (columns < 1) { + columns = 1; + } final int realWidth = availableWidth / columns; Log.d(Config.LOGTAG, "desired=" + desiredWidth + " real=" + realWidth); return new ColumnInfo(columns, realWidth); -- cgit v1.2.3