/[projects]/android/MarketStats/src/dk/thoerup/marketstats/AppsCallback.java
ViewVC logotype

Contents of /android/MarketStats/src/dk/thoerup/marketstats/AppsCallback.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 950 - (show annotations) (download)
Mon Jul 5 08:18:02 2010 UTC (13 years, 10 months ago) by torben
File size: 1241 byte(s)
refactor to jsp views
1 package dk.thoerup.marketstats;
2
3 import java.text.NumberFormat;
4 import java.util.Formatter;
5
6 import com.gc.android.market.api.MarketSession.Callback;
7 import com.gc.android.market.api.model.Market.App;
8 import com.gc.android.market.api.model.Market.AppsResponse;
9 import com.gc.android.market.api.model.Market.ResponseContext;
10
11 public class AppsCallback implements Callback<AppsResponse>{
12 private AppBean result = null;
13
14 public AppBean getResult() {
15 return result;
16 }
17
18 @Override
19 public void onResult(ResponseContext cntxt, AppsResponse apps) {
20 if (apps.getAppCount() == 1) {
21 NumberFormat form = NumberFormat.getNumberInstance();
22 form.setMinimumFractionDigits(4);
23 form.setMaximumFractionDigits(4);
24
25
26 App app = apps.getApp(0);
27
28
29 result = new AppBean();
30 result.id = app.getId();
31 result.title = app.getTitle();
32 result.version = app.getVersion();
33 result.versionCode = app.getVersionCode();
34 result.downloadsCount = app.getExtendedInfo().getDownloadsCount();
35 result.downloadsCountText = app.getExtendedInfo().getDownloadsCountText();
36
37 result.ratingsCount = app.getRatingsCount();
38 double rating = Double.parseDouble( app.getRating() );
39 result.rating = form.format(rating);
40 }
41 }
42
43
44 }

  ViewVC Help
Powered by ViewVC 1.1.20