コード例 #1
0
  private void initView() {
    // init RecyclerView
    recyclerView = (RecyclerView) findViewById(R.id.activity_favorites_recyclerView);
    recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext()));
    recyclerView.addItemDecoration(new GridDividerDecoration(recyclerView.getContext()));
    recyclerView.setAdapter(
        new MainActivityFileRecyclerViewAdapter(
            this,
            getFavoriteDataArrayList(),
            MainActivityFileRecyclerViewAdapter.FLAG_FAVORITE,
            user));
    adapter = (MainActivityFileRecyclerViewAdapter) recyclerView.getAdapter();

    // 刷新数据相关
    mSwipeRefreshLayout =
        (SwipeRefreshLayout) findViewById(R.id.activity_favorites_swipe_refresh_layout);
    mSwipeRefreshLayout.setOnRefreshListener(this);
    mSwipeRefreshLayout.setColorSchemeResources(R.color.green_800);

    Map<String, String> params = new HashMap<String, String>();
    params.put("uid", "" + user.getUid());
    params.put("pagenum", pagenum + "");
    pagenum++;
    GetFavoritesFile get = new GetFavoritesFile(this);
    get.execute(params);
  }
コード例 #2
0
  @Override
  public void onRefresh() {

    Map<String, String> params = new HashMap<String, String>();
    params.put("uid", "" + user.getUid());
    params.put("pagenum", pagenum + "");
    pagenum++;
    GetFavoritesFile get = new GetFavoritesFile(this);
    get.execute(params);
  }