Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ss-Android into feature/plans-master

Conflicts:
	WordPress/src/main/java/org/wordpress/android/ui/ActivityLauncher.java
	WordPress/src/main/res/values/strings.xml
  • Loading branch information
nbradbury committed Feb 23, 2016
2 parents 221b07e + 6fde017 commit 013443b
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 013443b

Please sign in to comment.