1 |
package dk.thoerup.marketstats; |
2 |
|
3 |
import java.util.List; |
4 |
|
5 |
import com.gc.android.market.api.MarketSession.Callback; |
6 |
import com.gc.android.market.api.model.Market.Comment; |
7 |
import com.gc.android.market.api.model.Market.CommentsResponse; |
8 |
import com.gc.android.market.api.model.Market.ResponseContext; |
9 |
|
10 |
public class CommentCallback implements Callback<CommentsResponse>{ |
11 |
private String locale; |
12 |
private List<CommentBean> commentBeans; |
13 |
|
14 |
private int entryCount; |
15 |
|
16 |
public void setLocale(String loc) { |
17 |
locale = loc; |
18 |
} |
19 |
|
20 |
public void setList(List<CommentBean> cl) { |
21 |
commentBeans = cl; |
22 |
} |
23 |
|
24 |
public int getEntryCount() { |
25 |
return entryCount; |
26 |
} |
27 |
|
28 |
|
29 |
@Override |
30 |
public void onResult(ResponseContext context, CommentsResponse response) { |
31 |
//System.out.println("Response : " + response); |
32 |
//sb.append("Response: " + response + "\n"); |
33 |
entryCount = response.getEntriesCount(); |
34 |
System.out.println("Count="+entryCount); |
35 |
|
36 |
List<Comment> cl = response.getCommentsList(); |
37 |
for (Comment c : cl) { |
38 |
CommentBean bean = new CommentBean(); |
39 |
bean.locale = locale; |
40 |
bean.author = c.getAuthorName(); |
41 |
bean.rating = c.getRating(); |
42 |
bean.time = c.getCreationTime(); |
43 |
bean.text = c.getText(); |
44 |
commentBeans.add(bean); |
45 |
} |
46 |
} |
47 |
} |