From e0909900a48a11389e3218ed0ba5bfbecc22760f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 3 Nov 2014 19:15:37 +0400 Subject: [PATCH] enable image alt-text dialog in image pager --- org.fox.ttrss/src/main/AndroidManifest.xml | 4 ++-- .../java/org/fox/ttrss/ArticleFragment.java | 1 + .../fox/ttrss/ArticleImagesPagerActivity.java | 21 ++++++++++++------- .../java/org/fox/ttrss/HeadlinesFragment.java | 1 + 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/org.fox.ttrss/src/main/AndroidManifest.xml b/org.fox.ttrss/src/main/AndroidManifest.xml index 31661ff0..03b78cea 100644 --- a/org.fox.ttrss/src/main/AndroidManifest.xml +++ b/org.fox.ttrss/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="263" + android:versionName="1.59" > m_checkedUrls; private String m_title; private ArticleImagesPagerAdapter m_adapter; + private String m_content; private class ArticleImagesPagerAdapter extends PagerAdapter { private List m_urls; @@ -196,9 +203,11 @@ public class ArticleImagesPagerActivity extends CommonActivity { if (savedInstanceState == null) { m_title = getIntent().getStringExtra("title"); m_urls = getIntent().getStringArrayListExtra("urls"); + m_content = getIntent().getStringExtra("content"); } else { m_urls = savedInstanceState.getStringArrayList("urls"); m_title = savedInstanceState.getString("title"); + m_content = savedInstanceState.getString("content"); } @@ -250,9 +259,6 @@ public class ArticleImagesPagerActivity extends CommonActivity { getMenuInflater().inflate(R.menu.article_content_img_context_menu, menu); - // not supported here yet - menu.findItem(R.id.article_img_view_caption).setVisible(false); - super.onCreateContextMenu(menu, v, menuInfo); } @@ -263,14 +269,13 @@ public class ArticleImagesPagerActivity extends CommonActivity { out.putStringArrayList("urls", m_urls); out.putString("title", m_title); + out.putString("content", m_content); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.article_content_img_context_menu, menu); - // not supported here yet - menu.findItem(R.id.article_img_view_caption).setVisible(false); return true; } @@ -323,14 +328,14 @@ public class ArticleImagesPagerActivity extends CommonActivity { } return true; // TODO: this needs access to article text, I'm afraid - /* case R.id.article_img_view_caption: + case R.id.article_img_view_caption: if (url != null) { // Android doesn't give us an easy way to access title tags; // we'll use Jsoup on the body text to grab the title text // from the first image tag with this url. This will show // the wrong text if an image is used multiple times. - Document doc = Jsoup.parse(ap.getSelectedArticle().content); + Document doc = Jsoup.parse(m_content); Elements es = doc.getElementsByAttributeValue("src", url); if (es.size() > 0) { if (es.get(0).hasAttr("title")) { @@ -359,7 +364,7 @@ public class ArticleImagesPagerActivity extends CommonActivity { toast(R.string.no_caption_to_display); } } - return true; */ + return true; default: Log.d(TAG, "onContextItemSelected, unhandled id=" + item.getItemId()); return super.onContextItemSelected(item); 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 84cdb48a..69d6033a 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 @@ -826,6 +826,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, Intent intent = new Intent(m_activity, ArticleImagesPagerActivity.class); intent.putExtra("urls", imgsList); intent.putExtra("title", article.title); + intent.putExtra("content", article.content); startActivityForResult(intent, 0); //m_activity.overridePendingTransition(android.R.anim.fade_in, 0);