Search in sources :

Example 1 with NearByPeopleAdapter

use of com.lingtuan.firefly.adapter.NearByPeopleAdapter in project SmartMesh_Android by SmartMeshFoundation.

the class NearByPeopleUI method initData.

@Override
protected void initData() {
    swipeLayout.setColorScheme(R.color.app_title_bg);
    setTitle(getString(R.string.near_by_people_title));
    String filter = MySharedPrefs.readString(this, MySharedPrefs.FILE_USER, MySharedPrefs.NEARY_PEOPLE_FILTER);
    if (!TextUtils.isEmpty(filter)) {
        // int index=Integer.parseInt(filter);
        // imgFilter.setText(sexFilter[index]);
        CURRENT_FILTER = filter;
    }
    // else{
    // imgFilter.setText(sexFilter[0]);
    // }
    imgFilter.setVisibility(View.VISIBLE);
    source = new ArrayList<UserInfoVo>();
    String response = Utils.readFromFile("discover-people_nearby.json");
    if (!TextUtils.isEmpty(response)) {
        try {
            JSONObject json = new JSONObject(response);
            JSONArray array = json.optJSONArray("data");
            parseJson(array);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    mRequestUtils = NetRequestUtils.getInstance();
    adapter = new NearByPeopleAdapter(this, source);
    nearLv.setAdapter(adapter);
    new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
            swipeLayout.setRefreshing(true);
            loadNearByList(1, CURRENT_FILTER);
        }
    }, 500);
}
Also used : JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) JSONException(org.json.JSONException) Handler(android.os.Handler) NearByPeopleAdapter(com.lingtuan.firefly.adapter.NearByPeopleAdapter) UserInfoVo(com.lingtuan.firefly.vo.UserInfoVo)

Aggregations

Handler (android.os.Handler)1 NearByPeopleAdapter (com.lingtuan.firefly.adapter.NearByPeopleAdapter)1 UserInfoVo (com.lingtuan.firefly.vo.UserInfoVo)1 JSONArray (org.json.JSONArray)1 JSONException (org.json.JSONException)1 JSONObject (org.json.JSONObject)1