Search in sources :

Example 1 with ImportDialog

use of com.ichi2.anki.dialogs.ImportDialog in project AnkiChinaAndroid by ankichinateam.

the class AnkiActivity method showImportDialog.

@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public void showImportDialog(int id, String message) {
    // On API19+ we only use import dialog to confirm, otherwise we use it the whole time
    if ((CompatHelper.getSdkVersion() < 19) || (id == ImportDialog.DIALOG_IMPORT_ADD_CONFIRM) || (id == ImportDialog.DIALOG_IMPORT_REPLACE_CONFIRM)) {
        Timber.d("showImportDialog() delegating to ImportDialog");
        AsyncDialogFragment newFragment = ImportDialog.newInstance(id, message, this);
        showAsyncDialogFragment(newFragment);
    } else {
        Timber.d("showImportDialog() delegating to file picker intent");
        Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
        intent.addCategory(Intent.CATEGORY_OPENABLE);
        intent.setType("*/*");
        intent.putExtra("android.content.extra.SHOW_ADVANCED", true);
        intent.putExtra("android.content.extra.FANCY", true);
        intent.putExtra("android.content.extra.SHOW_FILESIZE", true);
        startActivityForResultWithoutAnimation(intent, PICK_APKG_FILE);
    }
}
Also used : AsyncDialogFragment(com.ichi2.anki.dialogs.AsyncDialogFragment) PendingIntent(android.app.PendingIntent) CustomTabsIntent(androidx.browser.customtabs.CustomTabsIntent) Intent(android.content.Intent) TargetApi(android.annotation.TargetApi)

Example 2 with ImportDialog

use of com.ichi2.anki.dialogs.ImportDialog in project Anki-Android by ankidroid.

the class DeckPicker method showImportDialog.

public void showImportDialog(int id, String message) {
    Timber.d("showImportDialog() delegating to ImportDialog");
    if (message == null) {
        message = "";
    }
    AsyncDialogFragment newFragment = ImportDialog.newInstance(id, message);
    showAsyncDialogFragment(newFragment);
}
Also used : AsyncDialogFragment(com.ichi2.anki.dialogs.AsyncDialogFragment)

Aggregations

AsyncDialogFragment (com.ichi2.anki.dialogs.AsyncDialogFragment)2 TargetApi (android.annotation.TargetApi)1 PendingIntent (android.app.PendingIntent)1 Intent (android.content.Intent)1 CustomTabsIntent (androidx.browser.customtabs.CustomTabsIntent)1