Search in sources :

Example 1 with CompatV9

use of com.ichi2.compat.CompatV9 in project Anki-Android by Ramblurr.

the class AnkiDroidApp method onCreate.

/**
     * On application creation.
     */
@Override
public void onCreate() {
    super.onCreate();
    if (isNookHdPlus() && AnkiDroidApp.SDK_VERSION == 15) {
        mCompat = new CompatV15NookHdPlus();
    } else if (isNook()) {
        mCompat = new CompatV4();
    } else if (AnkiDroidApp.SDK_VERSION >= 16) {
        mCompat = new CompatV16();
    } else if (AnkiDroidApp.SDK_VERSION >= 15) {
        mCompat = new CompatV15();
    } else if (AnkiDroidApp.SDK_VERSION >= 11) {
        mCompat = new CompatV11();
    } else if (AnkiDroidApp.SDK_VERSION >= 9) {
        mCompat = new CompatV9();
    } else if (AnkiDroidApp.SDK_VERSION >= 5) {
        mCompat = new CompatV5();
    } else {
        mCompat = new CompatV4();
    }
    sInstance = this;
    Connection.setContext(getApplicationContext());
    // Error Reporter
    CustomExceptionHandler customExceptionHandler = CustomExceptionHandler.getInstance();
    customExceptionHandler.init(sInstance.getApplicationContext());
    Thread.setDefaultUncaughtExceptionHandler(customExceptionHandler);
    SharedPreferences preferences = getSharedPrefs(this);
    sInstance.mHooks = new Hooks(preferences);
    setLanguage(preferences.getString("language", ""));
    // Assign some default settings if necessary
    if (!preferences.contains("deckPath")) {
        Editor editor = preferences.edit();
        // Create the folder "AnkiDroid", if not exists, where the decks
        // will be stored by default
        String deckPath = getDefaultAnkiDroidDirectory();
        createDirectoryIfMissing(new File(deckPath));
        // Put the base path in preferences pointing to the default "AnkiDroid" folder
        editor.putString("deckPath", deckPath);
        // Using commit instead of apply even though we don't need a return value.
        // Reason: apply() not available on Android 1.5
        editor.commit();
    }
}
Also used : CompatV15NookHdPlus(com.ichi2.compat.CompatV15NookHdPlus) SharedPreferences(android.content.SharedPreferences) CompatV15(com.ichi2.compat.CompatV15) CompatV16(com.ichi2.compat.CompatV16) CompatV11(com.ichi2.compat.CompatV11) CompatV4(com.ichi2.compat.CompatV4) Hooks(com.ichi2.libanki.hooks.Hooks) CompatV5(com.ichi2.compat.CompatV5) Editor(android.content.SharedPreferences.Editor) File(java.io.File) CompatV9(com.ichi2.compat.CompatV9)

Aggregations

SharedPreferences (android.content.SharedPreferences)1 Editor (android.content.SharedPreferences.Editor)1 CompatV11 (com.ichi2.compat.CompatV11)1 CompatV15 (com.ichi2.compat.CompatV15)1 CompatV15NookHdPlus (com.ichi2.compat.CompatV15NookHdPlus)1 CompatV16 (com.ichi2.compat.CompatV16)1 CompatV4 (com.ichi2.compat.CompatV4)1 CompatV5 (com.ichi2.compat.CompatV5)1 CompatV9 (com.ichi2.compat.CompatV9)1 Hooks (com.ichi2.libanki.hooks.Hooks)1 File (java.io.File)1