private void updateDatabase(long id, WheelchairState state) {
    Log.d(TAG, "updating id = " + id + " state = " + state.asRequestParameter());
    if (id == Extra.ID_UNKNOWN || state == null) return;

    ContentValues values = new ContentValues();
    values.put(POIs.WHEELCHAIR, state.getId());
    values.put(POIs.DIRTY, POIs.DIRTY_STATE);

    PrepareDatabaseHelper.editCopy(getContentResolver(), id, values);
  }
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   Log.d(TAG, "onActivityResult: requestCode = " + requestCode + " resultCode = " + resultCode);
   if (requestCode == SELECT_WHEELCHAIRSTATE) {
     if (resultCode == RESULT_OK) {
       // newly selected wheelchair state as action data
       if (data != null) {
         WheelchairState state =
             WheelchairState.valueOf(data.getIntExtra(Extra.WHEELCHAIR_STATE, Extra.UNKNOWN));
         updateDatabase(poiIdSelected, state);
         Log.d(TAG, "starting SyncServiceHelper.executeUpdateServer");
         SyncServiceHelper.executeUpdateServer(this, null);
       }
     }
   }
 }
Exemplo n.º 3
0
 public static WheelchairState getWheelchair(Cursor c) {
   return WheelchairState.valueOf(
       c.getInt(c.getColumnIndexOrThrow(Wheelmap.POIsColumns.WHEELCHAIR)));
 }
 @Override
 public void onEditWheelchairState(WheelchairState wState) {
   Intent intent = new Intent(this, WheelchairStateActivity.class);
   intent.putExtra(Extra.WHEELCHAIR_STATE, wState.getId());
   startActivityForResult(intent, SELECT_WHEELCHAIRSTATE);
 }