├── .gitignore ├── LICENSE ├── README.md ├── art ├── configurations │ ├── ._all.psd │ ├── ._all_configs.png │ ├── ._diagram.psd │ ├── ._fill_bottom.png │ ├── ._fill_center.png │ ├── ._fill_left.png │ ├── ._fill_right.png │ ├── ._fill_top │ ├── ._height_center.png │ ├── ._height_left.png │ ├── ._height_right.png │ ├── ._width_bottom.png │ ├── ._width_center.png │ ├── ._width_top.png │ ├── all.psd │ ├── all_configs.png │ ├── diagram.psd │ ├── fill_bottom.png │ ├── fill_center.png │ ├── fill_left.png │ ├── fill_right.png │ ├── fill_top │ ├── height_center.png │ ├── height_left.png │ ├── height_right.png │ ├── width_bottom.png │ ├── width_center.png │ └── width_top.png ├── images │ ├── flat_1.jpg │ ├── flat_2.jpg │ ├── flat_3.jpg │ ├── flat_4.jpg │ ├── icon_1.jpg │ ├── icon_2.jpg │ ├── icon_3.jpg │ ├── icon_4.jpg │ ├── icon_5.jpg │ ├── icon_6.jpg │ ├── icon_7.jpg │ ├── long_1.jpg │ ├── long_2.jpg │ ├── long_3.jpg │ ├── long_4.jpg │ ├── pictures.psd │ ├── square_1.jpg │ ├── square_2.jpg │ ├── square_3.jpg │ ├── square_4.jpg │ ├── square_5.jpg │ ├── thin_1.jpg │ ├── thin_2.jpg │ ├── thin_3.jpg │ ├── thin_4.jpg │ ├── thin_5.jpg │ ├── wide_1.jpg │ ├── wide_2.jpg │ ├── wide_3.jpg │ └── wide_4.jpg ├── logo │ ├── logo.psd │ ├── logo128.png │ ├── logo144.png │ ├── logo192.png │ ├── logo256.png │ ├── logo48.png │ ├── logo512.png │ ├── logo64.png │ ├── logo72.png │ └── logo96.png └── screens │ ├── fill_top.jpg │ ├── fill_top1.jpg │ └── fill_top2.jpg ├── binaries └── jcrop-0.22.apk └── project ├── aar-publish.gradle ├── build.gradle ├── mod_library ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com.github.jimcoven │ │ └── view │ │ └── JCropImageView.java │ └── res │ └── values │ └── attrs.xml ├── mod_sample ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── creative_commons.txt │ ├── java │ └── com.github.jimcoven.demo │ │ ├── DataPack.java │ │ └── jcropimageview │ │ ├── Configuration.java │ │ ├── JCropImageViewActivity.java │ │ └── MainActivity.java │ └── res │ ├── drawable-hdpi │ ├── fill_bottom.png │ ├── fill_center.png │ ├── fill_left.png │ ├── fill_right.png │ ├── fill_top │ ├── github_circle.png │ ├── height_center.png │ ├── height_left.png │ ├── height_right.png │ ├── width_bottom.png │ ├── width_center.png │ └── width_top.png │ ├── drawable │ └── thin_border.xml │ ├── layout │ ├── jcrop_activity.xml │ ├── jcropitem_view.xml │ ├── main_activity.xml │ └── mainitem_view.xml │ ├── menu │ └── action_bar.xml │ ├── mipmap-hdpi │ ├── ccsa_4_0.png │ ├── flat_11.jpg │ ├── flat_12.jpg │ ├── flat_13.jpg │ ├── flat_14.jpg │ ├── ic_launcher.png │ ├── icon_11.jpg │ ├── icon_12.jpg │ ├── icon_13.jpg │ ├── icon_14.jpg │ ├── long_11.jpg │ ├── long_12.jpg │ ├── long_13.jpg │ ├── long_14.jpg │ ├── long_15.jpg │ ├── square_11.jpg │ ├── square_12.jpg │ ├── square_13.jpg │ ├── square_14.jpg │ ├── square_15.jpg │ ├── thin_11.jpg │ ├── thin_12.jpg │ ├── thin_13.jpg │ ├── thin_14.jpg │ ├── thin_15.jpg │ ├── wide_11.jpg │ ├── wide_12.jpg │ ├── wide_13.jpg │ └── wide_14.jpg │ └── values │ ├── strings.xml │ └── styles.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | #built application files 2 | *.ap_ 3 | 4 | # files for the dex VM 5 | *.dex 6 | 7 | # Generated files 8 | *.class 9 | bin/ 10 | gen/ 11 | 12 | # System caches 13 | Thumbs.db # Windows thumbnail db 14 | .DS_Store # OSX files 15 | *~ 16 | 17 | # Eclipse project files 18 | .classpath 19 | .project 20 | .metadata/ 21 | 22 | # Android Studio / Intellij project files 23 | *.iml 24 | *.ipr 25 | *.iws 26 | .idea/ 27 | 28 | # Gradle wrappers / generated 29 | .gradle/ 30 | gradle/ 31 | gradlew 32 | gradlew.bat 33 | build/ 34 | 35 | # Local configs 36 | local.properties 37 | gradle.properties 38 | 39 | # Authentication policies 40 | *.auth 41 | 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### Overview of JCropImageView 2 | 3 | [![Hex.pm](https://img.shields.io/hexpm/l/plug.svg)](http://www.apache.org/licenses/LICENSE-2.0) [![Platform](https://img.shields.io/badge/platform-android-green.svg)](http://developer.android.com/index.html) 4 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-JCropImageView-green.svg?style=flat)](https://android-arsenal.com/details/1/2208) 5 | [![Android Gems](http://www.android-gems.com/badge/jimcoven/JCropImageView.svg?branch=master)](http://www.android-gems.com/lib/jimcoven/JCropImageView) 6 | 7 | One of the popular scaletype configurations used in Android is the "centerCrop". However, it is limited to just center cropping. This usually crops off the faces of people from images that have an aspect ratio height > width. 8 | 9 | ### Download the sample app 10 | 11 | [![Get it on Google Play](https://developer.android.com/images/brand/en_generic_rgb_wo_60.png)](https://play.google.com/store/apps/details?id=com.github.jimcoven.demo.jcropimageview.release) 12 | 13 | JCropImageView is a lightweight extension of the centercrop feature to provide additional control over how the images are displayed. For example in the screenshot below: 14 | 15 | - JCropImageView is used on the top, and it shows IronMan's face. 16 | - ImageView (Android Default) with centerCrop is shown below, and only the body is shown. 17 | 18 | ![alt text][fill_top1] 19 | 20 | [fill_top1]: https://raw.githubusercontent.com/jimcoven/JCropImageView/master/art/screens/fill_top1.jpg "pic1" 21 | 22 | In total, JCropImageView provides 11 configurations 23 | 24 | * FitWidth - 3 configurations - TOP/BOTTOM/CENTER 25 | * FitHeight - 3 configurations - CENTER/LEFT/RIGHT 26 | * FitBest - 5 configurations - TOP/BOTTOM/CENTER/LEFT/RIGHT depending on which scale is used. 27 | 28 | Note: The configurations for FitWidth + LEFT/RIGHT are correct, but they doesn't show any visual difference. This is because when an image is fit to width, the full width is already within the visible left and right bounds. They are effectively ALWAYS aligned LEFT and RIGHT. 29 | 30 | Similarly for FitHeight, it is effectively ALWAYS aligned TOP and BOTTOM 31 | 32 | THe configurations are more visible with FitBest, which will decide which bound to fit to. The default android scaleType=centerCrop is effectively 1 of the above configurations FitBest + CENTER 33 | 34 | ![alt text][all_configs] 35 | 36 | [all_configs]: https://raw.githubusercontent.com/jimcoven/JCropImageView/master/art/configurations/all_configs.png "configs" 37 | 38 | ### How to use JCropImageView 39 | 40 | A) Simply include the repository and dependency in your build.gradle file 41 | 42 | ``` 43 | repositories { 44 | mavenCentral() 45 | } 46 | dependencies { 47 | compile 'com.github.jimcoven:jcropimageview:0.22' 48 | } 49 | ``` 50 | 51 | Just create an imageview as usual in xml. Then specify the configurations "app:cropType" and "app:cropAlign". 52 | If "app:cropType" is not specified, this reverts back to the default behaviour an Android ImageView. 53 | 54 | Note! Remember to include the namespace xlmns:app 55 | 56 | ``` 57 | xmlns:app="http://schemas.android.com/apk/res-auto" 58 | 59 | 66 | ``` 67 | 68 | ### Supported configurations are: 69 | 70 | Supported configurations for "app:cropType" are: 71 | * fit_width : Stretch to fit width 72 | * fit_fill : Stretch to fit width or height to fill 73 | * fit_height: Stretch to fit height 74 | 75 | Supported configurations for "app:cropAlign" are: 76 | * top : align top edge 77 | * bottom : align bottom edge 78 | * center : align center 79 | * left : align left edge 80 | * right : align right edge 81 | 82 | 83 | -------------------------------------------------------------------------------- /art/configurations/._all.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/._all.psd -------------------------------------------------------------------------------- /art/configurations/._all_configs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/._all_configs.png -------------------------------------------------------------------------------- /art/configurations/._diagram.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/._diagram.psd -------------------------------------------------------------------------------- /art/configurations/._fill_bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/._fill_bottom.png -------------------------------------------------------------------------------- /art/configurations/._fill_center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/._fill_center.png -------------------------------------------------------------------------------- /art/configurations/._fill_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/._fill_left.png -------------------------------------------------------------------------------- /art/configurations/._fill_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/._fill_right.png -------------------------------------------------------------------------------- /art/configurations/._fill_top: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/._fill_top -------------------------------------------------------------------------------- /art/configurations/._height_center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/._height_center.png -------------------------------------------------------------------------------- /art/configurations/._height_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/._height_left.png -------------------------------------------------------------------------------- /art/configurations/._height_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/._height_right.png -------------------------------------------------------------------------------- /art/configurations/._width_bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/._width_bottom.png -------------------------------------------------------------------------------- /art/configurations/._width_center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/._width_center.png -------------------------------------------------------------------------------- /art/configurations/._width_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/._width_top.png -------------------------------------------------------------------------------- /art/configurations/all.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/all.psd -------------------------------------------------------------------------------- /art/configurations/all_configs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/all_configs.png -------------------------------------------------------------------------------- /art/configurations/diagram.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/diagram.psd -------------------------------------------------------------------------------- /art/configurations/fill_bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/fill_bottom.png -------------------------------------------------------------------------------- /art/configurations/fill_center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/fill_center.png -------------------------------------------------------------------------------- /art/configurations/fill_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/fill_left.png -------------------------------------------------------------------------------- /art/configurations/fill_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/fill_right.png -------------------------------------------------------------------------------- /art/configurations/fill_top: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/fill_top -------------------------------------------------------------------------------- /art/configurations/height_center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/height_center.png -------------------------------------------------------------------------------- /art/configurations/height_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/height_left.png -------------------------------------------------------------------------------- /art/configurations/height_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/height_right.png -------------------------------------------------------------------------------- /art/configurations/width_bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/width_bottom.png -------------------------------------------------------------------------------- /art/configurations/width_center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/width_center.png -------------------------------------------------------------------------------- /art/configurations/width_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/configurations/width_top.png -------------------------------------------------------------------------------- /art/images/flat_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/flat_1.jpg -------------------------------------------------------------------------------- /art/images/flat_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/flat_2.jpg -------------------------------------------------------------------------------- /art/images/flat_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/flat_3.jpg -------------------------------------------------------------------------------- /art/images/flat_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/flat_4.jpg -------------------------------------------------------------------------------- /art/images/icon_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/icon_1.jpg -------------------------------------------------------------------------------- /art/images/icon_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/icon_2.jpg -------------------------------------------------------------------------------- /art/images/icon_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/icon_3.jpg -------------------------------------------------------------------------------- /art/images/icon_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/icon_4.jpg -------------------------------------------------------------------------------- /art/images/icon_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/icon_5.jpg -------------------------------------------------------------------------------- /art/images/icon_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/icon_6.jpg -------------------------------------------------------------------------------- /art/images/icon_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/icon_7.jpg -------------------------------------------------------------------------------- /art/images/long_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/long_1.jpg -------------------------------------------------------------------------------- /art/images/long_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/long_2.jpg -------------------------------------------------------------------------------- /art/images/long_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/long_3.jpg -------------------------------------------------------------------------------- /art/images/long_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/long_4.jpg -------------------------------------------------------------------------------- /art/images/pictures.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/pictures.psd -------------------------------------------------------------------------------- /art/images/square_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/square_1.jpg -------------------------------------------------------------------------------- /art/images/square_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/square_2.jpg -------------------------------------------------------------------------------- /art/images/square_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/square_3.jpg -------------------------------------------------------------------------------- /art/images/square_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/square_4.jpg -------------------------------------------------------------------------------- /art/images/square_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/square_5.jpg -------------------------------------------------------------------------------- /art/images/thin_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/thin_1.jpg -------------------------------------------------------------------------------- /art/images/thin_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/thin_2.jpg -------------------------------------------------------------------------------- /art/images/thin_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/thin_3.jpg -------------------------------------------------------------------------------- /art/images/thin_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/thin_4.jpg -------------------------------------------------------------------------------- /art/images/thin_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/thin_5.jpg -------------------------------------------------------------------------------- /art/images/wide_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/wide_1.jpg -------------------------------------------------------------------------------- /art/images/wide_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/wide_2.jpg -------------------------------------------------------------------------------- /art/images/wide_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/wide_3.jpg -------------------------------------------------------------------------------- /art/images/wide_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/images/wide_4.jpg -------------------------------------------------------------------------------- /art/logo/logo.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/logo/logo.psd -------------------------------------------------------------------------------- /art/logo/logo128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/logo/logo128.png -------------------------------------------------------------------------------- /art/logo/logo144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/logo/logo144.png -------------------------------------------------------------------------------- /art/logo/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/logo/logo192.png -------------------------------------------------------------------------------- /art/logo/logo256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/logo/logo256.png -------------------------------------------------------------------------------- /art/logo/logo48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/logo/logo48.png -------------------------------------------------------------------------------- /art/logo/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/logo/logo512.png -------------------------------------------------------------------------------- /art/logo/logo64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/logo/logo64.png -------------------------------------------------------------------------------- /art/logo/logo72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/logo/logo72.png -------------------------------------------------------------------------------- /art/logo/logo96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/logo/logo96.png -------------------------------------------------------------------------------- /art/screens/fill_top.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/screens/fill_top.jpg -------------------------------------------------------------------------------- /art/screens/fill_top1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/screens/fill_top1.jpg -------------------------------------------------------------------------------- /art/screens/fill_top2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/art/screens/fill_top2.jpg -------------------------------------------------------------------------------- /binaries/jcrop-0.22.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/binaries/jcrop-0.22.apk -------------------------------------------------------------------------------- /project/aar-publish.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015. Jim Coven 3 | * http://www.github.com/jimcoven 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | group = group_id 20 | version = lib_version 21 | project.archivesBaseName = artifact_id 22 | 23 | /* ............................................................. 24 | * Generate secondary artifacts for publishing 25 | ............................................................. */ 26 | 27 | task androidSourcesJar(type: Jar) { 28 | from android.sourceSets.main.java.srcDirs 29 | classifier = 'sources' 30 | } 31 | 32 | task androidJavadoc(type: Javadoc) { 33 | source = android.sourceSets.main.java.srcDirs 34 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 35 | } 36 | 37 | task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) { 38 | from androidJavadoc.destinationDir 39 | classifier = 'javadoc' 40 | } 41 | 42 | androidJavadoc { 43 | options{ 44 | encoding "UTF-8" 45 | charSet 'UTF-8' 46 | author true 47 | version true 48 | links "http://docs.oracle.com/javase/7/docs/api" 49 | title artifact_id 50 | } 51 | } 52 | 53 | artifacts { 54 | archives androidJavadocJar 55 | archives androidSourcesJar 56 | } 57 | 58 | /* ............................................................. 59 | * Generate the project POM.xml & upload 60 | ............................................................. */ 61 | 62 | apply plugin: 'com.github.dcendents.android-maven' 63 | 64 | install { 65 | repositories.mavenInstaller { 66 | // This generates POM.xml with proper parameters 67 | pom { 68 | project { 69 | packaging 'aar' 70 | groupId group_id 71 | artifactId artifact_id 72 | 73 | // Add your description here 74 | name package_name 75 | description pom_library_desc 76 | url site_url 77 | 78 | // Set your license 79 | licenses { 80 | license { 81 | name pom_license_name 82 | url pom_license_url 83 | } 84 | } 85 | developers { 86 | developer { 87 | id pom_developer_id 88 | name pom_developer_name 89 | email pom_developer_email 90 | } 91 | } 92 | scm { 93 | connection git_url 94 | developerConnection git_url 95 | url site_url 96 | } 97 | } 98 | } 99 | } 100 | } 101 | 102 | /* ............................................................. 103 | * Upload to Sonatype / Bintray 104 | ............................................................. */ 105 | 106 | def isReleaseBuild() { 107 | return version.contains("SNAPSHOT") == false 108 | } 109 | 110 | def getReleaseRepositoryUrl() { 111 | return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL 112 | : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" 113 | } 114 | 115 | def getSnapshotRepositoryUrl() { 116 | return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL 117 | : "https://oss.sonatype.org/content/repositories/snapshots/" 118 | } 119 | 120 | signing { 121 | required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } 122 | sign configurations.archives 123 | } 124 | 125 | afterEvaluate { project -> 126 | uploadArchives { 127 | configuration = configurations.archives 128 | repositories.mavenDeployer { 129 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } 130 | 131 | repository(url: getReleaseRepositoryUrl()) { 132 | authentication(userName: sonatype_userid, password: sonatype_passwd) 133 | } 134 | 135 | snapshotRepository(url: getSnapshotRepositoryUrl()) { 136 | authentication(userName: sonatype_userid, password: sonatype_passwd) 137 | } 138 | 139 | pom.project { 140 | name package_name 141 | packaging 'aar' 142 | description pom_library_desc 143 | url site_url 144 | 145 | scm { 146 | url site_url 147 | connection git_url 148 | developerConnection git_url 149 | } 150 | 151 | licenses { 152 | license { 153 | name pom_license_name 154 | url pom_license_url 155 | distribution 'repo' 156 | } 157 | } 158 | 159 | developers { 160 | developer { 161 | id pom_developer_id 162 | name pom_developer_name 163 | email pom_developer_email 164 | } 165 | } 166 | } 167 | } 168 | } 169 | } 170 | -------------------------------------------------------------------------------- /project/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:1.2.3' 10 | classpath 'com.github.dcendents:android-maven-plugin:1.2' 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | jcenter() 17 | mavenCentral() 18 | maven { 19 | url "https://oss.sonatype.org/content/repositories/snapshots" 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /project/mod_library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'maven' 3 | apply plugin: 'signing' 4 | 5 | /* 6 | Project parameters are written in underscore_case to maintain readability from script codes. 7 | */ 8 | 9 | ext { 10 | // bare minimum params for uploading archive 11 | package_name = 'JCropImageView' 12 | group_id = 'com.github.jimcoven' 13 | artifact_id = 'jcropimageview' 14 | lib_version = '0.22' 15 | lib_version_code = 1 16 | git_url = 'https://github.com/jimcoven/JCropImageView.git' 17 | site_url = 'https://github.com/jimcoven/JCropImageView' 18 | all_licenses = ["Apache-2.0"] // mandatory 19 | 20 | // pom.xml is required for users to download your aars using the command 21 | // ie. compile 'group_id:artifact_id:artifact_version' 22 | // eg. compile 'com.android.support:appcompat-v7:22.1.1' 23 | // params below are for defining the additional params for the pom.xml 24 | pom_library_desc = 'Android view that extends ImageView to support more cropping options' 25 | pom_license_name = 'The Apache Software License, Version 2.0' 26 | pom_license_url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' 27 | pom_developer_id = 'jimcoven' 28 | pom_developer_name = 'Jim Coven' 29 | pom_developer_email = '' 30 | 31 | } 32 | 33 | dependencies { 34 | compile fileTree(dir: 'libs', include: ['*.jar']) 35 | compile 'com.android.support:appcompat-v7:22.2.1' 36 | compile 'com.android.support:support-annotations:20.0.0' 37 | } 38 | 39 | /* ............................................................. 40 | * Modify the following if needed. 41 | ............................................................. */ 42 | 43 | android { 44 | compileSdkVersion 22 45 | buildToolsVersion "22.0.1" 46 | 47 | defaultConfig { 48 | minSdkVersion 15 49 | targetSdkVersion 15 50 | versionCode lib_version_code 51 | versionName lib_version 52 | // android library does NOT need an app_id 53 | } 54 | 55 | buildTypes { 56 | release { 57 | zipAlignEnabled true 58 | minifyEnabled false // keep as false. No need proguard for OSS 59 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 60 | } 61 | } 62 | } 63 | 64 | //apply from: '../aar-publish.gradle' 65 | -------------------------------------------------------------------------------- /project/mod_library/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /home/gardev/android/adt-bundle-linux/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | -------------------------------------------------------------------------------- /project/mod_library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /project/mod_library/src/main/java/com.github.jimcoven/view/JCropImageView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015. Jim Coven 3 | * http://www.github.com/jimcoven 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package com.github.jimcoven.view; 20 | 21 | import android.annotation.TargetApi; 22 | import android.content.Context; 23 | import android.content.res.TypedArray; 24 | import android.graphics.Matrix; 25 | import android.graphics.drawable.Drawable; 26 | import android.os.Build.VERSION_CODES; 27 | import android.util.AttributeSet; 28 | import android.view.ViewGroup.LayoutParams; 29 | import android.widget.ImageView; 30 | 31 | import com.github.jimcoven.jcropimageview.R; 32 | 33 | /** 34 | * JCropImageView provides 11 configurations 35 | * 36 | * FitWidth - 3 configurations - TOP/BOTTOM/CENTER 37 | * FitHeight - 3 configurations - CENTER/LEFT/RIGHT 38 | * FitBest - 5 configurations - TOP/BOTTOM/CENTER/LEFT/RIGHT depending on which scale is used. 39 | * 40 | * The configurations for FitWidth + LEFT/RIGHT are correct, but they doesn't show any visual difference. 41 | * This is because when an image is fit to width, the full width is already within the visible left and right bounds. 42 | * They are effectively ALWAYS aligned LEFT and RIGHT. 43 | * 44 | * Similarly for FitHeight, it is effectively ALWAYS aligned TOP and BOTTOM 45 | * 46 | * THe configurations are more visible with FitBest, which will decide which bound to fit to. 47 | * The default android scaleType=centerCrop is effectively 1 of the above configurations FitBest + CENTER 48 | * 49 | */ 50 | 51 | public class JCropImageView extends ImageView { 52 | 53 | public static final class CropType { 54 | public static final int FIT_WIDTH = 0; 55 | public static final int FIT_FILL = 1; 56 | public static final int FIT_HEIGHT = 2; 57 | } 58 | 59 | public static final class CropAlign { 60 | public static final int ALIGN_TOP = 0; 61 | public static final int ALIGN_BOTTOM = 1; 62 | public static final int ALIGN_CENTER = 2; 63 | public static final int ALIGN_LEFT = 3; 64 | public static final int ALIGN_RIGHT = 4; 65 | } 66 | 67 | private int mCropType = -1; 68 | private int mCropAlign = 0; 69 | 70 | public JCropImageView(Context context) { 71 | super(context); 72 | initFromAttributes(context, null, 0, 0); 73 | } 74 | 75 | public JCropImageView(Context context, AttributeSet attrs) { 76 | super(context, attrs); 77 | initFromAttributes(context, attrs, 0, 0); 78 | } 79 | 80 | public JCropImageView(Context context, AttributeSet attrs, int defStyle) { 81 | super(context, attrs, defStyle); 82 | initFromAttributes(context, attrs, defStyle, 0); 83 | } 84 | 85 | /** 86 | * Initialize the attributes for JCropImageView 87 | * 88 | * @param context The Context the view is running in, through which it can 89 | * access the current theme, resources, etc. 90 | * @param attrs The attributes of the XML tag that is inflating the view. 91 | * @param defStyleAttr An attribute in the current theme that contains a 92 | * reference to a style resource that supplies default values for 93 | * the view. Can be 0 to not look for defaults. 94 | * @param defStyleRes A resource identifier of a style resource that 95 | * supplies default values for the view, used only if 96 | * defStyleAttr is 0 or can not be found in the theme. Can be 0 97 | * to not look for defaults. 98 | * @see @link android.view.View(Context, AttributeSet, int) 99 | */ 100 | private void initFromAttributes(Context context, AttributeSet attrs, 101 | int defStyleAttr, int defStyleRes) { 102 | // Read and apply provided attributes 103 | TypedArray a = context.obtainStyledAttributes(attrs, 104 | R.styleable.JCropImageView, defStyleAttr, defStyleRes); 105 | mCropType = a.getInt(R.styleable.JCropImageView_cropType, mCropType); 106 | mCropAlign = a.getInt(R.styleable.JCropImageView_cropAlign, mCropAlign); 107 | a.recycle(); 108 | 109 | setCropType(mCropType); 110 | } 111 | 112 | public void setCropType(int cropType) { 113 | mCropType = cropType; 114 | if (mCropType > -1) setScaleType(ScaleType.MATRIX); 115 | } 116 | 117 | public void setCropAlign(int cropAlign) { 118 | mCropAlign = cropAlign; 119 | } 120 | 121 | @TargetApi(VERSION_CODES.JELLY_BEAN) 122 | @Override 123 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 124 | Drawable d = getDrawable(); 125 | if (d != null && mCropType > -1) { 126 | 127 | final int dw = d.getIntrinsicWidth(); 128 | final int dh = d.getIntrinsicHeight(); 129 | int dx = 0, dy = 0; 130 | int msWidth = 0, msHeight = 0; 131 | int theoryw = 0, theoryh = 0; 132 | float scalew = 0, scaleh = 0; 133 | float scale = 0; 134 | 135 | if (mCropType <= CropType.FIT_FILL) { // fit width || bestfit 136 | // 1. get anchor by width. constrain to drawablewidth if wrap-content 137 | msWidth = MeasureSpec.getSize(widthMeasureSpec); // the view width 138 | if (getLayoutParams().width == LayoutParams.WRAP_CONTENT) { // wrap 139 | msWidth = dw < msWidth ? dw : msWidth; 140 | } 141 | 142 | // 2. compute scale and theoretical height 143 | scalew = (float) msWidth / dw; // scale_via_width 144 | theoryh = (int) (dh * scalew); // theoretical = height x scale_via_width 145 | } 146 | 147 | if (mCropType >= CropType.FIT_FILL) {// fit bestfit || height 148 | // 1. get anchor by height. constrain to drawableheight if wrap-content 149 | msHeight = MeasureSpec.getSize(heightMeasureSpec); // the view height 150 | if (getLayoutParams().height == LayoutParams.WRAP_CONTENT) { // wrap 151 | msHeight = dh < msHeight ? dh : msHeight; 152 | } 153 | 154 | // 2. compute scale and theoretical width 155 | scaleh = (float) msHeight / dh; // scale_via_height 156 | theoryw = (int) (dw * scaleh); // theoretical = width x scale_via_height 157 | } 158 | 159 | if (scalew > scaleh) { // fit width 160 | scale = scalew; 161 | 162 | // 3. constrain by maxheight 163 | // if match_parent then additional constraint if viewport < maxheight 164 | // if wrap_content then anything works even if viewport < or > maxheight 165 | int maxHeight = getMaxHeight(); 166 | msHeight = getLayoutParams().height; 167 | if (msHeight >= LayoutParams.MATCH_PARENT) { // match parent 168 | if (msHeight == LayoutParams.MATCH_PARENT) { 169 | msHeight = MeasureSpec.getSize(heightMeasureSpec); 170 | } 171 | maxHeight = msHeight < maxHeight ? msHeight : maxHeight; 172 | } 173 | msHeight = theoryh > maxHeight ? maxHeight : theoryh; // limited height 174 | 175 | // 4. translate 176 | if (mCropAlign >= CropAlign.ALIGN_CENTER) { 177 | // AlignTo.ALIGN_CENTER || AlignTo.ALIGN_LEFT || AlignTo.ALIGN_RIGHT 178 | // if you want center crop shift it up by 50% aka 0.5f 179 | dy = (int)( (msHeight - theoryh) * 0.5f + 0.5f ); // + 0.5f for rounding 180 | } else if (mCropAlign == CropAlign.ALIGN_BOTTOM) { 181 | // AlignTo.ALIGN_BOTTOM 182 | // if you want bottom crop shift it up by 100% aka 1.0f 183 | dy = (int)( (msHeight - theoryh) * 1.0f + 0.5f ); // + 0.5f for rounding 184 | } 185 | 186 | } else { // fit height 187 | scale = scaleh; 188 | 189 | // 3. constrain by maxwidth 190 | // if match_parent then additional constraint if viewport < maxwidth 191 | // if wrap_content then anything works even if viewport < or > maxwidth 192 | int maxWidth = getMaxWidth(); 193 | msWidth = getLayoutParams().width; 194 | if (msWidth >= LayoutParams.MATCH_PARENT) { // match parent or is set 195 | if (msWidth == LayoutParams.MATCH_PARENT) { 196 | msWidth = MeasureSpec.getSize(widthMeasureSpec); 197 | } 198 | maxWidth = msWidth < maxWidth ? msWidth : maxWidth; 199 | } 200 | msWidth = theoryw > maxWidth ? maxWidth : theoryw; // limited width 201 | 202 | if (mCropAlign <= CropAlign.ALIGN_CENTER) { 203 | // AlignTo.ALIGN_CENTER || AlignTo.ALIGN_TOP || AlignTo.ALIGN_BOTTOM 204 | // if you want center crop shift it left by 50% aka 0.5f 205 | dx = (int)( (msWidth - theoryw) * 0.5f + 0.5f ); // + 0.5f for rounding 206 | } else if (mCropAlign == CropAlign.ALIGN_RIGHT) { //AlignTo.ALIGN_RIGHT 207 | // if you want right crop shift right up by 100% aka 1.0f 208 | dx = (int)( (msWidth - theoryw) * 1.0f + 0.5f ); // + 0.5f for rounding 209 | } 210 | } 211 | 212 | // this is to scale it only by width - the pivot point is at (0,0) 213 | // for top crop we dont need to translate it 214 | Matrix matrix = getImageMatrix(); 215 | matrix.setScale(scale, scale); 216 | matrix.postTranslate(dx, dy); 217 | setImageMatrix(matrix); 218 | setMeasuredDimension(msWidth, msHeight); 219 | } 220 | else super.onMeasure(widthMeasureSpec, heightMeasureSpec); 221 | } 222 | } 223 | -------------------------------------------------------------------------------- /project/mod_library/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /project/mod_sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | ext { 4 | app_id = 'com.github.jimcoven.demo.jcropimageview' // usually the namespace. Note it is not the same as package 5 | app_version_code = 8 6 | app_version = '0.23' 7 | } 8 | 9 | dependencies { 10 | compile fileTree(dir: 'libs', include: ['*.jar']) 11 | compile 'com.android.support:appcompat-v7:22.2.0' 12 | compile 'com.android.support:recyclerview-v7:22.2.0' 13 | compile 'com.github.jimcoven:jcropimageview:0.22' 14 | } 15 | 16 | /* ............................................................. 17 | * Modify the following if needed 18 | ............................................................. */ 19 | 20 | android { 21 | compileSdkVersion 22 22 | buildToolsVersion "22.0.1" 23 | 24 | signingConfigs { 25 | release { 26 | keyAlias signapk_alias 27 | keyPassword signapk_pass1 28 | storeFile file(signapk_store) 29 | storePassword signapk_pass2 30 | } 31 | } 32 | 33 | defaultConfig { 34 | minSdkVersion 15 35 | targetSdkVersion 15 36 | applicationId app_id as String 37 | versionCode app_version_code as int 38 | versionName app_version as String 39 | } 40 | 41 | buildTypes { 42 | debug { 43 | applicationIdSuffix ".debug" 44 | } 45 | release { 46 | applicationIdSuffix ".release" 47 | signingConfig signingConfigs.release 48 | minifyEnabled true 49 | zipAlignEnabled true 50 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /project/mod_sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /home/gardev/android/adt-bundle-linux/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /project/mod_sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /project/mod_sample/src/main/assets/creative_commons.txt: -------------------------------------------------------------------------------- 1 | Except where otherwise noted, images/content adapted for this application are licensed under a Creative Commons Attribution 4.0 License. 2 | To view a copy of this license, please visit http://creativecommons.org/licenses/by/4.0/. 3 | This application serves no purpose other than for demonstration of an open source Android Library only. -------------------------------------------------------------------------------- /project/mod_sample/src/main/java/com.github.jimcoven.demo/DataPack.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015. Jim Coven 3 | * http://www.github.com/jimcoven 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package com.github.jimcoven.demo; 20 | 21 | import com.github.jimcoven.demo.jcropimageview.R; 22 | 23 | import java.util.ArrayList; 24 | import java.util.List; 25 | 26 | 27 | public class DataPack { 28 | 29 | public static final int SHAPE_LONG = 0; 30 | public static final int SHAPE_WIDE = 1; 31 | public static final int SHAPE_ICON = 2; 32 | public static final int SHAPE_SQUARE = 3; 33 | public static final int SHAPE_THIN = 4; 34 | public static final int SHAPE_FLAT = 5; 35 | 36 | private static String getShapeName(int shape) { 37 | switch (shape) { 38 | case SHAPE_LONG: return "Long"; 39 | case SHAPE_WIDE: return "Wide"; 40 | case SHAPE_ICON: return "Icon"; 41 | case SHAPE_SQUARE: return "Square"; 42 | case SHAPE_THIN: return "Thin"; 43 | case SHAPE_FLAT: return "Flat"; 44 | } 45 | return "UNKNOWN"; 46 | } 47 | 48 | public static class ImageItem { 49 | public final int shape; 50 | public final int resId; 51 | private ImageItem(int shape, int resId) { 52 | this.shape = shape; 53 | this.resId = resId; 54 | } 55 | 56 | public String getShapeName() { 57 | return DataPack.getShapeName(shape) + " " + resId; 58 | } 59 | } 60 | 61 | public static ImageItem[] getImages(int[] filters) { 62 | List filtered = new ArrayList<>(); 63 | for (int f : filters) { 64 | for (ImageItem ii : images) { 65 | if (ii.shape == f) { 66 | filtered.add(ii); 67 | } 68 | } 69 | } 70 | return filtered.toArray(new ImageItem[filtered.size()]); 71 | } 72 | 73 | private static final ImageItem[] images; 74 | 75 | static { 76 | List items = new ArrayList<>(); 77 | 78 | items.add(new ImageItem(SHAPE_THIN, R.mipmap.thin_11)); 79 | items.add(new ImageItem(SHAPE_THIN, R.mipmap.thin_12)); 80 | items.add(new ImageItem(SHAPE_THIN, R.mipmap.thin_13)); 81 | items.add(new ImageItem(SHAPE_THIN, R.mipmap.thin_14)); 82 | items.add(new ImageItem(SHAPE_THIN, R.mipmap.thin_15)); 83 | 84 | items.add(new ImageItem(SHAPE_FLAT, R.mipmap.flat_11)); 85 | items.add(new ImageItem(SHAPE_FLAT, R.mipmap.flat_12)); 86 | items.add(new ImageItem(SHAPE_FLAT, R.mipmap.flat_13)); 87 | items.add(new ImageItem(SHAPE_FLAT, R.mipmap.flat_14)); 88 | 89 | items.add(new ImageItem(SHAPE_LONG, R.mipmap.long_11)); 90 | items.add(new ImageItem(SHAPE_LONG, R.mipmap.long_12)); 91 | items.add(new ImageItem(SHAPE_LONG, R.mipmap.long_13)); 92 | items.add(new ImageItem(SHAPE_LONG, R.mipmap.long_14)); 93 | items.add(new ImageItem(SHAPE_LONG, R.mipmap.long_15)); 94 | 95 | items.add(new ImageItem(SHAPE_WIDE, R.mipmap.wide_11)); 96 | items.add(new ImageItem(SHAPE_WIDE, R.mipmap.wide_12)); 97 | items.add(new ImageItem(SHAPE_WIDE, R.mipmap.wide_13)); 98 | items.add(new ImageItem(SHAPE_WIDE, R.mipmap.wide_14)); 99 | 100 | items.add(new ImageItem(SHAPE_ICON, R.mipmap.icon_11)); 101 | items.add(new ImageItem(SHAPE_ICON, R.mipmap.icon_12)); 102 | items.add(new ImageItem(SHAPE_ICON, R.mipmap.icon_13)); 103 | items.add(new ImageItem(SHAPE_ICON, R.mipmap.icon_14)); 104 | 105 | items.add(new ImageItem(SHAPE_SQUARE, R.mipmap.square_11)); 106 | items.add(new ImageItem(SHAPE_SQUARE, R.mipmap.square_12)); 107 | items.add(new ImageItem(SHAPE_SQUARE, R.mipmap.square_13)); 108 | items.add(new ImageItem(SHAPE_SQUARE, R.mipmap.square_14)); 109 | items.add(new ImageItem(SHAPE_SQUARE, R.mipmap.square_15)); 110 | 111 | images = items.toArray(new ImageItem[items.size()]); 112 | } 113 | 114 | 115 | } 116 | -------------------------------------------------------------------------------- /project/mod_sample/src/main/java/com.github.jimcoven.demo/jcropimageview/Configuration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015. Jim Coven 3 | * http://www.github.com/jimcoven 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package com.github.jimcoven.demo.jcropimageview; 20 | 21 | import android.os.Parcel; 22 | import android.os.Parcelable; 23 | 24 | import com.github.jimcoven.demo.DataPack; 25 | 26 | class Configuration implements Parcelable { 27 | final int cropType; 28 | final int cropAlign; 29 | final int display; 30 | 31 | Configuration(int type, int align, int display) { 32 | this.cropType = type; 33 | this.cropAlign = align; 34 | this.display = display; 35 | } 36 | 37 | String getConfigurationName() { 38 | return getCropType(cropType) + " + " + getCropAlign(cropAlign); 39 | } 40 | 41 | private static String getCropType(int id) { 42 | switch(id) { 43 | case 0: return "FIT_WIDTH"; 44 | case 1: return "FIT_FILL"; 45 | case 2: return "FIT_HEIGHT"; 46 | } 47 | return "NA"; 48 | } 49 | 50 | private static String getCropAlign(int id) { 51 | switch(id) { 52 | case 0: return "ALIGN_TOP"; 53 | case 1: return "ALIGN_BOTTOM"; 54 | case 2: return "ALIGN_CENTER"; 55 | case 3: return "ALIGN_LEFT"; 56 | case 4: return "ALIGN_RIGHT"; 57 | } 58 | return "NA"; 59 | } 60 | 61 | public DataPack.ImageItem[] getImageItems() { 62 | 63 | // FIT_FILL && TOP|BOTTOM|CENTER 64 | if (cropType == 1 && cropAlign < 3) { 65 | return DataPack.getImages(new int[] { 66 | DataPack.SHAPE_LONG, 67 | DataPack.SHAPE_THIN, 68 | DataPack.SHAPE_ICON, 69 | DataPack.SHAPE_SQUARE 70 | }); 71 | } 72 | 73 | // FIT_FILL && LEFT|RIGHT|CENTER 74 | if (cropType == 1 && cropAlign >= 3) { 75 | return DataPack.getImages(new int[] { 76 | DataPack.SHAPE_FLAT, 77 | DataPack.SHAPE_WIDE 78 | }); 79 | } 80 | 81 | // FIT_WIDTH 82 | if (cropType == 0) { 83 | return DataPack.getImages(new int[] { 84 | DataPack.SHAPE_LONG, 85 | DataPack.SHAPE_THIN 86 | }); 87 | } 88 | 89 | // FIT_HEIGHT 90 | if (cropType == 2) { 91 | return DataPack.getImages(new int[]{ 92 | DataPack.SHAPE_FLAT, 93 | DataPack.SHAPE_WIDE 94 | }); 95 | } 96 | 97 | // ANYTHING ELSE 98 | return DataPack.getImages(new int[] { 99 | DataPack.SHAPE_THIN, 100 | DataPack.SHAPE_LONG, 101 | DataPack.SHAPE_ICON, 102 | DataPack.SHAPE_SQUARE, 103 | DataPack.SHAPE_FLAT, 104 | DataPack.SHAPE_WIDE 105 | }); 106 | } 107 | 108 | Configuration(Parcel in) { 109 | cropType = in.readInt(); 110 | cropAlign = in.readInt(); 111 | display = in.readInt(); 112 | } 113 | 114 | @Override 115 | public void writeToParcel(Parcel dest, int flags) { 116 | dest.writeInt(cropType); 117 | dest.writeInt(cropAlign); 118 | dest.writeInt(display); 119 | } 120 | 121 | @Override 122 | public int describeContents() { 123 | return 0; 124 | } 125 | 126 | public static final Parcelable.Creator CREATOR 127 | = new Parcelable.Creator() { 128 | 129 | public Configuration createFromParcel(Parcel in) { 130 | return new Configuration(in); 131 | } 132 | 133 | public Configuration[] newArray(int size) { 134 | return new Configuration[size]; 135 | } 136 | }; 137 | } 138 | -------------------------------------------------------------------------------- /project/mod_sample/src/main/java/com.github.jimcoven.demo/jcropimageview/JCropImageViewActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015. Jim Coven 3 | * http://www.github.com/jimcoven 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package com.github.jimcoven.demo.jcropimageview; 20 | 21 | import android.content.Context; 22 | import android.content.res.Resources; 23 | import android.graphics.drawable.Drawable; 24 | import android.os.Bundle; 25 | import android.support.v4.view.PagerAdapter; 26 | import android.support.v4.view.ViewPager; 27 | import android.support.v7.app.AppCompatActivity; 28 | import android.view.LayoutInflater; 29 | import android.view.View; 30 | import android.view.ViewGroup; 31 | import android.widget.TextView; 32 | 33 | import com.github.jimcoven.demo.DataPack.ImageItem; 34 | import com.github.jimcoven.view.JCropImageView; 35 | 36 | import java.util.ArrayList; 37 | import java.util.List; 38 | 39 | public class JCropImageViewActivity extends AppCompatActivity { 40 | 41 | @Override 42 | protected void onCreate(Bundle savedInstanceState) { 43 | super.onCreate(savedInstanceState); 44 | 45 | setContentView(R.layout.jcrop_activity); 46 | 47 | Configuration config = getIntent().getParcelableExtra("config"); 48 | 49 | ImagePageAdapter adapter = new ImagePageAdapter(this, config); 50 | ViewPager pager = (ViewPager) findViewById(R.id.view_pager); 51 | pager.setAdapter(adapter); 52 | 53 | } 54 | 55 | 56 | private static class ImagePageAdapter extends ObjectPageAdaper { 57 | 58 | private class VHItem { 59 | JCropImageView jcropImage; 60 | TextView jcropTitle; 61 | 62 | VHItem(View itemView) { 63 | this.jcropImage = (JCropImageView) itemView.findViewById(R.id.jcropimage_view); 64 | this.jcropTitle = (TextView) itemView.findViewById(R.id.jcrop_title); 65 | 66 | jcropImage.setCropType(config.cropType); 67 | jcropImage.setCropAlign(config.cropAlign); 68 | 69 | itemView.setTag(this); 70 | } 71 | } 72 | 73 | private final LayoutInflater inflater; 74 | 75 | private final Resources resources; 76 | 77 | private final ImageItem[] images; 78 | 79 | private final Configuration config; 80 | 81 | ImagePageAdapter(Context context, Configuration config) { 82 | this.resources = context.getResources(); 83 | this.inflater = LayoutInflater.from(context); 84 | this.config = config; 85 | this.images = config.getImageItems(); 86 | } 87 | 88 | @Override 89 | public int getCount() { 90 | return images.length; 91 | } 92 | 93 | @Override 94 | protected View getView(int position, View view, ViewGroup parent) { 95 | VHItem holder; 96 | if (view == null) { 97 | view = inflater.inflate(R.layout.jcropitem_view, parent, false); 98 | holder = new VHItem(view); 99 | } else { 100 | holder = (VHItem) view.getTag(); 101 | } 102 | 103 | bindView(holder, position); 104 | 105 | return view; 106 | } 107 | 108 | @SuppressWarnings("deprecation") 109 | private void bindView(final VHItem holder, int position) { 110 | Drawable image = resources.getDrawable(images[position].resId); 111 | 112 | holder.jcropImage.setImageDrawable(image); 113 | String jconfig = resources.getString(R.string.jcrop_image_view, 114 | config.getConfigurationName()); 115 | holder.jcropTitle.setText(jconfig); 116 | } 117 | 118 | } 119 | 120 | /** 121 | * A page adapter which works with a large data set by reusing views. 122 | */ 123 | private abstract static class ObjectPageAdaper extends PagerAdapter { 124 | 125 | private static class RecycleItem { 126 | private int position = -1; 127 | private View view; 128 | } 129 | 130 | // Views that can be reused. 131 | private final List recycler = new ArrayList<>(); 132 | private final List active = new ArrayList<>(); 133 | 134 | @Override 135 | public abstract int getCount(); 136 | 137 | protected abstract View getView(int position, View view, ViewGroup parent); 138 | 139 | @Override 140 | public Object instantiateItem(ViewGroup parent, int position) { 141 | RecycleItem item = recycler.isEmpty() ? new RecycleItem() : recycler.remove(0); 142 | item.view = getView(position, item.view, parent); 143 | item.position = position; 144 | 145 | parent.addView(item.view); 146 | active.add(item); 147 | 148 | return item; 149 | } 150 | 151 | @Override 152 | public void destroyItem(ViewGroup container, int position, Object object) { 153 | RecycleItem item = (RecycleItem) object; 154 | if (item != null) { 155 | item.position = -1; 156 | recycler.add(item); 157 | container.removeView(item.view); 158 | active.remove(item); 159 | } 160 | } 161 | 162 | @Override 163 | public boolean isViewFromObject(View v, Object obj) { 164 | return v == ((RecycleItem) obj).view; 165 | } 166 | 167 | /** 168 | * Attempts to return the view based on position. 169 | * It can only return -x/+x of current position of the view pager. 170 | * @param position position of the adapter 171 | * @return view or null. If it returns null, it means its being recycled at the moment 172 | */ 173 | protected View getItem(int position) { 174 | for (RecycleItem item : active) { 175 | if (item.position == position) { 176 | return item.view; 177 | } 178 | } 179 | return null; 180 | } 181 | 182 | @Override 183 | public void notifyDataSetChanged() { 184 | recycler.clear(); 185 | super.notifyDataSetChanged(); 186 | } 187 | } 188 | 189 | } -------------------------------------------------------------------------------- /project/mod_sample/src/main/java/com.github.jimcoven.demo/jcropimageview/MainActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015. Jim Coven 3 | * http://www.github.com/jimcoven 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package com.github.jimcoven.demo.jcropimageview; 20 | 21 | import android.content.Context; 22 | import android.content.Intent; 23 | import android.net.Uri; 24 | import android.os.Bundle; 25 | import android.support.v7.app.AppCompatActivity; 26 | import android.support.v7.widget.LinearLayoutManager; 27 | import android.support.v7.widget.RecyclerView; 28 | import android.support.v7.widget.RecyclerView.Adapter; 29 | import android.text.Html; 30 | import android.text.method.LinkMovementMethod; 31 | import android.util.Log; 32 | import android.view.LayoutInflater; 33 | import android.view.Menu; 34 | import android.view.MenuInflater; 35 | import android.view.MenuItem; 36 | import android.view.View; 37 | import android.view.ViewGroup; 38 | import android.widget.ImageView; 39 | import android.widget.TextView; 40 | 41 | import java.io.BufferedReader; 42 | import java.io.IOException; 43 | import java.io.InputStream; 44 | import java.io.InputStreamReader; 45 | import java.util.ArrayList; 46 | import java.util.List; 47 | 48 | public class MainActivity extends AppCompatActivity { 49 | 50 | private static final String TAG = MainActivity.class.getSimpleName(); 51 | 52 | private static final Configuration[] configs; 53 | 54 | static { 55 | List items = new ArrayList<>(); 56 | 57 | items.add(new Configuration(1, 0, R.drawable.fill_top)); // FIT_FILL + ALIGN_TOP 58 | items.add(new Configuration(1, 1, R.drawable.fill_bottom)); // FIT_FILL + ALIGN_BOTTOM 59 | items.add(new Configuration(1, 2, R.drawable.fill_center)); // FIT_FILL + ALIGN_CENTER 60 | items.add(new Configuration(1, 3, R.drawable.fill_left)); // FIT_FILL + ALIGN_LEFT 61 | items.add(new Configuration(1, 4, R.drawable.fill_right)); // FIT_FILL + ALIGN_RIGHT 62 | 63 | items.add(new Configuration(0, 0, R.drawable.width_top)); // FIT_WIDTH + ALIGN_TOP 64 | items.add(new Configuration(0, 1, R.drawable.width_bottom)); // FIT_WIDTH + ALIGN_BOTTOM 65 | items.add(new Configuration(0, 2, R.drawable.width_center)); // FIT_WIDTH + ALIGN_CENTER 66 | //items.add(new Configuration(0, 3)); // FIT_WIDTH + ALIGN_LEFT 67 | //items.add(new Configuration(0, 4)); // FIT_WIDTH + ALIGN_RIGHT 68 | 69 | //items.add(new Configuration(2, 0)); // FIT_HEIGHT + ALIGN_TOP 70 | //items.add(new Configuration(2, 1)); // FIT_HEIGHT + ALIGN_BOTTOM 71 | items.add(new Configuration(2, 2, R.drawable.height_center)); // FIT_HEIGHT + ALIGN_CENTER 72 | items.add(new Configuration(2, 3, R.drawable.height_left)); // FIT_HEIGHT + ALIGN_LEFT 73 | items.add(new Configuration(2, 4, R.drawable.height_right)); // FIT_HEIGHT + ALIGN_RIGHT 74 | 75 | configs = items.toArray(new Configuration[items.size()]); 76 | } 77 | 78 | @Override 79 | protected void onCreate(Bundle savedInstanceState) { 80 | super.onCreate(savedInstanceState); 81 | 82 | setContentView(R.layout.main_activity); 83 | getSupportActionBar().setLogo(R.mipmap.ic_launcher); 84 | getSupportActionBar().setDisplayUseLogoEnabled(true); 85 | 86 | RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view); 87 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); 88 | linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); 89 | recyclerView.setLayoutManager(linearLayoutManager); 90 | recyclerView.setAdapter(new ConfigAdapter(this, configs)); 91 | 92 | setLicenseBox(); 93 | 94 | } 95 | 96 | 97 | public class ConfigAdapter extends Adapter { 98 | 99 | // Provide a reference to the views for each data item 100 | // Provide access to all the views for a data item in a view holder 101 | public final class ViewHolder extends RecyclerView.ViewHolder 102 | implements RecyclerView.OnClickListener { 103 | private final ImageView image; 104 | private final TextView title; 105 | Configuration config; 106 | 107 | public ViewHolder(View view) { 108 | super(view); 109 | image = (ImageView) view.findViewById(R.id.image); 110 | title = (TextView) view.findViewById(R.id.title_view); 111 | view.setOnClickListener(this); 112 | } 113 | 114 | @Override 115 | public void onClick(View v) { 116 | Intent intent = new Intent(MainActivity.this, JCropImageViewActivity.class); 117 | intent.putExtra("config", config); 118 | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 119 | startActivity(intent); 120 | } 121 | } 122 | 123 | private final LayoutInflater inflater; 124 | 125 | private final Configuration[] configs; 126 | 127 | private ConfigAdapter(Context context, Configuration[] configs) { 128 | this.inflater = LayoutInflater.from(context); 129 | this.configs = configs; 130 | } 131 | 132 | // Create new items (invoked by the layout manager) 133 | // Usually involves inflating a layout from XML and returning the holder 134 | @Override 135 | public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { 136 | View view = inflater.inflate(R.layout.mainitem_view, viewGroup, false); 137 | return new ViewHolder(view); 138 | } 139 | 140 | // Replace the contents of a view (invoked by the layout manager) 141 | // Involves populating data into the item through holder 142 | @Override 143 | public void onBindViewHolder(ViewHolder holder, int position) { 144 | Configuration config = configs[position]; 145 | holder.image.setImageDrawable(getResources().getDrawable(config.display)); 146 | holder.title.setText("(" + (position + 1) + ") " + config.getConfigurationName()); 147 | holder.config = config; 148 | } 149 | 150 | // Return the size of your dataset (invoked by the layout manager) 151 | @Override 152 | public int getItemCount() { 153 | return this.configs.length; 154 | } 155 | 156 | } 157 | 158 | private void openGithub() { 159 | String url = "https://github.com/jimcoven/JCropImageView"; 160 | Intent intent = new Intent(Intent.ACTION_VIEW); 161 | intent.setData(Uri.parse(url)); 162 | startActivity(intent); 163 | } 164 | 165 | @Override 166 | public boolean onCreateOptionsMenu(Menu menu) { 167 | // Inflate the menu items for use in the action bar 168 | MenuInflater inflater = getMenuInflater(); 169 | inflater.inflate(R.menu.action_bar, menu); 170 | return super.onCreateOptionsMenu(menu); 171 | } 172 | 173 | @Override 174 | public boolean onOptionsItemSelected(MenuItem item) { 175 | if (item != null) { 176 | // example 1: 177 | switch (item.getItemId()) { 178 | case R.id.github_link: 179 | openGithub(); 180 | return true; 181 | } 182 | } 183 | return super.onOptionsItemSelected(item); 184 | } 185 | 186 | private void setLicenseBox() { 187 | 188 | StringBuilder sb = null; 189 | 190 | InputStream stream = null; 191 | BufferedReader br = null; 192 | try { 193 | String line; 194 | 195 | stream = getAssets().open("creative_commons.txt"); 196 | br = new BufferedReader(new InputStreamReader(stream, "UTF-8")); 197 | sb = new StringBuilder(); 198 | while ((line = br.readLine()) != null) { 199 | sb.append(line); 200 | } 201 | 202 | } catch (IOException e) { 203 | e.printStackTrace(); 204 | } finally { 205 | try { 206 | if (br != null) br.close(); 207 | } catch (IOException e) { 208 | Log.e(TAG, e.getLocalizedMessage()); 209 | } 210 | } 211 | 212 | if (sb != null) { // for some reason 213 | TextView license = (TextView) findViewById(R.id.license); 214 | license.setText(Html.fromHtml(sb.toString())); 215 | license.setMovementMethod(LinkMovementMethod.getInstance()); 216 | } 217 | } 218 | } 219 | -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/drawable-hdpi/fill_bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/drawable-hdpi/fill_bottom.png -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/drawable-hdpi/fill_center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/drawable-hdpi/fill_center.png -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/drawable-hdpi/fill_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/drawable-hdpi/fill_left.png -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/drawable-hdpi/fill_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/drawable-hdpi/fill_right.png -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/drawable-hdpi/fill_top: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/drawable-hdpi/fill_top -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/drawable-hdpi/github_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/drawable-hdpi/github_circle.png -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/drawable-hdpi/height_center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/drawable-hdpi/height_center.png -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/drawable-hdpi/height_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/drawable-hdpi/height_left.png -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/drawable-hdpi/height_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/drawable-hdpi/height_right.png -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/drawable-hdpi/width_bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/drawable-hdpi/width_bottom.png -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/drawable-hdpi/width_center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/drawable-hdpi/width_center.png -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/drawable-hdpi/width_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/drawable-hdpi/width_top.png -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/drawable/thin_border.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/layout/jcrop_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 21 | 26 | 27 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/layout/jcropitem_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 21 | 27 | 28 | 38 | 39 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/layout/main_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 26 | 27 | 35 | 36 | 41 | 42 | -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/layout/mainitem_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 21 | 29 | 30 | 40 | 41 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/menu/action_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/ccsa_4_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/ccsa_4_0.png -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/flat_11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/flat_11.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/flat_12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/flat_12.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/flat_13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/flat_13.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/flat_14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/flat_14.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/icon_11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/icon_11.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/icon_12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/icon_12.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/icon_13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/icon_13.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/icon_14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/icon_14.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/long_11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/long_11.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/long_12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/long_12.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/long_13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/long_13.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/long_14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/long_14.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/long_15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/long_15.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/square_11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/square_11.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/square_12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/square_12.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/square_13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/square_13.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/square_14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/square_14.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/square_15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/square_15.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/thin_11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/thin_11.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/thin_12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/thin_12.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/thin_13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/thin_13.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/thin_14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/thin_14.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/thin_15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/thin_15.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/wide_11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/wide_11.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/wide_12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/wide_12.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/wide_13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/wide_13.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/mipmap-hdpi/wide_14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omgnuts/JCropImageView/fda5dd5924b00c8c930d31edb0e7dd1ed1e3952d/project/mod_sample/src/main/res/mipmap-hdpi/wide_14.jpg -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | JCropImageView 5 | JCrop ImageView (%1$s) 6 | View it on Github 7 | 8 | 9 | -------------------------------------------------------------------------------- /project/mod_sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |