1 |
torben |
663 |
package dk.thoerup.marketstats; |
2 |
|
|
|
3 |
|
|
import java.util.Formatter; |
4 |
|
|
|
5 |
|
|
import com.gc.android.market.api.MarketSession.Callback; |
6 |
|
|
import com.gc.android.market.api.model.Market.App; |
7 |
|
|
import com.gc.android.market.api.model.Market.AppsResponse; |
8 |
|
|
import com.gc.android.market.api.model.Market.ResponseContext; |
9 |
|
|
|
10 |
|
|
public class AppsCallback implements Callback<AppsResponse>{ |
11 |
|
|
private StringBuilder sb; |
12 |
|
|
|
13 |
|
|
public void setStringBuffer(StringBuilder s) { |
14 |
|
|
sb = s; |
15 |
|
|
} |
16 |
|
|
|
17 |
|
|
|
18 |
|
|
@Override |
19 |
|
|
public void onResult(ResponseContext context, AppsResponse response) { |
20 |
|
|
//System.out.println("Response : " + response); |
21 |
torben |
665 |
//sb.append("Response: " + response + "\n"); |
22 |
torben |
663 |
|
23 |
|
|
Formatter form = new Formatter(sb); |
24 |
|
|
App app = response.getApp(0); |
25 |
|
|
sb.append( "<h2>" + app.getTitle() + "</h2>"); |
26 |
|
|
sb.append("Ver: " + app.getVersion() + " (" + app.getVersionCode() + ")\n" ); |
27 |
|
|
sb.append("Ratingcount: " + app.getRatingsCount() + "\n"); |
28 |
|
|
|
29 |
|
|
sb.append("Rating: " ); |
30 |
|
|
double rating = Double.parseDouble( app.getRating() ); |
31 |
|
|
form.format("%.4f", rating); |
32 |
|
|
sb.append("\n"); |
33 |
|
|
|
34 |
|
|
sb.append("Downloads: " + app.getExtendedInfo().getDownloadsCountText() + " (" + app.getExtendedInfo().getDownloadsCount() + ")\n" ); |
35 |
|
|
|
36 |
|
|
sb.append("\n"); |
37 |
|
|
|
38 |
|
|
} |
39 |
|
|
|
40 |
|
|
|
41 |
|
|
} |