mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 08:45:17 +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.AccountManager;
|
||||||
import android.accounts.AccountManagerCallback;
|
import android.accounts.AccountManagerCallback;
|
||||||
import android.accounts.AccountManagerFuture;
|
import android.accounts.AccountManagerFuture;
|
||||||
import android.content.ContentResolver;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
|
@ -303,13 +303,13 @@ public class DocumentsStorageProvider extends DocumentsProvider {
|
||||||
throws FileNotFoundException {
|
throws FileNotFoundException {
|
||||||
Log.d(TAG, "openDocumentThumbnail(), id=" + documentId);
|
Log.d(TAG, "openDocumentThumbnail(), id=" + documentId);
|
||||||
|
|
||||||
Document document = toDocument(documentId);
|
|
||||||
|
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
throw new FileNotFoundException("Context may not be null!");
|
throw new FileNotFoundException("Context may not be null!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Document document = toDocument(documentId);
|
||||||
|
|
||||||
boolean exists = ThumbnailsCacheManager.containsBitmap(ThumbnailsCacheManager.PREFIX_THUMBNAIL
|
boolean exists = ThumbnailsCacheManager.containsBitmap(ThumbnailsCacheManager.PREFIX_THUMBNAIL
|
||||||
+ document.getFile().getRemoteId());
|
+ document.getFile().getRemoteId());
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,6 @@ public class ExternalSiteWebView extends FileActivity {
|
||||||
private boolean showSidebar;
|
private boolean showSidebar;
|
||||||
String url;
|
String url;
|
||||||
|
|
||||||
@SuppressLint("SetJavaScriptEnabled")
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
Log_OC.v(TAG, "onCreate() start");
|
Log_OC.v(TAG, "onCreate() start");
|
||||||
|
@ -93,7 +92,6 @@ public class ExternalSiteWebView extends FileActivity {
|
||||||
webview.setFocusableInTouchMode(true);
|
webview.setFocusableInTouchMode(true);
|
||||||
webview.setClickable(true);
|
webview.setClickable(true);
|
||||||
|
|
||||||
|
|
||||||
// allow debugging (when building the debug version); see details in
|
// allow debugging (when building the debug version); see details in
|
||||||
// https://developers.google.com/web/tools/chrome-devtools/remote-debugging/webviews
|
// https://developers.google.com/web/tools/chrome-devtools/remote-debugging/webviews
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
|
||||||
|
@ -114,39 +112,8 @@ public class ExternalSiteWebView extends FileActivity {
|
||||||
setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|
setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionBar actionBar = getSupportActionBar();
|
setupActionBar(title);
|
||||||
if (actionBar != null) {
|
setupWebSettings(webSettings);
|
||||||
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);
|
|
||||||
|
|
||||||
final ProgressBar progressBar = findViewById(R.id.progressBar);
|
final ProgressBar progressBar = findViewById(R.id.progressBar);
|
||||||
|
|
||||||
|
@ -172,6 +139,45 @@ public class ExternalSiteWebView extends FileActivity {
|
||||||
webview.loadUrl(url);
|
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
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
boolean retval;
|
boolean retval;
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
package com.owncloud.android.ui.activity;
|
package com.owncloud.android.ui.activity;
|
||||||
|
|
||||||
import android.accounts.Account;
|
|
||||||
import android.accounts.AuthenticatorException;
|
import android.accounts.AuthenticatorException;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
|
|
|
@ -89,7 +89,6 @@ import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
|
@ -64,8 +64,6 @@ import java.io.IOException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import androidx.annotation.RequiresApi;
|
|
||||||
|
|
||||||
import static com.owncloud.android.datamodel.OCFile.PATH_SEPARATOR;
|
import static com.owncloud.android.datamodel.OCFile.PATH_SEPARATOR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue