Merge pull request #10407 from osmandapp/Wiki-Read-Full-Article-button

[UI Issue] Wiki "Read Full Article" button
This commit is contained in:
Vitaliy 2020-12-18 23:19:36 +02:00 committed by GitHub
commit 7852a62da1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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));