Android Refresh - HeZaiJin/advance Wiki

下拉刷新

下拉刷新,使用的是ultra的下拉刷新模块。暂时没有迁移过来。

上拉加载 PtrListView

listView.setOnLoadMoreListener(new PtrListView.OnLoadMoreListener() {
            @Override
            public void onLoadMoreStart() {
                Log.d(TAG, "onLoadMoreStart() called with: " + " is in mainThread ? ="  + (Looper.myLooper() == Looper.getMainLooper()));
            }

            @Override
            public void onLoadMoreRunning() {
                Log.d(TAG, "onLoadMoreRunning() called with: " + " is in mainThread ? ="  + (Looper.myLooper() == Looper.getMainLooper()));
                try {
                    Thread.sleep(5000);
                    int size = i + 10;
                    for (; i < size; i++) {
                        list.add(i);
                    }
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }

            @Override
            public void onLoadMoreCompleted() {
                Log.d(TAG, "onLoadMoreCompleted() called with: " + " is in mainThread ? =" + (Looper.myLooper() == Looper.getMainLooper()));
                adapter.notifyDataSetChanged();
            }
        }).setOnPtrItemClickListener(new PtrListView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Log.d(TAG, "onItemClick() called with: " + "position = " + position);

            }
        }).setOnFootClickListener(new PtrListView.OnFootClickListener() {
            @Override
            public void onFootClickListener(View foot) {
                Log.d(TAG, "onFootClickListener() called with: " + "");
            }
        });