Skip to content

Commit

Permalink
Primary site added to Account Settings (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
oguzkocer committed Feb 1, 2016
1 parent 26983b7 commit b6449a5
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 b6449a5

Please sign in to comment.