summaryrefslogtreecommitdiff
path: root/src/org/fox/ttrss/MainActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/fox/ttrss/MainActivity.java')
-rw-r--r--src/org/fox/ttrss/MainActivity.java52
1 files changed, 35 insertions, 17 deletions
diff --git a/src/org/fox/ttrss/MainActivity.java b/src/org/fox/ttrss/MainActivity.java
index bb72543c..1ac736e2 100644
--- a/src/org/fox/ttrss/MainActivity.java
+++ b/src/org/fox/ttrss/MainActivity.java
@@ -183,15 +183,17 @@ public class MainActivity extends CommonActivity implements OnlineServices {
if (m_activeFeed.is_cat) {
FeedCategoriesFragment cats = (FeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
- ft.show(cats);
-
- cats.setSelectedCategory(null);
+ if (cats != null) {
+ ft.show(cats);
+ cats.setSelectedCategory(null);
+ }
} else {
FeedsFragment feeds = (FeedsFragment) getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS);
-
- ft.show(feeds);
-
- feeds.setSelectedFeed(null);
+
+ if (feeds != null) {
+ ft.show(feeds);
+ feeds.setSelectedFeed(null);
+ }
}
} else {
@@ -307,8 +309,7 @@ public class MainActivity extends CommonActivity implements OnlineServices {
refresh();
- Toast toast = Toast.makeText(MainActivity.this, R.string.offline_sync_success, Toast.LENGTH_SHORT);
- toast.show();
+ toast(R.string.offline_sync_success);
}
}
@@ -381,7 +382,11 @@ public class MainActivity extends CommonActivity implements OnlineServices {
@SuppressWarnings({ "unchecked", "serial" })
public void saveArticleMarked(final Article article) {
- ApiRequest req = new ApiRequest(getApplicationContext());
+ ApiRequest req = new ApiRequest(getApplicationContext()) {
+ protected void onPostExecute(JsonElement result) {
+ toast(article.marked ? R.string.notify_article_marked : R.string.notify_article_unmarked);
+ }
+ };
HashMap<String, String> map = new HashMap<String, String>() {
{
@@ -392,13 +397,18 @@ public class MainActivity extends CommonActivity implements OnlineServices {
put("field", "0");
}
};
-
+
req.execute(map);
}
@SuppressWarnings({ "unchecked", "serial" })
public void saveArticlePublished(final Article article) {
- ApiRequest req = new ApiRequest(getApplicationContext());
+
+ ApiRequest req = new ApiRequest(getApplicationContext()) {
+ protected void onPostExecute(JsonElement result) {
+ toast(article.published ? R.string.notify_article_published : R.string.notify_article_unpublished);
+ }
+ };
HashMap<String, String> map = new HashMap<String, String>() {
{
@@ -415,7 +425,11 @@ public class MainActivity extends CommonActivity implements OnlineServices {
@SuppressWarnings({ "unchecked", "serial" })
public void saveArticleNote(final Article article, final String note) {
- ApiRequest req = new ApiRequest(getApplicationContext());
+ ApiRequest req = new ApiRequest(getApplicationContext()) {
+ protected void onPostExecute(JsonElement result) {
+ toast(R.string.notify_article_note_set);
+ }
+ };
HashMap<String, String> map = new HashMap<String, String>() {
{
@@ -1017,10 +1031,14 @@ public class MainActivity extends CommonActivity implements OnlineServices {
if (m_activeFeed.is_cat) {
FeedCategoriesFragment cats = (FeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
- cats.setSelectedCategory(null);
+ if (cats != null) {
+ cats.setSelectedCategory(null);
+ }
} else {
FeedsFragment feeds = (FeedsFragment) getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS);
- feeds.setSelectedFeed(null);
+ if (feeds != null) {
+ feeds.setSelectedFeed(null);
+ }
}
m_activeFeed = null;
@@ -1397,8 +1415,8 @@ public class MainActivity extends CommonActivity implements OnlineServices {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
- //intent.putExtra(Intent.EXTRA_SUBJECT, article.title);
- intent.putExtra(Intent.EXTRA_TEXT, article.title + " " + article.link);
+ intent.putExtra(Intent.EXTRA_SUBJECT, article.title);
+ intent.putExtra(Intent.EXTRA_TEXT, article.link);
return intent;
}