diff options
author | Andrew Dolgov <[email protected]> | 2014-11-03 19:15:37 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2014-11-03 19:15:37 +0400 |
commit | e0909900a48a11389e3218ed0ba5bfbecc22760f (patch) | |
tree | 6cb410f2d3ed1f0cd6663719fac59e3d77459218 /org.fox.ttrss/src/main/java | |
parent | fc7a1a308de4a05d1a9ca45b212411da19be1cf3 (diff) |
enable image alt-text dialog in image pager
Diffstat (limited to 'org.fox.ttrss/src/main/java')
3 files changed, 15 insertions, 8 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java index cec48fb1..e6ad89be 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java @@ -11,6 +11,7 @@ import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v4.app.Fragment; import android.text.Html; +import android.util.Log; import android.util.TypedValue; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleImagesPagerActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleImagesPagerActivity.java index 87aeaff9..c90ea788 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleImagesPagerActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleImagesPagerActivity.java @@ -1,6 +1,7 @@ package org.fox.ttrss; import android.annotation.SuppressLint; +import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; @@ -21,6 +22,7 @@ import android.view.WindowManager; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.ProgressBar; +import android.widget.TextView; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoader; @@ -29,6 +31,10 @@ import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer; import com.nostra13.universalimageloader.core.listener.ImageLoadingListener; import com.viewpagerindicator.UnderlinePageIndicator; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.select.Elements; + import java.util.ArrayList; import java.util.List; @@ -39,6 +45,7 @@ public class ArticleImagesPagerActivity extends CommonActivity { private ArrayList<String> m_checkedUrls; private String m_title; private ArticleImagesPagerAdapter m_adapter; + private String m_content; private class ArticleImagesPagerAdapter extends PagerAdapter { private List<String> 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); |