Parcourir la source

Resolve #3148 adding lombok support for the app

Andy Scherzinger il y a 6 ans
Parent
commit
0aae8653d8

+ 3 - 0
build.gradle

@@ -261,6 +261,9 @@ dependencies {
     //androidTestImplementation "com.android.support:support-annotations:${supportLibraryVersion}"
     implementation 'org.jetbrains:annotations:16.0.3'
 
+    compileOnly "org.projectlombok:lombok:1.18.4"
+    annotationProcessor "org.projectlombok:lombok:1.18.4"
+
     androidTestImplementation 'tools.fastlane:screengrab:1.2.0'
 
     findbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.8.0'

+ 3 - 0
gradle.properties

@@ -0,0 +1,3 @@
+# workaround since lombok and desugering have an issue
+# to be fixed with gradle Android plugin 3.3.0
+android.enableD8.desugaring=false

+ 10 - 111
src/main/java/com/owncloud/android/datamodel/SyncedFolder.java

@@ -1,4 +1,4 @@
-/**
+/*
  *   Nextcloud Android client application
  *
  *   @author Tobias Kaminsky
@@ -23,12 +23,20 @@ package com.owncloud.android.datamodel;
 
 import java.io.Serializable;
 
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.Setter;
+
 /**
  * Synced folder entity containing all information per synced folder.
  */
+@Getter
+@Setter
+@AllArgsConstructor
 public class SyncedFolder implements Serializable, Cloneable {
     public static final long UNPERSISTED_ID = Long.MIN_VALUE;
     private static final long serialVersionUID = -793476118299906429L;
+
     private long id = UNPERSISTED_ID;
     private String localPath;
     private String remotePath;
@@ -40,35 +48,6 @@ public class SyncedFolder implements Serializable, Cloneable {
     private boolean enabled;
     private MediaFolderType type;
 
-    /**
-     * constructor for already persisted entity.
-     *
-     * @param id              the primary key
-     * @param localPath       local path
-     * @param remotePath      remote path
-     * @param wifiOnly        upload on wifi only flag
-     * @param chargingOnly    upload on charging only
-     * @param subfolderByDate create sub-folders by date (month)
-     * @param account         the account owning the synced folder
-     * @param uploadAction    the action to be done after the upload
-     * @param enabled         flag if synced folder config is active
-     * @param type            the type of the folder
-     */
-    public SyncedFolder(long id, String localPath, String remotePath, Boolean wifiOnly, Boolean chargingOnly,
-                        Boolean subfolderByDate, String account, Integer uploadAction, Boolean enabled,
-                        MediaFolderType type) {
-        this.id = id;
-        this.localPath = localPath;
-        this.remotePath = remotePath;
-        this.wifiOnly = wifiOnly;
-        this.chargingOnly = chargingOnly;
-        this.subfolderByDate = subfolderByDate;
-        this.account = account;
-        this.uploadAction = uploadAction;
-        this.enabled = enabled;
-        this.type = type;
-    }
-
     /**
      * constructor for new, to be persisted entity.
      *
@@ -103,84 +82,4 @@ public class SyncedFolder implements Serializable, Cloneable {
             return null;
         }
     }
-
-    public long getId() {
-        return id;
-    }
-
-    public void setId(long id) {
-        this.id = id;
-    }
-
-    public String getLocalPath() {
-        return localPath;
-    }
-
-    public void setLocalPath(String localPath) {
-        this.localPath = localPath;
-    }
-
-    public String getRemotePath() {
-        return remotePath;
-    }
-
-    public void setRemotePath(String remotePath) {
-        this.remotePath = remotePath;
-    }
-
-    public Boolean getWifiOnly() {
-        return wifiOnly;
-    }
-
-    public void setWifiOnly(Boolean wifiOnly) {
-        this.wifiOnly = wifiOnly;
-    }
-
-    public Boolean getChargingOnly() {
-        return chargingOnly;
-    }
-
-    public void setChargingOnly(Boolean chargingOnly) {
-        this.chargingOnly = chargingOnly;
-    }
-
-    public Boolean getSubfolderByDate() {
-        return subfolderByDate;
-    }
-
-    public void setSubfolderByDate(Boolean subfolderByDate) {
-        this.subfolderByDate = subfolderByDate;
-    }
-
-    public String getAccount() {
-        return account;
-    }
-
-    public void setAccount(String account) {
-        this.account = account;
-    }
-
-    public Integer getUploadAction() {
-        return uploadAction;
-    }
-
-    public void setUploadAction(Integer uploadAction) {
-        this.uploadAction = uploadAction;
-    }
-
-    public boolean isEnabled() {
-        return enabled;
-    }
-
-    public void setEnabled(boolean enabled) {
-        this.enabled = enabled;
-    }
-
-    public MediaFolderType getType() {
-        return type;
-    }
-
-    public void setType(MediaFolderType type) {
-        this.type = type;
-    }
-}
+}

+ 6 - 25
src/main/java/com/owncloud/android/datamodel/SyncedFolderDisplayItem.java

@@ -1,4 +1,4 @@
-/**
+/*
  *   Nextcloud Android client application
  *
  *   @author Andy Scherzinger
@@ -23,10 +23,15 @@ package com.owncloud.android.datamodel;
 
 import java.util.List;
 
+import lombok.Getter;
+import lombok.Setter;
+
 /**
  * Display item specialization for synced folder objects to be displayed in a list/grid view adding further
  * information to be displayed in the UI but not part of the persisted underlying {@link SyncedFolder} object.
  */
+@Getter
+@Setter
 public class SyncedFolderDisplayItem extends SyncedFolder {
     private List<String> filePaths;
     private String folderName;
@@ -65,28 +70,4 @@ public class SyncedFolderDisplayItem extends SyncedFolder {
         super(id, localPath, remotePath, wifiOnly, chargingOnly, subfolderByDate, account, uploadAction, enabled, type);
         this.folderName = folderName;
     }
-
-    public List<String> getFilePaths() {
-        return filePaths;
-    }
-
-    public void setFilePaths(List<String> filePaths) {
-        this.filePaths = filePaths;
-    }
-
-    public String getFolderName() {
-        return folderName;
-    }
-
-    public void setFolderName(String folderName) {
-        this.folderName = folderName;
-    }
-
-    public long getNumberOfFiles() {
-        return numberOfFiles;
-    }
-
-    public void setNumberOfFiles(long numberOfFiles) {
-        this.numberOfFiles = numberOfFiles;
-    }
 }