コード例 #1
0
 @Override
 public boolean handleMessage(final Message msg) {
   Log.d(LOG_TAG_MODEL, "GeoModel.handleMessage: START");
   switch (msg.what) {
     case MessageConstans.M_LOCATION_CHANGED:
       Log.d(LOG_TAG_MODEL, "GeoModel.handleMessage: M_LOCATION_CHANGED");
       if (msg.obj != null && msg.obj instanceof Location) {
         this.location = (Location) msg.obj;
         Presenter.getInst().sendViewMessage(MessageConstans.M_LOCATION_UPDATE, this.location);
         Presenter.getInst().sendModelMessage(MessageConstans.M_UPDATE_PLACES);
       }
       break;
     case MessageConstans.M_UPDATE_PLACES:
       Log.d(LOG_TAG_MODEL, "GeoModel.handleMessage: M_UPDATE_PLACES");
       if (this.placeResultList == null) {
         this.refreshPlaceList();
       }
       break;
     case MessageConstans.V_REFRESH_PLACES:
       Log.d(LOG_TAG_MODEL, "GeoModel.handleMessage: V_REFRESH_PLACES");
       this.refreshPlaceList();
       break;
     default:
       break;
   }
   Log.d(LOG_TAG_MODEL, "GeoModel.handleMessage: END");
   return false;
 }
コード例 #2
0
 @Override
 public void onLocationChanged(final Location location) {
   Log.d(LOG_TAG_MODEL, "LocationListener.onLocationChanged: START");
   if (location != null) {
     Presenter.getInst().sendModelMessage(MessageConstans.M_LOCATION_CHANGED, location);
   }
   Log.d(LOG_TAG_MODEL, "LocationListener.onLocationChanged: START");
 }
コード例 #3
0
    @Override
    public void onSuccess(final String content) {
      super.onSuccess(content);
      Log.d(LOG_TAG_MODEL, "PlacesResponseHandler.onSuccess: START");
      final Gson gson = new Gson();
      final PlacesResponse placeResponse = gson.fromJson(content, PlacesResponse.class);
      final List<Result> results = placeResponse.results;

      if (results != null) {
        Log.d(LOG_TAG_MODEL, "PlacesResponseHandler.onSuccess: SUCCESS");
        GeoModel.this.placeResultList = new ArrayList<Result>(results);
        Presenter.getInst()
            .sendViewMessage(MessageConstans.M_REFRESH_PLACES, new ResultList(results));
      }
      Log.d(LOG_TAG_MODEL, "PlacesResponseHandler.onSuccess: END");
    }