diff options
author | H. Lehmann <ByteHamster@users.noreply.github.com> | 2020-05-06 16:45:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-06 16:45:33 +0200 |
commit | 626c6aebe5d3817a7bef2a26f875241c2f1f8541 (patch) | |
tree | d791e158c48e10c2d20d102ac8017ce2961d5c35 | |
parent | 8a77f7eb6dc5e3dbb33f053404827f3420431e4e (diff) | |
parent | 8357518229edd5888cdbc58d3964691fd7c46eec (diff) | |
download | AntennaPod-626c6aebe5d3817a7bef2a26f875241c2f1f8541.zip |
Merge pull request #4117 from ByteHamster/webview-min-height
Reduced probability for closing player accidentally
-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())); + } } |