Skip to content

Commit

Permalink
refined annotations
Browse files Browse the repository at this point in the history
added one more annotation

Signed-off-by: tobiaskaminsky <tobias@kaminsky.me>
  • Loading branch information
tobiasKaminsky committed Jan 9, 2018
1 parent a3ddb27 commit 82d2de1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/owncloud/android/ui/TextDrawable.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,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);
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/owncloud/android/utils/NextcloudServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
1 change: 1 addition & 0 deletions src/main/java/com/owncloud/android/utils/ThemeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public static int elementColor() {
return elementColor(null);
}

@NextcloudServer(max = 12)
public static int elementColor(Account account) {
OCCapability capability = getCapability(account);

Expand Down

0 comments on commit 82d2de1

Please sign in to comment.