View title text on images
Conflicts: res/values-fr/strings.xml res/values/strings.xml
This commit is contained in:
parent
bea2554711
commit
fc42b73ba5
@ -10,6 +10,11 @@
|
|||||||
android:showAsAction=""
|
android:showAsAction=""
|
||||||
android:title="@string/article_img_share"/>
|
android:title="@string/article_img_share"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/article_img_view_caption"
|
||||||
|
android:showAsAction=""
|
||||||
|
android:title="@string/article_img_view_caption"/>
|
||||||
|
|
||||||
<!-- <item
|
<!-- <item
|
||||||
android:id="@+id/article_img_save"
|
android:id="@+id/article_img_save"
|
||||||
android:showAsAction=""
|
android:showAsAction=""
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
<string name="download_feed_icons">Activer les icônes des flux</string>
|
<string name="download_feed_icons">Activer les icônes des flux</string>
|
||||||
<string name="enable_cats">Activer les catégories des flux</string>
|
<string name="enable_cats">Activer les catégories des flux</string>
|
||||||
<string name="no_feeds_to_display">Aucun flux à afficher</string>
|
<string name="no_feeds_to_display">Aucun flux à afficher</string>
|
||||||
|
<string name="no_caption_to_display">Aucun sous-titre trouvé</string>
|
||||||
<string name="no_headlines_to_display">Aucun titre à afficher</string>
|
<string name="no_headlines_to_display">Aucun titre à afficher</string>
|
||||||
<string name="browse_cats_like_feeds">Parcourir les catégories comme les flux</string>
|
<string name="browse_cats_like_feeds">Parcourir les catégories comme les flux</string>
|
||||||
<string name="browse_cats_like_feeds_summary">Utilisez le menu contexte des catégories pour redéfinir ce paramètre.</string>
|
<string name="browse_cats_like_feeds_summary">Utilisez le menu contexte des catégories pour redéfinir ce paramètre.</string>
|
||||||
@ -189,4 +190,5 @@
|
|||||||
<string name="article_img_open">Ouvrir l\'image</string>
|
<string name="article_img_open">Ouvrir l\'image</string>
|
||||||
<string name="article_img_share">Partager l\'image</string>
|
<string name="article_img_share">Partager l\'image</string>
|
||||||
<string name="requires_api5">Nécessite la version 1.7.6</string>
|
<string name="requires_api5">Nécessite la version 1.7.6</string>
|
||||||
|
<string name="article_img_view_caption">Montrer le sous-titre</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
<string name="enable_cats">Enable feed categories</string>
|
<string name="enable_cats">Enable feed categories</string>
|
||||||
<string name="no_feeds_to_display">No feeds to display</string>
|
<string name="no_feeds_to_display">No feeds to display</string>
|
||||||
<string name="no_headlines_to_display">No headlines to display</string>
|
<string name="no_headlines_to_display">No headlines to display</string>
|
||||||
|
<string name="no_caption_to_display">No caption to display</string>
|
||||||
<string name="browse_cats_like_feeds">Browse categories like feeds</string>
|
<string name="browse_cats_like_feeds">Browse categories like feeds</string>
|
||||||
<string name="browse_cats_like_feeds_summary">Use category context menu to override this setting</string>
|
<string name="browse_cats_like_feeds_summary">Use category context menu to override this setting</string>
|
||||||
<string name="headlines_mark_as_read">Mark read</string>
|
<string name="headlines_mark_as_read">Mark read</string>
|
||||||
@ -190,4 +191,5 @@
|
|||||||
<string name="article_img_share">Share image</string>
|
<string name="article_img_share">Share image</string>
|
||||||
<string name="requires_api5">Requires version 1.7.6</string>
|
<string name="requires_api5">Requires version 1.7.6</string>
|
||||||
<string name="labels">Labels</string>
|
<string name="labels">Labels</string>
|
||||||
|
<string name="article_img_view_caption">View Caption</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -44,12 +44,19 @@ import android.webkit.WebView.HitTestResult;
|
|||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.SearchView;
|
import android.widget.SearchView;
|
||||||
import android.widget.ShareActionProvider;
|
import android.widget.ShareActionProvider;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
import org.jsoup.nodes.Document;
|
||||||
|
import org.jsoup.nodes.Element;
|
||||||
|
import org.jsoup.select.Elements;
|
||||||
|
|
||||||
|
|
||||||
public class OnlineActivity extends CommonActivity {
|
public class OnlineActivity extends CommonActivity {
|
||||||
private final String TAG = this.getClass().getSimpleName();
|
private final String TAG = this.getClass().getSimpleName();
|
||||||
|
|
||||||
@ -564,6 +571,37 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
startActivity(Intent.createChooser(intent, getLastContentImageHitTestUrl()));
|
startActivity(Intent.createChooser(intent, getLastContentImageHitTestUrl()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
case R.id.article_img_view_caption:
|
||||||
|
if (getLastContentImageHitTestUrl() != 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);
|
||||||
|
Elements es = doc.getElementsByAttributeValue("src", getLastContentImageHitTestUrl());
|
||||||
|
if (es.size() > 0){
|
||||||
|
if (es.get(0).hasAttr("title")){
|
||||||
|
Dialog dia = new Dialog(this);
|
||||||
|
if (es.get(0).hasAttr("alt")){
|
||||||
|
dia.setTitle(es.get(0).attr("alt"));
|
||||||
|
} else {
|
||||||
|
dia.setTitle(es.get(0).attr("title"));
|
||||||
|
}
|
||||||
|
TextView titleText = new TextView(this);
|
||||||
|
titleText.setPaddingRelative(24, 24, 24, 24);
|
||||||
|
titleText.setTextSize(16);
|
||||||
|
titleText.setText(es.get(0).attr("title"));
|
||||||
|
dia.setContentView(titleText);
|
||||||
|
dia.show();
|
||||||
|
} else {
|
||||||
|
toast(R.string.no_caption_to_display);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
toast(R.string.no_caption_to_display);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
case R.id.article_link_share:
|
case R.id.article_link_share:
|
||||||
if (ap != null && ap.getSelectedArticle() != null) {
|
if (ap != null && ap.getSelectedArticle() != null) {
|
||||||
shareArticle(ap.getSelectedArticle());
|
shareArticle(ap.getSelectedArticle());
|
||||||
|
Loading…
Reference in New Issue
Block a user