codacy: A getX() method which returns a boolean should be named isX()

This commit is contained in:
AndyScherzinger 2018-09-20 16:57:01 +02:00
parent ebed24ab5d
commit 6b59ade7bd
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
14 changed files with 27 additions and 28 deletions

View file

@ -455,7 +455,7 @@ public class FileDataStorageManager {
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, folder.getPublicLink());
cv.put(ProviderTableMeta.FILE_PERMISSIONS, folder.getPermissions());
cv.put(ProviderTableMeta.FILE_REMOTE_ID, folder.getRemoteId());
cv.put(ProviderTableMeta.FILE_FAVORITE, folder.getIsFavorite());
cv.put(ProviderTableMeta.FILE_FAVORITE, folder.isFavorite());
cv.put(ProviderTableMeta.FILE_IS_ENCRYPTED, folder.isEncrypted());
return cv;
}
@ -487,7 +487,7 @@ public class FileDataStorageManager {
cv.put(ProviderTableMeta.FILE_UPDATE_THUMBNAIL, file.needsUpdateThumbnail());
cv.put(ProviderTableMeta.FILE_IS_DOWNLOADING, file.isDownloading());
cv.put(ProviderTableMeta.FILE_ETAG_IN_CONFLICT, file.getEtagInConflict());
cv.put(ProviderTableMeta.FILE_FAVORITE, file.getIsFavorite());
cv.put(ProviderTableMeta.FILE_FAVORITE, file.isFavorite());
cv.put(ProviderTableMeta.FILE_IS_ENCRYPTED, file.isEncrypted());
cv.put(ProviderTableMeta.FILE_MOUNT_TYPE, file.getMountType().ordinal());
return cv;
@ -1399,7 +1399,7 @@ public class FileDataStorageManager {
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, file.getPublicLink());
cv.put(ProviderTableMeta.FILE_PERMISSIONS, file.getPermissions());
cv.put(ProviderTableMeta.FILE_REMOTE_ID, file.getRemoteId());
cv.put(ProviderTableMeta.FILE_FAVORITE, file.getIsFavorite());
cv.put(ProviderTableMeta.FILE_FAVORITE, file.isFavorite());
cv.put(
ProviderTableMeta.FILE_UPDATE_THUMBNAIL,
file.needsUpdateThumbnail() ? 1 : 0

View file

@ -198,7 +198,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
dest.writeSerializable(mMountType);
}
public boolean getIsFavorite() {
public boolean isFavorite() {
return mIsFavorite;
}

View file

@ -495,7 +495,7 @@ public class FileMenuFilter {
private boolean allFavorites() {
for (OCFile file : mFiles) {
if (!file.getIsFavorite()) {
if (!file.isFavorite()) {
return false;
}
}
@ -504,7 +504,7 @@ public class FileMenuFilter {
private boolean allNotFavorites() {
for (OCFile file : mFiles) {
if (file.getIsFavorite()) {
if (file.isFavorite()) {
return false;
}
}

View file

@ -961,15 +961,15 @@ public class FileUploader extends Service
totalToTransfer, fileName);
if (MainApp.getAppContext() != null) {
if (mCurrentUpload.getIsWifiRequired() && !Device.getNetworkType(MainApp.getAppContext()).
if (mCurrentUpload.isWifiRequired() && !Device.getNetworkType(MainApp.getAppContext()).
equals(JobRequest.NetworkType.UNMETERED)) {
cancel(mCurrentUpload.getAccount().name, mCurrentUpload.getFile().getRemotePath()
, ResultCode.DELAYED_FOR_WIFI);
} else if (mCurrentUpload.getIsChargingRequired() &&
} else if (mCurrentUpload.isChargingRequired() &&
!Device.getBatteryStatus(MainApp.getAppContext()).isCharging()) {
cancel(mCurrentUpload.getAccount().name, mCurrentUpload.getFile().getRemotePath()
, ResultCode.DELAYED_FOR_CHARGING);
} else if (!mCurrentUpload.getIsIgnoringPowerSaveMode() &&
} else if (!mCurrentUpload.isIgnoringPowerSaveMode() &&
PowerUtils.isPowerSaveMode(MainApp.getAppContext())) {
cancel(mCurrentUpload.getAccount().name, mCurrentUpload.getFile().getRemotePath()
, ResultCode.DELAYED_IN_POWER_SAVE_MODE);

View file

@ -144,8 +144,7 @@ public class DownloadFileOperation extends RemoteOperation {
}
public long getModificationTimestamp() {
return (mModificationTimestamp > 0) ? mModificationTimestamp :
mFile.getModificationTimestamp();
return mModificationTimestamp > 0 ? mModificationTimestamp : mFile.getModificationTimestamp();
}
public String getEtag() {

View file

@ -245,7 +245,7 @@ public class SynchronizeFileOperation extends SyncOperation {
// service when the upload finishes
} else {
// TODO CHECK: is this really useful in some point in the code?
mServerFile.setFavorite(mLocalFile.getIsFavorite());
mServerFile.setFavorite(mLocalFile.isFavorite());
mServerFile.setAvailableOffline(mLocalFile.isAvailableOffline());
mServerFile.setLastSyncDateForData(mLocalFile.getLastSyncDateForData());
mServerFile.setStoragePath(mLocalFile.getStoragePath());

View file

@ -219,15 +219,15 @@ public class UploadFileOperation extends SyncOperation {
mFolderUnlockToken = upload.getFolderUnlockToken();
}
public boolean getIsWifiRequired() {
public boolean isWifiRequired() {
return mOnWifiOnly;
}
public boolean getIsChargingRequired() {
public boolean isChargingRequired() {
return mWhileChargingOnly;
}
public boolean getIsIgnoringPowerSaveMode() { return mIgnoringPowerSaveMode; }
public boolean isIgnoringPowerSaveMode() { return mIgnoringPowerSaveMode; }
public Account getAccount() {
return mAccount;

View file

@ -338,7 +338,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
gridViewHolder.localFileIndicator.setVisibility(View.VISIBLE);
}
gridViewHolder.favorite.setVisibility(file.getIsFavorite() ? View.VISIBLE : View.GONE);
gridViewHolder.favorite.setVisibility(file.isFavorite() ? View.VISIBLE : View.GONE);
gridViewHolder.offlineIcon.setVisibility(file.isAvailableOffline() ? View.VISIBLE : View.GONE);
if (multiSelect) {

View file

@ -433,12 +433,12 @@ public class FileDetailFragment extends FileFragment implements OnClickListener
break;
}
case R.id.favorite: {
if (getFile().getIsFavorite()) {
if (getFile().isFavorite()) {
mContainerActivity.getFileOperationsHelper().toggleFavoriteFile(getFile(), false);
} else {
mContainerActivity.getFileOperationsHelper().toggleFavoriteFile(getFile(), true);
}
setFavoriteIconStatus(!getFile().getIsFavorite());
setFavoriteIconStatus(!getFile().isFavorite());
break;
}
case R.id.overflow_menu: {
@ -503,7 +503,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener
fileSize.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength()));
fileModifiedTimestamp.setText(DisplayUtils.getRelativeTimestamp(getContext(), file.getModificationTimestamp()));
setFilePreview(file);
setFavoriteIconStatus(file.getIsFavorite());
setFavoriteIconStatus(file.isFavorite());
// configure UI for depending upon local state of the file
FileDownloaderBinder downloaderBinder = mContainerActivity.getFileDownloaderBinder();

View file

@ -780,7 +780,7 @@ public class FileOperationsHelper {
public void toggleFavoriteFiles(Collection<OCFile> files, boolean shouldBeFavorite) {
List<OCFile> alreadyRightStateList = new ArrayList<>();
for (OCFile file : files) {
if (file.getIsFavorite() == shouldBeFavorite) {
if (file.isFavorite() == shouldBeFavorite) {
alreadyRightStateList.add(file);
}
}
@ -793,7 +793,7 @@ public class FileOperationsHelper {
}
public void toggleFavoriteFile(OCFile file, boolean shouldBeFavorite) {
if (file.getIsFavorite() != shouldBeFavorite) {
if (file.isFavorite() != shouldBeFavorite) {
EventBus.getDefault().post(new FavoriteEvent(file.getRemotePath(), shouldBeFavorite, file.getRemoteId()));
}
}

View file

@ -167,7 +167,7 @@ public class PreviewImageActivity extends FileActivity implements
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean(KEY_WAITING_FOR_BINDER, mRequestWaitingForBinder);
outState.putBoolean(KEY_SYSTEM_VISIBLE, getSystemUIVisible());
outState.putBoolean(KEY_SYSTEM_VISIBLE, isSystemUIVisible());
}
@Override
@ -426,7 +426,7 @@ public class PreviewImageActivity extends FileActivity implements
}
}
public boolean getSystemUIVisible() {
public boolean isSystemUIVisible() {
return getSupportActionBar() == null || getSupportActionBar().isShowing();
}

View file

@ -728,7 +728,7 @@ public class PreviewImageFragment extends FileFragment {
LayerDrawable layerDrawable = (LayerDrawable) mImageView.getDrawable();
Drawable layerOne;
if (previewImageActivity.getSystemUIVisible()) {
if (previewImageActivity.isSystemUIVisible()) {
layerOne = getResources().getDrawable(R.color.white);
} else {
layerOne = getResources().getDrawable(R.drawable.backrepeat);

View file

@ -79,11 +79,11 @@ public class FileSortOrder {
*/
public static List<OCFile> sortCloudFilesByFavourite(List<OCFile> files) {
Collections.sort(files, (o1, o2) -> {
if (o1.getIsFavorite() && o2.getIsFavorite()) {
if (o1.isFavorite() && o2.isFavorite()) {
return 0;
} else if (o1.getIsFavorite()) {
} else if (o1.isFavorite()) {
return -1;
} else if (o2.getIsFavorite()) {
} else if (o2.isFavorite()) {
return 1;
}
return 0;

View file

@ -195,7 +195,7 @@ public final class FileStorageUtils {
file.setEtag(ocFile.getEtag());
file.setPermissions(ocFile.getPermissions());
file.setRemoteId(ocFile.getRemoteId());
file.setFavorite(ocFile.getIsFavorite());
file.setFavorite(ocFile.isFavorite());
return file;
}