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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1013 by torben, Mon Jul 5 08:18:02 2010 UTC revision 1014 by torben, Thu Aug 12 09:25:52 2010 UTC
# Line 1  Line 1 
1  package dk.thoerup.marketstats;  package dk.thoerup.marketstats;
2    
3  import java.text.NumberFormat;  import java.text.NumberFormat;
4  import java.util.Formatter;  import java.util.ArrayList;
5    import java.util.List;
6    
7  import com.gc.android.market.api.MarketSession.Callback;  import com.gc.android.market.api.MarketSession.Callback;
8  import com.gc.android.market.api.model.Market.App;  import com.gc.android.market.api.model.Market.App;
# Line 9  import com.gc.android.market.api.model.M Line 10  import com.gc.android.market.api.model.M
10  import com.gc.android.market.api.model.Market.ResponseContext;  import com.gc.android.market.api.model.Market.ResponseContext;
11    
12  public class AppsCallback implements Callback<AppsResponse>{  public class AppsCallback implements Callback<AppsResponse>{
13          private AppBean result = null;          private List<AppBean> result = new ArrayList<AppBean>();
14                    
15          public AppBean getResult() {          public List<AppBean> getResult() {
16                  return result;                  return result;
17          }          }
18                    
19          @Override          @Override
20          public void onResult(ResponseContext cntxt, AppsResponse apps) {          public void onResult(ResponseContext cntxt, AppsResponse apps) {
21                  if (apps.getAppCount() == 1) {                  
22                          NumberFormat form = NumberFormat.getNumberInstance();                  NumberFormat form = NumberFormat.getNumberInstance();
23                          form.setMinimumFractionDigits(4);                  form.setMinimumFractionDigits(4);
24                          form.setMaximumFractionDigits(4);                  form.setMaximumFractionDigits(4);
25                                                    
26                    
27                    for (App app : apps.getAppList()) {    
28                                                    
29                                                    
30                          App app = apps.getApp(0);                          AppBean appBean= new AppBean();
31                            appBean.packageName = app.getPackageName();
32                            appBean.id = app.getId();
33                            appBean.title = app.getTitle();
34                            appBean.version = app.getVersion();
35                            appBean.versionCode = app.getVersionCode();
36                            appBean.downloadsCount = app.getExtendedInfo().getDownloadsCount();
37                            appBean.downloadsCountText = app.getExtendedInfo().getDownloadsCountText();
38                                                    
39                                                    appBean.ratingsCount = app.getRatingsCount();
                         result = new AppBean();  
                         result.id = app.getId();  
                         result.title = app.getTitle();  
                         result.version = app.getVersion();  
                         result.versionCode = app.getVersionCode();  
                         result.downloadsCount = app.getExtendedInfo().getDownloadsCount();  
                         result.downloadsCountText = app.getExtendedInfo().getDownloadsCountText();  
                           
                         result.ratingsCount = app.getRatingsCount();  
40                          double rating = Double.parseDouble( app.getRating() );                          double rating = Double.parseDouble( app.getRating() );
41                          result.rating = form.format(rating);                          appBean.rating = form.format(rating);
42                            
43                            result.add(appBean);
44                  }                  }
45          }          }
46    

Legend:
Removed from v.1013  
changed lines
  Added in v.1014

  ViewVC Help
Powered by ViewVC 1.1.20