Merge pull request #4733 from nextcloud/codacy

Codacy
This commit is contained in:
Tobias Kaminsky 2019-10-28 11:17:13 +01:00 committed by GitHub
commit 98487b501d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 42 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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;
/**