// On friend list fetch success @Override public void onSuccess(List<SocialMember> response) { if (response != null && response.size() > 0) { friendListAdapter.setItems(response); } refreshPage(State.LOADED); }
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (savedInstanceState != null) { ArrayList<SocialMember> friends = savedInstanceState.getParcelableArrayList(FRIEND_LIST_MODELS); friendListAdapter.setItems(friends); // Restore the saved selected set long[] selected = savedInstanceState.getLongArray(FRIEND_LIST_STATES); if (selected != null) { friendListAdapter.setSelectedList(JavaUtil.primitiveLongToSet(selected)); } // Restore the saved already in group set long[] alreadyInGroup = savedInstanceState.getLongArray(FRIEND_LIST_ALREADY_IN_GROUP); if (alreadyInGroup != null) { friendListAdapter.setAlreadyInGroupList(JavaUtil.primitiveLongToSet(alreadyInGroup)); } refreshPage(State.LOADED); } else if (getArguments() != null && getArguments().containsKey(EXTRA_OPT_FRIENDS_LIST)) { List<SocialMember> friends = getArguments().getParcelableArrayList(EXTRA_OPT_FRIENDS_LIST); friendListAdapter.setItems(friends); refreshPage(State.LOADED); } else { friendProvider.getMyFriends(getActivity(), this); refreshPage(State.LOADING); } // Retrieve the already in group list if (getArguments() != null && getArguments().containsKey(EXTRA_OPT_IN_GROUP)) { long[] alreadyInGroup = getArguments().getLongArray(EXTRA_OPT_IN_GROUP); friendListAdapter.setAlreadyInGroupList(JavaUtil.primitiveLongToSet(alreadyInGroup)); } }