Browse Source

refined annotations
added one more annotation

Signed-off-by: tobiaskaminsky <tobias@kaminsky.me>

tobiaskaminsky 7 years ago
parent
commit
614d78ba58

+ 1 - 1
src/main/java/com/owncloud/android/ui/TextDrawable.java

@@ -96,7 +96,7 @@ public class TextDrawable extends Drawable {
      * @throws NoSuchAlgorithmException     if the specified algorithm is not available when calculating the color values
      */
     @NonNull
-    @NextcloudServer(min = -1, max = 12)
+    @NextcloudServer(max = 12)
     public static TextDrawable createAvatar(String accountName, float radiusInDp) throws
             UnsupportedEncodingException, NoSuchAlgorithmException {
         String username = AccountUtils.getAccountUsername(accountName);

+ 3 - 2
src/main/java/com/owncloud/android/utils/NextcloudServer.java

@@ -6,13 +6,14 @@ import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
 /**
- * Created by tobi on 21.12.17.
+ * Defines min and max server version. Useful to find not needed code, e.g. if annotated max=12 and last supported 
+ * version is 13 the code can be removed.
  */
 
 @Retention(RetentionPolicy.SOURCE)
 @Target(ElementType.METHOD)
 public @interface NextcloudServer {
-    int min();
+    int min() default -1;
 
     int max();
 }

+ 1 - 0
src/main/java/com/owncloud/android/utils/ThemeUtils.java

@@ -108,6 +108,7 @@ public class ThemeUtils {
         return elementColor(null);
     }
 
+    @NextcloudServer(max = 12)
     public static int elementColor(Account account) {
         OCCapability capability = getCapability(account);