@Override
 public void onBackupSettingsChanged(
     final BackupSettings oldSettings,
     final BackupSettings newSettings,
     final BackupSettings.Diff diff) {
   BackupManager.setMaxNumberOfAutoBackups(newSettings.maxNumberOfAutoBackups);
 }
 public DBSettingsManager(final Context context) {
   super(context, context.getPackageName() + ".settings", null, DB_VERSION);
   adapter = createAdapter(DB_VERSION);
   try {
     m_db = getWritableDatabase();
   } catch (final Exception ex) {
     LCTX.e("Unexpected DB error: ", ex);
   }
   BackupManager.addAgent(this);
 }
 private OpdsSettings() {
   BackupManager.addAgent(this);
   SharedPreferences prefs = SettingsManager.prefs;
   /* =============== OPDS settings =============== */
   opdsCatalogs = OPDS_CATALOGS.getPreferenceValue(prefs);
   downloadDir = OPDS_DOWNLOAD_DIR.getPreferenceValue(prefs);
   filterTypes = OPDS_FILTER_TYPES.getPreferenceValue(prefs);
   downloadArchives = OPDS_DOWNLOAD_ARCHIVES.getPreferenceValue(prefs);
   unpackArchives = OPDS_UNPACK_ARCHIVES.getPreferenceValue(prefs);
   deleteArchives = OPDS_DELETE_ARCHIVES.getPreferenceValue(prefs);
 }
  /**
   * {@inheritDoc}
   *
   * @see org.emdev.ui.AbstractActivityController#onDestroy(boolean)
   */
  @Override
  public void onDestroy(final boolean finishing) {
    if (finishing) {
      if (BackupSettings.current().backupOnBookClose) {
        BackupManager.backup();
      }
      if (documentModel != null) {
        documentModel.recycle();
      }
      if (scheme != null && scheme.temporary) {
        CacheManager.clear(scheme.key);
      }
      SettingsManager.removeListener(this);
      BitmapManager.clear("on finish");
      ByteBufferManager.clear("on finish");

      EBookDroidApp.onActivityClose(finishing);
    }
  }