From cd4fb6fb6400c00f09718f1b731df196c6d123aa Mon Sep 17 00:00:00 2001
From: akwizgran <akwizgran@users.sourceforge.net>
Date: Mon, 10 Mar 2014 18:47:08 +0000
Subject: [PATCH] Padding on checkboxes is broken on Android < 4.2.

---
 .../briarproject/android/SettingsActivity.java  | 11 ++++++++---
 .../android/util/FixedHorizontalSpace.java      | 17 -----------------
 .../android/util/FixedVerticalSpace.java        |  9 ++++++---
 3 files changed, 14 insertions(+), 23 deletions(-)
 delete mode 100644 briar-android/src/org/briarproject/android/util/FixedHorizontalSpace.java

diff --git a/briar-android/src/org/briarproject/android/SettingsActivity.java b/briar-android/src/org/briarproject/android/SettingsActivity.java
index e64d901c94..68f9594aa2 100644
--- a/briar-android/src/org/briarproject/android/SettingsActivity.java
+++ b/briar-android/src/org/briarproject/android/SettingsActivity.java
@@ -15,6 +15,7 @@ import java.util.logging.Logger;
 import javax.inject.Inject;
 
 import org.briarproject.R;
+import org.briarproject.android.util.FixedVerticalSpace;
 import org.briarproject.android.util.HorizontalBorder;
 import org.briarproject.android.util.LayoutUtils;
 import org.briarproject.android.util.ListLoadingProgressBar;
@@ -109,33 +110,37 @@ OnClickListener {
 		underline.setBackgroundColor(titleUnderline);
 		settings.addView(underline);
 
+		settings.addView(new FixedVerticalSpace(this));
+
 		notifyPrivateMessages = new CheckBox(this);
-		notifyPrivateMessages.setPadding(0, pad, 0, pad);
 		notifyPrivateMessages.setTextSize(18);
 		notifyPrivateMessages.setText(R.string.notify_private_messages_setting);
 		notifyPrivateMessages.setChecked(true);
 		notifyPrivateMessages.setOnClickListener(this);
 		settings.addView(notifyPrivateMessages);
 
+		settings.addView(new FixedVerticalSpace(this));
 		settings.addView(new HorizontalBorder(this));
+		settings.addView(new FixedVerticalSpace(this));
 
 		notifyGroupPosts = new CheckBox(this);
-		notifyGroupPosts.setPadding(0, pad, 0, pad);
 		notifyGroupPosts.setTextSize(18);
 		notifyGroupPosts.setText(R.string.notify_group_posts_setting);
 		notifyGroupPosts.setChecked(true);
 		notifyGroupPosts.setOnClickListener(this);
 		settings.addView(notifyGroupPosts);
 
+		settings.addView(new FixedVerticalSpace(this));
 		settings.addView(new HorizontalBorder(this));
+		settings.addView(new FixedVerticalSpace(this));
 
 		notifyVibration = new CheckBox(this);
-		notifyVibration.setPadding(0, pad, 0, pad);
 		notifyVibration.setTextSize(18);
 		notifyVibration.setText(R.string.notify_vibration_setting);
 		notifyVibration.setOnClickListener(this);
 		settings.addView(notifyVibration);
 
+		settings.addView(new FixedVerticalSpace(this));
 		settings.addView(new HorizontalBorder(this));
 
 		notifySound = new TextView(this);
diff --git a/briar-android/src/org/briarproject/android/util/FixedHorizontalSpace.java b/briar-android/src/org/briarproject/android/util/FixedHorizontalSpace.java
deleted file mode 100644
index 45810af1bb..0000000000
--- a/briar-android/src/org/briarproject/android/util/FixedHorizontalSpace.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.briarproject.android.util;
-
-import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
-import android.content.Context;
-import android.view.View;
-import android.view.ViewGroup.LayoutParams;
-
-public class FixedHorizontalSpace extends View {
-
-	public FixedHorizontalSpace(Context ctx) {
-		super(ctx);
-	}
-
-	public void setWidth(int width) {
-		setLayoutParams(new LayoutParams(width, WRAP_CONTENT));
-	}
-}
diff --git a/briar-android/src/org/briarproject/android/util/FixedVerticalSpace.java b/briar-android/src/org/briarproject/android/util/FixedVerticalSpace.java
index 2ef076fda9..acd6b7e624 100644
--- a/briar-android/src/org/briarproject/android/util/FixedVerticalSpace.java
+++ b/briar-android/src/org/briarproject/android/util/FixedVerticalSpace.java
@@ -1,6 +1,6 @@
 package org.briarproject.android.util;
 
-import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
+import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
 import android.content.Context;
 import android.view.View;
 import android.view.ViewGroup.LayoutParams;
@@ -9,7 +9,10 @@ public class FixedVerticalSpace extends View {
 
 	public FixedVerticalSpace(Context ctx) {
 		super(ctx);
-		int height = LayoutUtils.getPadding(ctx);
-		setLayoutParams(new LayoutParams(MATCH_PARENT, height));
+		setHeight(LayoutUtils.getPadding(ctx));
+	}
+
+	public void setHeight(int height) {
+		setLayoutParams(new LayoutParams(WRAP_CONTENT, height));
 	}
 }
-- 
GitLab