@Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode) {
      case REQUEST_CODE_PUBLIC_KEYS:
        {
          if (resultCode == Activity.RESULT_OK) {
            Bundle bundle = data.getExtras();
            setEncryptionKeyIds(
                bundle.getLongArray(SelectPublicKeyActivity.RESULT_EXTRA_MASTER_KEY_IDS));
          }
          break;
        }

      case REQUEST_CODE_SECRET_KEYS:
        {
          if (resultCode == Activity.RESULT_OK) {
            Uri uriMasterKey = data.getData();
            setSignatureKeyId(Long.valueOf(uriMasterKey.getLastPathSegment()));
          } else {
            setSignatureKeyId(Constants.key.none);
          }
          break;
        }

      default:
        {
          super.onActivityResult(requestCode, resultCode, data);

          break;
        }
    }
  }
Ejemplo n.º 2
0
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == AddBook.RC_BARCODE_CAPTURE) {
      if (resultCode == CommonStatusCodes.SUCCESS) {
        if (data != null) {
          Barcode barcode = data.getParcelableExtra(BarcodeCaptureActivity.BarcodeObject);
          ((EditText) rootView.findViewById(R.id.ean)).setText(barcode.displayValue);
          //                    statusMessage.setText(R.string.barcode_success);
          //                    barcodeValue.setText(barcode.displayValue);
          Log.d(TAG, "Barcode read: " + barcode.displayValue);
        } else {
          //                    statusMessage.setText(R.string.barcode_failure);
          Log.d(TAG, "No barcode captured, intent data is null");
        }
      } else {
        //                statusMessage.setText(String.format(getString(R.string.barcode_error),
        //                        CommonStatusCodes.getStatusCodeString(resultCode)));
        Log.d(TAG, "No barcode captured, resultCode: " + resultCode);
      }
    } else {
      super.onActivityResult(requestCode, resultCode, data);
    }
  }
Ejemplo n.º 3
0
  @Override
  public void onActivityResult(int reqCode, int resCode, Intent data) {

    int pick = 131073;
    int camera = 131072;
    int mapa = 131074;
    if (reqCode == IS_LOGGED) {
      if (resCode == RESULT_OK) {
        Bundle bundle = data.getExtras();
        logged = bundle.getBoolean("logged");

        if (logged) {
          Toast.makeText(this, "¡Has iniciado sesion exitosamente!", Toast.LENGTH_LONG).show();
        }
      }
    } else if (reqCode == camera) {

      fragment.onActivityResult(0, resCode, data);

    } else if (reqCode == pick) {

      fragment.onActivityResult(1, resCode, data);

    } else if (reqCode == mapa) {

      fragment.onActivityResult(2, resCode, data);
    }
  }
Ejemplo n.º 4
0
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    switch (requestCode) {
      case REQUEST_GOOGLE_PLAY_SERVICES:
        if (resultCode != Activity.RESULT_OK) {
          isGooglePlayServicesAvailable();
        }
        break;
      case REQUEST_ACCOUNT_PICKER:
        if (resultCode == Activity.RESULT_OK && data != null && data.getExtras() != null) {
          String accountName = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);
          if (accountName != null) {
            credential.setSelectedAccountName(accountName);
            SharedPreferences settings = getActivity().getPreferences(Context.MODE_PRIVATE);
            SharedPreferences.Editor editor = settings.edit();
            editor.putString(PREF_ACCOUNT_NAME, accountName);
            editor.commit();
          }
        } else if (resultCode == Activity.RESULT_CANCELED) {
          mStatusText.setText("Pas de compte sélectionné");
        }
        break;
      case REQUEST_AUTHORIZATION:
        if (resultCode != Activity.RESULT_OK) {
          chooseAccount();
        }
        break;
    }

    super.onActivityResult(requestCode, resultCode, data);
  }
Ejemplo n.º 5
0
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    List<Fragment> fragments = getChildFragmentManager().getFragments();
    if (fragments != null) {
      for (Fragment fragment : fragments) {
        fragment.onActivityResult(requestCode, resultCode, data);
      }
    }
  }
