@Override
 public void onLoadFinished(Loader<Collection> loader, Collection col) {
   if (col != null && AnkiDroidApp.colIsOpen()) {
     onCollectionLoaded(col);
   } else {
     onCollectionLoadError();
   }
 }
 // Method for loading the collection which is inherited by all AnkiActivitys
 public void startLoadingCollection() {
   // Initialize the open collection loader
   Timber.d("AnkiActivity.startLoadingCollection()");
   if (!AnkiDroidApp.colIsOpen()) {
     showOpeningCollectionDialog();
   }
   getSupportLoaderManager().restartLoader(0, null, this);
 }
Beispiel #3
0
  @Override
  protected void onStop() {
    super.onStop();

    if (!isFinishing()) {
      if (AnkiDroidApp.colIsOpen()) {
        WidgetStatus.update(this, mSched.progressToday(null, mCurrentCard, true));
      }
    }
    UIUtils.saveCollectionInBackground();
  }
Beispiel #4
0
 @Override
 protected void setTitle() {
   try {
     String[] title = {""};
     if (AnkiDroidApp.colIsOpen()) {
       title = getCol().getDecks().current().getString("name").split("::");
     } else {
       Timber.e("Could not set title in reviewer because collection closed");
     }
     AnkiDroidApp.getCompat().setTitle(this, title[title.length - 1], mNightMode);
     super.setTitle(title[title.length - 1]);
   } catch (JSONException e) {
     throw new RuntimeException(e);
   }
   AnkiDroidApp.getCompat().setSubtitle(this, "", mNightMode);
 }
 public boolean colOpen() {
   return AnkiDroidApp.colIsOpen();
 }