当前位置: 首页>>代码示例>>Java>>正文


Java CropImage类代码示例

本文整理汇总了Java中eu.janmuller.android.simplecropimage.CropImage的典型用法代码示例。如果您正苦于以下问题:Java CropImage类的具体用法?Java CropImage怎么用?Java CropImage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CropImage类属于eu.janmuller.android.simplecropimage包,在下文中一共展示了CropImage类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startCropImage

import eu.janmuller.android.simplecropimage.CropImage; //导入依赖的package包/类
private void startCropImage() {

        Intent intent = new Intent(this, CropImage.class);
        intent.putExtra(CropImage.IMAGE_PATH, mFileTemp.getPath());
        intent.putExtra(CropImage.SCALE, true);

        intent.putExtra(CropImage.ASPECT_X, 1);//width
        intent.putExtra(CropImage.ASPECT_Y, 1);//hight

        startActivityForResult(intent, REQUEST_CODE_CROP_IMAGE);
    }
 
开发者ID:multidots,项目名称:android-app-common-tasks,代码行数:12,代码来源:CropImageActivity.java

示例2: startCropImage

import eu.janmuller.android.simplecropimage.CropImage; //导入依赖的package包/类
public static void startCropImage(Context context, String path, @SuppressWarnings("SameParameterValue") int requestCode, @SuppressWarnings("SameParameterValue") int aspectX) {

        Intent intent = new Intent(context, CropImage.class);
        intent.putExtra(CropImage.IMAGE_PATH, path);
        intent.putExtra(CropImage.SCALE, true);

        intent.putExtra(CropImage.ASPECT_X, aspectX);
        intent.putExtra(CropImage.ASPECT_Y, 1);

        ((Activity) context).startActivityForResult(intent, requestCode);
    }
 
开发者ID:multidots,项目名称:android-app-common-tasks,代码行数:12,代码来源:Common.java

示例3: onActivityResult

import eu.janmuller.android.simplecropimage.CropImage; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode != RESULT_OK) {
        return;
    }

    Bitmap bitmap = null;
    switch (requestCode) {
        case REQUEST_CODE_CROP_IMAGE:
            String path = data.getStringExtra(CropImage.IMAGE_PATH);
            if (path == null) {
                return;
            }

            bitmap = BitmapFactory.decodeFile(path);

            if (bitmap != null && !bitmap.isRecycled()) {
                try {
                    setWallpaper(bitmap);
                    Toast.makeText(this, "Set Successful", Toast.LENGTH_SHORT).show();
                } catch (IOException e) {
                    e.printStackTrace();
                    Toast.makeText(this, "Set Failed", Toast.LENGTH_SHORT).show();
                }
            }
            break;
        default:
            break;
    }
    super.onActivityResult(requestCode, resultCode, data);
}
 
开发者ID:snowdream,项目名称:android-wallpaper,代码行数:32,代码来源:ImagePagerActivity.java

示例4: onActivityResult

import eu.janmuller.android.simplecropimage.CropImage; //导入依赖的package包/类
@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == RESULT_OK) {
            switch (requestCode) {
                case 101:
                    vvVideo.setVisibility(View.GONE);
                    ivPreview.setVisibility(View.VISIBLE);
                    Common.previewCapturedImage(ivPreview);
                    break;
                case 102:
                    vvVideo.setVisibility(View.VISIBLE);
                    ivPreview.setVisibility(View.GONE);
                    Common.previewVideo(vvVideo);
                    break;
                case 103:
                    vvVideo.setVisibility(View.GONE);
                    ivPreview.setVisibility(View.VISIBLE);
                    Uri uri = data.getData();
                    Common.startCropImage(this, Common.getPath(this, uri), 105, 1);
//                    try {
//                        Bitmap bm = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri);
//                        ivPreview.setImageBitmap(bm);
//                    } catch (IOException e) {
//                        e.printStackTrace();
//                    }
                    break;
                case 104:
                    vvVideo.setVisibility(View.VISIBLE);
                    ivPreview.setVisibility(View.GONE);
                    Uri fileUri = data.getData();
                    vvVideo.setVideoPath(Common.getPath(PickCaptureActivity.this, fileUri));
                    vvVideo.start();
                    break;
                case 105:
                    String path = data.getStringExtra(CropImage.IMAGE_PATH);
                    File imgFile = new File(path);
                    if (imgFile.exists()) {
                        Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
                        ivPreview.setImageBitmap(myBitmap);
                    }
                    break;
            }
        }
    }
 
开发者ID:multidots,项目名称:android-app-common-tasks,代码行数:46,代码来源:PickCaptureActivity.java

示例5: onActivityResult

