some more tweaks

This commit is contained in:
Andrew Dolgov 2015-07-10 22:57:33 +03:00
parent b218b743bf
commit 91417fa3dd
5 changed files with 19 additions and 6 deletions

View File

@ -1376,6 +1376,12 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
return dp; 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) { private void maybeRepositionFlavorImage(View view, Bitmap bitmap) {
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) view.getLayoutParams(); 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) { if (pxToDp(bitmap.getHeight()) < 300 || r >= 1.2) {
lp.addRule(RelativeLayout.BELOW, R.id.headline_header); lp.addRule(RelativeLayout.BELOW, R.id.headline_header);
if (w < h) lp.topMargin = dpToPx(8);
} else { } else {
lp.addRule(RelativeLayout.BELOW, 0); lp.addRule(RelativeLayout.BELOW, 0);
lp.topMargin = 0;
//lp.removeRule(RelativeLayout.BELOW); //lp.removeRule(RelativeLayout.BELOW);
} }

View File

@ -60,7 +60,7 @@
android:id="@+id/headline_header" android:id="@+id/headline_header"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="#ccffffff" android:background="?headlineHeaderBackground"
android:padding="16dp"> android:padding="16dp">
<TextView <TextView
@ -117,11 +117,11 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="#90000000" android:background="?headlineHeaderBackground"
android:gravity="center" android:gravity="center"
android:text="@string/flavor_image_prompt" android:text="@string/flavor_image_prompt"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@android:color/primary_text_dark" android:textColor="?headlineSecondaryTextColor"
android:visibility="visible" /> android:visibility="visible" />
</FrameLayout> </FrameLayout>

View File

@ -61,7 +61,7 @@
android:id="@+id/headline_header" android:id="@+id/headline_header"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="#ccffffff" android:background="?headlineHeaderBackground"
android:padding="16dp"> android:padding="16dp">
<TextView <TextView
@ -118,11 +118,11 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="#90000000" android:background="?headlineHeaderBackground"
android:gravity="center" android:gravity="center"
android:text="@string/flavor_image_prompt" android:text="@string/flavor_image_prompt"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@android:color/primary_text_dark" android:textColor="?headlineSecondaryTextColor"
android:visibility="visible" /> android:visibility="visible" />
</FrameLayout> </FrameLayout>

View File

@ -11,6 +11,7 @@
<attr name="feedlistTextColor" format="reference|color" /> <attr name="feedlistTextColor" format="reference|color" />
<attr name="feedlistSelectedTextColor" format="reference|color" /> <attr name="feedlistSelectedTextColor" format="reference|color" />
<!-- <attr name="headlineTextColor" format="reference|color" /> --> <!-- <attr name="headlineTextColor" format="reference|color" /> -->
<attr name="headlineHeaderBackground" format="reference|color" />
<attr name="headlineUnreadTextColor" format="reference|color" /> <attr name="headlineUnreadTextColor" format="reference|color" />
<attr name="headlineSelectedTextColor" format="reference|color" /> <attr name="headlineSelectedTextColor" format="reference|color" />
<attr name="headlineExcerptTextColor" format="reference|color" /> <attr name="headlineExcerptTextColor" format="reference|color" />

View File

@ -15,6 +15,7 @@
<item name="headlinesBackground">#f0f0f0</item> <item name="headlinesBackground">#f0f0f0</item>
<item name="articleBackground">@android:color/white</item> <item name="articleBackground">@android:color/white</item>
<item name="headlineSelectedBackground">#dddddd</item> <item name="headlineSelectedBackground">#dddddd</item>
<item name="headlineHeaderBackground">#ccffffff</item>
<item name="headlineUnreadBackground">@android:color/white</item> <item name="headlineUnreadBackground">@android:color/white</item>
<item name="feedsSelectedBackground">#dddddd</item> <item name="feedsSelectedBackground">#dddddd</item>
<item name="feedlistTextColor">@android:color/primary_text_light</item> <item name="feedlistTextColor">@android:color/primary_text_light</item>
@ -79,6 +80,7 @@
<item name="headlineSelectedExcerptTextColor">@android:color/secondary_text_dark</item> <item name="headlineSelectedExcerptTextColor">@android:color/secondary_text_dark</item>
<item name="headlineSelectedSecondaryTextColor">?headlineSelectedExcerptTextColor</item> <item name="headlineSelectedSecondaryTextColor">?headlineSelectedExcerptTextColor</item>
<item name="headlineSelectedBackground">#1c1c1c</item> <item name="headlineSelectedBackground">#1c1c1c</item>
<item name="headlineHeaderBackground">#cc000000</item>
<item name="headlineUnreadBackground">#101010</item> <item name="headlineUnreadBackground">#101010</item>
<item name="linkColor">?colorPrimary</item> <item name="linkColor">?colorPrimary</item>
<item name="loadingBackground">@android:color/black</item> <item name="loadingBackground">@android:color/black</item>