summaryrefslogtreecommitdiff
path: root/app/src/main/java/de/danoeh/antennapod
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod')
-rw-r--r--app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/CancelDownloadActionButton.java2
-rw-r--r--app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/DownloadActionButton.java7
-rw-r--r--app/src/main/java/de/danoeh/antennapod/dialog/MediaPlayerErrorDialog.java7
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java3
-rw-r--r--app/src/main/java/de/danoeh/antennapod/view/NoRelayoutTextView.java20
5 files changed, 32 insertions, 7 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/CancelDownloadActionButton.java b/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/CancelDownloadActionButton.java
index 8b7a88873..c9500340b 100644
--- a/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/CancelDownloadActionButton.java
+++ b/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/CancelDownloadActionButton.java
@@ -32,7 +32,7 @@ public class CancelDownloadActionButton extends ItemActionButton {
@Override
public void onClick(Context context) {
FeedMedia media = item.getMedia();
- DownloadServiceInterface.get().cancel(context, media.getDownload_url());
+ DownloadServiceInterface.get().cancel(context, media);
if (UserPreferences.isEnableAutodownload()) {
item.disableAutoDownload();
DBWriter.setFeedItem(item);
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/DownloadActionButton.java b/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/DownloadActionButton.java
index 86a8047a9..4d5b0b6d5 100644
--- a/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/DownloadActionButton.java
+++ b/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/DownloadActionButton.java
@@ -52,12 +52,17 @@ public class DownloadActionButton extends ItemActionButton {
} else {
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context)
.setTitle(R.string.confirm_mobile_download_dialog_title)
- .setMessage(R.string.confirm_mobile_download_dialog_message)
.setPositiveButton(R.string.confirm_mobile_download_dialog_download_later,
(d, w) -> DownloadServiceInterface.get().downloadNow(context, item, false))
.setNeutralButton(R.string.confirm_mobile_download_dialog_allow_this_time,
(d, w) -> DownloadServiceInterface.get().downloadNow(context, item, true))
.setNegativeButton(R.string.cancel_label, null);
+ if (NetworkUtils.isNetworkRestricted() && NetworkUtils.isVpnOverWifi()) {
+ builder.setMessage(R.string.confirm_mobile_download_dialog_message_vpn);
+ } else {
+ builder.setMessage(R.string.confirm_mobile_download_dialog_message);
+ }
+
builder.show();
}
}
diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/MediaPlayerErrorDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/MediaPlayerErrorDialog.java
index 306400b29..8425e0bfa 100644
--- a/app/src/main/java/de/danoeh/antennapod/dialog/MediaPlayerErrorDialog.java
+++ b/app/src/main/java/de/danoeh/antennapod/dialog/MediaPlayerErrorDialog.java
@@ -21,8 +21,11 @@ public class MediaPlayerErrorDialog {
genericMessage.length(), errorMessage.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
errorDialog.setMessage(errorMessage);
- errorDialog.setPositiveButton(android.R.string.ok, (dialog, which) ->
- ((MainActivity) activity).getBottomSheet().setState(BottomSheetBehavior.STATE_COLLAPSED));
+ errorDialog.setPositiveButton(android.R.string.ok, (dialog, which) -> {
+ if (activity instanceof MainActivity) {
+ ((MainActivity) activity).getBottomSheet().setState(BottomSheetBehavior.STATE_COLLAPSED);
+ }
+ });
errorDialog.create().show();
}
}
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java
index 016f29e65..3d9e39482 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java
@@ -161,6 +161,9 @@ public class ItemPagerFragment extends Fragment implements MaterialToolbar.OnMen
}
private void openPodcast() {
+ if (item == null) {
+ return;
+ }
Fragment fragment = FeedItemlistFragment.newInstance(item.getFeedId());
((MainActivity) getActivity()).loadChildFragment(fragment);
}
diff --git a/app/src/main/java/de/danoeh/antennapod/view/NoRelayoutTextView.java b/app/src/main/java/de/danoeh/antennapod/view/NoRelayoutTextView.java
index 3f921b445..cbb2ef0af 100644
--- a/app/src/main/java/de/danoeh/antennapod/view/NoRelayoutTextView.java
+++ b/app/src/main/java/de/danoeh/antennapod/view/NoRelayoutTextView.java
@@ -1,6 +1,5 @@
package de.danoeh.antennapod.view;
-import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
import androidx.annotation.NonNull;
@@ -8,6 +7,9 @@ import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;
public class NoRelayoutTextView extends AppCompatTextView {
+ private boolean requestLayoutEnabled = false;
+ private float maxTextLength = 0;
+
public NoRelayoutTextView(@NonNull Context context) {
super(context);
}
@@ -20,9 +22,21 @@ public class NoRelayoutTextView extends AppCompatTextView {
super(context, attrs, defStyleAttr);
}
- @SuppressLint("MissingSuperCall")
@Override
public void requestLayout() {
- // Deliberate no-op
+ if (requestLayoutEnabled) {
+ super.requestLayout();
+ }
+ requestLayoutEnabled = false;
+ }
+
+ @Override
+ public void setText(CharSequence text, BufferType type) {
+ float textLength = getPaint().measureText(text.toString());
+ if (textLength > maxTextLength) {
+ maxTextLength = textLength;
+ requestLayoutEnabled = true;
+ }
+ super.setText(text, type);
}
}