diff options
author | Andrew Dolgov <[email protected]> | 2014-11-09 20:04:03 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2014-11-09 20:04:03 +0400 |
commit | ae20f7ba7799c8cd773e0f101afeb2ba73609a1c (patch) | |
tree | f1bdbe532caad0e05256013471faa17b5d3bbec5 /org.fox.ttrss/src/main | |
parent | f66f8734df34f2352f5f12024ccd498285665cf6 (diff) |
consider img size attributes when choosing flavor image
Diffstat (limited to 'org.fox.ttrss/src/main')
-rw-r--r-- | org.fox.ttrss/src/main/AndroidManifest.xml | 2 | ||||
-rw-r--r-- | org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java | 21 |
2 files changed, 20 insertions, 3 deletions
diff --git a/org.fox.ttrss/src/main/AndroidManifest.xml b/org.fox.ttrss/src/main/AndroidManifest.xml index 88bc3cbd..3ca478ba 100644 --- a/org.fox.ttrss/src/main/AndroidManifest.xml +++ b/org.fox.ttrss/src/main/AndroidManifest.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.fox.ttrss" - android:versionCode="277" + android:versionCode="278" android:versionName="1.69" > <uses-sdk 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 9f714430..d605a9c1 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java @@ -70,6 +70,9 @@ import java.util.TimeZone; public class HeadlinesFragment extends Fragment implements OnItemClickListener, OnScrollListener { public static enum ArticlesSelection { ALL, NONE, UNREAD } + public static final int FLAVOR_IMG_MIN_WIDTH = 128; + public static final int FLAVOR_IMG_MIN_HEIGHT = 128; + public static final int HEADLINES_REQUEST_SIZE = 30; public static final int HEADLINES_BUFFER_MAX = 500; @@ -804,7 +807,21 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, //Element img = doc.select("img").first(); final Elements imgs = doc.select("img"); - Element img = imgs.first(); + Element img = null; + + for (Element tmp : imgs) { + try { + if (Integer.valueOf(tmp.attr("width")) > FLAVOR_IMG_MIN_WIDTH && Integer.valueOf(tmp.attr("width")) > FLAVOR_IMG_MIN_HEIGHT) { + img = tmp; + break; + } + } catch (NumberFormatException e) { + // + } + } + + if (img == null) + img = imgs.first(); if (img != null) { String imgSrc = img.attr("src"); @@ -879,7 +896,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, flavorImageLoadingBar.setVisibility(View.INVISIBLE); - if (arg2.getWidth() > 128 && arg2.getHeight() > 128) { + if (arg2.getWidth() > FLAVOR_IMG_MIN_WIDTH && arg2.getHeight() > FLAVOR_IMG_MIN_HEIGHT) { if (!m_activity.isCompatMode() && weNeedAnimation) { ObjectAnimator anim = ObjectAnimator.ofFloat(flavorImageView, "alpha", 0f, 1f); |