public void showList(List<Poem> poems) { // 第一次加载 if (poemListAdapter == null) { poemListAdapter = new PoemListAdapter(getActivity(), poems); listView.setILoadListener(new LoadListener()); listView.setAdapter(poemListAdapter); } else { poemListAdapter.onDateChange(poems); } }
public List<Poem> getData() { if (RANDOM.equals(classfy)) { return jsonUtil.getRandomPoem(); } else if (AUTHOR.equals(classfy)) { List<Poem> poems = jsonUtil.getPoemByAuthorName(info, listView.getPage()); if (poems.size() >= 1) { return poems; } return null; } else if (STYLE.equals(classfy)) { List<Poem> poems = jsonUtil.getPoemByTag(info, listView.getPage()); if (poems.size() >= 1) { return poems; } return null; } // TODO还没有做完,分类没有全部完成 return jsonUtil.getRandomPoem(); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_loadlist, container, false); listView = (LoadListView) view.findViewById(R.id.load_listview); initData(); listView.setOnItemClickListener(new poemItemClickLlistener()); return view; }