Ejemplo n.º 1
0
  @Override
  protected void onDestroy() {
    super.onDestroy();

    if (mRecyclerViewSwipeManager != null) {
      mRecyclerViewSwipeManager.release();
      mRecyclerViewSwipeManager = null;
    }

    if (mRecyclerViewTouchActionGuardManager != null) {
      mRecyclerViewTouchActionGuardManager.release();
      mRecyclerViewTouchActionGuardManager = null;
    }

    if (mRecyclerView != null) {
      mRecyclerView.setItemAnimator(null);
      mRecyclerView.setAdapter(null);
      mRecyclerView = null;
    }

    if (mWrappedAdapter != null) {
      WrapperAdapterUtils.releaseAll(mWrappedAdapter);
      mWrappedAdapter = null;
    }
    mAdapter = null;
    mLayoutManager = null;

    if (mLazyList != null) {
      mLazyList.close();
    }
  }
Ejemplo n.º 2
0
 // Remember to notify
 private void updateLazyList() {
   LazyList<DraftRaw> lazyList = DB.getDraftLazyList();
   if (mLazyList != null) {
     mLazyList.close();
   }
   mLazyList = lazyList;
 }
Ejemplo n.º 3
0
 @Override
 public boolean onItemClick(EasyRecyclerView parent, View view, int position, long id) {
   DraftRaw draftRaw = mLazyList.get(position);
   ClipboardManager cbm = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
   cbm.setPrimaryClip(ClipData.newPlainText(null, draftRaw.getContent()));
   Toast.makeText(this, R.string.draft_copied_clipboard, Toast.LENGTH_SHORT).show();
   return false;
 }
Ejemplo n.º 4
0
  public void testRawQueryLazyList() {
    ArrayList<TestEntity> list = insert(2);

    LazyList<TestEntity> listLazy = dao.queryRawCreate("").listLazy();
    assertEquals(list.size(), listLazy.size());
    assertNull(listLazy.peak(0));
    assertNull(listLazy.peak(1));

    assertNotNull(listLazy.get(1));
    assertNull(listLazy.peak(0));
    assertNotNull(listLazy.peak(1));

    assertNotNull(listLazy.get(0));
    assertNotNull(listLazy.peak(0));
    assertNotNull(listLazy.peak(1));
  }