aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/utils
diff options
context:
space:
mode:
authorsaqura <saqura@saqura.eu>2015-10-26 00:59:32 +0100
committersaqura <saqura@saqura.eu>2015-10-26 00:59:32 +0100
commit48f172fc9e9a464ee220afd2a82b719ec5b984e9 (patch)
tree4e10ee51019c71882f642284bf927bf29f2aa9dc /src/main/java/eu/siacs/conversations/utils
parent1f2b2c88344102f6f9161f3e4052a77d149a6b6d (diff)
Reset the margins manually after rotating
Diffstat (limited to 'src/main/java/eu/siacs/conversations/utils')
-rw-r--r--src/main/java/eu/siacs/conversations/utils/UIHelper.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/utils/UIHelper.java b/src/main/java/eu/siacs/conversations/utils/UIHelper.java
index cac23f07..8a73d35f 100644
--- a/src/main/java/eu/siacs/conversations/utils/UIHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/UIHelper.java
@@ -3,7 +3,11 @@ package eu.siacs.conversations.utils;
import android.content.Context;
import android.text.format.DateFormat;
import android.text.format.DateUtils;
+import android.util.DisplayMetrics;
import android.util.Pair;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
import java.util.ArrayList;
import java.util.Arrays;
@@ -261,4 +265,21 @@ public class UIHelper {
body = body.replace("?","").replace("¿","");
return LOCATION_QUESTIONS.contains(body);
}
+
+ public static void resetChildMargins(LinearLayout view) {
+ int childCount = view.getChildCount();
+ for (int i = 0; i < childCount; i++) {
+ UIHelper.resetMargins(view.getChildAt(i));
+ }
+ }
+
+ private static void resetMargins(View view) {
+ LinearLayout.MarginLayoutParams marginLayoutParams = new LinearLayout.MarginLayoutParams(view.getLayoutParams());
+ marginLayoutParams.setMargins(view.getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin),
+ view.getResources().getDimensionPixelSize(R.dimen.activity_vertical_margin),
+ view.getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin),
+ view.getResources().getDimensionPixelSize(R.dimen.activity_vertical_margin));
+ LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(marginLayoutParams);
+ view.setLayoutParams(layoutParams);
+ }
}