Convert string to uri

This commit is contained in:
Martin Fietz 2017-04-10 21:19:25 +02:00
parent d555668d10
commit 77e89b5786
1 changed files with 10 additions and 10 deletions

View File

@ -6,25 +6,25 @@ import android.os.Bundle;
import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences;
/** Lets the user start the OPML-import process. */ /**
* Lets the user start the OPML-import process.
*/
public class OpmlImportFromIntentActivity extends OpmlImportBaseActivity { public class OpmlImportFromIntentActivity extends OpmlImportBaseActivity {
private static final String TAG = "OpmlImportFromIntentAct"; private static final String TAG = "OpmlImportFromIntentAct";
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
setTheme(UserPreferences.getTheme()); setTheme(UserPreferences.getTheme());
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Uri uri = getIntent().getData(); Uri uri = getIntent().getData();
if(uri != null) { if (uri != null && uri.toString().startsWith("/")) {
if(uri.toString().startsWith("/")) { uri = Uri.parse("file://" + uri.toString());
uri = Uri.parse("file://" + uri.toString());
}
} else { } else {
uri = getIntent().getStringExtra(Intent.EXTRA_TEXT); uri = Uri.parse(getIntent().getStringExtra(Intent.EXTRA_TEXT));
} }
importUri(uri); importUri(uri);
} }