Skip to content

Commit

Permalink
annotate via custom annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasKaminsky committed Jan 13, 2018
1 parent 20c0d21 commit 4737f55
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/owncloud/android/ui/TextDrawable.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.utils.BitmapUtils;
import com.owncloud.android.utils.NextcloudServer;

import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
Expand Down Expand Up @@ -95,6 +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)
public static TextDrawable createAvatar(String accountName, float radiusInDp) throws
UnsupportedEncodingException, NoSuchAlgorithmException {
String username = AccountUtils.getAccountUsername(accountName);
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/com/owncloud/android/utils/NextcloudServer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.owncloud.android.utils;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Created by tobi on 21.12.17.
*/

@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.METHOD)
public @interface NextcloudServer {
int min();

int max();
}

0 comments on commit 4737f55

Please sign in to comment.