Ejemplo n.º 6
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == ADD_PHOTO && resultCode == Activity.RESULT_OK) {
     if (data != null && data.getExtras() != null && data.getExtras().get("data") != null) {
       Bitmap bm = (Bitmap) data.getExtras().get("data");
       showPopupMenuAskingImageSize(null, bm);
     } else if (data != null && data.getData() != null) {
       String filePath = getRealPathFromURI(data.getData());
       showPopupMenuAskingImageSize(filePath, null);
     } else if (imageToUploadUri != null) {
       String filePath = imageToUploadUri.getPath();
       showPopupMenuAskingImageSize(filePath, null);
     } else {
       File file =
           new File(
               Environment.getExternalStorageDirectory(), getString(R.string.temp_photo_name));
       if (file.exists()) {
         imageToUploadUri = Uri.fromFile(file);
         String filePath = imageToUploadUri.getPath();
         showPopupMenuAskingImageSize(filePath, null);
       }
     }
   } else {
     super.onActivityResult(requestCode, resultCode, data);
   }
 }
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == Constants.ResultCode.ALARM_LIST) {
     updateAlarm();
   }
   super.onActivityResult(requestCode, resultCode, data);
 }
Ejemplo n.º 8
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   switch (requestCode) {
     case CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE:
       if (resultCode == Activity.RESULT_OK) {
         Uri selectedImage = imageUri;
         AddFragment.this.getActivity().getContentResolver().notifyChange(selectedImage, null);
         imageView = (ImageView) view.findViewById(R.id.imageView2);
         ContentResolver cr = AddFragment.this.getActivity().getContentResolver();
         try {
           Matrix matrix = new Matrix();
           matrix.postRotate(90);
           bitmap = android.provider.MediaStore.Images.Media.getBitmap(cr, selectedImage);
           Bitmap rotatedBitmap =
               Bitmap.createBitmap(
                   bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
           imageView.setImageBitmap(rotatedBitmap);
           recupLocation();
         } catch (Exception e) {
           Toast.makeText(AddFragment.this.getActivity(), "Failed to load", Toast.LENGTH_SHORT)
               .show();
           Log.e("Camera", e.toString());
         }
       }
   }
 }
Ejemplo n.º 9
0
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == MediaPickerConstants.CAPTURE_IMAGE_REQUEST_CODE) {
      if (resultCode == Activity.RESULT_OK) {
        String fileUriString = fileUri.toString().replaceFirst("file:///", "/").trim();
        Media media = new Media(fileUriString, MediaType.MEDIA_TYPE_IMAGE);
        mSelectedMedias.clear();
        mSelectedMedias.add(media);

        setCallback(Activity.RESULT_OK);
        getActivity().finish();
      }
    } else if (requestCode == MediaPickerConstants.PREVIEW_ALBUM_MEDIAS_REQUEST_CODE) {
      if (resultCode == MediaPickerConstants.PREVIEW_MEDIAS_BACK_RESULT_CODE) {
        mSelectedMedias = (ArrayList<Media>) data.getSerializableExtra("selectedMedias");
        mMediaAdapter.setSelectedMedias(mSelectedMedias);

        mCallback.onMediaSelected(mSelectedMedias);
      } else if (resultCode == Activity.RESULT_OK) {
        mSelectedMedias = (ArrayList<Media>) data.getSerializableExtra("selectedMedias");

        setCallback(Activity.RESULT_OK);
        getActivity().finish();
      }
    }
  }
Ejemplo n.º 10
0
  @SuppressWarnings("static-access")
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    switch (requestCode) {
      case Value.CODE_PREFERENCE:
        if (resultCode == getActivity().RESULT_OK) {
          if (data != null && data.getBooleanExtra("IsExit", false) == true) {
            getActivity().finish();
          }
        }
        break;

      case Value.CODE_LOGIN:
        if (resultCode == getActivity().RESULT_OK) {
          if (data != null) {
            User tmpUser = (User) data.getSerializableExtra("user");
            User user = User.getIntance();

            user.setNickname(tmpUser.getNickname());
            user.setPhoto(tmpUser.getPhoto());
            user.setTele(tmpUser.getTele());
            user.setPassword(tmpUser.getPassword());
          }
        }
    }
  }
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   if (resultCode == Activity.RESULT_OK && requestCode == SELECT_FILE_REQUEST_CODE) {
     mPathToFileEdit.setText(data.getStringExtra(FileDialog.RESULT_PATH));
   }
 }
