From 47facd83c5ce3952c4438914d4e711e9a3ab6dd7 Mon Sep 17 00:00:00 2001 From: androiddevkkotlin Date: Wed, 16 Dec 2020 00:35:05 +0200 Subject: [PATCH] [UI Issue] Wiki "Read Full Article" button --- .../wikipedia/WikipediaDialogFragment.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikipedia/WikipediaDialogFragment.java b/OsmAnd/src/net/osmand/plus/wikipedia/WikipediaDialogFragment.java index 2e917881e4..3f2114327c 100644 --- a/OsmAnd/src/net/osmand/plus/wikipedia/WikipediaDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikipedia/WikipediaDialogFragment.java @@ -13,6 +13,7 @@ import android.text.TextUtils; import android.view.Gravity; import android.view.LayoutInflater; import android.view.MenuItem; +import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.webkit.WebSettings; @@ -67,7 +68,7 @@ public class WikipediaDialogFragment extends WikiArticleBaseDialogFragment { this.lang = lang; } - @SuppressLint("SetJavaScriptEnabled") + @SuppressLint({"SetJavaScriptEnabled", "ClickableViewAccessibility"}) @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { @@ -120,7 +121,25 @@ public class WikipediaDialogFragment extends WikiArticleBaseDialogFragment { selectedLangTv.setBackgroundResource(nightMode ? R.drawable.wikipedia_select_lang_bg_dark_n : R.drawable.wikipedia_select_lang_bg_light_n); - contentWebView = (WebView) mainView.findViewById(R.id.content_web_view); + contentWebView = mainView.findViewById(R.id.content_web_view); + contentWebView.setOnTouchListener(new View.OnTouchListener() { + @Override + public boolean onTouch(View v, MotionEvent event) { + switch (event.getAction()) { + case MotionEvent.ACTION_SCROLL: + case MotionEvent.ACTION_MOVE: + readFullArticleButton.setVisibility(View.GONE); + break; + case MotionEvent.ACTION_CANCEL: + case MotionEvent.ACTION_DOWN: + case MotionEvent.ACTION_UP: + readFullArticleButton.setVisibility(View.VISIBLE); + break; + } + return false; + } + }); + WebSettings webSettings = contentWebView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setTextZoom((int) (getResources().getConfiguration().fontScale * 100f));