diff options
author | Martin Fietz <martin.fietz@gmail.com> | 2017-10-24 21:01:36 +0200 |
---|---|---|
committer | Martin Fietz <martin.fietz@gmail.com> | 2017-10-24 21:01:36 +0200 |
commit | 717a1ec00ea140bd6ae2962449cffbc37e7d3725 (patch) | |
tree | 65a8ada382c52355ce032f5314fb2d8e162dd43e /app | |
parent | e884e989c781a2527b737ff30f0fcadd23e791f5 (diff) | |
parent | cef70063ffc7ce54caa12d65c83e2497eccbd3a7 (diff) | |
download | AntennaPod-717a1ec00ea140bd6ae2962449cffbc37e7d3725.zip |
Merge tag '1.6.4.1'
Diffstat (limited to 'app')
6 files changed, 59 insertions, 9 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 288e289d5..e7938682e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,8 +2,8 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.danoeh.antennapod" android:installLocation="auto" - android:versionCode="1060400" - android:versionName="1.6.4.0"> + android:versionCode="1060401" + android:versionName="1.6.4.1"> <!-- Version code schema: "1.2.3-SNAPSHOT" -> 1020300 @@ -371,6 +371,16 @@ android:scheme="package"/> </intent-filter> </receiver> + + <provider + android:authorities="de.danoeh.antennapod.provider" + android:name="android.support.v4.content.FileProvider" + android:exported="false" + android:grantUriPermissions="true"> + <meta-data + android:name="android.support.FILE_PROVIDER_PATHS" + android:resource="@xml/provider_paths"/> + </provider> <meta-data android:name="de.danoeh.antennapod.core.glide.ApGlideModule" diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java index 4c94e2b76..557510808 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java @@ -24,7 +24,10 @@ public class OpmlImportFromIntentActivity extends OpmlImportBaseActivity { if (uri != null && uri.toString().startsWith("/")) { uri = Uri.parse("file://" + uri.toString()); } else { - uri = Uri.parse(getIntent().getStringExtra(Intent.EXTRA_TEXT)); + String extraText = getIntent().getStringExtra(Intent.EXTRA_TEXT); + if(extraText != null) { + uri = Uri.parse(extraText); + } } importUri(uri); } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItunesSearchFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItunesSearchFragment.java index db88c070d..43dedad25 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItunesSearchFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItunesSearchFragment.java @@ -116,6 +116,9 @@ public class ItunesSearchFragment extends Fragment { //Show information about the podcast when the list item is clicked gridView.setOnItemClickListener((parent, view1, position, id) -> { Podcast podcast = searchResults.get(position); + if(podcast.feedUrl == null) { + return; + } if (!podcast.feedUrl.contains("itunes.apple.com")) { Intent intent = new Intent(getActivity(), OnlineFeedViewActivity.class); intent.putExtra(OnlineFeedViewActivity.ARG_FEEDURL, podcast.feedUrl); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java index d7f25c134..fccb86076 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -400,6 +400,9 @@ public class QueueFragment extends Fragment { int from = viewHolder.getAdapterPosition(); int to = target.getAdapterPosition(); Log.d(TAG, "move(" + from + ", " + to + ")"); + if(from >= queue.size() || to >= queue.size()) { + return false; + } queue.add(to, queue.remove(from)); recyclerAdapter.notifyItemMoved(from, to); DBWriter.moveQueueItem(from, to, true); diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java index 2ca7dd029..f46d44320 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java @@ -10,6 +10,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; import android.content.res.Resources; import android.net.Uri; import android.net.wifi.WifiConfiguration; @@ -24,6 +25,7 @@ import android.preference.PreferenceScreen; import android.support.design.widget.Snackbar; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; +import android.support.v4.content.FileProvider; import android.support.v7.app.AlertDialog; import android.text.Editable; import android.text.Html; @@ -59,6 +61,7 @@ import de.danoeh.antennapod.activity.PreferenceActivity; import de.danoeh.antennapod.activity.PreferenceActivityGingerbread; import de.danoeh.antennapod.activity.StatisticsActivity; import de.danoeh.antennapod.asynctask.ExportWorker; +import de.danoeh.antennapod.core.BuildConfig; import de.danoeh.antennapod.core.export.ExportWriter; import de.danoeh.antennapod.core.export.html.HtmlWriter; import de.danoeh.antennapod.core.export.opml.OpmlWriter; @@ -158,7 +161,7 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc public void onCreate() { final Activity activity = ui.getActivity(); - if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { // disable expanded notification option on unsupported android versions ui.findPreference(PreferenceController.PREF_EXPANDED_NOTIFICATION).setEnabled(false); ui.findPreference(PreferenceController.PREF_EXPANDED_NOTIFICATION).setOnPreferenceClickListener( @@ -230,8 +233,12 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc .setOnPreferenceChangeListener( (preference, newValue) -> { Intent i = new Intent(activity, MainActivity.class); - i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK - | Intent.FLAG_ACTIVITY_NEW_TASK); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK + | Intent.FLAG_ACTIVITY_NEW_TASK); + } else { + i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + } activity.finish(); activity.startActivity(i); return true; @@ -441,14 +448,25 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc return true; }); ui.findPreference(PREF_SEND_CRASH_REPORT).setOnPreferenceClickListener(preference -> { + Context context = ui.getActivity().getApplicationContext(); Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setType("text/plain"); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{"Martin.Fietz@gmail.com"}); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "AntennaPod Crash Report"); emailIntent.putExtra(Intent.EXTRA_TEXT, "Please describe what you were doing when the app crashed"); // the attachment - emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(CrashReportWriter.getFile())); + Uri fileUri = FileProvider.getUriForFile(context, "de.danoeh.antennapod.provider", + CrashReportWriter.getFile()); + emailIntent.putExtra(Intent.EXTRA_STREAM, fileUri); + emailIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); String intentTitle = ui.getActivity().getString(R.string.send_email); + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) { + List<ResolveInfo> resInfoList = context.getPackageManager().queryIntentActivities(emailIntent, PackageManager.MATCH_DEFAULT_ONLY); + for (ResolveInfo resolveInfo : resInfoList) { + String packageName = resolveInfo.activityInfo.packageName; + context.grantUriPermission(packageName, fileUri, Intent.FLAG_GRANT_READ_URI_PERMISSION); + } + } ui.getActivity().startActivity(Intent.createChooser(emailIntent, intentTitle)); return true; }); @@ -475,12 +493,21 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc String message = context.getString(R.string.opml_export_success_sum) + output.toString(); alert.setMessage(message); alert.setPositiveButton(R.string.send_label, (dialog, which) -> { - Uri outputUri = Uri.fromFile(output); + Uri fileUri = FileProvider.getUriForFile(context.getApplicationContext(), + "de.danoeh.antennapod.provider", output); Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_SUBJECT, context.getResources().getText(R.string.opml_export_label)); - sendIntent.putExtra(Intent.EXTRA_STREAM, outputUri); + sendIntent.putExtra(Intent.EXTRA_STREAM, fileUri); sendIntent.setType("text/plain"); + sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) { + List<ResolveInfo> resInfoList = context.getPackageManager().queryIntentActivities(sendIntent, PackageManager.MATCH_DEFAULT_ONLY); + for (ResolveInfo resolveInfo : resInfoList) { + String packageName = resolveInfo.activityInfo.packageName; + context.grantUriPermission(packageName, fileUri, Intent.FLAG_GRANT_READ_URI_PERMISSION); + } + } context.startActivity(Intent.createChooser(sendIntent, context.getResources().getText(R.string.send_label))); }); diff --git a/app/src/main/res/xml/provider_paths.xml b/app/src/main/res/xml/provider_paths.xml new file mode 100644 index 000000000..4ff893110 --- /dev/null +++ b/app/src/main/res/xml/provider_paths.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<paths xmlns:android="http://schemas.android.com/apk/res/android"> + <external-path name="external_files" path="."/> +</paths> |