blob: 5ab3ef563591d505da74496d392e1f0a2c218e9f (
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
package de.gultsch.chat;
import java.util.ArrayList;
import de.gultsch.chat.entities.Conversation;
import de.gultsch.chat.entities.Message;
import android.database.AbstractCursor;
public class ConversationCursor extends AbstractCursor {
protected ConversationList conversations;
public static final String NAME = "conversationname";
public static final String LAST_MSG = "lastmsg";
public static final String DATE = "date";
public static final String ID = "_id";
public ConversationCursor(ConversationList list) {
super();
this.conversations = list;
}
public ArrayList<Conversation> getConversationOverview() {
return this.conversations;
}
public void setConversationOverview(ConversationList list) {
this.conversations = list;
}
@Override
public String[] getColumnNames() {
return new String[]{ID,NAME,LAST_MSG,DATE};
}
@Override
public int getCount() {
return conversations.size();
}
@Override
public double getDouble(int column) {
// TODO Auto-generated method stub
return 0;
}
@Override
public float getFloat(int column) {
// TODO Auto-generated method stub
return 0;
}
@Override
public int getInt(int column) {
// TODO Auto-generated method stub
return 0;
}
@Override
public long getLong(int column) {
// TODO Auto-generated method stub
return 0;
}
@Override
public short getShort(int column) {
// TODO Auto-generated method stub
return 0;
}
@Override
public String getString(int column) {
Conversation conversation = conversations.get(getPosition());
Message lastMessage = conversation.getLastMessages(1,0).get(0);
switch (column) {
case 1:
return conversation.getName();
case 2:
return lastMessage.toString();
case 3:
return lastMessage.getTimeReadable();
default:
return null;
}
}
@Override
public boolean isNull(int column) {
// TODO Auto-generated method stub
return false;
}
}
|