Exemple #1
0
  private void createCurrentLocationList() {
    final ListView list = (ListView) findViewById(R.id.location_list_view);
    int adapterLayout;
    // #if ${piramide.user.capabilities.problems.sight.diopters} > 15
    adapterLayout = R.layout.location_sight_disability;
    // #else
    adapterLayout = R.layout.location_normal;
    // #endif
    String[] currentLocation = {LocationService.getLocation()};

    final ArrayAdapter<String> adapter =
        new ArrayAdapter<String>(this, adapterLayout, currentLocation);
    list.setAdapter(adapter);

    list.setOnItemClickListener(
        new OnItemClickListener() {
          public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
            // #if ${piramide.user.capabilities.problems.sight.diopters} > 15
            vibrator.vibrate(500);
            String selection = list.getItemAtPosition(position).toString();
            tts.speech(selection);
            // #endif
          }
        });
  }
Exemple #2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // #if ${piramide.user.capabilities.problems}
    // #if ${piramide.user.capabilities.problems.sight}
    // #if ${piramide.user.capabilities.problems.sight.diopters} < 15
    setContentView(R.layout.location_normal);
    // #else
    setContentView(R.layout.location_sight_disability);
    tts = new TextToSpeechWeb();
    tts.init(getApplicationContext(), Constants.DEFAULT_LANGUAGE);
    vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
    // #endif
    // #endif
    // #endif
    Log.d(Constants.TAG, "Launching CurrentLocation...");
    createCurrentLocationList();

    location = (TextView) findViewById(R.id.location);
    location.setText(LocationService.getLocation());

    // #if ${piramide.user.capabilities.problems.sight.diopters} > 15
    tts.speech((String) location.getText());
    // #endif

    setResult(Constants.SUCCESS_RETURN_CODE, new Intent());
  }