29 lines
726 B
Java
29 lines
726 B
Java
package org.mercury_im.messenger.android.ui.contacts;
|
|
|
|
import androidx.annotation.ColorInt;
|
|
|
|
import org.jivesoftware.smack.packet.Presence;
|
|
import org.mercury_im.messenger.android.util.ColorUtil;
|
|
|
|
public class PresenceModeToColorMapper {
|
|
|
|
@ColorInt
|
|
public static int map(Presence.Mode mode) {
|
|
int color = 0;
|
|
switch (mode) {
|
|
case chat:
|
|
case available:
|
|
color = ColorUtil.rgb(0, 255, 0);
|
|
break;
|
|
case away:
|
|
case xa:
|
|
color = ColorUtil.rgb(255, 128, 0);
|
|
break;
|
|
case dnd:
|
|
color = ColorUtil.rgb(255, 0, 0);
|
|
break;
|
|
}
|
|
return color;
|
|
}
|
|
}
|