Codacy
This commit is contained in:
Tobias Kaminsky 2019-05-29 10:50:44 +02:00 committed by GitHub
commit 7a2ab86a88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 26 additions and 40 deletions

View file

@ -1 +1 @@
424
423

View file

@ -123,10 +123,6 @@ public final class PassCodeManager {
}
}
private void setUnlockTimestamp(Activity activity) {
AppPreferencesImpl.fromContext(activity).setLockTimestamp(System.currentTimeMillis());
}
private boolean passCodeShouldBeRequested(Long timestamp) {
return (System.currentTimeMillis() - timestamp) > PASS_CODE_TIMEOUT &&
visibleActivitiesCounter <= 0 && isPassCodeEnabled();

View file

@ -67,7 +67,6 @@ import androidx.annotation.Nullable;
import lombok.Getter;
import lombok.Setter;
import static com.owncloud.android.datamodel.OCFile.ROOT_PATH;
@Getter
public class FileDataStorageManager {
@ -266,7 +265,7 @@ public class FileDataStorageManager {
* @return the parent file
*/
public OCFile saveFileWithParent(OCFile file, Context context) {
if (file.getParentId() == 0 && !ROOT_PATH.equals(file.getRemotePath())) {
if (file.getParentId() == 0 && !OCFile.ROOT_PATH.equals(file.getRemotePath())) {
String remotePath = file.getRemotePath();
String parentPath = remotePath.substring(0, remotePath.lastIndexOf(file.getFileName()));

View file

@ -59,7 +59,8 @@ public class MediaControlView extends FrameLayout implements OnClickListener, On
private MediaPlayerControl mPlayer;
private View mRoot;
private ProgressBar mProgress;
private TextView mEndTime, mCurrentTime;
private TextView mEndTime;
private TextView mCurrentTime;
private boolean mDragging;
private static final int SHOW_PROGRESS = 1;
private ImageButton mPauseButton;

View file

@ -2673,7 +2673,6 @@ public class FileDisplayActivity extends FileActivity
FetchRemoteFileTask fetchRemoteFileTask = new FetchRemoteFileTask(newAccount,
fileId,
userId,
storageManager,
this);
fetchRemoteFileTask.execute();

View file

@ -37,7 +37,6 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.viewpager.widget.ViewPager;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.appinfo.AppInfo;
@ -45,7 +44,6 @@ import com.nextcloud.client.di.Injectable;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.client.whatsnew.WhatsNewService;
import com.owncloud.android.BuildConfig;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.authentication.AuthenticatorActivity;
@ -56,6 +54,8 @@ import com.owncloud.android.utils.DisplayUtils;
import javax.inject.Inject;
import androidx.viewpager.widget.ViewPager;
/**
* Activity displaying general feature after a fresh install.
*/

View file

@ -62,19 +62,6 @@ import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AlertDialog.Builder;
import androidx.appcompat.widget.SearchView;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.view.MenuItemCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentManager;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.di.Injectable;
@ -124,8 +111,19 @@ import java.util.Vector;
import javax.inject.Inject;
import static com.owncloud.android.datamodel.OCFile.PATH_SEPARATOR;
import static com.owncloud.android.datamodel.OCFile.ROOT_PATH;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AlertDialog.Builder;
import androidx.appcompat.widget.SearchView;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.view.MenuItemCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentManager;
/**
* This can be used to upload things to an ownCloud instance.
@ -178,7 +176,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
String parentPath = savedInstanceState.getString(KEY_PARENTS);
if (parentPath != null) {
mParents.addAll(Arrays.asList(parentPath.split(PATH_SEPARATOR)));
mParents.addAll(Arrays.asList(parentPath.split(OCFile.PATH_SEPARATOR)));
}
mFile = savedInstanceState.getParcelable(KEY_FILE);
@ -888,7 +886,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
String full_path = "";
for (String a : dirs) {
full_path += a + PATH_SEPARATOR;
full_path += a + OCFile.PATH_SEPARATOR;
}
return full_path;
}
@ -1038,10 +1036,10 @@ public class ReceiveExternalFilesActivity extends FileActivity
if (mParents.empty()) {
String lastPath = preferences.getLastUploadPath();
// "/" equals root-directory
if (ROOT_PATH.equals(lastPath)) {
if (OCFile.ROOT_PATH.equals(lastPath)) {
mParents.add("");
} else {
String[] dir_names = lastPath.split(PATH_SEPARATOR);
String[] dir_names = lastPath.split(OCFile.PATH_SEPARATOR);
mParents.clear();
mParents.addAll(Arrays.asList(dir_names));
}

View file

@ -47,7 +47,6 @@ import com.bumptech.glide.Glide;
import com.google.android.material.snackbar.Snackbar;
import com.nextcloud.client.account.CurrentAccountProvider;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.Template;
import com.owncloud.android.datamodel.ThumbnailsCacheManager;

View file

@ -44,18 +44,15 @@ import static com.owncloud.android.lib.resources.files.SearchRemoteOperation.Sea
public class FetchRemoteFileTask extends AsyncTask<Void, Void, String> {
private Account account;
private String fileId;
private String userId;
private FileDataStorageManager storageManager;
private FileDisplayActivity fileDisplayActivity;
public FetchRemoteFileTask(Account account,
String fileId,
String userId,
FileDataStorageManager storageManager,
FileDisplayActivity fileDisplayActivity) {
this.account = account;
this.fileId = fileId;
this.userId = userId;
this.storageManager = storageManager;
this.fileDisplayActivity = fileDisplayActivity;
}

View file

@ -27,7 +27,7 @@ import android.util.Log;
import java.io.PrintWriter;
import java.io.StringWriter;
public class ExceptionHandler implements java.lang.Thread.UncaughtExceptionHandler {
public class ExceptionHandler implements Thread.UncaughtExceptionHandler {
private final Activity mContext;
private static final String TAG = ExceptionHandler.class.getSimpleName();
@ -79,4 +79,4 @@ public class ExceptionHandler implements java.lang.Thread.UncaughtExceptionHandl
System.exit(1000);
}
}
}

View file

@ -1462,7 +1462,6 @@ public class OCFileListFragment extends ExtendedListFragment implements
Account currentAccount = accountManager.getCurrentAccount();
OwnCloudAccount ocAccount;
AccountManager mAccountMgr = AccountManager.get(getActivity());
try {
ocAccount = new OwnCloudAccount(currentAccount, MainApp.getAppContext());

View file

@ -270,7 +270,7 @@ public class PreviewTextFragment extends FileFragment implements SearchView.OnQu
}
@Override
protected StringWriter doInBackground(java.lang.Object... params) {
protected StringWriter doInBackground(Object... params) {
if (params.length != PARAMS_LENGTH) {
throw new IllegalArgumentException("The parameter to " + TextLoadAsyncTask.class.getName()
+ " must be (1) the file location");

View file

@ -24,7 +24,6 @@
package com.owncloud.android.ui.trashbin;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
import android.os.AsyncTask;

View file

@ -38,7 +38,6 @@ import android.util.Log;
import com.evernote.android.job.JobManager;
import com.evernote.android.job.JobRequest;
import com.evernote.android.job.util.Device;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.network.ConnectivityService;
import com.nextcloud.client.preferences.AppPreferences;