Ejemplo n.º 12
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   this.getActivity();
   if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) { // À´×ÔͼƬ¿â
     if (resultCode == FragmentActivity.RESULT_OK) {
       uri = data.getData();
       if (uri != null) {
         ContentResolver cr = this.getActivity().getContentResolver();
         try {
           Bitmap bitmap = BitmapFactory.decodeStream(cr.openInputStream(uri));
           // ½«BitmapÉ趨µ½ImageView
           ivImage.setImageBitmap(bitmap);
         } catch (FileNotFoundException e) {
           Log.e("Exception", e.getMessage(), e);
         }
       }
     }
   } else if (requestCode == CAPTURE_CAMERA_ACTIVITY_REQUEST_CODE) { // À´×ÔÕÕÏà»ú
     if (resultCode == FragmentActivity.RESULT_OK) {
       if (data != null) {
         uri = data.getData();
         if (data.hasExtra("data")) {
           Bitmap bitmap = data.getParcelableExtra("data");
           // ½«BitmapÉ趨µ½ImageView
           ivImage.setImageBitmap(bitmap);
         }
       }
     }
   }
   super.onActivityResult(requestCode, resultCode, data);
 }
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    PreferenceManagerCompat.dispatchActivityResult(
        mPreferenceManager, requestCode, resultCode, data);
  }
  @TargetApi(Build.VERSION_CODES.KITKAT)
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    // Override this method in the activity that hosts the Fragment and call super
    // in order to receive the result inside onActivityResult from the fragment.
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == getActivity().RESULT_OK) {
      // Get the Uri of the selected file
      Uri uri = data.getData();
      String id = DocumentsContract.getDocumentId(uri);
      Uri contentUri =
          ContentUris.withAppendedId(
              Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
      File myFile = new File(fileManager.getDataColumn(getActivity(), contentUri, null, null));
      byte[] bytes = new byte[0];
      try {
        bytes = fileManager.loadFile(myFile);
      } catch (IOException e) {
        e.printStackTrace();
      }
      file = Base64.encodeToString(bytes, Base64.NO_WRAP);
      Log.d("file", file);
      et_anexo_desc.setText("Descrição da vaga anexada");
    }
  }
Ejemplo n.º 15
0
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == Activity.RESULT_OK) {
      if (requestCode == 100) {
        Uri uri = data.getParcelableExtra("uri");
        String[] projects =
            new String[] {MediaStore.Video.Media.DATA, MediaStore.Video.Media.DURATION};
        Cursor cursor = getActivity().getContentResolver().query(uri, projects, null, null, null);
        int duration = 0;
        String filePath = null;

        if (cursor.moveToFirst()) {
          // 路径:MediaStore.Audio.Media.DATA
          filePath = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA));
          // 总播放时长:MediaStore.Audio.Media.DURATION
          duration = cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DURATION));
          EMLog.d(TAG, "duration:" + duration);
        }
        if (cursor != null) {
          cursor.close();
          cursor = null;
        }

        getActivity()
            .setResult(
                Activity.RESULT_OK,
                getActivity().getIntent().putExtra("path", filePath).putExtra("dur", duration));
        getActivity().finish();
      }
    }
  }
Ejemplo n.º 16
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   // TODO Auto-generated method stub
   switch (requestCode) {
     case 11:
       if (resultCode == super.getActivity().RESULT_OK) {
         cropPhoto(data.getData()); // 裁剪图片
       }
       break;
     case 22:
       if (resultCode == super.getActivity().RESULT_OK) {
         File temp = new File(Environment.getExternalStorageDirectory() + "/user_header.png");
         cropPhoto(Uri.fromFile(temp)); // 裁剪图片
       }
       break;
     case 33:
       if (data != null) {
         Bundle extras = data.getExtras();
         headerPortait = extras.getParcelable("data");
         headerPortait = BitmapCut.toRoundBitmap(headerPortait);
         if (headerPortait != null) {
           saveHeadImg(headerPortait);
           ivUserHead.setImageBitmap(headerPortait); // 用ImageView显示出来
         }
       }
       break;
     default:
       break;
   }
   super.onActivityResult(requestCode, resultCode, data);
 }
