Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cesards/SuperImageView
Crop and Rounded Corners added to an ImageView.
https://github.com/cesards/SuperImageView
Last synced: 11 days ago
JSON representation
Crop and Rounded Corners added to an ImageView.
- Host: GitHub
- URL: https://github.com/cesards/SuperImageView
- Owner: cesards
- License: mit
- Created: 2014-11-03T15:46:43.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2019-02-20T09:36:26.000Z (over 5 years ago)
- Last Synced: 2024-07-30T14:17:44.555Z (3 months ago)
- Language: Java
- Homepage:
- Size: 13.9 MB
- Stars: 652
- Watchers: 29
- Forks: 112
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
- -awesome-android-ui - CropImageView - 2.0) | <img src="/art/CropImageView.png" width="100%"> (Index `(light-weight pages)`)
- awesome-android-ui - CropImageView - 2.0) | <img src="/art/CropImageView.png" width="100%"> (Index `(light-weight pages)`)
- awesome-github-android-ui - CropImageView - 支持不同类型裁剪的ImageView (图片)
- awesome-android-ui - CropImageView - 2.0) | <img src="/art/CropImageView.png" width="100%"> (Index)
README
SuperImageView
Extra features for your ImageView provided in a modularized way
Documentation for v2 coming this week.
---
---
---CropImageView
An ImageView that supports different kind of cropping rather than the only Android is currently supporting: `centerCrop`
Using this library, you can crop your desired image by sides described below:
![Crop options](https://github.com/cesards/CropImageView/blob/master/art/cropping.png)
Development idea borns at the point in [Kerad Games] we needed images cropped by somewhere no matter the image size.
The original images we had to deal with (we wanted the half size of the ball shown whatever screen size), below
![Menu Left Side](https://github.com/cesards/CropImageView/blob/master/art/slide_menu_left.jpg)
![Menu Right Side](https://github.com/cesards/CropImageView/blob/master/art/slide_menu_right.jpg)Here are some screenshots what we got thanks to this widget :-)
![Menu Post Left Side](https://github.com/cesards/CropImageView/blob/master/art/crop_menu_1.png)
![Menu Post Right Side](https://github.com/cesards/CropImageView/blob/master/art/crop_menu_2.png)
![Menu Centered](https://github.com/cesards/CropImageView/blob/master/art/crop_menu_3.png)Usage
-----
### Step 1
##### Gradle
```groovy
dependencies {
compile 'com.cesards.android:cropimageview:1.0.2.1'
}
```
##### Maven
```xmlcom.cesards.android
CropImageView
1.0.2
aar```
### Step 2
Define in xml:
```xml```
where `value` can take values
```xml
topLeft|centerLeft|bottomLeft|topRight|centerRight|bottomRight|centerTop|centerBottom
```
Or in code:
```java
final CropImageView cropImageView = new CropImageView(CropActivity.this);
final Resources res = getResources();
cropImageView.setImageDrawable(res.getDrawable(images[position]));
final CropImageView.CropType cropType = imageCrops[position];
cropImageView.setCropType(cropType);
```
Performance tests (using [Hugo](https://github.com/jakeWharton/hugo))
---------### Center Crop Sample (ImageView)
```
V/TestForegroundImageView﹕ ⇢ setFrame(l=0, t=0, r=1080, b=1557)
V/TestForegroundImageView﹕ ⇠ setFrame [0ms] = true
V/TestForegroundImageView﹕ ⇢ setFrame(l=1080, t=0, r=2160, b=1557)
V/TestForegroundImageView﹕ ⇠ setFrame [0ms] = true
V/TestForegroundImageView﹕ ⇢ setFrame(l=0, t=0, r=1080, b=1557)
V/TestForegroundImageView﹕ ⇠ setFrame [0ms] = false
V/TestForegroundImageView﹕ ⇢ setFrame(l=1080, t=0, r=2160, b=1557)
V/TestForegroundImageView﹕ ⇠ setFrame [0ms] = false
V/TestForegroundImageView﹕ ⇢ setFrame(l=0, t=0, r=1080, b=1701)
V/TestForegroundImageView﹕ ⇠ setFrame [0ms] = true
V/TestForegroundImageView﹕ ⇢ setFrame(l=1080, t=0, r=2160, b=1701)
V/TestForegroundImageView﹕ ⇠ setFrame [0ms] = true`
```### Custom Crop Sample (CropImageView)
```
V/TestForegroundCropImageView﹕ ⇢ setFrame(l=0, t=0, r=1080, b=1557)
V/TestForegroundCropImageView﹕ ⇠ setFrame [0ms] = true
V/TestForegroundCropImageView﹕ ⇢ setFrame(l=1080, t=0, r=2160, b=1557)
V/TestForegroundCropImageView﹕ ⇠ setFrame [0ms] = true
V/TestForegroundCropImageView﹕ ⇢ setFrame(l=0, t=0, r=1080, b=1557)
V/TestForegroundCropImageView﹕ ⇠ setFrame [0ms] = false
V/TestForegroundCropImageView﹕ ⇢ setFrame(l=1080, t=0, r=2160, b=1557)
V/TestForegroundCropImageView﹕ ⇠ setFrame [0ms] = false
V/TestForegroundCropImageView﹕ ⇢ setFrame(l=0, t=0, r=1080, b=1701)
V/TestForegroundCropImageView﹕ ⇠ setFrame [0ms] = true
V/TestForegroundCropImageView﹕ ⇢ setFrame(l=1080, t=0, r=2160, b=1701)
V/TestForegroundCropImageView﹕ ⇠ setFrame [0ms] = true
```
Results: code used does not cause overhead in the UI thread.ChangeLog
---------
* __1.0.2.1 (2015-10-22)__
* ImageView crashes in devices with API < 18 due to a `@TargetApi` annotation
* __1.0.2 (2015-10-22)__
* Changed `minSdkVersion` to 7
* Solved a bug related with ImageView and API < 18.
* __1.0.1 (2015-02-17)__
* Changed Samples UI and removed unused resources.
* Added performance tests to Samples.
* Added code styles for contributions.
* Improved CropImageView widget. Removed `onLayout()` overhead. `ImageView` `onLayout()` is empty, so we only need logic in `setFrame()` method.
* __1.0.0 (2015-02-15)__
* Initial release. (`minSdkVersion="14"`).Developed By
------------
* César Díez Sánchez -Who's using it
--------------
* [Golden Manager](https://play.google.com/store/apps/details?id=com.keradgames.goldenmanager)
* [Slipstream Music](https://play.google.com/store/apps/details?id=com.cypher.slipstream&hl=en)
* [Vueling](https://play.google.com/store/apps/details?id=com.mo2o.vueling)
* Does your app use CropImageView? Let me know if you want to be featured in this list :-)Do you want to contribute?
--------------------------
I'm pretty sure you there are some awesome hidden features you need in your daily dev life. Just let me know or collaborate to improve this librarI'd like to improve this library with your help, there are some new features to implement waiting for you ;)
If you want to contribute, you should use [my code styles](https://github.com/cesards/CropImageView/blob/master/codestyles_DogmaLabs.xml) available in the root of the project!
License
__The MIT License (MIT)__
Copyright (c) 2016 César Díez Sánchez
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.