Search in sources :

Example 1 with SdCardReceiver

use of com.ichi2.anki.receiver.SdCardReceiver in project AnkiChinaAndroid by ankichinateam.

the class SelfStudyActivity method registerExternalStorageListener.

/**
 * Show/dismiss dialog when sd card is ejected/remounted (collection is saved by SdCardReceiver)
 */
private void registerExternalStorageListener() {
    if (mUnmountReceiver == null) {
        mUnmountReceiver = new BroadcastReceiver() {

            @Override
            public void onReceive(Context context, Intent intent) {
                if (intent.getAction().equals(SdCardReceiver.MEDIA_EJECT)) {
                    finishWithoutAnimation();
                }
            }
        };
        IntentFilter iFilter = new IntentFilter();
        iFilter.addAction(SdCardReceiver.MEDIA_EJECT);
        registerReceiver(mUnmountReceiver, iFilter);
    }
}
Also used : TaskListenerWithContext(com.ichi2.async.TaskListenerWithContext) Context(android.content.Context) IntentFilter(android.content.IntentFilter) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver)

Example 2 with SdCardReceiver

use of com.ichi2.anki.receiver.SdCardReceiver in project AnkiChinaAndroid by ankichinateam.

the class CardBrowser method registerExternalStorageListener.

/**
 * Show/dismiss dialog when sd card is ejected/remounted (collection is saved by SdCardReceiver)
 */
private void registerExternalStorageListener() {
    if (mUnmountReceiver == null) {
        mUnmountReceiver = new BroadcastReceiver() {

            @Override
            public void onReceive(Context context, Intent intent) {
                if (intent.getAction().equals(SdCardReceiver.MEDIA_EJECT)) {
                    finishWithoutAnimation();
                }
            }
        };
        IntentFilter iFilter = new IntentFilter();
        iFilter.addAction(SdCardReceiver.MEDIA_EJECT);
        registerReceiver(mUnmountReceiver, iFilter);
    }
}
Also used : TaskListenerWithContext(com.ichi2.async.TaskListenerWithContext) Context(android.content.Context) IntentFilter(android.content.IntentFilter) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver)

Example 3 with SdCardReceiver

use of com.ichi2.anki.receiver.SdCardReceiver in project Anki-Android by ankidroid.

the class CardBrowser method registerExternalStorageListener.

/**
 * Show/dismiss dialog when sd card is ejected/remounted (collection is saved by SdCardReceiver)
 */
private void registerExternalStorageListener() {
    if (mUnmountReceiver == null) {
        mUnmountReceiver = new BroadcastReceiver() {

            @Override
            public void onReceive(Context context, Intent intent) {
                if (intent.getAction().equals(SdCardReceiver.MEDIA_EJECT)) {
                    finishWithoutAnimation();
                }
            }
        };
        IntentFilter iFilter = new IntentFilter();
        iFilter.addAction(SdCardReceiver.MEDIA_EJECT);
        registerReceiver(mUnmountReceiver, iFilter);
    }
}
Also used : TaskListenerWithContext(com.ichi2.async.TaskListenerWithContext) Context(android.content.Context) IntentFilter(android.content.IntentFilter) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver)

Aggregations

BroadcastReceiver (android.content.BroadcastReceiver)3 Context (android.content.Context)3 Intent (android.content.Intent)3 IntentFilter (android.content.IntentFilter)3 TaskListenerWithContext (com.ichi2.async.TaskListenerWithContext)3