Search in sources :

Example 1 with FilterFacade

use of com.ichi2.filters.FilterFacade in project Anki-Android by Ramblurr.

the class CardEditor method fetchIntentInformation.

private void fetchIntentInformation(Intent intent) {
    Bundle extras = intent.getExtras();
    if (ACTION_CREATE_FLASHCARD.equals(intent.getAction())) {
        // mSourceLanguage = extras.getString(SOURCE_LANGUAGE);
        // mTargetLanguage = extras.getString(TARGET_LANGUAGE);
        mSourceText = new String[2];
        mSourceText[0] = extras.getString(SOURCE_TEXT);
        mSourceText[1] = extras.getString(TARGET_TEXT);
    } else {
        String first;
        String second;
        if (extras.getString(Intent.EXTRA_SUBJECT) != null) {
            first = extras.getString(Intent.EXTRA_SUBJECT);
        } else {
            first = "";
        }
        if (extras.getString(Intent.EXTRA_TEXT) != null) {
            second = extras.getString(Intent.EXTRA_TEXT);
        } else {
            second = "";
        }
        Pair<String, String> messages = new Pair<String, String>(first, second);
        /* Filter garbage information */
        Pair<String, String> cleanMessages = new FilterFacade(getBaseContext()).filter(messages);
        mSourceText = new String[2];
        mSourceText[0] = cleanMessages.first;
        mSourceText[1] = cleanMessages.second;
    }
}
Also used : Bundle(android.os.Bundle) FilterFacade(com.ichi2.filters.FilterFacade)

Aggregations

Bundle (android.os.Bundle)1 FilterFacade (com.ichi2.filters.FilterFacade)1