Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/naxam/ucrop-android-binding
Xamarin Binding Library for Yalantis uCrop library
https://github.com/naxam/ucrop-android-binding
android bindings crop ucrop xamarin xamarin-android-binding
Last synced: about 1 month ago
JSON representation
Xamarin Binding Library for Yalantis uCrop library
- Host: GitHub
- URL: https://github.com/naxam/ucrop-android-binding
- Owner: NAXAM
- License: mit
- Created: 2017-06-11T15:51:45.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-30T15:51:40.000Z (over 6 years ago)
- Last Synced: 2024-12-16T04:31:05.491Z (about 1 month ago)
- Topics: android, bindings, crop, ucrop, xamarin, xamarin-android-binding
- Language: C#
- Homepage: https://github.com/Yalantis/uCrop
- Size: 2.24 MB
- Stars: 7
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# XAMARIN ANDROID BINDING LIBRARY
uCrop - Image Cropping Library for Android# Usage
*For a working implementation, please have a look at the Sample Project - sample*
1. Include the library via nuget
```
Install-Package Naxam.uCrop.Droid
```2. Add UCropActivity into your AndroidManifest.xml
```
```3. The uCrop configuration is created using the builder pattern.
```java
UCrop.Of(sourceUri, destinationUri)
.WithAspectRatio(16, 9)
.WithMaxResultSize(maxWidth, maxHeight)
.Start(context);
```4. Override `OnActivityResult` method and handle uCrop result.
```c#
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data) {
if (resultCode == Result.Ok && requestCode == UCrop.RequestCrop) {
Uri resultUri = UCrop.GetOutput(data);
} else if (resultCode == UCrop.ResultError) {
Throwable cropError = UCrop.GetError(data);
}
}
```
5. You may want to add this to your PROGUARD config:```
-dontwarn com.yalantis.ucrop**
-keep class com.yalantis.ucrop** { *; }
-keep interface com.yalantis.ucrop** { *; }
```# Customization
If you want to let your users choose crop ratio dynamically, just do not call `WithAspectRatio(x, y)`.
uCrop builder class has method `WithOptions(UCrop.Options options)` which extends library configurations.
Currently you can change:
* image compression format (e.g. PNG, JPEG, WEBP), compression
* image compression quality [0 - 100]. PNG which is lossless, will ignore the quality setting.
* whether all gestures are enabled simultaneously
* maximum size for Bitmap that is decoded from source Uri and used within crop view. If you want to override default behaviour.
* toggle whether to show crop frame/guidelines
* setup color/width/count of crop frame/rows/columns
* choose whether you want rectangle or oval crop area
* the UI colors (Toolbar, StatusBar, active widget state)
* and more...
# Compatibility
* Library - Android ICS 4.0+ (API 14) (Android GINGERBREAD 2.3+ (API 10) for versions <= 1.3.2)
* Sample - Android ICS 4.0+ (API 14)
* CPU - armeabi armeabi-v7a x86 x86_64 arm64-v8a (for versions >= 2.1.2)## License
This binding is licensed under the MIT license, but the native Java library is license under the Apache License by Yalantis.Copyright 2017, Yalantis
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.