Exemplo n.º 1
0
  @Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle("我的收藏");
    groups = WrapGroup.all(realm);

    KLog.e(groups.size());
    mAdapter =
        new CollectedAdapter(this) {
          @Override
          protected void onItemClick(View v, int position) {
            startGroupActivity(v, position);
          }
        };
    mRecyclerView.setAdapter(mAdapter);

    if (groups.size() > 0) { // 本地有数据才去上传
      mAdapter.replaceWith(groups);
      if (mHasUser) { // 已经登录
        saveToCloud();
      } else {
        showSnackBar("可以登录进行云端同步啦");
      }
    } else if (mHasUser) { // 本地没有  并且已经登录
      getFromCloud();
    } else {
      showSnackBar("可以登录进行云端同步啦");
    }
  }
Exemplo n.º 2
0
 @Override
 public void onRefresh() {
   List<WrapGroup> groups = WrapGroup.all(realm);
   mAdapter.replaceWith(groups);
   mRefresher.setRefreshing(false);
 }