properly sort feedlist by unread, misc cleanup
This commit is contained in:
parent
581f79b3c1
commit
5178ba7287
@ -4,12 +4,6 @@
|
||||
|
||||
<group android:id="@+id/menu_group_feeds" >
|
||||
|
||||
<item
|
||||
android:id="@+id/go_offline"
|
||||
android:icon="@drawable/ic_menu_cloud"
|
||||
android:showAsAction="ifRoom|withText"
|
||||
android:title="@string/go_offline"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/back_to_categories"
|
||||
android:icon="@android:drawable/ic_menu_close_clear_cancel"
|
||||
@ -25,9 +19,15 @@
|
||||
<item
|
||||
android:id="@+id/update_feeds"
|
||||
android:icon="@android:drawable/ic_menu_rotate"
|
||||
android:showAsAction=""
|
||||
android:showAsAction="ifRoom|"
|
||||
android:title="@string/update_feeds"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/go_offline"
|
||||
android:icon="@drawable/ic_menu_cloud"
|
||||
android:showAsAction="ifRoom|withText"
|
||||
android:title="@string/go_offline"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/logout"
|
||||
android:icon="@drawable/ic_menu_exit"
|
||||
@ -46,6 +46,7 @@
|
||||
<item
|
||||
android:id="@+id/headlines_mark_as_read"
|
||||
android:icon="@drawable/ic_menu_tick"
|
||||
android:showAsAction=""
|
||||
android:title="@string/headlines_mark_as_read"/>
|
||||
|
||||
<item
|
||||
|
@ -20,12 +20,6 @@
|
||||
android:icon="@android:drawable/ic_menu_agenda"
|
||||
android:showAsAction=""
|
||||
android:title="@string/menu_all_feeds"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/logout"
|
||||
android:icon="@drawable/ic_menu_exit"
|
||||
android:showAsAction=""
|
||||
android:title="@string/logout"/>
|
||||
</group>
|
||||
|
||||
<group android:id="@+id/menu_group_headlines" >
|
||||
|
@ -101,4 +101,5 @@
|
||||
<string name="dialog_offline_go">Go offline</string>
|
||||
<string name="dialog_cancel">Cancel</string>
|
||||
<string name="syncing_offline_data">Synchronizing offline data...</string>
|
||||
<string name="dialog_offline_switch_prompt">Download unread articles and go offline?</string>
|
||||
</resources>
|
@ -43,6 +43,9 @@ import com.google.gson.reflect.TypeToken;
|
||||
public class MainActivity extends FragmentActivity implements FeedsFragment.OnFeedSelectedListener, ArticleOps, FeedCategoriesFragment.OnCatSelectedListener {
|
||||
private final String TAG = this.getClass().getSimpleName();
|
||||
|
||||
private final int OFFLINE_SYNC_SEQ = 60;
|
||||
private final int OFFLINE_SYNC_MAX = 500;
|
||||
|
||||
private SharedPreferences m_prefs;
|
||||
private String m_themeName = "";
|
||||
private String m_sessionId;
|
||||
@ -466,7 +469,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
||||
put("view_mode", "unread");
|
||||
put("show_content", "true");
|
||||
put("skip", String.valueOf(m_articleOffset));
|
||||
put("limit", "30");
|
||||
put("limit", String.valueOf(OFFLINE_SYNC_SEQ));
|
||||
}
|
||||
};
|
||||
|
||||
@ -475,6 +478,12 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void switchOffline() {
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this).
|
||||
setMessage(R.string.dialog_offline_switch_prompt).
|
||||
setPositiveButton(R.string.dialog_offline_go, new Dialog.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
Log.d(TAG, "offline: starting");
|
||||
|
||||
if (m_sessionId != null) {
|
||||
@ -546,6 +555,17 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
||||
switchOfflineSuccess();
|
||||
}
|
||||
}
|
||||
}).
|
||||
setNegativeButton(R.string.dialog_cancel, new Dialog.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
//
|
||||
}
|
||||
});
|
||||
|
||||
AlertDialog dlg = builder.create();
|
||||
dlg.show();
|
||||
|
||||
}
|
||||
|
||||
public void switchOfflineSuccess() {
|
||||
logout();
|
||||
@ -746,10 +766,9 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
||||
case R.id.headlines_select:
|
||||
if (hf != null) {
|
||||
Dialog dialog = new Dialog(this);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(R.string.headlines_select_dialog);
|
||||
|
||||
builder.setSingleChoiceItems(new String[] { getString(R.string.headlines_select_all),
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.headlines_select_dialog)
|
||||
.setSingleChoiceItems(new String[] { getString(R.string.headlines_select_all),
|
||||
getString(R.string.headlines_select_unread), getString(R.string.headlines_select_none) }, 0, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
@ -1796,7 +1815,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
||||
|
||||
Log.d(TAG, "offline: received " + articles.size() + " articles");
|
||||
|
||||
if (articles.size() == 30 && m_articleOffset < 500) {
|
||||
if (articles.size() == OFFLINE_SYNC_SEQ && m_articleOffset < OFFLINE_SYNC_MAX) {
|
||||
offlineGetArticles();
|
||||
} else {
|
||||
switchOfflineSuccess();
|
||||
|
@ -56,8 +56,10 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
|
||||
public Cursor createCursor() {
|
||||
String unreadOnly = ((OfflineActivity)getActivity()).getUnreadOnly() ? "unread > 0" : null;
|
||||
|
||||
String order = m_prefs.getBoolean("sort_feeds_by_unread", false) ? "unread DESC, title" : "title";
|
||||
|
||||
return ((OfflineActivity)getActivity()).getReadableDb().query("feeds_unread",
|
||||
null, unreadOnly, null, null, null, "title");
|
||||
null, unreadOnly, null, null, null, order);
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
|
Loading…
Reference in New Issue
Block a user