blob: a0ffa256c330be599b7625a385e6395f74e6215d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
package de.thedevstack.conversationsplus.persistance.db.migrations;
import de.thedevstack.conversationsplus.enums.MessageDirection;
import de.thedevstack.conversationsplus.enums.MessageStatus;
/**
*/
public class MessageStatusMigration {
// Following status integers copied from old Message class
public static final int STATUS_RECEIVED = 0;
public static final int STATUS_UNSEND = 1;
public static final int STATUS_SEND = 2;
public static final int STATUS_SEND_FAILED = 3;
public static final int STATUS_WAITING = 5;
public static final int STATUS_OFFERED = 6;
public static final int STATUS_SEND_RECEIVED = 7;
public static final int STATUS_SEND_DISPLAYED = 8;
public static final int STATUS_SEND_CANCELED = 9; // FIXME This bullshit is needed until status is handled more properly
public static MessageDirection getMessageDirection(int status) {
switch (status) {
case STATUS_SEND:
case STATUS_SEND_DISPLAYED:
case STATUS_SEND_FAILED:
case STATUS_SEND_RECEIVED:
case STATUS_SEND_CANCELED:
case STATUS_UNSEND:
case STATUS_WAITING:
case STATUS_OFFERED:
return MessageDirection.OUT;
default:
return MessageDirection.IN;
}
}
public static MessageStatus getMessageStatus(int status) {
switch (status) {
case STATUS_UNSEND:
case STATUS_WAITING:
return MessageStatus.WAITING;
case STATUS_RECEIVED:
case STATUS_SEND:
return MessageStatus.TRANSMITTED;
case STATUS_OFFERED:
return MessageStatus.TRANSMITTING;
case STATUS_SEND_FAILED:
return MessageStatus.FAILED;
case STATUS_SEND_DISPLAYED:
return MessageStatus.DISPLAYED;
case STATUS_SEND_RECEIVED:
return MessageStatus.RECEIVED;
default:
return MessageStatus.CANCELED;
}
}
}
|