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 |
public void setLocale(String loc) { |
15 |
locale = loc; |
16 |
} |
17 |
|
18 |
public void setList(List<CommentBean> cl) { |
19 |
commentBeans = cl; |
20 |
} |
21 |
|
22 |
|
23 |
|
24 |
|
25 |
@Override |
26 |
public void onResult(ResponseContext context, CommentsResponse response) { |
27 |
//System.out.println("Response : " + response); |
28 |
//sb.append("Response: " + response + "\n"); |
29 |
|
30 |
List<Comment> cl = response.getCommentsList(); |
31 |
for (Comment c : cl) { |
32 |
CommentBean bean = new CommentBean(); |
33 |
bean.locale = locale; |
34 |
bean.author = c.getAuthorName(); |
35 |
bean.rating = c.getRating(); |
36 |
bean.time = c.getCreationTime(); |
37 |
bean.text = c.getText(); |
38 |
commentBeans.add(bean); |
39 |
} |
40 |
} |
41 |
} |