diff options
author | ByteHamster <info@bytehamster.com> | 2020-05-05 00:07:23 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2020-05-06 13:25:47 +0200 |
commit | 8357518229edd5888cdbc58d3964691fd7c46eec (patch) | |
tree | b31b851dfb0a4d69c78242fc9d97a85cf442bbd0 | |
parent | b233f4dcb7273a5f39474c1d1cea3c017f5ba500 (diff) | |
download | AntennaPod-8357518229edd5888cdbc58d3964691fd7c46eec.zip |
Reduced probability for closing player accidentally
If the description is really short, the WebView shrinks. When touching
below the WebView, one needs to slide pretty precisely to swipe horizontally.
If there is a little bit of slope, the player closes (completely, without following
the finger). This change resizes the WebView, so that one can not touch below it.
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java | 11 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java | 7 |
2 files changed, 18 insertions, 0 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java index 8a8162d1a..04a62741c 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java @@ -47,6 +47,17 @@ public class ItemDescriptionFragment extends Fragment { // Restoring the scroll position might not always work webvDescription.postDelayed(ItemDescriptionFragment.this::restoreFromPreference, 50); }); + + root.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { + @Override + public void onLayoutChange(View v, int left, int top, int right, + int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { + if (root.getMeasuredHeight() != webvDescription.getMinimumHeight()) { + webvDescription.setMinimumHeight(root.getMeasuredHeight()); + } + root.removeOnLayoutChangeListener(this); + } + }); registerForContextMenu(webvDescription); return root; } diff --git a/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java b/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java index 701fe1ff6..99c8900ba 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java +++ b/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java @@ -165,4 +165,11 @@ public class ShownotesWebView extends WebView implements View.OnLongClickListene public void setPageFinishedListener(Runnable pageFinishedListener) { this.pageFinishedListener = pageFinishedListener; } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + setMeasuredDimension(Math.max(getMeasuredWidth(), getMinimumWidth()), + Math.max(getMeasuredHeight(), getMinimumHeight())); + } } |