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


Java CropImageView类代码示例

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


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

示例1: onViewCreated

import com.theartofdev.edmodo.cropper.CropImageView; //导入依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    mCropImageView = (CropImageView) view.findViewById(R.id.cropImageView);
    mCropImageView.setOnSetImageUriCompleteListener(this);
    mCropImageView.setOnCropImageCompleteListener(this);

    updateCurrentCropViewOptions();

    if (savedInstanceState == null) {
        if (mDemoPreset == CropDemoPreset.SCALE_CENTER_INSIDE) {
            mCropImageView.setImageResource(R.drawable.cat_small);
        } else {
            mCropImageView.setImageResource(R.drawable.cat);
        }
    }
}
 
开发者ID:chuch0805,项目名称:Android-Demo_ImageCroper,代码行数:19,代码来源:MainFragment.java

示例2: handleCropResult

import com.theartofdev.edmodo.cropper.CropImageView; //导入依赖的package包/类
private void handleCropResult(CropImageView.CropResult result) {
    if (result.getError() == null) {
        Intent intent = new Intent(getActivity(), CropResultActivity.class);
        intent.putExtra("SAMPLE_SIZE", result.getSampleSize());
        if (result.getUri() != null) {
            intent.putExtra("URI", result.getUri());
        } else {
            CropResultActivity.mImage = mCropImageView.getCropShape() == CropImageView.CropShape.OVAL
                    ? CropImage.toOvalBitmap(result.getBitmap())
                    : result.getBitmap();
        }
        startActivity(intent);
    } else {
        Log.e("AIC", "Failed to crop image", result.getError());
        Toast.makeText(getActivity(), "Image crop failed: " + result.getError().getMessage(), Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:chuch0805,项目名称:Android-Demo_ImageCroper,代码行数:18,代码来源:MainFragment.java

示例3: onActivityResult

import com.theartofdev.edmodo.cropper.CropImageView; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if(requestCode == GALLERY_REQUEST_CODE && resultCode == RESULT_OK){

        Uri imageUri = data.getData();
        CropImage.activity(imageUri)
                .setGuidelines(CropImageView.Guidelines.ON)
                .setAspectRatio(1,1)
                .start(this);
    }
    if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
        CropImage.ActivityResult result = CropImage.getActivityResult(data);
        if (resultCode == RESULT_OK) {

            mImageUri = result.getUri();
            mProfilePicture.setImageURI(mImageUri);

        } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
            Toast.makeText(CreateProfileActivity.this, "Failed to get profile picture, Try Again.", Toast.LENGTH_LONG).show();
        }
    }
}
 
开发者ID:Socialate,项目名称:furry-sniffle,代码行数:25,代码来源:CreateProfileActivity.java

示例4: onActivityResult

import com.theartofdev.edmodo.cropper.CropImageView; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if(requestCode == GALLERY_REQUEST_CODE && resultCode == RESULT_OK){
        Uri ImageUri = data.getData();
        CropImage.activity(ImageUri)
                .setGuidelines(CropImageView.Guidelines.ON)
                .setAspectRatio(1,1)
                .start(this);
    }
    if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
        CropImage.ActivityResult result = CropImage.getActivityResult(data);
        if (resultCode == RESULT_OK) {
            imageUri = result.getUri();
            getProfilePicture.setImageURI(imageUri);

        } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
            Toast.makeText(ViewEditProfileActivity.this, "Failed to get profile picture, please try again.", Toast.LENGTH_LONG).show();
        }
    }
}
 
开发者ID:Socialate,项目名称:furry-sniffle,代码行数:23,代码来源:ViewEditProfileActivity.java

示例5: startCropImageActivity

import com.theartofdev.edmodo.cropper.CropImageView; //导入依赖的package包/类
public static void startCropImageActivity(Activity activity, CropImageView.CropShape cropShape, boolean isAvatar) {
    if (isAvatar) {
        CropImage.activity()
                .setMinCropResultSize(300, 300)
                .setMaxCropResultSize(1280, 1280)
                .setCropMenuCropButtonIcon(R.drawable.ic_content_white_cut_24dp)
                .setCropShape(cropShape)
                .start(activity);
    } else {
        CropImage.activity()
                .setMinCropResultSize(1280, 720)
                .setMaxCropResultSize(3840, 2160)
                .setCropMenuCropButtonIcon(R.drawable.ic_content_white_cut_24dp)
                .setCropShape(cropShape)
                .start(activity);
    }

}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:19,代码来源:FunctionHelper.java

示例6: onCreate

import com.theartofdev.edmodo.cropper.CropImageView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.crop_and_rotate);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ViewCompat.setElevation(toolbar,10);
    toolbar.setOnMenuItemClickListener(this);
    Intent intent = getIntent();
    message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
    cropImageView = (CropImageView) findViewById(R.id.cropImageView);

    cropImageView.setImageUriAsync(Uri.parse(message));
    mFab = (FloatingActionButton) findViewById(R.id.nextStep);
    mFab.setOnClickListener(this);

}
 
开发者ID:testica,项目名称:text-scanner,代码行数:18,代码来源:CropAndRotate.java

示例7: onViewCreated

import com.theartofdev.edmodo.cropper.CropImageView; //导入依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    mCropImageView = (CropImageView) view.findViewById(R.id.cropImageView);
    mCropImageView.setOnSetImageUriCompleteListener(this);
    mCropImageView.setOnGetCroppedImageCompleteListener(this);

    updateCurrentCropViewOptions();

    if (savedInstanceState == null) {
        if (mDemoPreset == CropDemoPreset.SCALE_CENTER_INSIDE) {
            mCropImageView.setImageResource(R.drawable.cat_small);
        } else {
            mCropImageView.setImageResource(R.drawable.cat);
        }
    }
}
 
开发者ID:enjoyproduct,项目名称:ImageCroper,代码行数:19,代码来源:MainFragment.java

示例8: cropImage

import com.theartofdev.edmodo.cropper.CropImageView; //导入依赖的package包/类
private void cropImage(@NonNull Uri input) {
    Timber.v("Uri.toString: %s", input.toString());
    if (!MimeTypeUtils.isImage(getContext(), input)) {
        mNotificationBar.showTemporaryInverse(getString(R.string.not_image_file));
        return;
    }

    mUserAvatarFile = FileNameUtils.getJPEGFile(getContext());
    CropImage.activity(input)
        .setGuidelines(CropImageView.Guidelines.ON_TOUCH)
        .setOutputUri(Uri.fromFile(mUserAvatarFile))
        .setOutputCompressFormat(Bitmap.CompressFormat.JPEG)
        .setMinCropResultSize(450, 450)
        .setRequestedSize(512, 512)
        .setMaxCropResultSize(768, 768)
        .setCropShape(CropImageView.CropShape.OVAL)
        .start(getContext(), this);
}
 
开发者ID:TomeOkin,项目名称:LsPush,代码行数:19,代码来源:RegisterFragment.java

示例9: setScaleType

import com.theartofdev.edmodo.cropper.CropImageView; //导入依赖的package包/类
/**
 * The initial scale type of the image in the crop image view<br>
 * <i>Default: {@link #SCALE_TYPE_FIT_CENTER}</i>
 */
public Builder setScaleType(@ScaleTypes int scaleType) {
    switch (scaleType) {
        case SCALE_TYPE_CENTER:
            mOptions.scaleType = CropImageView.ScaleType.CENTER;
            break;
        case SCALE_TYPE_CENTER_CROP:
            mOptions.scaleType = CropImageView.ScaleType.CENTER_CROP;
            break;
        case SCALE_TYPE_CENTER_INSIDE:
            mOptions.scaleType = CropImageView.ScaleType.CENTER_INSIDE;
            break;
        case SCALE_TYPE_FIT_CENTER:
            mOptions.scaleType = CropImageView.ScaleType.FIT_CENTER;
            break;
    }
    return this;
}
 
开发者ID:ligboy,项目名称:selectphoto,代码行数:22,代码来源:SelectImageActivity.java

示例10: handleCropResult

import com.theartofdev.edmodo.cropper.CropImageView; //导入依赖的package包/类
private void handleCropResult(CropImageView.CropResult result) {
  if (result.getError() == null) {
    Intent intent = new Intent(getActivity(), CropResultActivity.class);
    intent.putExtra("SAMPLE_SIZE", result.getSampleSize());
    if (result.getUri() != null) {
      intent.putExtra("URI", result.getUri());
    } else {
      CropResultActivity.mImage =
          mCropImageView.getCropShape() == CropImageView.CropShape.OVAL
              ? CropImage.toOvalBitmap(result.getBitmap())
              : result.getBitmap();
    }
    startActivity(intent);
  } else {
    Log.e("AIC", "Failed to crop image", result.getError());
    Toast.makeText(
            getActivity(),
            "Image crop failed: " + result.getError().getMessage(),
            Toast.LENGTH_LONG)
        .show();
  }
}
 
