summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/build.gradle4
-rw-r--r--app/src/main/java/de/danoeh/antennapod/dialog/ShareDialog.java31
-rw-r--r--app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java1
-rw-r--r--app/src/main/java/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java32
-rw-r--r--app/src/main/res/layout/share_episode_dialog.xml20
5 files changed, 28 insertions, 60 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 09303af16..5a6f57f5f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -11,8 +11,8 @@ android {
// Version code schema:
// "1.2.3-beta4" -> 1020304
// "1.2.3" -> 1020395
- versionCode 2040195
- versionName "2.4.1"
+ versionCode 2040295
+ versionName "2.4.2"
def commit = ""
try {
diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/ShareDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/ShareDialog.java
index 37faea46f..699e40e71 100644
--- a/app/src/main/java/de/danoeh/antennapod/dialog/ShareDialog.java
+++ b/app/src/main/java/de/danoeh/antennapod/dialog/ShareDialog.java
@@ -20,18 +20,14 @@ import de.danoeh.antennapod.core.util.ShareUtils;
public class ShareDialog extends DialogFragment {
private static final String ARGUMENT_FEED_ITEM = "feedItem";
private static final String PREF_NAME = "ShareDialog";
- private static final String PREF_SHARE_DIALOG_OPTION = "prefShareDialogOption";
private static final String PREF_SHARE_EPISODE_START_AT = "prefShareEpisodeStartAt";
- private static final String PREF_VALUE_WEBSITE = "website";
- private static final String PREF_VALUE_MEDIA_URL = "media";
private Context ctx;
private FeedItem item;
private SharedPreferences prefs;
- private RadioButton radioEpisodeWebsite;
- private RadioButton radioMediaFileUrl;
private RadioButton radioMediaFile;
+ private RadioButton radioLinkToEpisode;
private CheckBox checkBoxStartAt;
public ShareDialog() {
@@ -64,8 +60,7 @@ public class ShareDialog extends DialogFragment {
radioGroup.setOnCheckedChangeListener((group, checkedId) ->
checkBoxStartAt.setEnabled(checkedId != R.id.share_media_file_radio));
- radioEpisodeWebsite = content.findViewById(R.id.share_episode_website_radio);
- radioMediaFileUrl = content.findViewById(R.id.share_media_file_url_radio);
+ radioLinkToEpisode = content.findViewById(R.id.share_link_to_episode_radio);
radioMediaFile = content.findViewById(R.id.share_media_file_radio);
checkBoxStartAt = content.findViewById(R.id.share_start_at_timer_dialog);
@@ -73,12 +68,8 @@ public class ShareDialog extends DialogFragment {
builder.setPositiveButton(R.string.share_label, (dialog, id) -> {
boolean includePlaybackPosition = checkBoxStartAt.isChecked();
- if (radioEpisodeWebsite.isChecked()) {
- ShareUtils.shareFeedItemLink(ctx, item, includePlaybackPosition);
- prefs.edit().putString(PREF_SHARE_DIALOG_OPTION, PREF_VALUE_WEBSITE).apply();
- } else if (radioMediaFileUrl.isChecked()) {
- ShareUtils.shareFeedItemDownloadLink(ctx, item, includePlaybackPosition);
- prefs.edit().putString(PREF_SHARE_DIALOG_OPTION, PREF_VALUE_MEDIA_URL).apply();
+ if (radioLinkToEpisode.isChecked()) {
+ ShareUtils.shareFeedItemLinkWithDownloadLink(ctx, item, includePlaybackPosition);
} else if (radioMediaFile.isChecked()) {
ShareUtils.shareFeedItemFile(ctx, item.getMedia());
} else {
@@ -96,19 +87,11 @@ public class ShareDialog extends DialogFragment {
boolean downloaded = hasMedia && item.getMedia().isDownloaded();
radioMediaFile.setVisibility(downloaded ? View.VISIBLE : View.GONE);
- radioEpisodeWebsite.setVisibility(ShareUtils.hasLinkToShare(item) ? View.VISIBLE : View.GONE);
-
boolean hasDownloadUrl = hasMedia && item.getMedia().getDownload_url() != null;
- radioMediaFileUrl.setVisibility(hasDownloadUrl ? View.VISIBLE : View.GONE);
-
- String option = prefs.getString(PREF_SHARE_DIALOG_OPTION, PREF_VALUE_WEBSITE);
- if (option.equals(PREF_VALUE_WEBSITE)) {
- radioEpisodeWebsite.setChecked(true);
- radioMediaFileUrl.setChecked(false);
- } else {
- radioEpisodeWebsite.setChecked(false);
- radioMediaFileUrl.setChecked(true);
+ if (!ShareUtils.hasLinkToShare(item) && !hasDownloadUrl) {
+ radioLinkToEpisode.setVisibility(View.GONE);
}
+
radioMediaFile.setChecked(false);
boolean switchIsChecked = prefs.getBoolean(PREF_SHARE_EPISODE_START_AT, false);
diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java
index 764940e06..8cd34b5f8 100644
--- a/app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java
+++ b/app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java
@@ -73,6 +73,7 @@ public class SleepTimerDialog extends DialogFragment {
spTimeUnit = content.findViewById(R.id.spTimeUnit);
timeSetup = content.findViewById(R.id.timeSetup);
timeDisplay = content.findViewById(R.id.timeDisplay);
+ timeDisplay.setVisibility(View.GONE);
time = content.findViewById(R.id.time);
Button extendSleepFiveMinutesButton = content.findViewById(R.id.extendSleepFiveMinutesButton);
extendSleepFiveMinutesButton.setText(getString(R.string.extend_sleep_timer_label, 5));
diff --git a/app/src/main/java/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java b/app/src/main/java/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java
index 2ea15005a..020f4374b 100644
--- a/app/src/main/java/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java
+++ b/app/src/main/java/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java
@@ -4,37 +4,23 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
import android.text.TextUtils;
import android.util.Log;
+
import de.danoeh.antennapod.core.ClientConfig;
-import de.danoeh.antennapod.core.storage.DBTasks;
-import de.danoeh.antennapod.core.storage.DownloadRequester;
import de.danoeh.antennapod.core.util.NetworkUtils;
public class ConnectivityActionReceiver extends BroadcastReceiver {
- private static final String TAG = "ConnectivityActionRecvr";
+ private static final String TAG = "ConnectivityActionRecvr";
- @Override
- public void onReceive(final Context context, Intent intent) {
- if (TextUtils.equals(intent.getAction(), ConnectivityManager.CONNECTIVITY_ACTION)) {
- Log.d(TAG, "Received intent");
+ @Override
+ public void onReceive(final Context context, Intent intent) {
+ if (TextUtils.equals(intent.getAction(), ConnectivityManager.CONNECTIVITY_ACTION)) {
+ Log.d(TAG, "Received intent");
ClientConfig.initialize(context);
- if (NetworkUtils.isAutoDownloadAllowed()) {
- Log.d(TAG, "auto-dl network available, starting auto-download");
- DBTasks.autodownloadUndownloadedItems(context);
- } else { // if new network is Wi-Fi, finish ongoing downloads,
- // otherwise cancel all downloads
- ConnectivityManager cm = (ConnectivityManager) context
- .getSystemService(Context.CONNECTIVITY_SERVICE);
- NetworkInfo ni = cm.getActiveNetworkInfo();
- if (ni == null || ni.getType() != ConnectivityManager.TYPE_WIFI) {
- Log.i(TAG, "Device is no longer connected to Wi-Fi. Cancelling ongoing downloads");
- DownloadRequester.getInstance().cancelAllDownloads(context);
- }
- }
- }
- }
+ NetworkUtils.networkChangedDetected();
+ }
+ }
}
diff --git a/app/src/main/res/layout/share_episode_dialog.xml b/app/src/main/res/layout/share_episode_dialog.xml
index 539efa5c8..d79854972 100644
--- a/app/src/main/res/layout/share_episode_dialog.xml
+++ b/app/src/main/res/layout/share_episode_dialog.xml
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:orientation="vertical"
android:gravity="center"
android:padding="16dp">
@@ -14,27 +15,24 @@
android:orientation="vertical">
<RadioButton
- android:id="@+id/share_episode_website_radio"
+ android:id="@+id/share_link_to_episode_radio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/share_dialog_episode_website_label"
+ android:text="@string/share_dialog_link_to_episode"
android:checked="true" />
- <RadioButton
- android:id="@+id/share_media_file_url_radio"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/share_dialog_media_file_url_label" />
+
<RadioButton
android:id="@+id/share_media_file_radio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/share_dialog_media_file_label" />
+
</RadioGroup>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:text="@string/share_dialog_include_label"/>
+ android:text="@string/share_dialog_include_label" />
<CheckBox
android:id="@+id/share_start_at_timer_dialog"
@@ -42,4 +40,4 @@
android:layout_height="wrap_content"
android:text="@string/share_playback_position_dialog_label" />
-</LinearLayout> \ No newline at end of file
+</LinearLayout>