diff options
author | TacoTheDank <SkytkRSfan3895@gmail.com> | 2021-07-22 16:49:50 -0400 |
---|---|---|
committer | TacoTheDank <SkytkRSfan3895@gmail.com> | 2021-07-22 16:49:50 -0400 |
commit | 47ac240f56dd7cb3eab81b040bfbcae62d1341e8 (patch) | |
tree | 3b7c02230a7a33364fca4e679a542d607c14f6be /app/src/main/java/de/danoeh/antennapod/view | |
parent | fdaf5394d93ff4f9a31109f1161e48ffe1bc7ec7 (diff) | |
download | AntennaPod-47ac240f56dd7cb3eab81b040bfbcae62d1341e8.zip |
Fix NonConstantResourceId code lint errors
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/view')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java | 49 |
1 files changed, 22 insertions, 27 deletions
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 30852c970..ae6e88c45 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java +++ b/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java @@ -123,33 +123,28 @@ public class ShownotesWebView extends WebView implements View.OnLongClickListene return false; } - switch (item.getItemId()) { - case R.id.open_in_browser_item: - IntentUtils.openInBrowser(getContext(), selectedUrl); - break; - case R.id.share_url_item: - ShareUtils.shareLink(getContext(), selectedUrl); - break; - case R.id.copy_url_item: - ClipData clipData = ClipData.newPlainText(selectedUrl, selectedUrl); - android.content.ClipboardManager cm = (android.content.ClipboardManager) getContext() - .getSystemService(Context.CLIPBOARD_SERVICE); - cm.setPrimaryClip(clipData); - Snackbar s = Snackbar.make(this, R.string.copied_url_msg, Snackbar.LENGTH_LONG); - ViewCompat.setElevation(s.getView(), 100); - s.show(); - break; - case R.id.go_to_position_item: - if (Timeline.isTimecodeLink(selectedUrl) && timecodeSelectedListener != null) { - timecodeSelectedListener.accept(Timeline.getTimecodeLinkTime(selectedUrl)); - } else { - Log.e(TAG, "Selected go_to_position_item, but URL was no timecode link: " + selectedUrl); - } - break; - default: - selectedUrl = null; - return false; - + final int itemId = item.getItemId(); + if (itemId == R.id.open_in_browser_item) { + IntentUtils.openInBrowser(getContext(), selectedUrl); + } else if (itemId == R.id.share_url_item) { + ShareUtils.shareLink(getContext(), selectedUrl); + } else if (itemId == R.id.copy_url_item) { + ClipData clipData = ClipData.newPlainText(selectedUrl, selectedUrl); + ClipboardManager cm = (ClipboardManager) getContext() + .getSystemService(Context.CLIPBOARD_SERVICE); + cm.setPrimaryClip(clipData); + Snackbar s = Snackbar.make(this, R.string.copied_url_msg, Snackbar.LENGTH_LONG); + ViewCompat.setElevation(s.getView(), 100); + s.show(); + } else if (itemId == R.id.go_to_position_item) { + if (Timeline.isTimecodeLink(selectedUrl) && timecodeSelectedListener != null) { + timecodeSelectedListener.accept(Timeline.getTimecodeLinkTime(selectedUrl)); + } else { + Log.e(TAG, "Selected go_to_position_item, but URL was no timecode link: " + selectedUrl); + } + } else { + selectedUrl = null; + return false; } selectedUrl = null; return true; |