diff options
author | Andrew Dolgov <[email protected]> | 2013-01-03 15:09:30 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-01-03 15:09:30 +0400 |
commit | f78ad58b79893b3ba236ef47fba40bbc2b588843 (patch) | |
tree | a351315ea0e9b5e0bda37dd5b5ba7f9d10c1b23f | |
parent | 4b92a16f101359cac1df7fd8fded54c0af2d5f20 (diff) |
rework attachment UI to use a dialog, update published actionbar icon
21 files changed, 355 insertions, 145 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 91512dce..f6b72649 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.fox.ttrss" - android:versionCode="128" - android:versionName="1.6" > + android:versionCode="129" + android:versionName="1.7" > <uses-sdk android:minSdkVersion="8" diff --git a/res/drawable-hdpi/ic_menu_attaches.png b/res/drawable-hdpi/ic_menu_attaches.png Binary files differnew file mode 100644 index 00000000..eccb0cbc --- /dev/null +++ b/res/drawable-hdpi/ic_menu_attaches.png diff --git a/res/drawable-hdpi/ic_menu_publish.png b/res/drawable-hdpi/ic_menu_publish.png Binary files differnew file mode 100644 index 00000000..de42e535 --- /dev/null +++ b/res/drawable-hdpi/ic_menu_publish.png diff --git a/res/drawable-hdpi/ic_menu_rss.png b/res/drawable-hdpi/ic_menu_rss.png Binary files differdeleted file mode 100644 index 431921ab..00000000 --- a/res/drawable-hdpi/ic_menu_rss.png +++ /dev/null diff --git a/res/drawable-hdpi/ic_next_article.png b/res/drawable-hdpi/ic_next_article.png Binary files differdeleted file mode 100644 index ef7e7be3..00000000 --- a/res/drawable-hdpi/ic_next_article.png +++ /dev/null diff --git a/res/drawable-hdpi/ic_next_article_disabled.png b/res/drawable-hdpi/ic_next_article_disabled.png Binary files differdeleted file mode 100644 index 7aeac8a4..00000000 --- a/res/drawable-hdpi/ic_next_article_disabled.png +++ /dev/null diff --git a/res/drawable-hdpi/ic_prev_article.png b/res/drawable-hdpi/ic_prev_article.png Binary files differdeleted file mode 100644 index 0d5744de..00000000 --- a/res/drawable-hdpi/ic_prev_article.png +++ /dev/null diff --git a/res/drawable-hdpi/ic_prev_article_disabled.png b/res/drawable-hdpi/ic_prev_article_disabled.png Binary files differdeleted file mode 100644 index 848cf464..00000000 --- a/res/drawable-hdpi/ic_prev_article_disabled.png +++ /dev/null diff --git a/res/drawable/s_menu_attaches.svg b/res/drawable/s_menu_attaches.svg new file mode 100644 index 00000000..d158f478 --- /dev/null +++ b/res/drawable/s_menu_attaches.svg @@ -0,0 +1,143 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="16.000000px" + height="16.000000px" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.48.2 r9819" + sodipodi:docname="s_menu_attaches.svg" + inkscape:export-filename="C:\Users\fox\workspace\org.fox.ttrss\res\drawable-hdpi\ic_menu_attaches.png" + inkscape:export-xdpi="225" + inkscape:export-ydpi="225" + version="1.1"> + <defs + id="defs4"> + <filter + id="filter2997" + inkscape:label="Desaturate" + x="0" + y="0" + width="1" + height="1" + inkscape:menu="Color" + inkscape:menu-tooltip="Render in shades of gray by reducing saturation to zero" + color-interpolation-filters="sRGB"> + <feColorMatrix + id="feColorMatrix2999" + type="saturate" + values="0" /> + </filter> + <linearGradient + gradientUnits="userSpaceOnUse" + y2="29.85923" + x2="20.604948" + y1="5.7753429" + x1="23.505953" + id="linearGradient5789" + xlink:href="#linearGradient5783" + inkscape:collect="always" + gradientTransform="matrix(0.42042845,0,0,0.42042845,13.623381,13.232492)" /> + <radialGradient + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.977282,3.554943e-8,-8.305337e-10,0.651376,-0.794430,15.82896)" + r="15.571428" + fy="23.07144" + fx="21.761711" + cy="23.07144" + cx="21.761711" + id="radialGradient3564" + xlink:href="#linearGradient3558" + inkscape:collect="always" /> + <linearGradient + id="linearGradient3558" + inkscape:collect="always"> + <stop + id="stop3560" + offset="0" + style="stop-color:#000000;stop-opacity:1;" /> + <stop + id="stop3562" + offset="1" + style="stop-color:#000000;stop-opacity:0;" /> + </linearGradient> + <linearGradient + id="linearGradient5783"> + <stop + id="stop5785" + offset="0" + style="stop-color:#d3d7cf;stop-opacity:1;" /> + <stop + style="stop-color:#f5f5f5;stop-opacity:1;" + offset="0.5" + id="stop5791" /> + <stop + id="stop5787" + offset="1" + style="stop-color:#bebebe;stop-opacity:1;" /> + </linearGradient> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient3558" + id="radialGradient3808" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.977282,3.554943e-8,0,0.651376,-0.79443,15.82896)" + cx="21.761711" + cy="23.07144" + fx="21.761711" + fy="23.07144" + r="15.571428" /> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0000000" + inkscape:pageshadow="2" + inkscape:zoom="22.4" + inkscape:cx="1.501129" + inkscape:cy="8.3641285" + inkscape:document-units="px" + inkscape:current-layer="layer1" + inkscape:window-width="1920" + inkscape:window-height="1138" + inkscape:window-x="-8" + inkscape:window-y="-8" + showguides="true" + inkscape:guide-bbox="true" + showgrid="false" + inkscape:window-maximized="1" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <path + style="fill:none;stroke:#888a85;stroke-width:1.26131642;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="M 6.9892642,2.3757495 C 6.0497128,3.8758958 5.110161,5.376042 4.1706096,6.8761883 3.231058,8.3763347 2.1868547,9.8241539 1.2473032,11.3243 1.0695751,11.880314 2.4591402,13.489424 3.2673124,14.067232 4.108665,14.63398 6.5590494,15.293346 7.015292,15.13582 8.2872017,13.178185 9.6637633,11.272876 10.935674,9.3152417 12.207582,7.3576065 13.479493,5.399971 14.751402,3.4423357 14.794991,2.8776202 13.72786,1.8760087 12.997895,1.4004248 12.201569,0.90272101 11.053313,0.73681972 10.708457,0.90272101 9.6928273,2.5193913 8.6771969,4.1360615 7.6615667,5.7527318 6.6459365,7.3694021 5.6303063,8.9860723 4.6146759,10.602743 c -0.071518,0.275829 0.3965912,0.633779 0.5948867,0.7923 0.2227539,0.132721 0.8326308,0.441406 1.1257707,0.327777 C 6.9455358,10.82126 7.555738,9.9197012 8.1659403,9.0181406 8.7761427,8.1165809 9.3863449,7.215021 9.9965471,6.3134614" + id="path3814" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccccccccccccc" /> + </g> +</svg> diff --git a/res/drawable/s_menu_publish.svg b/res/drawable/s_menu_publish.svg new file mode 100644 index 00000000..babb507a --- /dev/null +++ b/res/drawable/s_menu_publish.svg @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.1" + width="16" + height="16" + id="RSSicon" + viewBox="0 0 32 32" + inkscape:version="0.48.2 r9819" + sodipodi:docname="s_menu_publish.svg" + inkscape:export-filename="C:\Users\fox\workspace\org.fox.ttrss\res\drawable-hdpi\ic_menu_publish.png" + inkscape:export-xdpi="225" + inkscape:export-ydpi="225"> + <metadata + id="metadata34"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1138" + id="namedview32" + showgrid="false" + inkscape:zoom="23.953242" + inkscape:cx="-4.9762823" + inkscape:cy="10.694533" + inkscape:window-x="-8" + inkscape:window-y="-8" + inkscape:window-maximized="1" + inkscape:current-layer="RSSicon" /> + <defs + id="defs3"> + <linearGradient + x1="30.059999" + y1="30.059999" + x2="225.94" + y2="225.94" + id="RSSg" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(0,-224)"> + <stop + offset="0.0" + stop-color="#E3702D" + id="stop6" /> + <stop + offset="0.1071" + stop-color="#EA7D31" + id="stop8" /> + <stop + offset="0.3503" + stop-color="#F69537" + id="stop10" /> + <stop + offset="0.5" + stop-color="#FB9E3A" + id="stop12" /> + <stop + offset="0.7016" + stop-color="#EA7C31" + id="stop14" /> + <stop + offset="0.8866" + stop-color="#DE642B" + id="stop16" /> + <stop + offset="1.0" + stop-color="#D95B29" + id="stop18" /> + </linearGradient> + <filter + id="filter3031" + inkscape:label="Desaturate" + x="0" + y="0" + width="1" + height="1" + inkscape:menu="Color" + inkscape:menu-tooltip="Render in shades of gray by reducing saturation to zero" + color-interpolation-filters="sRGB"> + <feColorMatrix + id="feColorMatrix3033" + type="saturate" + values="0" /> + </filter> + </defs> + <path + style="fill:#4f9dfd;fill-opacity:1;filter:url(#filter3031)" + d="M 4.09375 1.15625 C 2.4640215 1.15625 1.15625 2.4640215 1.15625 4.09375 L 1.15625 11.90625 C 1.15625 13.535978 2.4640215 14.84375 4.09375 14.84375 L 11.90625 14.84375 C 13.535978 14.84375 14.84375 13.535978 14.84375 11.90625 L 14.84375 4.09375 C 14.84375 2.4640215 13.535978 1.15625 11.90625 1.15625 L 4.09375 1.15625 z M 3.5 3.1875 A 9.3601078 9.3601078 0 0 1 12.875 12.53125 L 11 12.53125 A 7.4880862 7.4880862 0 0 0 3.5 5.0625 L 3.5 3.1875 z M 3.5 6.34375 A 6.2044143 6.2044143 0 0 1 9.71875 12.53125 L 7.90625 12.53125 A 4.3858791 4.3858791 0 0 0 3.5 8.15625 L 3.5 6.34375 z M 4.78125 9.96875 C 5.4902024 9.96875 6.0625 10.541048 6.0625 11.25 C 6.0625 11.958952 5.4902024 12.53125 4.78125 12.53125 C 4.0722976 12.53125 3.5 11.958952 3.5 11.25 C 3.5 10.541048 4.0722976 9.96875 4.78125 9.96875 z " + transform="scale(2,2)" + id="rect20" /> +</svg> diff --git a/res/layout-sw600dp/article_fragment.xml b/res/layout-sw600dp/article_fragment.xml index de8cd900..dd97dad2 100644 --- a/res/layout-sw600dp/article_fragment.xml +++ b/res/layout-sw600dp/article_fragment.xml @@ -78,41 +78,4 @@ android:paddingTop="2dip" />
</LinearLayout>
</org.fox.ttrss.TitleWebView>
-
- <LinearLayout
- android:id="@+id/attachments_holder"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="0"
- android:paddingTop="5sp" >
-
- <Spinner
- android:id="@+id/attachments"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:prompt="@string/attachments_prompt" />
-
- <Button
- android:id="@+id/attachment_view"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="0"
- android:text="@string/attachment_view" />
-
- <Button
- android:id="@+id/attachment_share"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="0"
- android:text="@string/attachment_share" />
-
- <Button
- android:id="@+id/attachment_copy"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="0"
- android:text="@string/attachment_copy" />
- </LinearLayout>
-
</LinearLayout>
\ No newline at end of file diff --git a/res/layout/article_fragment.xml b/res/layout/article_fragment.xml index c41f1549..f5ae4d43 100644 --- a/res/layout/article_fragment.xml +++ b/res/layout/article_fragment.xml @@ -75,39 +75,4 @@ </LinearLayout>
</org.fox.ttrss.TitleWebView>
- <LinearLayout
- android:id="@+id/attachments_holder"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="0" >
-
- <Spinner
- android:id="@+id/attachments"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:prompt="@string/attachments_prompt" />
-
- <Button
- android:id="@+id/attachment_view"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="0"
- android:text="@string/attachment_view" />
-
- <Button
- android:id="@+id/attachment_share"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="0"
- android:text="@string/attachment_share" />
-
- <Button
- android:id="@+id/attachment_copy"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="0"
- android:text="@string/attachment_copy" />
- </LinearLayout>
-
</LinearLayout>
\ No newline at end of file diff --git a/res/menu/headlines_action_menu.xml b/res/menu/headlines_action_menu.xml index 3c812f5d..77a9e745 100644 --- a/res/menu/headlines_action_menu.xml +++ b/res/menu/headlines_action_menu.xml @@ -14,7 +14,7 @@ <item android:id="@+id/selection_toggle_published" - android:icon="@drawable/ic_menu_rss" + android:icon="@drawable/ic_menu_publish" android:showAsAction="ifRoom" android:title="@string/selection_toggle_published"/> diff --git a/res/menu/main_menu.xml b/res/menu/main_menu.xml index 076597cb..44e5a7d1 100644 --- a/res/menu/main_menu.xml +++ b/res/menu/main_menu.xml @@ -77,7 +77,7 @@ android:title="@string/selection_toggle_marked"/> <item android:id="@+id/selection_toggle_published" - android:icon="@drawable/ic_menu_rss" + android:icon="@drawable/ic_menu_publish" android:showAsAction="ifRoom" android:title="@string/selection_toggle_published"/> <item @@ -94,10 +94,16 @@ android:title="@string/article_toggle_marked"/> <item android:id="@+id/toggle_published" - android:icon="@drawable/ic_menu_rss" + android:icon="@drawable/ic_menu_publish" android:showAsAction="ifRoom" android:title="@string/article_toggle_published"/> <item + android:id="@+id/toggle_attachments" + android:icon="@drawable/ic_menu_attaches" + android:showAsAction="ifRoom" + android:title="@string/attachments_prompt"/> + + <item android:id="@+id/share_article" android:actionProviderClass="android.widget.ShareActionProvider" android:icon="@android:drawable/ic_menu_share" diff --git a/res/menu/offline_menu.xml b/res/menu/offline_menu.xml index 137184d4..8a30a8e4 100644 --- a/res/menu/offline_menu.xml +++ b/res/menu/offline_menu.xml @@ -62,7 +62,7 @@ android:title="@string/selection_toggle_marked"/> <item android:id="@+id/selection_toggle_published" - android:icon="@drawable/ic_menu_rss" + android:icon="@drawable/ic_menu_publish" android:showAsAction="ifRoom" android:title="@string/selection_toggle_published"/> <item @@ -79,7 +79,7 @@ android:title="@string/article_toggle_marked"/> <item android:id="@+id/toggle_published" - android:icon="@drawable/ic_menu_rss" + android:icon="@drawable/ic_menu_publish" android:showAsAction="ifRoom" android:title="@string/article_toggle_published"/> <item diff --git a/src/org/fox/ttrss/ArticleFragment.java b/src/org/fox/ttrss/ArticleFragment.java index 0cb36b4d..b2b14f00 100644 --- a/src/org/fox/ttrss/ArticleFragment.java +++ b/src/org/fox/ttrss/ArticleFragment.java @@ -256,22 +256,12 @@ public class ArticleFragment extends Fragment implements GestureDetector.OnDoubl "</head>" +
"<body>" + articleContent;
- final Spinner spinner = (Spinner) view.findViewById(R.id.attachments);
-
if (m_article.attachments != null && m_article.attachments.size() != 0) {
- ArrayList<Attachment> spinnerArray = new ArrayList<Attachment>();
-
- ArrayAdapter<Attachment> spinnerArrayAdapter = new ArrayAdapter<Attachment>(
- getActivity(), android.R.layout.simple_spinner_item, spinnerArray);
-
- spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
-
String flatContent = articleContent.replaceAll("[\r\n]", "");
boolean hasImages = flatContent.matches(".*?<img[^>+].*?");
for (Attachment a : m_article.attachments) {
- if (a.content_type != null && a.content_url != null) {
-
+ if (a.content_type != null && a.content_url != null) {
try {
if (a.content_type.indexOf("image") != -1 &&
(!hasImages || m_article.always_display_attachments)) {
@@ -287,60 +277,8 @@ public class ArticleFragment extends Fragment implements GestureDetector.OnDoubl } catch (Exception e) {
e.printStackTrace();
}
-
- spinnerArray.add(a);
}
}
-
- spinner.setAdapter(spinnerArrayAdapter);
-
- Button attachmentsView = (Button) view.findViewById(R.id.attachment_view);
-
- attachmentsView.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- Attachment attachment = (Attachment) spinner.getSelectedItem();
-
- Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(attachment.content_url));
- startActivity(browserIntent);
- }
- });
-
- Button attachmentsCopy = (Button) view.findViewById(R.id.attachment_copy);
-
- attachmentsCopy.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- Attachment attachment = (Attachment) spinner.getSelectedItem();
-
- if (attachment != null) {
- m_activity.copyToClipboard(attachment.content_url);
- }
- }
- });
-
- Button attachmentsShare = (Button) view.findViewById(R.id.attachment_share);
-
- if (!m_activity.isPortrait()) {
- attachmentsShare.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- Attachment attachment = (Attachment) spinner.getSelectedItem();
-
- if (attachment != null) {
- m_activity.shareText(attachment.content_url);
- }
- }
- });
- } else {
- attachmentsShare.setVisibility(View.GONE);
- }
-
- } else {
- view.findViewById(R.id.attachments_holder).setVisibility(View.GONE);
}
content += "</body></html>";
diff --git a/src/org/fox/ttrss/FeedsActivity.java b/src/org/fox/ttrss/FeedsActivity.java index 58f8eda6..bb423285 100644 --- a/src/org/fox/ttrss/FeedsActivity.java +++ b/src/org/fox/ttrss/FeedsActivity.java @@ -159,6 +159,20 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe m_menu.findItem(R.id.update_headlines).setVisible(false);
}
+ if (af != null) {
+ if (af.getSelectedArticle() != null && af.getSelectedArticle().attachments != null && af.getSelectedArticle().attachments.size() > 0) {
+ if (!isCompatMode()) {
+ m_menu.findItem(R.id.toggle_attachments).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+ }
+ m_menu.findItem(R.id.toggle_attachments).setVisible(true);
+ } else {
+ if (!isCompatMode()) {
+ m_menu.findItem(R.id.toggle_attachments).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
+ }
+ m_menu.findItem(R.id.toggle_attachments).setVisible(false);
+ }
+ }
+
MenuItem item = m_menu.findItem(R.id.show_feeds);
if (getUnreadOnly()) {
diff --git a/src/org/fox/ttrss/HeadlinesActivity.java b/src/org/fox/ttrss/HeadlinesActivity.java index 81c4ca8c..68f226e7 100644 --- a/src/org/fox/ttrss/HeadlinesActivity.java +++ b/src/org/fox/ttrss/HeadlinesActivity.java @@ -149,10 +149,24 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL m_menu.setGroupVisible(R.id.menu_group_headlines, !isPortrait()&& hf != null && hf.getSelectedArticles().size() == 0);
m_menu.setGroupVisible(R.id.menu_group_headlines_selection, !isPortrait() && hf != null && hf.getSelectedArticles().size() != 0);
- Fragment af = getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
+ ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
m_menu.setGroupVisible(R.id.menu_group_article, af != null);
+ if (af != null) {
+ if (af.getSelectedArticle() != null && af.getSelectedArticle().attachments != null && af.getSelectedArticle().attachments.size() > 0) {
+ if (!isCompatMode()) {
+ m_menu.findItem(R.id.toggle_attachments).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+ }
+ m_menu.findItem(R.id.toggle_attachments).setVisible(true);
+ } else {
+ if (!isCompatMode()) {
+ m_menu.findItem(R.id.toggle_attachments).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
+ }
+ m_menu.findItem(R.id.toggle_attachments).setVisible(false);
+ }
+ }
+
m_menu.findItem(R.id.search).setVisible(false);
}
}
diff --git a/src/org/fox/ttrss/OnlineActivity.java b/src/org/fox/ttrss/OnlineActivity.java index 004fab6e..99b13a31 100644 --- a/src/org/fox/ttrss/OnlineActivity.java +++ b/src/org/fox/ttrss/OnlineActivity.java @@ -1,6 +1,8 @@ package org.fox.ttrss;
import java.lang.reflect.Type;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -9,6 +11,7 @@ import org.fox.ttrss.offline.OfflineDownloadService; import org.fox.ttrss.offline.OfflineUploadService;
import org.fox.ttrss.types.Article;
import org.fox.ttrss.types.ArticleList;
+import org.fox.ttrss.types.Attachment;
import org.fox.ttrss.types.Feed;
import org.fox.ttrss.types.Label;
@@ -534,6 +537,60 @@ public class OnlineActivity extends CommonActivity { case android.R.id.home:
finish();
return true;
+ case R.id.toggle_attachments:
+ if (true) {
+ Article article = ap.getSelectedArticle();
+
+ if (article != null && article.attachments != null && article.attachments.size() > 0) {
+ CharSequence[] items = new CharSequence[article.attachments.size()];
+ final CharSequence[] itemUrls = new CharSequence[article.attachments.size()];
+
+ for (int i = 0; i < article.attachments.size(); i++) {
+ items[i] = article.attachments.get(i).title != null ? article.attachments.get(i).content_url :
+ article.attachments.get(i).content_url;
+
+ itemUrls[i] = article.attachments.get(i).content_url;
+ }
+
+ Dialog dialog = new Dialog(OnlineActivity.this);
+ AlertDialog.Builder builder = new AlertDialog.Builder(OnlineActivity.this)
+ .setTitle(R.string.attachments_prompt)
+ .setSingleChoiceItems(items, 0, new OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ //
+ }
+ }).setNeutralButton(R.string.attachment_copy, new OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ int selectedPosition = ((AlertDialog)dialog).getListView().getCheckedItemPosition();
+
+ copyToClipboard((String)itemUrls[selectedPosition]);
+ }
+ }).setPositiveButton(R.string.attachment_view, new OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ int selectedPosition = ((AlertDialog)dialog).getListView().getCheckedItemPosition();
+
+ Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse((String)itemUrls[selectedPosition]));
+ startActivity(browserIntent);
+
+ dialog.cancel();
+ }
+ }).setNegativeButton(R.string.dialog_cancel, new OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ dialog.cancel();
+ }
+ });
+
+ dialog = builder.create();
+ dialog.show();
+ }
+ }
+ return true;
case R.id.donate:
if (true) {
openUnlockUrl();
diff --git a/src/org/fox/ttrss/offline/.OfflineActivity.java.swp b/src/org/fox/ttrss/offline/.OfflineActivity.java.swp Binary files differnew file mode 100644 index 00000000..56c1f525 --- /dev/null +++ b/src/org/fox/ttrss/offline/.OfflineActivity.java.swp diff --git a/src/org/fox/ttrss/offline/OfflineArticleFragment.java b/src/org/fox/ttrss/offline/OfflineArticleFragment.java index 0cf5cc4a..61ea7d39 100644 --- a/src/org/fox/ttrss/offline/OfflineArticleFragment.java +++ b/src/org/fox/ttrss/offline/OfflineArticleFragment.java @@ -227,8 +227,6 @@ public class OfflineArticleFragment extends Fragment implements GestureDetector. articleContent = doc.toString();
}
- view.findViewById(R.id.attachments_holder).setVisibility(View.GONE);
-
String align = m_prefs.getBoolean("justify_article_text", true) ? "text-align : justified" : "";
switch (Integer.parseInt(m_prefs.getString("font_size", "0"))) {
|