@Override public void onResponse(String response) { searchUserAdapter.setIsSearchMode(true); tv_friends_list.setText(R.string.search_result_list); searchUserAdapter.clearData(); user = JsonUtils.getListFromJson(response, User.class); searchUserAdapter.getList().addAll(user); searchUserAdapter.notifyDataSetChanged(); }
@Override public void onResponse(String response) { searchUserAdapter.setIsSearchMode(false); searchUserAdapter.clearData(); JSONObject jsonObject; try { jsonObject = new JSONObject(response); String json = jsonObject.getString("users"); user = JsonUtils.getListFromJson(json, User.class); mProgressBar.setVisibility(View.GONE); searchUserAdapter.getList().addAll(user); searchUserAdapter.notifyDataSetChanged(); } catch (JSONException e) { e.printStackTrace(); } }
@Override public void initData(Bundle savedInstanceState) { Bundle arguments = getArguments(); type = arguments.getInt("type", 0); if (type == SearchUserActivity.SEARCH_USER) { mProgressBar.setVisibility(View.GONE); tv_friends_list.setText(R.string.search_result_list); // TODO 搜索用户 } else if (type == SearchUserActivity.AT_USER) { tv_tips.setText(R.string.follower_num_limit); searchUserAdapter.setOnItemClickListener(onItemClicklistener); String url = AppConstant.FRIENDSHIPS_FRIENDS_URL + "?access_token=" + SharePrefUtil.getString(context, "access_token", "") + "&uid=" + SharePrefUtil.getString(context, "uid", "") + "&count=50"; getData(url, listener, errorListener); } }