shorten method

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2019-10-26 04:33:03 +02:00
parent 1d3fca653f
commit a6fdec8656
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B

View file

@ -93,7 +93,6 @@ public class ExternalSiteWebView extends FileActivity {
webview.setFocusableInTouchMode(true);
webview.setClickable(true);
// allow debugging (when building the debug version); see details in
// https://developers.google.com/web/tools/chrome-devtools/remote-debugging/webviews
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
@ -114,39 +113,8 @@ public class ExternalSiteWebView extends FileActivity {
setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
ThemeUtils.setColoredTitle(actionBar, title, this);
if (showSidebar) {
actionBar.setDisplayHomeAsUpEnabled(true);
} else {
setDrawerIndicatorEnabled(false);
}
}
// enable zoom
webSettings.setSupportZoom(true);
webSettings.setBuiltInZoomControls(true);
webSettings.setDisplayZoomControls(false);
// Non-responsive webs are zoomed out when loaded
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
// user agent
webSettings.setUserAgentString(MainApp.getUserAgent());
// no private data storing
webSettings.setSavePassword(false);
webSettings.setSaveFormData(false);
// disable local file access
webSettings.setAllowFileAccess(false);
// enable javascript
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
setupActionBar(title);
setupWebSettings(webSettings);
final ProgressBar progressBar = findViewById(R.id.progressBar);
@ -172,6 +140,44 @@ public class ExternalSiteWebView extends FileActivity {
webview.loadUrl(url);
}
private void setupWebSettings(WebSettings webSettings) {
// enable zoom
webSettings.setSupportZoom(true);
webSettings.setBuiltInZoomControls(true);
webSettings.setDisplayZoomControls(false);
// Non-responsive webs are zoomed out when loaded
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
// user agent
webSettings.setUserAgentString(MainApp.getUserAgent());
// no private data storing
webSettings.setSavePassword(false);
webSettings.setSaveFormData(false);
// disable local file access
webSettings.setAllowFileAccess(false);
// enable javascript
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
}
private void setupActionBar(String title) {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
ThemeUtils.setColoredTitle(actionBar, title, this);
if (showSidebar) {
actionBar.setDisplayHomeAsUpEnabled(true);
} else {
setDrawerIndicatorEnabled(false);
}
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
boolean retval;