Ejemplo n.º 1
0
  @Override
  protected void onPostExecute(final Object o) {

    // argument could be null
    if (o != null) {

      //            NavigationView navigationView =
      // (NavigationView)((AppCompatActivity)context).findViewById(R.id.navigation_view);
      RecyclerView recyclerView =
          (RecyclerView) ((AppCompatActivity) context).findViewById(R.id.listView);
      if (recyclerView != null) {
        recyclerView.setLayoutManager(new LinearLayoutManager(context));
        MemberListAdapter memberListAdapter = new MemberListAdapter(context, (List<Member>) o);
        recyclerView.setAdapter(memberListAdapter);
        final StickyRecyclerHeadersDecoration headersDecoration =
            new StickyRecyclerHeadersDecoration(memberListAdapter);
        recyclerView.addItemDecoration(headersDecoration);
        memberListAdapter.registerAdapterDataObserver(
            new RecyclerView.AdapterDataObserver() {
              @Override
              public void onChanged() {
                headersDecoration.invalidateHeaders();
              }
            });

        //                ((SwipeRefreshLayout)((AppCompatActivity)context)
        //                        .findViewById(R.id.frag_group_members_swipe_refresh))
        //                        .setRefreshing(false);
      }
    }
  }