private void initRefreshLayout() {
    mRefreshLayout.setWaveColor(0x000);
    mRefreshLayout.setIsOverLay(true);
    mRefreshLayout.setWaveShow(true);
    mRefreshLayout.setLoadMore(true);
    mRefreshLayout.setMaterialRefreshListener(
        new MaterialRefreshListener() {
          @Override
          public void onRefresh(MaterialRefreshLayout materialRefreshLayout) {
            new Handler()
                .postDelayed(
                    new Runnable() {
                      @Override
                      public void run() {
                        mRefreshLayout.finishRefresh();
                      }
                    },
                    2000);
          }

          @Override
          public void onRefreshLoadMore(MaterialRefreshLayout materialRefreshLayout) {
            new Handler()
                .postDelayed(
                    new Runnable() {
                      @Override
                      public void run() {
                        mRefreshLayout.finishRefreshLoadMore();
                      }
                    },
                    2000);
          }
        });
  }
 private void finishRefreshLoadMore(ArrayList<Creator> list) {
   if (list != null) {
     scheduleUserGroupAdapter.add(list);
   }
   refreshLayout.finishRefresh();
   refreshLayout.finishRefreshLoadMore();
 }
  /** 初始化 */
  private void initView() {
    findViewById(R.id.tv_cancel).setOnClickListener(this);
    listView = $(R.id.lv_list);
    refreshLayout = $(R.id.refresh_layout);
    View emptyView = $(R.id.list_empty_view);
    emptyView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            getNetDatas();
          }
        });
    listView.setEmptyView(emptyView);
    scheduleUserGroupAdapter = new ScheduleUserGroupAdapter(this);
    listView.setAdapter(scheduleUserGroupAdapter);
    listView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Creator p = scheduleUserGroupAdapter.getItem(position);
            Intent intent =
                new Intent(ScheduleOtherUserListActivity.this, ScheduleOtherListActivity.class);
            intent.putExtra("otherUserId", p.getId());
            startActivity(intent);
          }
        });
    refreshLayout.setLoadMore(true);
    refreshLayout.setMaterialRefreshListener(
        new MaterialRefreshListener() {
          @Override
          public void onRefresh(MaterialRefreshLayout materialRefreshLayout) {
            getNetDatas();
          }

          @Override
          public void onRefreshLoadMore(MaterialRefreshLayout materialRefreshLayout) {
            getNetDatasMore();
          }
        });
    getNetDatas();
  }
Пример #4
0
  private void Data() {
    viewSelectorLayout.show_LoadingView();
    getWeekBookData();

    refreshLayout.setMaterialRefreshListener(
        new MaterialRefreshListener() {
          @Override
          public void onRefresh(MaterialRefreshLayout materialRefreshLayout) {
            getWeekBookData();
          }
        });
  }
  @Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_list);
    initsToolbar();

    materialRefreshLayout = (MaterialRefreshLayout) findViewById(R.id.refresh);
    //        materialRefreshLayout.setWaveColor(0xffffffff);
    //        materialRefreshLayout.setIsOverLay(false);
    //        materialRefreshLayout.setWaveShow(false);
    //        materialRefreshLayout.setShowProgressBg(true);
    //
    // materialRefreshLayout.setProgressColors(getResources().getIntArray(R.array.material_colors));
    //        materialRefreshLayout.setShowArrow(true);
    materialRefreshLayout.setMaterialRefreshListener(
        new MaterialRefreshListener() {
          @Override
          public void onRefresh(final MaterialRefreshLayout materialRefreshLayout) {
            materialRefreshLayout.postDelayed(
                new Runnable() {
                  @Override
                  public void run() {
                    materialRefreshLayout.finishRefresh();
                  }
                },
                3000);
          }

          @Override
          public void onfinish() {
            Toast.makeText(RecyclerViewActivity.this, "finish", Toast.LENGTH_LONG).show();
          }
        });
    RecyclerView rv = (RecyclerView) findViewById(R.id.recyclerview);
    setupRecyclerView(rv);
  }
        @Override
        public boolean onMenuItemClick(MenuItem menuItem) {
          switch (menuItem.getItemId()) {
            case R.id.style0:
              materialRefreshLayout.setWaveColor(0xff8BC34A);
              materialRefreshLayout.setIsOverLay(false);
              materialRefreshLayout.setWaveShow(true);
              materialRefreshLayout.setShowProgressBg(true);
              materialRefreshLayout.setProgressColors(
                  getResources().getIntArray(R.array.material_colors));
              materialRefreshLayout.setShowArrow(true);
              break;
            case R.id.style1:
              break;
              //                case R.id.style2:
              //                    materialRefreshLayout.setWaveColor(0x90ffffff);
              //                    materialRefreshLayout.setIsOverLay(true);
              //                    materialRefreshLayout.setWaveShow(true);
              //                    materialRefreshLayout.setShowProgressBg(true);
              //
              // materialRefreshLayout.setProgressColors(getResources().getIntArray(R.array.material_colors));
              //                    materialRefreshLayout.setShowArrow(true);
              //                    break;
              //                case R.id.style3:
              //                    materialRefreshLayout.setWaveColor(0xff8BC34A);
              //                    materialRefreshLayout.setIsOverLay(false);
              //                    materialRefreshLayout.setWaveShow(true);
              //                    materialRefreshLayout.setShowProgressBg(true);
              //
              // materialRefreshLayout.setProgressColors(getResources().getIntArray(R.array.material_colors));
              //                    materialRefreshLayout.setShowArrow(true);
              //                    break;
          }

          return true;
        }
 @Override
 protected void handleHttpError(Throwable e) {
   super.handleHttpError(e);
   refreshLayout.finishRefresh();
   refreshLayout.finishRefreshLoadMore();
 }
 @Override
 protected void handleResponseError() {
   super.handleResponseError();
   refreshLayout.finishRefresh();
   refreshLayout.finishRefreshLoadMore();
 }
 private void onLoadFinish(ArrayList<Creator> list) {
   refreshLayout.finishRefresh();
   scheduleUserGroupAdapter.update(list);
   refreshLayout.finishRefresh();
   refreshLayout.finishRefreshLoadMore();
 }