/[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 704 by torben, Fri Apr 23 15:26:21 2010 UTC revision 705 by torben, Tue May 4 03:48:37 2010 UTC
# Line 9  import com.gc.android.market.api.model.M Line 9  import com.gc.android.market.api.model.M
9    
10  public class AppsCallback implements Callback<AppsResponse>{  public class AppsCallback implements Callback<AppsResponse>{
11          private StringBuilder sb;          private StringBuilder sb;
12            private String appId = null;
13    
14          public void setStringBuffer(StringBuilder s) {          public void setStringBuffer(StringBuilder s) {
15                  sb = s;                  sb = s;
16          }          }
17            
18            public String getAppId() {
19                    return appId;
20            }
21    
22    
23          @Override          @Override
24          public void onResult(ResponseContext context, AppsResponse response) {          public void onResult(ResponseContext context, AppsResponse response) {
25                  //System.out.println("Response : " + response);                  //System.out.println("Response : " + response);
26                  //sb.append("Response: " + response + "\n");                  //sb.append("Response: " + response + "\n");
27                    
28                  Formatter form = new Formatter(sb);                  if (response.getAppCount() == 1 ) {
29                  App app = response.getApp(0);                  
30                  sb.append( "<h2>" + app.getTitle() + "</h2>");                          App app = response.getApp(0);
31                  sb.append("Ver: " + app.getVersion() + " (" + app.getVersionCode() + ")\n"  );                          appId = app.getId();
32                  sb.append("Ratingcount: " + app.getRatingsCount() + "\n");          
33                            Formatter form = new Formatter(sb);
34                  sb.append("Rating: "  );                          
35                  double rating = Double.parseDouble( app.getRating() );                          
36                  form.format("%.4f", rating);                          sb.append( "<h2>" + app.getTitle() + "</h2>");
37                  sb.append("\n");                          sb.append("Ver: " + app.getVersion() + " (" + app.getVersionCode() + ")\n"  );
38                            sb.append("Ratingcount: " + app.getRatingsCount() + "\n");
39                  sb.append("Downloads: " + app.getExtendedInfo().getDownloadsCountText() + " (" + app.getExtendedInfo().getDownloadsCount() + ")\n" );          
40                            sb.append("Rating: "  );
41                  sb.append("\n");                          double rating = Double.parseDouble( app.getRating() );
42                            form.format("%.4f", rating);
43                            sb.append("\n");
44            
45                            sb.append("Downloads: " + app.getExtendedInfo().getDownloadsCountText() + " (" + app.getExtendedInfo().getDownloadsCount() + ")\n" );
46            
47                            sb.append("\n");
48                    } else {
49                            sb.append("<h2>Application not found</h2>");
50                    }
51    
52          }          }
53    

Legend:
Removed from v.704  
changed lines
  Added in v.705

  ViewVC Help
Powered by ViewVC 1.1.20