diff --git a/res/menu/feed_menu.xml b/res/menu/feed_menu.xml
index c0578897..fa7dac1f 100644
--- a/res/menu/feed_menu.xml
+++ b/res/menu/feed_menu.xml
@@ -19,5 +19,9 @@
+
+
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 7cbb05c8..fc488f70 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -212,4 +212,7 @@
Compatible article layout
Enable if you see glitches in article content
sp
+ Sorry, this function is not available on your tt-rss version.
+ Unsubscribe
+ Unsubscribe from %1$s?
diff --git a/src/org/fox/ttrss/FeedsActivity.java b/src/org/fox/ttrss/FeedsActivity.java
index 39b5f487..9c8a54bc 100644
--- a/src/org/fox/ttrss/FeedsActivity.java
+++ b/src/org/fox/ttrss/FeedsActivity.java
@@ -2,6 +2,7 @@ package org.fox.ttrss;
import java.util.Date;
+import java.util.HashMap;
import org.fox.ttrss.types.Article;
import org.fox.ttrss.types.ArticleList;
@@ -25,6 +26,7 @@ import android.util.Log;
import android.widget.LinearLayout;
import com.actionbarsherlock.view.MenuItem;
+import com.google.gson.JsonElement;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
public class FeedsActivity extends OnlineActivity implements HeadlinesEventListener {
@@ -459,4 +461,24 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
public void createCategoryShortcut(FeedCategory cat) {
createFeedShortcut(new Feed(cat.id, cat.title, true));
}
+
+ public void unsubscribeFeed(final Feed feed) {
+ ApiRequest req = new ApiRequest(getApplicationContext()) {
+ protected void onPostExecute(JsonElement result) {
+ refresh();
+ }
+ };
+
+ @SuppressWarnings("serial")
+ HashMap map = new HashMap() {
+ {
+ put("sid", getSessionId());
+ put("op", "unsubscribeFeed");
+ put("feed_id", String.valueOf(feed.id));
+ }
+ };
+
+ req.execute(map);
+
+ }
}
diff --git a/src/org/fox/ttrss/FeedsFragment.java b/src/org/fox/ttrss/FeedsFragment.java
index 430294ed..cd08b35f 100644
--- a/src/org/fox/ttrss/FeedsFragment.java
+++ b/src/org/fox/ttrss/FeedsFragment.java
@@ -158,6 +158,35 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
m_activity.onCatSelected(new FeedCategory(feed.id, feed.title, feed.unread), false);
}
}
+ return true;
+ case R.id.unsubscribe_feed:
+ if (true) {
+ final Feed feed = getFeedAtPosition(info.position);
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(
+ m_activity)
+ .setMessage(getString(R.string.unsubscribe_from_prompt, feed.title))
+ .setPositiveButton(R.string.unsubscribe,
+ new Dialog.OnClickListener() {
+ public void onClick(DialogInterface dialog,
+ int which) {
+
+ m_activity.unsubscribeFeed(feed);
+
+ }
+ })
+ .setNegativeButton(R.string.dialog_cancel,
+ new Dialog.OnClickListener() {
+ public void onClick(DialogInterface dialog,
+ int which) {
+
+ }
+ });
+
+ AlertDialog dlg = builder.create();
+ dlg.show();
+ }
+
return true;
case R.id.create_shortcut:
if (true) {
diff --git a/src/org/fox/ttrss/OnlineActivity.java b/src/org/fox/ttrss/OnlineActivity.java
index d68c3642..8d856cd9 100644
--- a/src/org/fox/ttrss/OnlineActivity.java
+++ b/src/org/fox/ttrss/OnlineActivity.java
@@ -1004,7 +1004,7 @@ public class OnlineActivity extends CommonActivity {
if (getApiLevel() != 7) {
editArticleLabels(ap.getSelectedArticle());
} else {
- toast("Sorry, this function is not available on your tt-rss version.");
+ toast(R.string.server_function_not_available);
}
}