enable nested categories API

This commit is contained in:
Andrew Dolgov 2012-09-18 10:03:16 +04:00
parent 3da48391d6
commit 1a7edb4254
3 changed files with 29 additions and 5 deletions

View File

@ -224,6 +224,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
{
put("op", "getCategories");
put("sid", sessionId);
put("enable_nested", "true");
if (unreadOnly) {
put("unread_only", String.valueOf(unreadOnly));
}

View File

@ -99,7 +99,13 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
@Override
public int compare(Feed a, Feed b) {
if (a.id >= 0 && b.id >= 0)
if (a.is_cat && b.is_cat)
return a.title.compareTo(b.title);
else if (a.is_cat && !b.is_cat)
return -1;
else if (!a.is_cat && b.is_cat)
return 1;
else if (a.id >= 0 && b.id >= 0)
return a.title.compareTo(b.title);
else
return a.id - b.id;
@ -112,7 +118,13 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
@Override
public int compare(Feed a, Feed b) {
if (a.id >= 0 && b.id >= 0)
if (a.order_id != 0 && b.order_id != 0)
if (a.is_cat && b.is_cat)
return a.title.compareTo(b.title);
else if (a.is_cat && !b.is_cat)
return -1;
else if (!a.is_cat && b.is_cat)
return 1;
else if (a.order_id != 0 && b.order_id != 0)
return a.order_id - b.order_id;
else
return a.title.compareTo(b.title);
@ -223,7 +235,16 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
if (list != null) {
Feed feed = (Feed)list.getItemAtPosition(position);
m_activity.onFeedSelected(feed);
if (feed.is_cat) {
FeedCategory cat = new FeedCategory();
cat.id = feed.id;
cat.title = feed.title;
m_activity.onCatSelected(cat);
} else {
m_activity.onFeedSelected(feed);
}
if (!m_activity.isSmallScreen())
m_selectedFeed = feed;
@ -256,6 +277,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
{
put("op", "getFeeds");
put("sid", sessionId);
put("include_nested", "true");
put("cat_id", String.valueOf(catId));
if (unreadOnly) {
put("unread_only", String.valueOf(unreadOnly));

View File

@ -394,6 +394,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
put("offset", String.valueOf(0));
put("view_mode", showUnread ? "adaptive" : "all_articles");
put("skip", String.valueOf(fskip));
put("include_nested", "true");
if (isCat) put("is_cat", "true");