use of com.ichi2.anki.dialogs.DialogHandler in project Anki-Android by ankidroid.
the class DeckPicker method onFinishedStartup.
/**
* Perform the following tasks:
* Automatic backup
* loadStudyOptionsFragment() if tablet
* Automatic sync
*/
private void onFinishedStartup() {
// create backup in background if needed
BackupManager.performBackupInBackground(getCol().getPath(), getCol().getTime());
// Force a full sync if flag was set in upgrade path, asking the user to confirm if necessary
if (mRecommendFullSync) {
mRecommendFullSync = false;
try {
getCol().modSchema();
} catch (ConfirmModSchemaException e) {
Timber.w("Forcing full sync");
e.log();
// If libanki determines it's necessary to confirm the full sync then show a confirmation dialog
// We have to show the dialog via the DialogHandler since this method is called via an async task
Resources res = getResources();
Message handlerMessage = Message.obtain();
handlerMessage.what = DialogHandler.MSG_SHOW_FORCE_FULL_SYNC_DIALOG;
Bundle handlerMessageData = new Bundle();
handlerMessageData.putString("message", res.getString(R.string.full_sync_confirmation_upgrade) + "\n\n" + res.getString(R.string.full_sync_confirmation));
handlerMessage.setData(handlerMessageData);
getDialogHandler().sendMessage(handlerMessage);
}
}
automaticSync();
}
use of com.ichi2.anki.dialogs.DialogHandler in project AnkiChinaAndroid by ankichinateam.
the class DeckPicker method onFinishedStartup.
/**
* Perform the following tasks:
* Automatic backup
* loadStudyOptionsFragment() if tablet
* Automatic sync
*/
private void onFinishedStartup() {
// create backup in background if needed
if (getCol() == null) {
return;
}
SharedPreferences preferences = AnkiDroidApp.getSharedPrefs(this);
if (preferences.getBoolean(AUTO_TURN_TO_LOGIN, true) && !Consts.isLogin()) {
Intent myAccount = new Intent(this, MyAccount.class);
myAccount.putExtra("notLoggedIn", true);
startActivityForResultWithAnimation(myAccount, LOG_IN_FOR_SYNC, ActivityTransitionAnimation.FADE);
preferences.edit().putBoolean(AUTO_TURN_TO_LOGIN, false).apply();
}
BackupManager.performBackupInBackground(getCol().getPath(), getCol().getTime());
// Force a full sync if flag was set in upgrade path, asking the user to confirm if necessary
if (mRecommendFullSync) {
mRecommendFullSync = false;
try {
getCol().modSchema();
} catch (ConfirmModSchemaException e) {
Timber.w("Forcing full sync");
// If libanki determines it's necessary to confirm the full sync then show a confirmation dialog
// We have to show the dialog via the DialogHandler since this method is called via an async task
Resources res = getResources();
Message handlerMessage = Message.obtain();
handlerMessage.what = DialogHandler.MSG_SHOW_FORCE_FULL_SYNC_DIALOG;
Bundle handlerMessageData = new Bundle();
handlerMessageData.putString("message", res.getString(R.string.full_sync_confirmation_upgrade) + "\n\n" + res.getString(R.string.full_sync_confirmation));
handlerMessage.setData(handlerMessageData);
getDialogHandler().sendMessage(handlerMessage);
}
}
// Open StudyOptionsFragment if in fragmented mode
automaticSync();
}
Aggregations