Search in sources :

Example 1 with OpmlImportWorker

use of de.danoeh.antennapod.asynctask.OpmlImportWorker in project AntennaPod by AntennaPod.

the class OpmlImportBaseActivity method startImport.

/** Starts the import process. */
protected void startImport() {
    try {
        Reader mReader = new InputStreamReader(getContentResolver().openInputStream(uri), LangUtils.UTF_8);
        importWorker = new OpmlImportWorker(this, mReader) {

            @Override
            protected void onPostExecute(ArrayList<OpmlElement> result) {
                super.onPostExecute(result);
                if (result != null) {
                    Log.d(TAG, "Parsing was successful");
                    OpmlImportHolder.setReadElements(result);
                    startActivityForResult(new Intent(OpmlImportBaseActivity.this, OpmlFeedChooserActivity.class), 0);
                } else {
                    Log.d(TAG, "Parser error occurred");
                }
            }
        };
        importWorker.executeAsync();
    } catch (Exception e) {
        Log.d(TAG, Log.getStackTraceString(e));
        String message = getString(R.string.opml_reader_error);
        new MaterialDialog.Builder(this).content(message + " " + e.getMessage()).positiveText(android.R.string.ok).show();
    }
}
Also used : InputStreamReader(java.io.InputStreamReader) Reader(java.io.Reader) InputStreamReader(java.io.InputStreamReader) Intent(android.content.Intent) OpmlImportWorker(de.danoeh.antennapod.asynctask.OpmlImportWorker) OpmlElement(de.danoeh.antennapod.core.export.opml.OpmlElement)

Aggregations

Intent (android.content.Intent)1 OpmlImportWorker (de.danoeh.antennapod.asynctask.OpmlImportWorker)1 OpmlElement (de.danoeh.antennapod.core.export.opml.OpmlElement)1 InputStreamReader (java.io.InputStreamReader)1 Reader (java.io.Reader)1