@Override public void initComponents() { lvPulldown = (PullDownListView) innerView.findViewById(R.id.lvPulldown); list = new ArrayList<ArticleListItem>(); adapter = new ArticleListAdapter(getActivity(), list); lvPulldown.getListView().setAdapter(adapter); loader = new ArticleListLoader(getActivity()); lvPulldown.enableAutoFetchMore(true, 1); lvPulldown.getListView().setFocusableInTouchMode(false); }
@Override public void onLoadComplete(Loader<List<SbbsMeMessage>> loader, List<SbbsMeMessage> data) { listMessage.clear(); if (data != null) { listMessage.addAll(data); } if (getActivity() != null) { tvNodata.setEnabled(true); tvNodata.setVisibility(listMessage.size() == 0 ? View.VISIBLE : View.GONE); tvNodata.setText(R.string.no_data_refresh); adapter.setNewList(listMessage); tvLoading.setVisibility(View.GONE); lvPullDown.getListView().setSelected(false); lvPullDown.notifyDidRefresh(); } }
@Override public void handleMessage(Message msg) { if (msg.what == 1) { lvPullDown.notifyDidMore(); } super.handleMessage(msg); };
@Override public void initLogic() { if (!SbbsMeAPI.isLogin()) { lvPullDown.setEnabled(false); lvPullDown.getListView().setEnabled(false); tvLoading.setText(R.string.not_login); tvLoading.setVisibility(View.VISIBLE); tvNodata.setText(R.string.no_data_cannot_refresh); tvNodata.setVisibility(View.VISIBLE); } else if (listMessage.size() == 0) { tvLoading.setVisibility(View.VISIBLE); loader.startLoading(); } lvPullDown.notifyDidLoad(); SbbsMeAPI.writeLogT(getActivity(), SbbsMeLogs.LOG_RECENT, ""); }
@Override public void initComponents() { lvPullDown = (PullDownListView) innerView.findViewById(R.id.lvPullDown); tvLoading = (TextView) innerView.findViewById(R.id.tvLoading); tvNodata = (TextView) innerView.findViewById(R.id.tvNodata); if (listMessage == null) { listMessage = new ArrayList<SbbsMeMessage>(); } adapter = new SbbsMeMessageAdapter(getActivity(), listMessage); lvPullDown.getListView().setAdapter(adapter); loader = new SbbsMessageLoader(getActivity()); lvPullDown.enableAutoFetchMore(true, 1); lvPullDown.setOnPullDownListener(this); int devide = UIUtils.dipToPx(8); lvPullDown.getListView().setDivider(null); lvPullDown.getListView().setDividerHeight(devide); lvPullDown.getListView().setPadding(devide, devide, devide, devide); lvPullDown.getListView().setOverScrollMode(View.OVER_SCROLL_NEVER); lvPullDown.getListView().setFocusableInTouchMode(false); }
@Override public void initEvents() { lvPullDown.getListView().setOnItemClickListener(this); tvNodata.setOnClickListener(this); loader.registerListener(0, this); }
@Override public void initLogic() { loader.startLoading(); lvPulldown.notifyDidLoad(); }