add preference to confirm marking headlines as read
This commit is contained in:
parent
c1b41d9de8
commit
709b3838bb
@ -196,4 +196,5 @@
|
|||||||
<string name="pref_headlines_mark_read_scroll">Mark read on scroll</string>
|
<string name="pref_headlines_mark_read_scroll">Mark read on scroll</string>
|
||||||
<string name="pref_headlines_mark_read_scroll_long">Headlines will be marked read when scrolling past them</string>
|
<string name="pref_headlines_mark_read_scroll_long">Headlines will be marked read when scrolling past them</string>
|
||||||
<string name="mark_num_headlines_as_read">Mark %1$d article(s) as read?</string>
|
<string name="mark_num_headlines_as_read">Mark %1$d article(s) as read?</string>
|
||||||
|
<string name="prefs_confirm_headlines_catchup">Confirm marking articles as read</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -129,6 +129,12 @@
|
|||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="full_screen_mode"
|
android:key="full_screen_mode"
|
||||||
android:title="@string/prefs_fullscreen_mode" />
|
android:title="@string/prefs_fullscreen_mode" />
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="confirm_headlines_catchup"
|
||||||
|
android:title="@string/prefs_confirm_headlines_catchup" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/offline_mode" >
|
<PreferenceCategory android:title="@string/offline_mode" >
|
||||||
<ListPreference
|
<ListPreference
|
||||||
|
@ -749,7 +749,10 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
|
|
||||||
int count = hf.getUnreadArticles().size();
|
int count = hf.getUnreadArticles().size();
|
||||||
|
|
||||||
|
boolean confirm = m_prefs.getBoolean("confirm_headlines_catchup", true);
|
||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
|
if (confirm) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(
|
AlertDialog.Builder builder = new AlertDialog.Builder(
|
||||||
OnlineActivity.this)
|
OnlineActivity.this)
|
||||||
.setMessage(getString(R.string.mark_num_headlines_as_read, count))
|
.setMessage(getString(R.string.mark_num_headlines_as_read, count))
|
||||||
@ -758,33 +761,7 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
public void onClick(DialogInterface dialog,
|
public void onClick(DialogInterface dialog,
|
||||||
int which) {
|
int which) {
|
||||||
|
|
||||||
ArticleList articles = hf.getUnreadArticles();
|
catchupVisibleArticles();
|
||||||
|
|
||||||
for (Article a : articles)
|
|
||||||
a.unread = false;
|
|
||||||
|
|
||||||
ApiRequest req = new ApiRequest(getApplicationContext()) {
|
|
||||||
protected void onPostExecute(JsonElement result) {
|
|
||||||
if (hf.isAdded()) {
|
|
||||||
hf.refresh(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
final String articleIds = articlesToIdString(articles);
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
HashMap<String, String> map = new HashMap<String, String>() {
|
|
||||||
{
|
|
||||||
put("sid", getSessionId());
|
|
||||||
put("op", "updateArticle");
|
|
||||||
put("article_ids", articleIds);
|
|
||||||
put("mode", "0");
|
|
||||||
put("field", "2");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
req.execute(map);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -798,6 +775,9 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
|
|
||||||
AlertDialog dlg = builder.create();
|
AlertDialog dlg = builder.create();
|
||||||
dlg.show();
|
dlg.show();
|
||||||
|
} else {
|
||||||
|
catchupVisibleArticles();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -1020,6 +1000,39 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void catchupVisibleArticles() {
|
||||||
|
final HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||||
|
|
||||||
|
if (hf != null) {
|
||||||
|
ArticleList articles = hf.getUnreadArticles();
|
||||||
|
|
||||||
|
for (Article a : articles)
|
||||||
|
a.unread = false;
|
||||||
|
|
||||||
|
ApiRequest req = new ApiRequest(getApplicationContext()) {
|
||||||
|
protected void onPostExecute(JsonElement result) {
|
||||||
|
if (hf.isAdded()) {
|
||||||
|
hf.refresh(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
final String articleIds = articlesToIdString(articles);
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
HashMap<String, String> map = new HashMap<String, String>() {
|
||||||
|
{
|
||||||
|
put("sid", getSessionId());
|
||||||
|
put("op", "updateArticle");
|
||||||
|
put("article_ids", articleIds);
|
||||||
|
put("mode", "0");
|
||||||
|
put("field", "2");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
req.execute(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void editArticleNote(final Article article) {
|
public void editArticleNote(final Article article) {
|
||||||
String note = "";
|
String note = "";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user