mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
shorten method
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
1d3fca653f
commit
a6fdec8656
1 changed files with 40 additions and 34 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue