use of com.ichi2.anki.InitialActivity.StartupFailure in project Anki-Android by ankidroid.
the class DeckPicker method handleStartup.
/**
* The first call in showing dialogs for startup - error or success.
* Attempts startup if storage permission has been acquired, else, it requests the permission
*/
public void handleStartup() {
if (Permissions.hasStorageAccessPermission(this)) {
StartupFailure failure = InitialActivity.getStartupFailureType(this);
if (failure == null) {
// Show any necessary dialogs (e.g. changelog, special messages, etc)
SharedPreferences sharedPrefs = AnkiDroidApp.getSharedPrefs(this);
showStartupScreensAndDialogs(sharedPrefs, 0);
mStartupError = false;
} else {
// Show error dialogs
handleStartupFailure(failure);
mStartupError = true;
}
} else {
requestStoragePermission();
}
}
use of com.ichi2.anki.InitialActivity.StartupFailure in project Anki-Android by ankidroid.
the class DeckPicker method handleStartupFailure.
@VisibleForTesting
void handleStartupFailure(StartupFailure failure) {
switch(failure) {
case SD_CARD_NOT_MOUNTED:
Timber.i("SD card not mounted");
onSdCardNotMounted();
break;
case DIRECTORY_NOT_ACCESSIBLE:
Timber.i("AnkiDroid directory inaccessible");
Intent i = Preferences.AdvancedSettingsFragment.getSubscreenIntent(this);
startActivityForResultWithoutAnimation(i, REQUEST_PATH_UPDATE);
UIUtils.showThemedToast(this, R.string.directory_inaccessible, false);
break;
case FUTURE_ANKIDROID_VERSION:
Timber.i("Displaying database versioning");
showDatabaseErrorDialog(DatabaseErrorDialog.INCOMPATIBLE_DB_VERSION);
break;
case DATABASE_LOCKED:
Timber.i("Displaying database locked error");
showDatabaseErrorDialog(DatabaseErrorDialog.DIALOG_DB_LOCKED);
break;
case DATABASE_DOWNGRADE_REQUIRED:
// This has a callback to continue with handleStartup
InitialActivity.downgradeBackend(this);
break;
case WEBVIEW_FAILED:
new MaterialDialog.Builder(this).title(R.string.ankidroid_init_failed_webview_title).content(getString(R.string.ankidroid_init_failed_webview, AnkiDroidApp.getWebViewErrorMessage())).positiveText(R.string.close).onPositive((d, w) -> exit()).cancelable(false).show();
break;
case DB_ERROR:
default:
displayDatabaseFailure();
}
}
Aggregations