Skip to content

Commit

Permalink
Merge branch 'develop' into feature/visual-editor
Browse files Browse the repository at this point in the history
Conflicts:
	WordPress/src/main/java/org/wordpress/android/ui/prefs/SettingsFragment.java
  • Loading branch information
aforcier committed Feb 23, 2016
2 parents 87d1cd7 + f925e0d commit e072fc5
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.wordpress.android.util;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;

public class BlogUtils {
Expand Down Expand Up @@ -45,4 +47,28 @@ public static String getHomeURLOrHostNameFromAccountMap(Map<String, Object> acco

return homeURL;
}

public static String[] getBlogNamesFromAccountMapList(List<Map<String, Object>> accounts) {
List<String> blogNames = new ArrayList<>();
for (Map<String, Object> account : accounts) {
blogNames.add(getBlogNameOrHomeURLFromAccountMap(account));
}
return blogNames.toArray(new String[blogNames.size()]);
}

public static String[] getHomeURLOrHostNamesFromAccountMapList(List<Map<String, Object>> accounts) {
List<String> urls = new ArrayList<>();
for (Map<String, Object> account : accounts) {
urls.add(getHomeURLOrHostNameFromAccountMap(account));
}
return urls.toArray(new String[urls.size()]);
}

public static String[] getBlogIdsFromAccountMapList(List<Map<String, Object>> accounts) {
List<String> ids = new ArrayList<>();
for (Map<String, Object> account : accounts) {
ids.add(MapUtils.getMapStr(account, "blogId"));
}
return ids.toArray(new String[ids.size()]);
}
}

0 comments on commit e072fc5

Please sign in to comment.