From d346f9d8a526b289322fd88507933d9025a27f81 Mon Sep 17 00:00:00 2001 From: tobiaskaminsky Date: Tue, 9 Jan 2018 07:50:53 +0100 Subject: [PATCH] refined annotations added one more annotation Signed-off-by: tobiaskaminsky --- src/main/java/com/owncloud/android/ui/TextDrawable.java | 2 +- .../java/com/owncloud/android/utils/NextcloudServer.java | 5 +++-- src/main/java/com/owncloud/android/utils/ThemeUtils.java | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/owncloud/android/ui/TextDrawable.java b/src/main/java/com/owncloud/android/ui/TextDrawable.java index b80e91d8cf67..5e6fb6e49a1b 100644 --- a/src/main/java/com/owncloud/android/ui/TextDrawable.java +++ b/src/main/java/com/owncloud/android/ui/TextDrawable.java @@ -96,7 +96,7 @@ public TextDrawable(String text, int r, int g, int b, float radius) { * @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); diff --git a/src/main/java/com/owncloud/android/utils/NextcloudServer.java b/src/main/java/com/owncloud/android/utils/NextcloudServer.java index 79998ba2bc76..cf72c345af1b 100644 --- a/src/main/java/com/owncloud/android/utils/NextcloudServer.java +++ b/src/main/java/com/owncloud/android/utils/NextcloudServer.java @@ -6,13 +6,14 @@ 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(); } \ No newline at end of file diff --git a/src/main/java/com/owncloud/android/utils/ThemeUtils.java b/src/main/java/com/owncloud/android/utils/ThemeUtils.java index 1d1849750b57..ac5b48689dcf 100644 --- a/src/main/java/com/owncloud/android/utils/ThemeUtils.java +++ b/src/main/java/com/owncloud/android/utils/ThemeUtils.java @@ -108,6 +108,7 @@ public static int elementColor() { return elementColor(null); } + @NextcloudServer(max = 12) public static int elementColor(Account account) { OCCapability capability = getCapability(account);