mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 05:35:39 +03:00
commit
98487b501d
6 changed files with 43 additions and 42 deletions
|
@ -28,7 +28,6 @@ import android.accounts.Account;
|
|||
import android.accounts.AccountManager;
|
||||
import android.accounts.AccountManagerCallback;
|
||||
import android.accounts.AccountManagerFuture;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
|
|
|
@ -303,13 +303,13 @@ public class DocumentsStorageProvider extends DocumentsProvider {
|
|||
throws FileNotFoundException {
|
||||
Log.d(TAG, "openDocumentThumbnail(), id=" + documentId);
|
||||
|
||||
Document document = toDocument(documentId);
|
||||
|
||||
Context context = getContext();
|
||||
if (context == null) {
|
||||
throw new FileNotFoundException("Context may not be null!");
|
||||
}
|
||||
|
||||
Document document = toDocument(documentId);
|
||||
|
||||
boolean exists = ThumbnailsCacheManager.containsBitmap(ThumbnailsCacheManager.PREFIX_THUMBNAIL
|
||||
+ document.getFile().getRemoteId());
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ public class ExternalSiteWebView extends FileActivity {
|
|||
private boolean showSidebar;
|
||||
String url;
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
Log_OC.v(TAG, "onCreate() start");
|
||||
|
@ -93,7 +92,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 +112,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 +139,45 @@ public class ExternalSiteWebView extends FileActivity {
|
|||
webview.loadUrl(url);
|
||||
}
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
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;
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package com.owncloud.android.ui.activity;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AuthenticatorException;
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
|
|
|
@ -89,7 +89,6 @@ import java.util.Collections;
|
|||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
|
|
@ -64,8 +64,6 @@ import java.io.IOException;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import static com.owncloud.android.datamodel.OCFile.PATH_SEPARATOR;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue