Ejemplo n.º 1
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    SharedPreferences.Editor editor = settings.edit();
    boolean check;
    int color;

    /* resultCode must equal RESULT_CANCELED because the only way
     * out of that activity is pressing the back button on the phone
     * this publishes a canceled result code not an ok result code
     */
    if (requestCode == SETTING_REQ && resultCode == RESULT_CANCELED) {
      // save the information we get from settings activity
      check = data.getBooleanExtra("HIDDEN", false);
      color = data.getIntExtra("COLOR", -1);

      editor.putBoolean(PREFS_HIDDEN, check);
      editor.putInt(PREFS_COLOR, color);
      editor.commit();

      flmg.setShowHiddenFiles(check);
      handler.setTextColor(color);
      handler.updateDirectory(flmg.getNextDir(flmg.getCurrentDir(), true));
    }
  }
Ejemplo n.º 2
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);

    if (intent != null) {
      Bundle extras = intent.getExtras();
      switch (requestCode) {
        case ACTIVITY_CREATE:
          String title = extras.getString(NotesDbAdapter.KEY_TITLE);
          String body = extras.getString(NotesDbAdapter.KEY_BODY);
          mDbHelper.createNote(title, body);
          fillData();
          break;
        case ACTIVITY_EDIT:
          Long rowId = extras.getLong(NotesDbAdapter.KEY_ROWID);
          if (rowId != null) {
            String editTitle = extras.getString(NotesDbAdapter.KEY_TITLE);
            String editBody = extras.getString(NotesDbAdapter.KEY_BODY);
            mDbHelper.updateNote(rowId, editTitle, editBody);
            fillData();
          }
          break;
        default:
          break;
      }
    }
  }
Ejemplo n.º 3
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent intent) {

    super.onActivityResult(requestCode, resultCode, intent);
    if (resultCode == RESULT_CANCELED) {
      return;
    }

    if (requestCode == REDIRECTION_ACTIVITY) {
      // if back from the browser try to obtain access to Opera Link data
      // and then synchronise
      grantAccess();
      syncItems();
      return;
    }

    // back from note edit activity
    int mode = intent.getIntExtra(NoteEdit.NOTEPAD_MODE, NoteEdit.EDIT_NOTE);

    if (mode == NoteEdit.DELETE_NOTE) {
      notesDeleted = true;
    }
    if (mode == NoteEdit.INSERT_NOTE) {
      notesAdded = true;
    } else if (mode == NoteEdit.EDIT_NOTE) {
      notesChanged = true;
    }
    isSynchronized = isSynchronized && !notesDeleted && !notesAdded && !notesChanged;

    if (automaticSync) {
      sendChanges();
    }
    fillData();
  }
Ejemplo n.º 4
0
  protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);

    if (resultCode != RESULT_OK) return;

    Bundle bundle = intent.getExtras();
    if (bundle == null) return;

    String front = bundle.getString(AddCards.CARD_FRONT);
    String back = bundle.getString(AddCards.CARD_BACK);

    if (requestCode == ADD_CARD) {
      Cards newCard = new Cards(front, back);
      cards.add(newCard);
      backend.save(deck);
    }

    if (requestCode == EDIT_CARD) {
      String oldCardFront = bundle.getString(AddCards.OLD_CARD_FRONT);

      deck.deleteCard(oldCardFront);

      Cards newCard = new Cards(front, back);
      deck.addCard(newCard);
      backend.save(deck);

      cards = deck.getCards();
    }

    listView.setAdapter(new ArrayAdapter<Cards>(this, R.layout.card, cards));
  }
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   // TODO Auto-generated method stub
   super.onActivityResult(requestCode, resultCode, data);
   if (resultCode == 2) {
     SearchListActivity.this.finish();
   }
 }
Ejemplo n.º 6
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   // refresh main activity
   if (resultCode == RESULT_OK) {
     browseTo(currentDirectory);
   }
 }
Ejemplo n.º 7
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == REQUEST_ENABLE_BT && resultCode == Activity.RESULT_CANCELED) {
     finish();
     return;
   }
   super.onActivityResult(requestCode, resultCode, data);
 }
Ejemplo n.º 8
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == RESULT_OK) {
      mAdapter.setAlarms(dbHelper.getAlarms());
      mAdapter.notifyDataSetChanged();
    }
  }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == MyConstant.REQUEST_CODE_CREATE_PROFILE) {
      if (resultCode == RESULT_OK) {
        MyProfile mp = (MyProfile) data.getParcelableExtra(MY_PROFILE_KEY);
        /*Toast.makeText(
        ProfileActivity.this,
        mp.toString(),
        Toast.LENGTH_LONG).show();*/

        // 将MyProfile的值填入ContentValues中
        ContentValues values = new ContentValues();
        values.put(MyProfileTable.NAME, mp.getName());
        values.put(MyProfileTable.ALLOW_CHANGING_VOLUME, mp.isAllowChangingVolume());
        if (mp.isAllowChangingVolume()) values.put(MyProfileTable.VOLUME, mp.getVolume());
        values.put(MyProfileTable.VIBRATE_TYPE, mp.getVibrate_type());
        values.put(MyProfileTable.ALLOW_CHANGING_RINGTONE, mp.isAllowChangingRingtone());
        if (mp.isAllowChangingRingtone()) values.put(MyProfileTable.RINGTONE, mp.getRingtone());
        values.put(MyProfileTable.MESSAGE_CONTENT, mp.getMessage_content());
        values.put(MyProfileTable.DESCRIPTION, mp.toString());
        getContentResolver().insert(MyProfileTable.CONTENT_URI, values);
        // MainActivity.rm.rearrange(this);
      }
    } else if (requestCode == MyConstant.REQUEST_CODE_EDIT_PROFILE) {
      if (resultCode == RESULT_OK) {
        /*Toast.makeText(
        ProfileActivity.this,
        "编辑返回测试",
        Toast.LENGTH_SHORT).show();*/
        MyProfile mp = (MyProfile) data.getParcelableExtra(MY_PROFILE_KEY);
        long id = data.getLongExtra(EDIT_PROFILE_ID_KEY, -1);

        // 将MyProfile的值填入ContentValues中
        ContentValues values = new ContentValues();
        values.put(MyProfileTable.NAME, mp.getName());
        values.put(MyProfileTable.ALLOW_CHANGING_VOLUME, mp.isAllowChangingVolume());
        if (mp.isAllowChangingVolume()) values.put(MyProfileTable.VOLUME, mp.getVolume());
        values.put(MyProfileTable.VIBRATE_TYPE, mp.getVibrate_type());
        values.put(MyProfileTable.ALLOW_CHANGING_RINGTONE, mp.isAllowChangingRingtone());
        if (mp.isAllowChangingRingtone()) values.put(MyProfileTable.RINGTONE, mp.getRingtone());
        values.put(MyProfileTable.MESSAGE_CONTENT, mp.getMessage_content());
        values.put(MyProfileTable.DESCRIPTION, mp.toString());

        getContentResolver()
            .update(
                MyProfileTable.CONTENT_URI,
                values,
                MyProfileTable._ID + "=?",
                new String[] {"" + id});

        MainActivity.rm.rearrange(this);
      }
    }
  }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);

    /*
     * Populate the listview with the online stories at the start of the
     * activity
     */
    fillData(esHelper.getOnlineStories());
  }
Ejemplo n.º 11
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   if (resultCode == 100) {
     // if result code 100 is received means the actions has effect
     // and reload this screen again.
     Intent in = getIntent();
     finish();
     startActivity(in);
   }
 }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == RESULT_OK) {
      switch (requestCode) {
        case REQUEST_NEW_GESTURE:
          loadGestures();
          break;
      }
    }
  }
Ejemplo n.º 13
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   switch (requestCode) {
     case REQUEST_AUTHENTICATE:
       if (resultCode == RESULT_OK) {
         loadAccount(false);
       } else {
         showDialog(DIALOG_ACCOUNTS);
       }
       break;
   }
 }
Ejemplo n.º 14
0
  /** @see android.app.Activity#onActivityResult(int, int, android.content.Intent) */
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == INFOSELECT_REQUEST) {
      if (data != null) {
        String[] checked = data.getStringArrayExtra("checked");
        infoView.setChecked(checked);
      }

      return;
    }

    super.onActivityResult(requestCode, resultCode, data);
  }
Ejemplo n.º 15
0
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == RESULT_OK && requestCode == 0) {
      int androidKeyCode = data.getIntExtra("androidKeyCode", 0);
      for (int i = 0; i < InputHandler.keyMapping.length; i++)
        if (InputHandler.keyMapping[i] == androidKeyCode) InputHandler.keyMapping[i] = -1;

      InputHandler.keyMapping[(playerIndex * emulatorInputLabels.length) + emulatorInputIndex] =
          androidKeyCode;
    }
    drawListAdapter();
  }
 // Response from Edit Product Activity
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   // if result code 100
   if (resultCode == 100) {
     // if result code 100 is received
     // means user edited/deleted product
     // reload this screen again
     Intent intent = getIntent();
     finish();
     startActivity(intent);
   }
 }
