From cec9c82f83514cc2523feca59cb7f69f829f8e6c Mon Sep 17 00:00:00 2001 From: Maxime Biais Date: Fri, 6 Mar 2015 17:04:55 +0100 Subject: [PATCH] fix #2328: sort blogs with an empty title by their hostname --- .../org/wordpress/android/util/BlogUtils.java | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/WordPressUtils/src/main/java/org/wordpress/android/util/BlogUtils.java b/WordPressUtils/src/main/java/org/wordpress/android/util/BlogUtils.java index 4944bf0a8a2d..0e07040a97c6 100644 --- a/WordPressUtils/src/main/java/org/wordpress/android/util/BlogUtils.java +++ b/WordPressUtils/src/main/java/org/wordpress/android/util/BlogUtils.java @@ -6,19 +6,10 @@ public class BlogUtils { public static Comparator BlogNameComparator = new Comparator() { public int compare(Object blog1, Object blog2) { - Map blogMap1 = (Map) blog1; - Map blogMap2 = (Map) blog2; - - String blogName1 = MapUtils.getMapStr(blogMap1, "blogName"); - if (blogName1.length() == 0) { - blogName1 = MapUtils.getMapStr(blogMap1, "url"); - } - - String blogName2 = MapUtils.getMapStr(blogMap2, "blogName"); - if (blogName2.length() == 0) { - blogName2 = MapUtils.getMapStr(blogMap2, "url"); - } - + Map blogMap1 = (Map) blog1; + Map blogMap2 = (Map) blog2; + String blogName1 = getBlogNameOrHostNameFromAccountMap(blogMap1); + String blogName2 = getBlogNameOrHostNameFromAccountMap(blogMap2); return blogName1.compareToIgnoreCase(blogName2); } };