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();
}
}
Aggregations