aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-12-15 21:32:16 +0100
committerChristian Schneppe <christian@pix-art.de>2018-12-15 21:32:16 +0100
commit75df2041c935e09a28810dc5b26ae7c22cf9f9c0 (patch)
tree73c7a2119fedb67d1d1da78b0efc58303e058bee /src/main/java/de/pixart/messenger
parent3449f7ccf9303f7ea9feae48733fa2f80e4ee0d8 (diff)
set min Columns in GridManager to 1
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r--src/main/java/de/pixart/messenger/ui/util/GridManager.java5
1 files changed, 4 insertions, 1 deletions
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);