コード例 #1
0
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mainView =
        inflater.inflate(
            R.layout.fragment_secretmsg_fans,
            (ViewGroup) getActivity().findViewById(R.id.vp),
            false);

    mainView.findViewById(R.id.llSearch).setOnClickListener(this);

    refreshListView = (MyPullToRefreshListView) mainView.findViewById(R.id.pullRefreshList);
    refreshListView.setMode(Mode.BOTH);
    refreshListView
        .getLoadingLayoutProxy(false, true)
        .setPullLabel(getString(R.string.refreshlvFooter1)); // 下拉刷新...
    refreshListView
        .getLoadingLayoutProxy(false, true)
        .setRefreshingLabel(getString(R.string.refreshlvFooter2)); // 放开刷新...
    refreshListView
        .getLoadingLayoutProxy(false, true)
        .setReleaseLabel(getString(R.string.refreshlvFooter3)); // 正在加载...
    refreshListView
        .getLoadingLayoutProxy(true, false)
        .setPullLabel(getString(R.string.refreshlvHeader1)); // 下拉刷新...
    refreshListView
        .getLoadingLayoutProxy(true, false)
        .setRefreshingLabel(getString(R.string.refreshlvHeader2)); // 放开刷新...
    refreshListView
        .getLoadingLayoutProxy(true, false)
        .setReleaseLabel(getString(R.string.refreshlvHeader3)); // 正在加载...

    refreshListView.setOnRefreshListener(
        new OnRefreshListener<ListView>() {

          @Override
          public void onRefresh(PullToRefreshBase<ListView> refreshView) {
            if (refreshListView.isNoReFreshing()) {
              if (refreshListView.isHeaderShown()) {
                String label =
                    DateUtils.formatDateTime(
                        getActivity().getApplicationContext(),
                        System.currentTimeMillis(),
                        DateUtils.FORMAT_SHOW_TIME
                            | DateUtils.FORMAT_SHOW_DATE
                            | DateUtils.FORMAT_ABBREV_ALL);
                refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label);
                refreshListView.setStatusUp();
                requestDatas();
              } else if (refreshListView.isFooterShown()) {
                String label =
                    DateUtils.formatDateTime(
                        getActivity().getApplicationContext(),
                        System.currentTimeMillis(),
                        DateUtils.FORMAT_SHOW_TIME
                            | DateUtils.FORMAT_SHOW_DATE
                            | DateUtils.FORMAT_ABBREV_ALL);
                refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label);
                requestDatas();
              }
            } else {
              refreshListView.onRefreshComplete();
            }
          }
        });
    adapter = new AdapterClassMember(getActivity());
    refreshListView.setAdapter(adapter);
    refreshListView.setOnItemClickListener(this);
    return mainView;
  }
コード例 #2
0
 private void addDatas(List<ClassMemberData> datas) {
   adapter.getDatas().addAll(datas);
   adapter.notifyDataSetChanged();
   refreshListView.onRefreshComplete2();
 }