add headline image border; make showing them optional

This commit is contained in:
Andrew Dolgov 2014-10-16 12:19:52 +04:00
parent 8e8bbf70aa
commit a38e98c80e
8 changed files with 41 additions and 9 deletions

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners android:radius="0dp" />
<stroke
android:width="1dp"
android:color="#cccccc" />
</shape>

View File

@ -85,8 +85,12 @@
android:id="@+id/flavor_image" android:id="@+id/flavor_image"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:maxHeight="128dp" android:background="@drawable/flavor_image_border"
android:cropToPadding="true"
android:maxHeight="256dp"
android:padding="1dp"
android:scaleType="centerInside" android:scaleType="centerInside"
android:src="@null" android:src="@null"
android:visibility="gone" /> android:visibility="gone" />

View File

@ -79,12 +79,16 @@
android:layout_gravity="center" android:layout_gravity="center"
android:layout_height="wrap_content" > android:layout_height="wrap_content" >
<ImageView <ImageView
android:id="@+id/flavor_image" android:id="@+id/flavor_image"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:maxHeight="128dp" android:background="@drawable/flavor_image_border"
android:cropToPadding="true"
android:maxHeight="256dp"
android:padding="1dp"
android:scaleType="centerInside" android:scaleType="centerInside"
android:src="@null" android:src="@null"
android:visibility="gone" /> android:visibility="gone" />

View File

@ -84,8 +84,12 @@
android:id="@+id/flavor_image" android:id="@+id/flavor_image"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:maxHeight="128dp" android:background="@drawable/flavor_image_border"
android:cropToPadding="true"
android:maxHeight="256dp"
android:padding="1dp"
android:scaleType="centerInside" android:scaleType="centerInside"
android:src="@null" android:src="@null"
android:visibility="gone" /> android:visibility="gone" />

View File

@ -74,18 +74,21 @@
</LinearLayout> </LinearLayout>
<FrameLayout <FrameLayout
android:paddingTop="3dp"
android:id="@+id/flavorImageHolder" android:id="@+id/flavorImageHolder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_gravity="center" android:layout_height="wrap_content"
android:layout_height="wrap_content" > android:paddingTop="3dp" >
<ImageView <ImageView
android:id="@+id/flavor_image" android:id="@+id/flavor_image"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:maxHeight="128dp" android:background="@drawable/flavor_image_border"
android:cropToPadding="true"
android:maxHeight="256dp"
android:padding="1dp"
android:scaleType="centerInside" android:scaleType="centerInside"
android:src="@null" android:src="@null"
android:visibility="gone" /> android:visibility="gone" />

View File

@ -221,5 +221,6 @@
<string name="pref_headlines_use_condensed_fonts_long">Use condensed fonts for headline titles and a few other UI elements.</string> <string name="pref_headlines_use_condensed_fonts_long">Use condensed fonts for headline titles and a few other UI elements.</string>
<string name="pref_headlines_full_content_long">Show full article content in headlines. Resource intensive, can cause UI lag on some devices.</string> <string name="pref_headlines_full_content_long">Show full article content in headlines. Resource intensive, can cause UI lag on some devices.</string>
<string name="pref_headlines_full_content">Show full content</string> <string name="pref_headlines_full_content">Show full content</string>
<string name="prefs_headlines_show_flavor_image">Show article image</string>
</resources> </resources>

View File

@ -92,6 +92,11 @@
android:key="headlines_show_content" android:key="headlines_show_content"
android:summary="@string/pref_headlines_show_content_long" android:summary="@string/pref_headlines_show_content_long"
android:title="@string/pref_headlines_show_content" /> android:title="@string/pref_headlines_show_content" />
<CheckBoxPreference
android:defaultValue="true"
android:key="headlines_show_flavor_image"
android:title="@string/prefs_headlines_show_flavor_image" />
<!-- <CheckBoxPreference <!-- <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"

View File

@ -819,7 +819,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
final ImageView flavorImage = (ImageView) v.findViewById(R.id.flavor_image); final ImageView flavorImage = (ImageView) v.findViewById(R.id.flavor_image);
if (flavorImage != null && m_prefs.getBoolean("headlines_show_content", true)) { if (flavorImage != null && m_prefs.getBoolean("headlines_show_flavor_image", true)) {
flavorImage.setVisibility(View.GONE); flavorImage.setVisibility(View.GONE);
Document doc = Jsoup.parse(articleContent); Document doc = Jsoup.parse(articleContent);