开发者ID:ArthurHub,项目名称:Android-Image-Cropper,代码行数:23,代码来源:MainFragment.java

示例11: onActivityResult

import com.theartofdev.edmodo.cropper.CropImageView; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == GALLERY_REQUEST && resultCode == RESULT_OK) {
        Uri imageUri = data.getData();

        CropImage.activity(imageUri)
                .setGuidelines(CropImageView.Guidelines.ON)
                .setCropShape(CropImageView.CropShape.OVAL)
                .setAspectRatio(1, 1)
                .start(this);
    }

    if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
        CropImage.ActivityResult result = CropImage.getActivityResult(data);
        if (resultCode == RESULT_OK) {

            mImageUri = result.getUri();
            editProfilepic.setImageURI(mImageUri);

        } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
            Exception error = result.getError();
            Log.e(TAG + "crop_error", error.toString());
        }
    }

}
 
开发者ID:clementf2b,项目名称:FaceT,代码行数:29,代码来源:ProfileEditActivity.java

示例12: startCropImageActivity

import com.theartofdev.edmodo.cropper.CropImageView; //导入依赖的package包/类
/**
 * Start crop image activity for the given image.
 */
private void startCropImageActivity(Uri imageUri) {
    CropImage.activity(imageUri)
            .setGuidelines(CropImageView.Guidelines.ON)
            .setMultiTouchEnabled(true)
            .start(this);
}
 
开发者ID:chuch0805,项目名称:Android-Demo_ImageCroper,代码行数:10,代码来源:MainActivity.java

示例13: onSetImageUriComplete

import com.theartofdev.edmodo.cropper.CropImageView; //导入依赖的package包/类
@Override
public void onSetImageUriComplete(CropImageView view, Uri uri, Exception error) {
    if (error == null) {
        Toast.makeText(getActivity(), "Image load successful", Toast.LENGTH_SHORT).show();
    } else {
        Log.e("AIC", "Failed to load image by URI", error);
        Toast.makeText(getActivity(), "Image load failed: " + error.getMessage(), Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:chuch0805,项目名称:Android-Demo_ImageCroper,代码行数:10,代码来源:MainFragment.java

示例14: onContextItemSelected

import com.theartofdev.edmodo.cropper.CropImageView; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
    int id = view_ShowMenu.getId();
    int itemId = item.getItemId();

    switch (id) {
        case R.id.avatar:
            switch (itemId) {
                case R.id.menu_default:
                    changeImage(img_avatar, "");
                    break;
                case R.id.menu_pic_custom:
                    FunctionHelper.startCropImageActivity(this, CropImageView.CropShape.OVAL, true);
                    break;
            }
            break;

        case R.id.background:
            switch (itemId) {
                case R.id.menu_default:
                    changeImage(img_background, "");
                    break;
                case R.id.menu_pic_custom:
                    FunctionHelper.startCropImageActivity(this, CropImageView.CropShape.RECTANGLE, false);
                    break;

            }
            break;
    }
    return super.onContextItemSelected(item);
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:32,代码来源:DetailTeacherActivity.java

示例15: cropImage

import com.theartofdev.edmodo.cropper.CropImageView; //导入依赖的package包/类
private void cropImage(Uri uri) {
    int xAR = 3, yAR = 5;
    CropImageView.CropShape cropShape = CropImageView.CropShape.RECTANGLE;

    CropImage.activity(uri)
            .setGuidelines(CropImageView.Guidelines.ON)
            .setCropShape(cropShape)
            .setAspectRatio(xAR, yAR)
            .setBackgroundColor(Color.argb(100, 100, 100, 100))
            //.setRequestedSize(250, 250, CropImageView.RequestSizeOptions.RESIZE_FIT)
            .start(this);
}
 
开发者ID:shivam301296,项目名称:2048-TimeKiller,代码行数:13,代码来源:Setting.java


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