Ejemplo n.º 17
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == RC_BARCODE_CAPTURE) {
     if (resultCode == CommonStatusCodes.SUCCESS) {
       if (data != null) {
         Barcode barcode = data.getParcelableExtra(BarcodeCaptureActivity.BarcodeObject);
         // statusMessage.setText(R.string.barcode_success);
         ean.setText(barcode.displayValue);
         Log.d(TAG, "Barcode read: " + barcode.displayValue);
       } else {
         // statusMessage.setText(R.string.barcode_failure);
         Log.d(TAG, "No barcode captured, intent data is null");
         Toast.makeText(
                 getActivity(), "no barcode captured, intent data is null", Toast.LENGTH_SHORT)
             .show();
       }
     } else {
       /*statusMessage.setText(String.format(getString(R.string.barcode_error),
       CommonStatusCodes.getStatusCodeString(resultCode)));*/
       Toast.makeText(getActivity(), "error reading barcode", Toast.LENGTH_SHORT).show();
     }
   } else {
     super.onActivityResult(requestCode, resultCode, data);
   }
 }
  @OnClick(R.id.button_submit)
  void submitClicked() {
    String key = mKeyEdit.getText().toString();
    String value = mValueEdit.getText().toString();

    if (TextUtils.isEmpty(key)) {
      return;
    }

    if (TextUtils.isEmpty(value)) {
      return;
    }

    Fragment target = getTargetFragment();
    if (target == null) {
      dismiss();
      return;
    }

    Intent data = new Intent();
    data.putExtra(EXTRA_KEY, key);
    data.putExtra(EXTRA_VALUE, value);

    target.onActivityResult(getTargetRequestCode(), Activity.RESULT_OK, data);
    dismiss();
  }
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   // 相机拍照完成后,返回图片路径
   if (requestCode == REQUEST_CAMERA) {
     if (resultCode == Activity.RESULT_OK) {
       if (mTmpFile != null) {
         if (mCallback != null) {
           if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
             Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
             Uri contentUri = Uri.fromFile(mTmpFile);
             mediaScanIntent.setData(contentUri);
             getActivity().sendBroadcast(mediaScanIntent);
           } else {
             getActivity()
                 .sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.fromFile(mTmpFile)));
           }
           mCallback.onCameraShot(mTmpFile);
         }
       }
     } else {
       if (mTmpFile != null && mTmpFile.exists()) {
         mTmpFile.delete();
       }
     }
   }
 }
Ejemplo n.º 20
0
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == 1 && resultCode == getActivity().RESULT_OK && null != data) {

      Uri selectedImage = data.getData();
      String[] filePathColumn = {MediaStore.Images.Media.DATA};

      Cursor cursor =
          getActivity().getContentResolver().query(selectedImage, filePathColumn, null, null, null);
      cursor.moveToFirst();

      int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
      String picturePath = cursor.getString(columnIndex);
      cursor.close();

      if (picturePath != null) {

        imagemLivro.setImageBitmap(
            imagemHelper.decodeSampledBitmapFromResource(picturePath, 100, 100));

        pathImagem = picturePath;
      } else {
        Toast.makeText(
                LivroFragment.this.getContext(),
                getString(R.string.erro_salvar),
                Toast.LENGTH_SHORT)
            .show();
      }
    }
  }
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   // This is an ugly hack, because the fragment's onActivityResult is not called otherwise,
   // even though the EulaActivity is started from the login fragment, not from this activity.
   // See: http://stackoverflow.com/questions/6147884/onactivityresult-not-being-called-in-fragment
   Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_container);
   fragment.onActivityResult(requestCode, resultCode, data);
 }
Ejemplo n.º 22
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   if (resultCode == 1) {
     String filePath = data.getStringExtra("filePath");
     filePathEt.setText(filePath);
   }
 }
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode == Activity.RESULT_OK) {
     patientList.clear();
     initData();
   }
   super.onActivityResult(requestCode, resultCode, data);
 }
