add unsubscribe to feed context menu
This commit is contained in:
parent
033dec883a
commit
5e8a618fd8
@ -20,4 +20,8 @@
|
|||||||
android:id="@+id/create_shortcut"
|
android:id="@+id/create_shortcut"
|
||||||
android:title="@string/place_shortcut"/>
|
android:title="@string/place_shortcut"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/unsubscribe_feed"
|
||||||
|
android:title="@string/unsubscribe"/>
|
||||||
|
|
||||||
</menu>
|
</menu>
|
@ -212,4 +212,7 @@
|
|||||||
<string name="prefs_compatible_article_layout">Compatible article layout</string>
|
<string name="prefs_compatible_article_layout">Compatible article layout</string>
|
||||||
<string name="prefs_compatible_layout_summary">Enable if you see glitches in article content</string>
|
<string name="prefs_compatible_layout_summary">Enable if you see glitches in article content</string>
|
||||||
<string name="font_size_dialog_suffix">sp</string>
|
<string name="font_size_dialog_suffix">sp</string>
|
||||||
|
<string name="server_function_not_available">Sorry, this function is not available on your tt-rss version.</string>
|
||||||
|
<string name="unsubscribe">Unsubscribe</string>
|
||||||
|
<string name="unsubscribe_from_prompt">Unsubscribe from %1$s?</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -2,6 +2,7 @@ package org.fox.ttrss;
|
|||||||
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.fox.ttrss.types.Article;
|
import org.fox.ttrss.types.Article;
|
||||||
import org.fox.ttrss.types.ArticleList;
|
import org.fox.ttrss.types.ArticleList;
|
||||||
@ -25,6 +26,7 @@ import android.util.Log;
|
|||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
||||||
|
|
||||||
public class FeedsActivity extends OnlineActivity implements HeadlinesEventListener {
|
public class FeedsActivity extends OnlineActivity implements HeadlinesEventListener {
|
||||||
@ -459,4 +461,24 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
public void createCategoryShortcut(FeedCategory cat) {
|
public void createCategoryShortcut(FeedCategory cat) {
|
||||||
createFeedShortcut(new Feed(cat.id, cat.title, true));
|
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<String, String> map = new HashMap<String, String>() {
|
||||||
|
{
|
||||||
|
put("sid", getSessionId());
|
||||||
|
put("op", "unsubscribeFeed");
|
||||||
|
put("feed_id", String.valueOf(feed.id));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
req.execute(map);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,6 +158,35 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
|||||||
m_activity.onCatSelected(new FeedCategory(feed.id, feed.title, feed.unread), false);
|
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;
|
return true;
|
||||||
case R.id.create_shortcut:
|
case R.id.create_shortcut:
|
||||||
if (true) {
|
if (true) {
|
||||||
|
@ -1004,7 +1004,7 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
if (getApiLevel() != 7) {
|
if (getApiLevel() != 7) {
|
||||||
editArticleLabels(ap.getSelectedArticle());
|
editArticleLabels(ap.getSelectedArticle());
|
||||||
} else {
|
} else {
|
||||||
toast("Sorry, this function is not available on your tt-rss version.");
|
toast(R.string.server_function_not_available);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user