예제 #1
0
  protected void advanceToNextScreen(final GeocodedAddress g) {
    Assert.assertNotNull(g);

    try {
      final Country nat = this.bundleCreatedWith.getParcelable(EXTRAS_COUNTRY_ID);
      DBManager.addZipCode(SDPostcodeUK_BS7666.this, g.getPostalCode(), nat.COUNTRYCODE);
    } catch (final DataBaseException e) {
      // Log.e(DEBUGTAG, "Error on inserting Postcode", e);
    }

    final int mode = SDPostcodeUK_BS7666.this.bundleCreatedWith.getInt(MODE_SD);
    switch (mode) {
      case MODE_SD_DESTINATION:
        /* Add the StreetNumber to the Bundle to be passed further. */
        SDPostcodeUK_BS7666.this.bundleCreatedWith.putInt(EXTRAS_MODE, EXTRAS_MODE_DIRECT_LATLNG);

        SDPostcodeUK_BS7666.this.bundleCreatedWith.putInt(
            EXTRAS_DESTINATION_LATITUDE_ID, g.getLatitudeE6());
        SDPostcodeUK_BS7666.this.bundleCreatedWith.putInt(
            EXTRAS_DESTINATION_LONGITUDE_ID, g.getLongitudeE6());

        /* Create an Intent to open the Map as a SubActivity. */
        final Intent fetchRouteIntent = new Intent(SDPostcodeUK_BS7666.this, OpenStreetDDMap.class);

        /* Pass the Bundle this Activity was created with further. */
        fetchRouteIntent.putExtras(SDPostcodeUK_BS7666.this.bundleCreatedWith);

        startActivityForResult(fetchRouteIntent, REQUESTCODE_FETCHROUTE);
        break;
      case MODE_SD_WAYPOINT:
      case MODE_SD_SETHOME:
      case MODE_SD_RESOLVE:
        final Intent resultData = new Intent();
        /* Add the StreetNumber to the Bundle to be passed further. */
        SDPostcodeUK_BS7666.this.bundleCreatedWith.putInt(EXTRAS_MODE, EXTRAS_MODE_DIRECT_LATLNG);

        SDPostcodeUK_BS7666.this.bundleCreatedWith.putInt(
            EXTRAS_DESTINATION_LATITUDE_ID, g.getLatitudeE6());
        SDPostcodeUK_BS7666.this.bundleCreatedWith.putInt(
            EXTRAS_DESTINATION_LONGITUDE_ID, g.getLongitudeE6());

        resultData.putExtras(SDPostcodeUK_BS7666.this.bundleCreatedWith);

        SDPostcodeUK_BS7666.this.setResult(SUBACTIVITY_RESULTCODE_CHAINCLOSE_SUCCESS, resultData);
        SDPostcodeUK_BS7666.this.finish();
        break;
    }
  }
예제 #2
0
  protected void applyAutoCompleteListeners() {
    try {
      final Country nat = this.bundleCreatedWith.getParcelable(EXTRAS_COUNTRY_ID);
      final List<String> usedCityNames = DBManager.getCityNames(this, nat.COUNTRYCODE);

      new InlineAutoCompleterCombined(this.postcodeEditText_1, usedCityNames, false) {

        @Override
        public boolean onEnter() {
          SDPostcodeUK_BS7666.this.checkFormat(false);
          return true;
        }

        @Override
        public ArrayList<String> onGetDynamic() {
          return doAutocomplete(0);
        }
      };

      new InlineAutoCompleterCombined(this.postcodeEditText_2, usedCityNames, false) {

        @Override
        public boolean onEnter() {
          SDPostcodeUK_BS7666.this.checkFormat(false);
          return true;
        }

        @Override
        public ArrayList<String> onGetDynamic() {
          return doAutocomplete(1);
        }
      };
    } catch (final DataBaseException e) {
      // Log.e(DEBUGTAG, "Error on loading CityNames", e);
    }
  }