From 91417fa3dd4b35dd0319379ddeb0e49b3b7745ea Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 10 Jul 2015 22:57:33 +0300 Subject: [PATCH] some more tweaks --- .../src/main/java/org/fox/ttrss/HeadlinesFragment.java | 10 ++++++++++ org.fox.ttrss/src/main/res/layout/headlines_row.xml | 6 +++--- .../src/main/res/layout/headlines_row_unread.xml | 6 +++--- org.fox.ttrss/src/main/res/values/attrs.xml | 1 + org.fox.ttrss/src/main/res/values/style.xml | 2 ++ 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java index 504ac9e2..289ffed6 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java @@ -1376,6 +1376,12 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, return dp; } + public int dpToPx(int dp) { + DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics(); + int px = Math.round(dp * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); + return px; + } + private void maybeRepositionFlavorImage(View view, Bitmap bitmap) { RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) view.getLayoutParams(); @@ -1388,8 +1394,12 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, if (pxToDp(bitmap.getHeight()) < 300 || r >= 1.2) { lp.addRule(RelativeLayout.BELOW, R.id.headline_header); + + if (w < h) lp.topMargin = dpToPx(8); + } else { lp.addRule(RelativeLayout.BELOW, 0); + lp.topMargin = 0; //lp.removeRule(RelativeLayout.BELOW); } diff --git a/org.fox.ttrss/src/main/res/layout/headlines_row.xml b/org.fox.ttrss/src/main/res/layout/headlines_row.xml index 627dba0b..9916187c 100755 --- a/org.fox.ttrss/src/main/res/layout/headlines_row.xml +++ b/org.fox.ttrss/src/main/res/layout/headlines_row.xml @@ -60,7 +60,7 @@ android:id="@+id/headline_header" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="#ccffffff" + android:background="?headlineHeaderBackground" android:padding="16dp"> diff --git a/org.fox.ttrss/src/main/res/layout/headlines_row_unread.xml b/org.fox.ttrss/src/main/res/layout/headlines_row_unread.xml index dab9b0eb..56579318 100755 --- a/org.fox.ttrss/src/main/res/layout/headlines_row_unread.xml +++ b/org.fox.ttrss/src/main/res/layout/headlines_row_unread.xml @@ -61,7 +61,7 @@ android:id="@+id/headline_header" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="#ccffffff" + android:background="?headlineHeaderBackground" android:padding="16dp"> diff --git a/org.fox.ttrss/src/main/res/values/attrs.xml b/org.fox.ttrss/src/main/res/values/attrs.xml index 28211bb4..e0bfb02c 100755 --- a/org.fox.ttrss/src/main/res/values/attrs.xml +++ b/org.fox.ttrss/src/main/res/values/attrs.xml @@ -11,6 +11,7 @@ + diff --git a/org.fox.ttrss/src/main/res/values/style.xml b/org.fox.ttrss/src/main/res/values/style.xml index deb42241..f36d9c2f 100755 --- a/org.fox.ttrss/src/main/res/values/style.xml +++ b/org.fox.ttrss/src/main/res/values/style.xml @@ -15,6 +15,7 @@ #f0f0f0 @android:color/white #dddddd + #ccffffff @android:color/white #dddddd @android:color/primary_text_light @@ -79,6 +80,7 @@ @android:color/secondary_text_dark ?headlineSelectedExcerptTextColor #1c1c1c + #cc000000 #101010 ?colorPrimary @android:color/black