add toast notifications for article mark/publish/setnote
This commit is contained in:
parent
48dc7fd846
commit
0020fdf172
@ -123,4 +123,9 @@
|
|||||||
<string name="close_article">Close article</string>
|
<string name="close_article">Close article</string>
|
||||||
<string name="dialog_open_preferences">Open preferences</string>
|
<string name="dialog_open_preferences">Open preferences</string>
|
||||||
<string name="dialog_need_configure_prompt">Please fill in your tt-rss server information such as URL, login, and password.</string>
|
<string name="dialog_need_configure_prompt">Please fill in your tt-rss server information such as URL, login, and password.</string>
|
||||||
|
<string name="notify_article_marked">Article starred</string>
|
||||||
|
<string name="notify_article_unmarked">Article unstarred</string>
|
||||||
|
<string name="notify_article_published">Article published</string>
|
||||||
|
<string name="notify_article_unpublished">Article unpublished</string>
|
||||||
|
<string name="notify_article_note_set">Article note saved</string>
|
||||||
</resources>
|
</resources>
|
@ -31,6 +31,16 @@ public class CommonActivity extends FragmentActivity {
|
|||||||
m_smallScreenMode = smallScreen;
|
m_smallScreenMode = smallScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void toast(int msgId) {
|
||||||
|
Toast toast = Toast.makeText(CommonActivity.this, msgId, Toast.LENGTH_SHORT);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toast(String msg) {
|
||||||
|
Toast toast = Toast.makeText(CommonActivity.this, msg, Toast.LENGTH_SHORT);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
|
|
||||||
protected void detectSmallTablet() {
|
protected void detectSmallTablet() {
|
||||||
|
|
||||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||||
|
@ -307,8 +307,7 @@ public class MainActivity extends CommonActivity implements OnlineServices {
|
|||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
Toast toast = Toast.makeText(MainActivity.this, R.string.offline_sync_success, Toast.LENGTH_SHORT);
|
toast(R.string.offline_sync_success);
|
||||||
toast.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -381,7 +380,11 @@ public class MainActivity extends CommonActivity implements OnlineServices {
|
|||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "serial" })
|
@SuppressWarnings({ "unchecked", "serial" })
|
||||||
public void saveArticleMarked(final Article article) {
|
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>() {
|
HashMap<String, String> map = new HashMap<String, String>() {
|
||||||
{
|
{
|
||||||
@ -398,7 +401,12 @@ public class MainActivity extends CommonActivity implements OnlineServices {
|
|||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "serial" })
|
@SuppressWarnings({ "unchecked", "serial" })
|
||||||
public void saveArticlePublished(final Article article) {
|
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>() {
|
HashMap<String, String> map = new HashMap<String, String>() {
|
||||||
{
|
{
|
||||||
@ -415,7 +423,11 @@ public class MainActivity extends CommonActivity implements OnlineServices {
|
|||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "serial" })
|
@SuppressWarnings({ "unchecked", "serial" })
|
||||||
public void saveArticleNote(final Article article, final String note) {
|
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>() {
|
HashMap<String, String> map = new HashMap<String, String>() {
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user