示例#1
0
 private void fillSelectedShopCenter(ShopCenter thisShopCenter) {
   selectedShopCenter.set_id(thisShopCenter.get_id());
   selectedShopCenter.setName(thisShopCenter.getName());
   selectedShopCenter.setCityId(thisShopCenter.getCityId());
   selectedShopCenter.setCoordinates(thisShopCenter.getCoordinates());
   selectedShopCenter.setCenterImage(thisShopCenter.getCenterImage());
   selectedShopCenter.setFloors(thisShopCenter.getFloors());
 }
示例#2
0
  private void checkLocation(Location location) {

    double latNow = location.getLatitude();
    double lonNow = location.getLongitude();

    for (City thisCity : WelcomeActivity.PARSE_DATA.getData()) {

      if ((thisCity.getCoordinates().getLatMin() <= latNow)
          && (latNow <= thisCity.getCoordinates().getLatMax())
          && ((thisCity.getCoordinates().getLonMin() <= lonNow)
              && (lonNow <= thisCity.getCoordinates().getLonMax()))) {

        city.setText(thisCity.getName());

        Log.d("name", thisCity.getName());
        Log.d("shop center size ", thisCity.getShopCenters().size() + "");

        if (thisCity.getShopCenters().size() > 0) {

          center.setEnabled(true);

          selectedCity.setName(thisCity.getName());
          selectedCity.set_id(thisCity.get_id());
          selectedCity.setCoordinates(thisCity.getCoordinates());
          selectedCity.setShopCenters(thisCity.getShopCenters());

          Log.d("selected name:", selectedCity.getName());
          Log.d("ccity center:", selectedCity.getShopCenters().size() + "");

        } else {
          center.setEnabled(false);
          floor.setEnabled(false);
        }

        for (ShopCenter thisShopCenter : thisCity.getShopCenters()) {

          if ((thisShopCenter.getCoordinates().getLatMin() <= latNow)
              && (latNow <= thisShopCenter.getCoordinates().getLatMax())
              && ((thisShopCenter.getCoordinates().getLonMin() <= lonNow)
                  && (lonNow <= thisShopCenter.getCoordinates().getLonMax()))) {

            center.setText(thisShopCenter.getName());

            if (thisShopCenter.getFloors().size() < 1) {

              floor.setEnabled(false);

              fillSelectedShopCenter(thisShopCenter);

              iv.setImageBitmap(selectedShopCenter.getCenterImage());

            } else {
              floor.setEnabled(true);
              fillSelectedShopCenter(thisShopCenter);
              iv.setImageBitmap(selectedShopCenter.getCenterImage());
            }
          }
        }
      }
    }
  }