Ejemplo n.º 17
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (REQUEST_CAPTURE_IMAGE == requestCode && resultCode == Activity.RESULT_OK) {
      // カメラアプリ起動後の処理
      try {
        Bitmap img = (Bitmap) data.getExtras().get("data");

        Intent intent = new Intent(ImageTwActivity.this, ImagePreviewActivity.class);
        intent.putExtra("photoData", img);
        intent.putExtra("fileName", imageFile);
        startActivity(intent);

      } catch (Exception e) {
        e.printStackTrace();
      }
    } else if (REQUEST_CODE == requestCode && resultCode == Activity.RESULT_OK) {
      // ギャラリーからのアップロード
      Bitmap bitmap = null;

      try {
        InputStream is = getContentResolver().openInputStream(data.getData());
        bitmap = BitmapFactory.decodeStream(is);

        int width = bitmap.getWidth();
        int height = bitmap.getHeight();

        // サイズが大きすぎたらサイズを小さくする
        if (width > 300 || height > 300) {
          float scale = Math.min((float) 200 / width, (float) 200 / height);
          Matrix matrix = new Matrix();
          matrix.postScale(scale, scale);
          bitmap = bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
        }

        is.close();

        Intent intent = new Intent(ImageTwActivity.this, ImagePreviewActivity.class);
        intent.putExtra("photoData", bitmap);
        intent.putExtra("fileName", imageFile);
        intent.putExtra("isGallery", 1);
        startActivity(intent);

      } catch (FileNotFoundException e) {
        e.printStackTrace();
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
  }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.d(TAG, "onActivityResult(" + requestCode + "," + resultCode + "," + data);

    // Pass on the activity result to the helper for handling
    if (!mHelper.handleActivityResult(requestCode, resultCode, data)) {
      // not handled, so handle it ourselves (here's where you'd
      // perform any handling of activity results not related to in-app
      // billing...
      super.onActivityResult(requestCode, resultCode, data);
    } else {
      Log.d(TAG, "onActivityResult handled by IABUtil.");
    }
  }
Ejemplo n.º 19
0
  // 5, Without this onIabPurchaseFinished will not working
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // Pass on the activity result to the helper for handling

    if (!mHelper.handleActivityResult(requestCode, resultCode, data)) {
      // handle of activity results not related to in-app
      super.onActivityResult(requestCode, resultCode, data);
      if (requestCode == 11) {
        // We are returning from signup so close this screen
        finish();
      }
    } else {

    }
  }
Ejemplo n.º 20
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    // Nos aseguramos que es la petición que hemos realizado
    switch (requestCode) {
      case C_CREAR:
        if (resultCode == RESULT_OK) consultar();

      case C_VISUALIZAR:
        if (resultCode == RESULT_OK) consultar();

      default:
        super.onActivityResult(requestCode, resultCode, data);
    }
  }
Ejemplo n.º 21
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   // TODO Auto-generated method stub
   super.onActivityResult(requestCode, resultCode, data);
   switch (requestCode) {
     case CustomResultCodes.VIEW_TEAMS_REQUEST_CODE:
       switch (resultCode) {
         case RESULT_OK:
           Intent mIntent = new Intent();
           mIntent.putExtras(data.getExtras());
           setResult(RESULT_OK, mIntent);
           finish();
           break;
       }
       break;
   }
 }
Ejemplo n.º 22
0
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   switch (requestCode) {
     case 1: // 拍照
       if (resultCode == RESULT_OK) {
         Toast.makeText(this, "拍摄成功", Toast.LENGTH_SHORT).show();
         Map<String, Object> map = new HashMap<String, Object>();
         map = new HashMap<String, Object>();
         map.put("title", "第 " + (mData.size() + 1) + "张图片");
         map.put("info", "还未添加描述哦~ ");
         map.put("img", "file://" + strImgPath);
         mData.add(map);
         adapter.notifyDataSetChanged();
       }
       break;
     default:
       break;
   }
 }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);

    switch (requestCode) {
      case ACTIVITY_EDIT_BOOKMARK:
        if (resultCode == RESULT_OK) {
          fillData();
        }
        break;
      case ACTIVITY_ADD_BOOKMARK:
        if (resultCode == RESULT_OK) {
          fillData();
        }
        break;

      default:
        break;
    }
  }