import eu.janmuller.android.simplecropimage.CropImage; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    if (resultCode != RESULT_OK) {

        return;
    }

    Bitmap bitmap;

    switch (requestCode) {

        case REQUEST_CODE_GALLERY:

            try {

                InputStream inputStream = getContentResolver().openInputStream(data.getData());
                FileOutputStream fileOutputStream = new FileOutputStream(mFileTemp);
                copyStream(inputStream, fileOutputStream);
                fileOutputStream.close();
                if (inputStream != null) {
                    inputStream.close();
                }
                startCropImage();

            } catch (Exception e) {

                Log.e(TAG, "Error while creating temp file", e);
            }

            break;
        case REQUEST_CODE_TAKE_PICTURE:

            startCropImage();
            break;
        case REQUEST_CODE_CROP_IMAGE:

            String path = data.getStringExtra(CropImage.IMAGE_PATH);
            if (path == null) {

                return;
            }

            bitmap = BitmapFactory.decodeFile(mFileTemp.getPath());
            mImageView.setImageBitmap(bitmap);
            break;
    }
    super.onActivityResult(requestCode, resultCode, data);
}
 
开发者ID:multidots,项目名称:android-app-common-tasks,代码行数:50,代码来源:CropImageActivity.java

示例6: setWallPaper

import eu.janmuller.android.simplecropimage.CropImage; //导入依赖的package包/类
private void setWallPaper() {
    if (pager == null || pager.getAdapter() == null
            || !(pager.getAdapter() instanceof ImagePagerAdapter)) {
        return;
    }

    ImagePagerAdapter adapter = (ImagePagerAdapter) pager.getAdapter();
    List<Image> images = adapter.getImages();

    if (images == null || images.size() <= 0) {
        return;
    }

    int pos = pager.getCurrentItem();

    if (pos >= images.size()) {
        return;
    }

    Image image = images.get(pos);

    if (image == null) {
        return;
    }

    String imageUrl = image.getUrl();

    if (imageUrl == null || imageUrl == "") {
        return;
    }

    File file = ImageLoader.getInstance().getDiscCache().get(imageUrl);

    if (file == null || !file.exists() || !file.canRead()) {
        return;
    }

    Intent intent = new Intent(this, CropImage.class);
    intent.putExtra(CropImage.IMAGE_PATH, file.getPath());
    intent.putExtra(CropImage.SCALE, true);

    intent.putExtra(CropImage.ASPECT_X, 480);
    intent.putExtra(CropImage.ASPECT_Y, 800);

    startActivityForResult(intent, REQUEST_CODE_CROP_IMAGE);
}
 
开发者ID:snowdream,项目名称:android-wallpaper,代码行数:47,代码来源:ImagePagerActivity.java

示例7: startCropImage

import eu.janmuller.android.simplecropimage.CropImage; //导入依赖的package包/类
private void startCropImage() {

		Intent intent = new Intent(this, CropImage.class);
		
		intent.putExtra(CropImage.IMAGE_PATH, mFileTemp.getPath());
		intent.putExtra(CropImage.SCALE, true);

		intent.putExtra(CropImage.ASPECT_X, 2);
		intent.putExtra(CropImage.ASPECT_Y, 4);

		startActivityForResult(intent, REQUEST_CODE_CROP_IMAGE);
	}
 
开发者ID:Pi-Developers,项目名称:Pi-Locker,代码行数:13,代码来源:MainActivity.java

示例8: onActivityResult

import eu.janmuller.android.simplecropimage.CropImage; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

	if (resultCode != RESULT_OK) {

		return;
	}

	switch (requestCode) {

	case REQUEST_CODE_GALLERY:

		try {

			InputStream inputStream = getContentResolver().openInputStream(data.getData());
			FileOutputStream fileOutputStream = new FileOutputStream(mFileTemp);
			copyStream(inputStream, fileOutputStream);
			fileOutputStream.close();
			inputStream.close();

			startCropImage();

		} catch (Exception e) {

			Log.e(TAG, "Error while creating temp file", e);
		}

		break;
		
	case REQUEST_CODE_TAKE_PICTURE:

		startCropImage();
		break;
		
	case REQUEST_CODE_CROP_IMAGE:

		String path = data.getStringExtra(CropImage.IMAGE_PATH);
		if (path == null) {

			return;
		}

		save("img", mFileTemp.getPath());

		break;
	}
	super.onActivityResult(requestCode, resultCode, data);
}
 
开发者ID:Pi-Developers,项目名称:Pi-Locker,代码行数:49,代码来源:MainActivity.java


注:本文中的eu.janmuller.android.simplecropimage.CropImage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。