Exemplo n.º 1
0
    @Override
    protected void onActivityResult(int requestCode, int resultCode,
            Intent data) {
        switch (requestCode) {
            case MenuHelper.RESULT_COMMON_MENU_CROP:
                if (resultCode == RESULT_OK) {
                    // The CropImage activity passes back the Uri of the
                    // cropped image as the Action rather than the Data.
                    mSavedUri = Uri.parse(data.getAction());

                    // if onStart() runs before, then set the returned
                    // image as currentImage.
                    if (mAllImages != null) {
                        IImage image = mAllImages.getImageForUri(mSavedUri);
                        // image could be null if SD card is removed.
                        if (image == null) {
                            finish();
                        } else {
                            mCurrentPosition = mAllImages.getImageIndex(image);
                            setImage(mCurrentPosition, false);
                        }
                    }
                }
                break;
        }
    }
Exemplo n.º 2
0
 private boolean init(Uri uri) {
     if (uri == null) return false;
     mAllImages = (mParam == null)
             ? buildImageListFromUri(uri)
             : ImageManager.makeImageList(getContentResolver(), mParam);
     IImage image = mAllImages.getImageForUri(uri);
     if (image == null) return false;
     mCurrentPosition = mAllImages.getImageIndex(image);
     return true;
 }