sort feeds and cats case-insensitively

bump version
This commit is contained in:
Andrew Dolgov 2013-06-07 12:51:52 +04:00
parent 952fbc022f
commit 22d949f83c
3 changed files with 18 additions and 10 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss" package="org.fox.ttrss"
android:versionCode="185" android:versionCode="186"
android:versionName="1.8.5" > android:versionName="1.8.6" >
<uses-sdk <uses-sdk
android:minSdkVersion="8" android:minSdkVersion="8"

View File

@ -11,6 +11,7 @@ import org.fox.ttrss.types.Feed;
import org.fox.ttrss.types.FeedCategory; import org.fox.ttrss.types.FeedCategory;
import org.fox.ttrss.types.FeedCategoryList; import org.fox.ttrss.types.FeedCategoryList;
import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -48,29 +49,32 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
private FeedCategory m_selectedCat; private FeedCategory m_selectedCat;
private FeedsActivity m_activity; private FeedsActivity m_activity;
@SuppressLint("DefaultLocale")
class CatUnreadComparator implements Comparator<FeedCategory> { class CatUnreadComparator implements Comparator<FeedCategory> {
@Override @Override
public int compare(FeedCategory a, FeedCategory b) { public int compare(FeedCategory a, FeedCategory b) {
if (a.unread != b.unread) if (a.unread != b.unread)
return b.unread - a.unread; return b.unread - a.unread;
else else
return a.title.compareTo(b.title); return a.title.toUpperCase().compareTo(b.title.toUpperCase());
} }
} }
@SuppressLint("DefaultLocale")
class CatTitleComparator implements Comparator<FeedCategory> { class CatTitleComparator implements Comparator<FeedCategory> {
@Override @Override
public int compare(FeedCategory a, FeedCategory b) { public int compare(FeedCategory a, FeedCategory b) {
if (a.id >= 0 && b.id >= 0) if (a.id >= 0 && b.id >= 0)
return a.title.compareTo(b.title); return a.title.toUpperCase().compareTo(b.title.toUpperCase());
else else
return a.id - b.id; return a.id - b.id;
} }
} }
@SuppressLint("DefaultLocale")
class CatOrderComparator implements Comparator<FeedCategory> { class CatOrderComparator implements Comparator<FeedCategory> {
@Override @Override
@ -79,7 +83,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
if (a.order_id != 0 && b.order_id != 0) if (a.order_id != 0 && b.order_id != 0)
return a.order_id - b.order_id; return a.order_id - b.order_id;
else else
return a.title.compareTo(b.title); return a.title.toUpperCase().compareTo(b.title.toUpperCase());
else else
return a.id - b.id; return a.id - b.id;
} }

View File

@ -17,6 +17,7 @@ import org.fox.ttrss.types.Feed;
import org.fox.ttrss.types.FeedCategory; import org.fox.ttrss.types.FeedCategory;
import org.fox.ttrss.types.FeedList; import org.fox.ttrss.types.FeedList;
import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -69,6 +70,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
m_activeCategory = cat; m_activeCategory = cat;
} }
@SuppressLint("DefaultLocale")
class FeedUnreadComparator implements Comparator<Feed> { class FeedUnreadComparator implements Comparator<Feed> {
@Override @Override
@ -76,37 +78,39 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
if (a.unread != b.unread) if (a.unread != b.unread)
return b.unread - a.unread; return b.unread - a.unread;
else else
return a.title.compareTo(b.title); return a.title.toUpperCase().compareTo(b.title.toUpperCase());
} }
} }
@SuppressLint("DefaultLocale")
class FeedTitleComparator implements Comparator<Feed> { class FeedTitleComparator implements Comparator<Feed> {
@Override @Override
public int compare(Feed a, Feed b) { public int compare(Feed a, Feed b) {
if (a.is_cat && b.is_cat) if (a.is_cat && b.is_cat)
return a.title.compareTo(b.title); return a.title.toUpperCase().compareTo(b.title.toUpperCase());
else if (a.is_cat && !b.is_cat) else if (a.is_cat && !b.is_cat)
return -1; return -1;
else if (!a.is_cat && b.is_cat) else if (!a.is_cat && b.is_cat)
return 1; return 1;
else if (a.id >= 0 && b.id >= 0) else if (a.id >= 0 && b.id >= 0)
return a.title.compareTo(b.title); return a.title.toUpperCase().compareTo(b.title.toUpperCase());
else else
return a.id - b.id; return a.id - b.id;
} }
} }
@SuppressLint("DefaultLocale")
class FeedOrderComparator implements Comparator<Feed> { class FeedOrderComparator implements Comparator<Feed> {
@Override @Override
public int compare(Feed a, Feed b) { public int compare(Feed a, Feed b) {
if (a.id >= 0 && b.id >= 0) if (a.id >= 0 && b.id >= 0)
if (a.is_cat && b.is_cat) if (a.is_cat && b.is_cat)
return a.title.compareTo(b.title); return a.title.toUpperCase().compareTo(b.title.toUpperCase());
else if (a.is_cat && !b.is_cat) else if (a.is_cat && !b.is_cat)
return -1; return -1;
else if (!a.is_cat && b.is_cat) else if (!a.is_cat && b.is_cat)
@ -114,7 +118,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
else if (a.order_id != 0 && b.order_id != 0) else if (a.order_id != 0 && b.order_id != 0)
return a.order_id - b.order_id; return a.order_id - b.order_id;
else else
return a.title.compareTo(b.title); return a.title.toUpperCase().compareTo(b.title.toUpperCase());
else else
return a.id - b.id; return a.id - b.id;
} }