diff options
author | Andrew Dolgov <[email protected]> | 2012-03-12 14:57:57 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-03-12 14:57:57 +0300 |
commit | 8caa0fcd8261f6c3d885cd880df3aac156f9d120 (patch) | |
tree | 11eb3c467148cc667d1b1e679e1403c18ca3ff35 | |
parent | 7da5405c3f6957b53375f9783b4775e4de290a10 (diff) |
implement new attachment UI with buttons to copy URL/view separate
attachment
-rw-r--r-- | res/layout-port/headlines_row.xml | 28 | ||||
-rw-r--r-- | res/layout-port/headlines_row_selected.xml | 28 | ||||
-rw-r--r-- | res/layout-port/headlines_row_unread.xml | 28 | ||||
-rw-r--r-- | res/layout-xlarge/headlines_row.xml | 28 | ||||
-rw-r--r-- | res/layout-xlarge/headlines_row_selected.xml | 28 | ||||
-rw-r--r-- | res/layout-xlarge/headlines_row_unread.xml | 28 | ||||
-rw-r--r-- | res/layout/article_fragment.xml | 35 | ||||
-rw-r--r-- | res/layout/headlines_row.xml | 28 | ||||
-rw-r--r-- | res/layout/headlines_row_selected.xml | 28 | ||||
-rw-r--r-- | res/layout/headlines_row_unread.xml | 27 | ||||
-rw-r--r-- | res/values/strings.xml | 3 | ||||
-rw-r--r-- | src/org/fox/ttrss/ArticleFragment.java | 57 | ||||
-rw-r--r-- | src/org/fox/ttrss/Attachment.java | 17 | ||||
-rw-r--r-- | src/org/fox/ttrss/HeadlinesFragment.java | 56 | ||||
-rw-r--r-- | src/org/fox/ttrss/MainActivity.java | 27 | ||||
-rw-r--r-- | src/org/fox/ttrss/OfflineArticleFragment.java | 2 | ||||
-rw-r--r-- | src/org/fox/ttrss/OfflineHeadlinesFragment.java | 7 | ||||
-rw-r--r-- | src/org/fox/ttrss/OnlineServices.java | 2 |
18 files changed, 423 insertions, 34 deletions
diff --git a/res/layout-port/headlines_row.xml b/res/layout-port/headlines_row.xml index 23d144bd..a981cb21 100644 --- a/res/layout-port/headlines_row.xml +++ b/res/layout-port/headlines_row.xml @@ -101,5 +101,33 @@ android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
+
+ <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_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-port/headlines_row_selected.xml b/res/layout-port/headlines_row_selected.xml index b4622d6a..bb63a41f 100644 --- a/res/layout-port/headlines_row_selected.xml +++ b/res/layout-port/headlines_row_selected.xml @@ -98,7 +98,6 @@ </LinearLayout>
-
<TextView
android:id="@+id/content"
android:text="Article content"
@@ -106,4 +105,31 @@ android:layout_height="match_parent"
android:layout_weight="1" />
+ <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_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-port/headlines_row_unread.xml b/res/layout-port/headlines_row_unread.xml index c485d84b..0b79e4b3 100644 --- a/res/layout-port/headlines_row_unread.xml +++ b/res/layout-port/headlines_row_unread.xml @@ -105,4 +105,32 @@ android:layout_height="match_parent"
android:layout_weight="1" />
+ <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_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-xlarge/headlines_row.xml b/res/layout-xlarge/headlines_row.xml index ace43e40..4ac32cd3 100644 --- a/res/layout-xlarge/headlines_row.xml +++ b/res/layout-xlarge/headlines_row.xml @@ -109,4 +109,32 @@ android:padding="3dip" >
</TextView>
+ <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_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-xlarge/headlines_row_selected.xml b/res/layout-xlarge/headlines_row_selected.xml index 3734141f..fc86c1f9 100644 --- a/res/layout-xlarge/headlines_row_selected.xml +++ b/res/layout-xlarge/headlines_row_selected.xml @@ -106,5 +106,33 @@ android:layout_weight="1"
android:padding="3dip" >
</TextView>
+
+ <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_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-xlarge/headlines_row_unread.xml b/res/layout-xlarge/headlines_row_unread.xml index 210e5fb3..b5a8cf84 100644 --- a/res/layout-xlarge/headlines_row_unread.xml +++ b/res/layout-xlarge/headlines_row_unread.xml @@ -107,4 +107,32 @@ android:padding="3dip" >
</TextView>
+ <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_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 3b1eac6b..4b2b3936 100644 --- a/res/layout/article_fragment.xml +++ b/res/layout/article_fragment.xml @@ -48,10 +48,10 @@ android:layout_height="wrap_content"
android:layout_above="@+id/linearLayout3"
android:layout_alignParentLeft="true"
- android:textSize="15sp"
android:layout_alignParentTop="true"
android:layout_weight="1"
- android:text="There are many variations of passages of Lorem Ipsum available" />
+ android:text="There are many variations of passages of Lorem Ipsum available"
+ android:textSize="15sp" />
<TextView
android:id="@+id/tags"
@@ -63,7 +63,7 @@ android:ellipsize="end"
android:singleLine="true"
android:text="{TAGS}"
- android:textSize="10sp" /> + android:textSize="10sp" />
<TextView
android:id="@+id/date"
@@ -76,7 +76,6 @@ android:text="{DATE}"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="10sp" />
-
</RelativeLayout>
<ImageView
@@ -94,6 +93,34 @@ android:layout_weight="1"
android:padding="3dip" >
</WebView>
+
+ <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_copy"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:text="@string/attachment_copy" />
+ </LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file diff --git a/res/layout/headlines_row.xml b/res/layout/headlines_row.xml index cdd04d2c..253de8d6 100644 --- a/res/layout/headlines_row.xml +++ b/res/layout/headlines_row.xml @@ -109,4 +109,32 @@ android:padding="3dip" >
</TextView>
+ <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_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/headlines_row_selected.xml b/res/layout/headlines_row_selected.xml index c7ddedc3..d691f7ef 100644 --- a/res/layout/headlines_row_selected.xml +++ b/res/layout/headlines_row_selected.xml @@ -106,5 +106,33 @@ android:layout_weight="1"
android:padding="3dip" >
</TextView>
+
+ <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_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/headlines_row_unread.xml b/res/layout/headlines_row_unread.xml index 210e5fb3..f89faa5a 100644 --- a/res/layout/headlines_row_unread.xml +++ b/res/layout/headlines_row_unread.xml @@ -107,4 +107,31 @@ android:padding="3dip" >
</TextView>
+ <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_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/values/strings.xml b/res/values/strings.xml index 867120a5..0c27758f 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -129,4 +129,7 @@ <string name="tablet_article_swipe">Swipe between articles</string> <string name="article_link_copy">Copy link to clipboard</string> <string name="text_copied_to_clipboard">Text copied to clipboard</string> + <string name="attachments_prompt">Select attachment</string> + <string name="attachment_view">View</string> + <string name="attachment_copy">Copy URL</string> </resources>
\ No newline at end of file diff --git a/src/org/fox/ttrss/ArticleFragment.java b/src/org/fox/ttrss/ArticleFragment.java index 3d803df8..6890376f 100644 --- a/src/org/fox/ttrss/ArticleFragment.java +++ b/src/org/fox/ttrss/ArticleFragment.java @@ -4,6 +4,7 @@ import java.io.File; import java.net.MalformedURLException;
import java.net.URL;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Date;
import org.jsoup.Jsoup;
@@ -12,7 +13,10 @@ import org.jsoup.nodes.Element; import org.jsoup.select.Elements;
import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
import android.content.SharedPreferences;
+import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
@@ -23,11 +27,17 @@ import android.util.TypedValue; import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ContextMenu.ContextMenuInfo;
import android.webkit.WebSettings;
import android.webkit.WebView;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.Spinner;
import android.widget.TextView;
+import android.widget.Toast;
import android.widget.AdapterView.AdapterContextMenuInfo;
public class ArticleFragment extends Fragment {
@@ -178,22 +188,27 @@ public class ArticleFragment extends Fragment { "</head>" +
"<body>" + articleContent;
+ final Spinner spinner = (Spinner) view.findViewById(R.id.attachments);
+
if (m_article.attachments != null && m_article.attachments.size() != 0) {
- String attachments = "<div class=\"attachments\">" + getString(R.string.attachments) + " ";
+ 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);
for (Attachment a : m_article.attachments) {
if (a.content_type != null && a.content_url != null) {
try {
URL url = new URL(a.content_url.trim());
-
- String atitle = (a.title != null && a.title.length() > 0) ? a.title : new File(url.getFile()).getName();
if (a.content_type.indexOf("image") != -1) {
content += "<br/><img src=\"" + url.toString().trim().replace("\"", "\\\"") + "\">";
}
- attachments += "<a href=\""+url.toString().trim().replace("\"", "\\\"") + "\">" + atitle + "</a>, ";
+ spinnerArray.add(a);
} catch (MalformedURLException e) {
//
@@ -203,8 +218,38 @@ public class ArticleFragment extends Fragment { }
}
- content += attachments.replaceAll(", $", "");
- content += "</div>";
+
+ 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_onlineServices.copyToClipboard(attachment.content_url);
+ }
+ }
+ });
+
+ } else {
+ view.findViewById(R.id.attachments_holder).setVisibility(View.GONE);
}
content += "</body></html>";
diff --git a/src/org/fox/ttrss/Attachment.java b/src/org/fox/ttrss/Attachment.java index 38cc16d8..37c4a08a 100644 --- a/src/org/fox/ttrss/Attachment.java +++ b/src/org/fox/ttrss/Attachment.java @@ -1,5 +1,9 @@ package org.fox.ttrss;
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
import android.os.Parcel;
import android.os.Parcelable;
@@ -30,6 +34,19 @@ public class Attachment implements Parcelable { out.writeInt(post_id);
}
+ public String toString() {
+ if (title != null && title.length() > 0) {
+ return title;
+ } else {
+ try {
+ URL url = new URL(content_url.trim());
+ return new File(url.getFile()).getName();
+ } catch (MalformedURLException e) {
+ return content_url;
+ }
+ }
+ }
+
public void readFromParcel(Parcel in) {
id = in.readInt();
content_url = in.readString();
diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java index e0927790..c1c69774 100644 --- a/src/org/fox/ttrss/HeadlinesFragment.java +++ b/src/org/fox/ttrss/HeadlinesFragment.java @@ -16,9 +16,11 @@ import org.jsoup.Jsoup; import android.app.Activity;
import android.content.Context;
+import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
+import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
@@ -38,9 +40,11 @@ import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
+import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.ListView;
+import android.widget.Spinner;
import android.widget.TextView;
import com.google.gson.Gson;
@@ -444,34 +448,67 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, if (m_combinedMode) {
content.setMovementMethod(LinkMovementMethod.getInstance());
+ final Spinner spinner = (Spinner) v.findViewById(R.id.attachments);
+
+ 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);
+
if (article.attachments != null && article.attachments.size() != 0) {
- String attachments = "<div style=\"font-size : 70%; margin-top : 1em;\">" + getString(R.string.attachments) + " ";
-
for (Attachment a : article.attachments) {
if (a.content_type != null && a.content_url != null) {
try {
URL url = new URL(a.content_url.trim());
- String atitle = (a.title != null && a.title.length() > 0) ? a.title : new File(url.getFile()).getName();
-
if (a.content_type.indexOf("image") != -1) {
articleContent += "<br/><img src=\"" + url.toString().trim().replace("\"", "\\\"") + "\">";
}
- attachments += "<a href=\""+url.toString().trim().replace("\"", "\\\"") + "\">" + atitle + "</a>, ";
+ spinnerArray.add(a);
} catch (MalformedURLException e) {
//
} catch (Exception e) {
e.printStackTrace();
- }
-
+ }
}
}
- articleContent += attachments.replaceAll(", $", "");
- articleContent += "</div>";
+ spinner.setAdapter(spinnerArrayAdapter);
+
+ Button attachmentsView = (Button) v.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) v.findViewById(R.id.attachment_copy);
+
+ attachmentsCopy.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ Attachment attachment = (Attachment) spinner.getSelectedItem();
+
+ if (attachment != null) {
+ m_onlineServices.copyToClipboard(attachment.content_url);
+ }
+ }
+ });
+
+ } else {
+ v.findViewById(R.id.attachments_holder).setVisibility(View.GONE);
}
//content.setText(Html.fromHtml(article.content, new URLImageGetter(content, getActivity()), null));
@@ -491,6 +528,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, } else {
content.setVisibility(View.GONE);
+ v.findViewById(R.id.attachments_holder).setVisibility(View.GONE);
}
}
diff --git a/src/org/fox/ttrss/MainActivity.java b/src/org/fox/ttrss/MainActivity.java index 70976e65..a86204c2 100644 --- a/src/org/fox/ttrss/MainActivity.java +++ b/src/org/fox/ttrss/MainActivity.java @@ -1829,17 +1829,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices { } if (article != null) { - if (android.os.Build.VERSION.SDK_INT < 11) { - @SuppressWarnings("deprecation") - android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(CLIPBOARD_SERVICE); - clipboard.setText(article.link); - } else { - android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService(CLIPBOARD_SERVICE); - clipboard.setText(article.link); - } - - Toast toast = Toast.makeText(MainActivity.this, R.string.text_copied_to_clipboard, Toast.LENGTH_SHORT); - toast.show(); + copyToClipboard(article.link); } } return true; @@ -2088,4 +2078,19 @@ public class MainActivity extends FragmentActivity implements OnlineServices { m_selectedArticle = article; updateHeadlines(); } + + @Override + public void copyToClipboard(String str) { + if (android.os.Build.VERSION.SDK_INT < 11) { + @SuppressWarnings("deprecation") + android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(CLIPBOARD_SERVICE); + clipboard.setText(str); + } else { + android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService(CLIPBOARD_SERVICE); + clipboard.setText(str); + } + + Toast toast = Toast.makeText(MainActivity.this, R.string.text_copied_to_clipboard, Toast.LENGTH_SHORT); + toast.show(); + } }
\ No newline at end of file diff --git a/src/org/fox/ttrss/OfflineArticleFragment.java b/src/org/fox/ttrss/OfflineArticleFragment.java index c37c2a45..04ad3384 100644 --- a/src/org/fox/ttrss/OfflineArticleFragment.java +++ b/src/org/fox/ttrss/OfflineArticleFragment.java @@ -165,6 +165,8 @@ public class OfflineArticleFragment extends Fragment { articleContent = doc.toString();
}
+ view.findViewById(R.id.attachments_holder).setVisibility(View.GONE);
+
switch (Integer.parseInt(m_prefs.getString("font_size", "0"))) {
case 0:
cssOverride += "body { text-align : justify; font-size : 14px; } ";
diff --git a/src/org/fox/ttrss/OfflineHeadlinesFragment.java b/src/org/fox/ttrss/OfflineHeadlinesFragment.java index 2dda7197..98083de1 100644 --- a/src/org/fox/ttrss/OfflineHeadlinesFragment.java +++ b/src/org/fox/ttrss/OfflineHeadlinesFragment.java @@ -291,7 +291,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis tt.setText(Html.fromHtml(article.getString(article.getColumnIndex("title"))));
}
}
-
+
ImageView marked = (ImageView)v.findViewById(R.id.marked);
if (marked != null) {
@@ -370,10 +370,11 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis }
} else {
content.setVisibility(View.GONE);
- }
-
+ }
}
+ v.findViewById(R.id.attachments_holder).setVisibility(View.GONE);
+
TextView dv = (TextView) v.findViewById(R.id.date);
if (dv != null) {
diff --git a/src/org/fox/ttrss/OnlineServices.java b/src/org/fox/ttrss/OnlineServices.java index 9d16ec33..a4a10f08 100644 --- a/src/org/fox/ttrss/OnlineServices.java +++ b/src/org/fox/ttrss/OnlineServices.java @@ -24,5 +24,7 @@ public interface OnlineServices { public boolean getUnreadOnly();
public int getApiLevel();
public void setSelectedArticle(Article article);
+
+ public void copyToClipboard(String str);
}
|