From 4e28980b339af038bd41f5dd4032058da0bfa61b Mon Sep 17 00:00:00 2001 From: Florens Douwes Date: Tue, 8 Apr 2014 16:16:00 +0200 Subject: [PATCH] Fixed Utils.dp no-op --- .../org/floens/chan/ui/activity/WatchSettingsActivity.java | 4 ++-- Chan/src/org/floens/chan/utils/Utils.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Chan/src/org/floens/chan/ui/activity/WatchSettingsActivity.java b/Chan/src/org/floens/chan/ui/activity/WatchSettingsActivity.java index 0d960509..9a59be3d 100644 --- a/Chan/src/org/floens/chan/ui/activity/WatchSettingsActivity.java +++ b/Chan/src/org/floens/chan/ui/activity/WatchSettingsActivity.java @@ -39,7 +39,7 @@ public class WatchSettingsActivity extends Activity implements OnCheckedChangeLi watchSwitch = (Switch) menu.findItem(R.id.enable_watch_switch).getActionView(); watchSwitch.setOnCheckedChangeListener(this); - watchSwitch.setPadding(0, 0, Utils.dp(this, 20), 0); + watchSwitch.setPadding(0, 0, Utils.dp(this, 14), 0); setEnabled(ChanPreferences.getWatchEnabled()); @@ -90,7 +90,7 @@ public class WatchSettingsActivity extends Activity implements OnCheckedChangeLi public View onCreateView(LayoutInflater inflater, ViewGroup group, Bundle savedInstanceState) { LinearLayout container = new LinearLayout(inflater.getContext()); - int p = Utils.dp(inflater.getContext(), 20); + int p = Utils.dp(inflater.getContext(), 14); container.setPadding(p, p, p, p); TextView text = new TextView(inflater.getContext()); diff --git a/Chan/src/org/floens/chan/utils/Utils.java b/Chan/src/org/floens/chan/utils/Utils.java index 77be1153..fe6936ed 100644 --- a/Chan/src/org/floens/chan/utils/Utils.java +++ b/Chan/src/org/floens/chan/utils/Utils.java @@ -9,8 +9,8 @@ import android.util.TypedValue; import android.view.View; public class Utils { - public static int dp(Context context, int dp) { - return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 14, context.getResources().getDisplayMetrics()); + public static int dp(Context context, float dp) { + return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics()); } /**