Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ga committed Jan 16, 2023
1 parent f8ce09c commit 3bd7a5a
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 14 deletions.
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ var ImageCrop = require('ti.imagecrop').createImageCrop({
lifecycleContainer: win
});
```
before you call the methods and add
```
repositories {
maven { url 'https://jitpack.io' }
}
```
to your `/app/platform/android/build.gradle`

## Methods:

Expand Down
9 changes: 3 additions & 6 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'androidx.activity:activity-ktx:1.3.1'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.github.CanHub:Android-Image-Cropper:4.2.1'
implementation 'androidx.activity:activity-ktx:1.5.1'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.vanniktech:android-image-cropper:4.4.0'
}
2 changes: 1 addition & 1 deletion android/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 2.0.0
version: 2.2.0
apiversion: 4
architectures: arm64-v8a armeabi-v7a x86 x86_64
description: ti.imagecrop
Expand Down
43 changes: 43 additions & 0 deletions example/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const win = Ti.UI.createWindow();
const img = Ti.UI.createImageView({
top: 0
});
const btn = Ti.UI.createButton({
title: "crop image (Ti picker)",
bottom: 0
});
const btn2 = Ti.UI.createButton({
title: "select image (module picker)",
bottom: 50
});

const ImageCrop = require('ti.imagecrop').createImageCrop({
lifecycleContainer: win,
showCamera: true,
showGallery: true
});
ImageCrop.addEventListener("done", function(e) {
img.image = e.image;
});
ImageCrop.addEventListener("cancel", function(e) {
alert("cancel");
});


win.add([img, btn, btn2]);
btn.addEventListener("click", function() {
Ti.Media.openPhotoGallery({
success: function(e) {
// crop image
ImageCrop.showCropDialog({
image: e.media.nativePath
})
}
})
})
btn2.addEventListener("click", function() {
// show image picker
ImageCrop.showCropDialog({})
})

win.open();

0 comments on commit 3bd7a5a

Please sign in to comment.