From ef525fb10e672b23219fdf180d310de9f6ce59d3 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 7 Jan 2015 15:03:29 +0100 Subject: basic affiliation changes in muc --- .../siacs/conversations/entities/MucOptions.java | 48 ++++++++++++++++------ 1 file changed, 36 insertions(+), 12 deletions(-) (limited to 'src/main/java/eu/siacs/conversations/entities/MucOptions.java') diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index ce2c5b04b..6a12f407d 100644 --- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -17,40 +17,64 @@ import android.annotation.SuppressLint; public class MucOptions { public enum Affiliation { - OWNER(R.string.owner), - ADMIN(R.string.admin), - MEMBER(R.string.member), - OUTCAST(R.string.outcast), - NONE(R.string.no_affiliation); - - private Affiliation(int resId) { + OWNER("owner", 4, R.string.owner), + ADMIN("admin", 3, R.string.admin), + MEMBER("member", 2, R.string.member), + OUTCAST("outcast", 0, R.string.outcast), + NONE("none", 1, R.string.no_affiliation); + + private Affiliation(String string, int rank, int resId) { + this.string = string; this.resId = resId; + this.rank = rank; } + private String string; private int resId; + private int rank; public int getResId() { return resId; } + + @Override + public String toString() { + return this.string; + } + + public boolean outranks(Affiliation affiliation) { + return rank > affiliation.rank; + } + + public boolean ranks(Affiliation affiliation) { + return rank >= affiliation.rank; + } } ; public enum Role { - MODERATOR(R.string.moderator), - VISITOR(R.string.visitor), - PARTICIPANT(R.string.participant), - NONE(R.string.no_role); + MODERATOR("moderator", R.string.moderator), + VISITOR("visitor", R.string.visitor), + PARTICIPANT("participant", R.string.participant), + NONE("none", R.string.no_role); - private Role(int resId) { + private Role(String string, int resId) { + this.string = string; this.resId = resId; } + private String string; private int resId; public int getResId() { return resId; } + + @Override + public String toString() { + return this.string; + } } public static final int ERROR_NO_ERROR = 0; -- cgit v1.2.3