Ejemplo n.º 24
0
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == 2) {
      if (resultCode == getActivity().RESULT_OK) {
        Log.d("year", Integer.toString(data.getIntExtra("year", 0)));
        Log.d("month", Integer.toString(data.getIntExtra("month", 0)));
        Log.d("day", Integer.toString(data.getIntExtra("day", 0)));
        int day = data.getIntExtra("day", 0);
        int month = data.getIntExtra("month", 0);
        int year = data.getIntExtra("year", 0);
        String date2, date;
        if (year != 0) {
          date = Integer.toString(year) + "-";

          if (month != 0) {
            if (month < 10) {
              date = date + "0" + Integer.toString(month) + "-";
            } else {
              date = date + Integer.toString(month) + "-";
            }
            if (day != 0) {
              if (day < 10) {
                date = date + "0" + Integer.toString(day) + " 00:00:00";
              } else {
                date = date + Integer.toString(day) + " 00:00:00";
              }

              date2 = nextDay(year, month, day);
              Log.d("Today", date);
              Log.d("Tomorrow", date2);
            } else {
              date = date + "01 00:00:00";
              date2 = nextMonth(year, month);
              Log.d("Today", date);
              Log.d("Next Month", date2);
            }
          } else {

            date = date + "01-01 00:00:00";
            date2 = Integer.toString(year + 1) + "-01-01 00:00:00";
            Log.d("Today", date);
            Log.d("Next Year", date2);
          }
          standupList = standupsDB.getAllDay(email, date, date2);
          if (standupList.size() > 0) {
            standupAdapter = new StandUpDateAdapter(getActivity(), standupList);
            dateList.setAdapter(standupAdapter);
            nothing.setVisibility(View.INVISIBLE);
          } else {
            standupAdapter = new StandUpDateAdapter(getActivity(), standupList);
            dateList.setAdapter(standupAdapter);
            nothing.setVisibility(View.VISIBLE);
          }
        }
      }
    }
  }
Ejemplo n.º 25
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   if (resultCode == Activity.RESULT_OK) {
     if (requestCode == REQUEST_BARCODE) {
       ean.setText(data.getStringExtra(ScannerActivity.EXTRA_BAR_CODE));
     }
   }
 }
Ejemplo n.º 26
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   // TODO Auto-generated method stub
   super.onActivityResult(requestCode, resultCode, data);
   // 添加校友组织后回调
   if (requestCode == ParamsManager.ORGANIZATION_REFRESH && resultCode == Activity.RESULT_OK) {
     refreshOrganization();
   }
 }
Ejemplo n.º 27
0
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == 123 && resultCode == Activity.RESULT_OK) {
      Barcode barcode = data.getParcelableExtra("barcode");
      ean.setText(barcode.displayValue);
    }
  }
Ejemplo n.º 28
0
 /**
  * 递归调用,对所有子Fragement生效
  *
  * @param frag
  * @param requestCode
  * @param resultCode
  * @param data
  */
 private void handleResult(Fragment frag, int requestCode, int resultCode, Intent data) {
   frag.onActivityResult(requestCode & 0xffff, resultCode, data);
   List<Fragment> frags = frag.getChildFragmentManager().getFragments();
   if (frags != null) {
     for (Fragment f : frags) {
       if (f != null) handleResult(f, requestCode, resultCode, data);
     }
   }
 }
Ejemplo n.º 29
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   List<Fragment> list = getChildFragmentManager().getFragments();
   if (list != null) {
     for (int i = 0; i < list.size(); i++) {
       list.get(i).onActivityResult(requestCode, resultCode, data);
     }
   }
 }
Ejemplo n.º 30
0
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == 5 && resultCode == -1) {}
   // Always refresh the list when coming back from child activity
   refreshList();
   // Log.v("CategoryViewFragment.onActivityResult", "requestCode: " + requestCode + " resultCode:
   // " + resultCode);
   super.onActivityResult(requestCode, resultCode, data);
   mFlistCallback.onFlistChanged(1);
   mCategoryCallback.onCategoryChanged(1);
   mFilterCallback.onFilterChanged(1);
 }