From 50104ff6f69131fe9bdf62d9c3d90e2a1a9c8034 Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Thu, 21 Feb 2013 17:01:55 +0100 Subject: Added margin to shownotes. Closes #80 --- .../antennapod/fragment/ItemDescriptionFragment.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/de/danoeh/antennapod') diff --git a/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java b/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java index 387823348..687c2582a 100644 --- a/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java +++ b/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java @@ -9,11 +9,14 @@ import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.util.Log; +import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.WebSettings.LayoutAlgorithm; import android.webkit.WebView; +import android.widget.FrameLayout; +import android.widget.LinearLayout; import com.actionbarsherlock.app.SherlockFragment; @@ -64,7 +67,8 @@ public class ItemDescriptionFragment extends SherlockFragment { webvDescription.setBackgroundColor(0); } webvDescription.getSettings().setUseWideViewPort(false); - webvDescription.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN); + webvDescription.getSettings().setLayoutAlgorithm( + LayoutAlgorithm.SINGLE_COLUMN); return webvDescription; } @@ -122,6 +126,17 @@ public class ItemDescriptionFragment extends SherlockFragment { @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); + + if (webvDescription.getLayoutParams() != null + && webvDescription.getLayoutParams() instanceof FrameLayout.LayoutParams) { + FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) webvDescription + .getLayoutParams(); + layoutParams.leftMargin = layoutParams.rightMargin = (int) TypedValue + .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, + getResources().getDisplayMetrics()); + webvDescription.setLayoutParams(layoutParams); + } + if (item != null) { if (item.getDescription() == null || item.getContentEncoded() == null) { @@ -176,7 +191,7 @@ public class ItemDescriptionFragment extends SherlockFragment { * value is inserted directly into the CSS String. * */ private String getWebViewStyle(String textColor) { - final String WEBVIEW_STYLE = ""; + final String WEBVIEW_STYLE = ""; return String.format(WEBVIEW_STYLE, textColor); } -- cgit v1.2.3