Ejemplo n.º 24
0
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == Activity.RESULT_CANCELED) {
      // Toast.makeText(this, "activity canceled", Toast.LENGTH_SHORT)
      // .show();
    } else if (resultCode == Activity.RESULT_OK) {
      String input = data.getStringExtra("input");
      // Toast.makeText(this, "input = " + input,
      // Toast.LENGTH_LONG).show();
      selLineid = Integer.parseInt(input);
      loadStopsList();

      for (int i = 0; i < busLinesId.length; i++) {
        if (selLineid == busLinesId[i]) {
          spin_buslines.setSelection(i);
          break;
        }
      }
    }
  }
Ejemplo n.º 25
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   Log.i(TAG, "result received. req: " + requestCode + " res: " + resultCode);
   if (requestCode == REQUEST_CODE_SETUP_ACCOUNT) {
     dismissDialog(DIALOG_NO_ACCOUNT);
     if (resultCode == RESULT_CANCELED) {
       finish();
     }
     Account[] accounts = mAccountManager.getAccountsByType(AccountAuthenticator.AUTH_TOKEN_TYPE);
     if (accounts.length == 0) {
       showDialog(DIALOG_NO_ACCOUNT);
     } else {
       // there is no need for checking for is there more then one
       // account at this point
       // since account setup can set only one account at time
       mAccount = accounts[0];
       populateDirectoryList();
     }
   }
 }
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
   if (resultCode == RESULT_CANCELED) {
     return;
   }
   switch (requestCode) {
       // returns with a form path, start entry
     case INSTANCE_UPLOADER:
       if (intent.getBooleanExtra(FormEntryActivity.KEY_SUCCESS, false)) {
         mSelected.clear();
         getListView().clearChoices();
         if (mInstances.isEmpty()) {
           finish();
         }
       }
       break;
     default:
       break;
   }
   super.onActivityResult(requestCode, resultCode, intent);
 }
Ejemplo n.º 27
0
  // gets fileName from FilePicker and starts Map Activity with fileName as parameter
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (data == null) {
      return;
    }
    String fileName = data.getStringExtra("selectedFile");
    String className = data.getStringExtra("class");
    if (fileName != null && className != null) {
      try {
        Intent myIntent = new Intent(LauncherList.this, Class.forName(className));

        Bundle b = new Bundle();
        b.putString("selectedFile", fileName);
        myIntent.putExtras(b);
        this.startActivity(myIntent);

      } catch (ClassNotFoundException e) {
        e.printStackTrace();
      }
    }
  }
Ejemplo n.º 28
0
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (GPLog.LOG_ABSURD) GPLog.addLogEntry(this, "Activity returned"); // $NON-NLS-1$
    super.onActivityResult(requestCode, resultCode, data);
    switch (requestCode) {
      case (MapsActivity.FORMUPDATE_RETURN_CODE):
        {
          if (resultCode == Activity.RESULT_OK) {
            String[] formArray = data.getStringArrayExtra(LibraryConstants.PREFS_KEY_FORM);
            if (formArray != null) {
              try {
                double lon = Double.parseDouble(formArray[0]);
                double lat = Double.parseDouble(formArray[1]);
                String textStr = formArray[4];
                String jsonStr = formArray[6];

                float n = (float) (lat + 0.00001f);
                float s = (float) (lat - 0.00001f);
                float w = (float) (lon - 0.00001f);
                float e = (float) (lon + 0.00001f);

                List<Note> notesInWorldBounds = DaoNotes.getNotesInWorldBounds(n, s, w, e);
                if (notesInWorldBounds.size() > 0) {
                  Note note = notesInWorldBounds.get(0);
                  long id = note.getId();
                  DaoNotes.updateForm(id, textStr, jsonStr);
                }

              } catch (Exception e) {
                e.printStackTrace();
                Utilities.messageDialog(this, eu.geopaparazzi.library.R.string.notenonsaved, null);
              }
            }
          }
          break;
        }
    }
  }
Ejemplo n.º 29
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
   super.onActivityResult(requestCode, resultCode, intent);
   fillData();
 }
Ejemplo n.º 30
0
 protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
   super.onActivityResult(requestCode, resultCode, intent);
   renderListView();
 }