├── .gitattributes ├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── libraries │ ├── animated_vector_drawable_25_3_1.xml │ ├── appcompat_v7_25_3_1.xml │ ├── design_25_3_1.xml │ ├── hamcrest_core_1_3.xml │ ├── junit_4_12.xml │ ├── recyclerview_v7_25_3_1.xml │ ├── support_annotations_25_3_1.xml │ ├── support_compat_25_3_1.xml │ ├── support_core_ui_25_3_1.xml │ ├── support_core_utils_25_3_1.xml │ ├── support_fragment_25_3_1.xml │ ├── support_media_compat_25_3_1.xml │ ├── support_v4_25_3_1.xml │ ├── support_vector_drawable_25_3_1.xml │ └── transition_25_3_1.xml ├── markdown-navigator │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── workspace.xml ├── G_20170802_1141099.gif ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── yuvaraj │ │ └── jigsawpuzzle │ │ ├── adapter │ │ ├── AnimationUtils.java │ │ ├── PuzzleAdapter.java │ │ └── StorePreference.java │ │ ├── cutter │ │ ├── CurveDrawer.java │ │ ├── CutMap.java │ │ ├── HorizontalCurve.java │ │ ├── ImageCutter.java │ │ ├── PieceCurveSet.java │ │ ├── PuzzlePieceBorderFinder.java │ │ └── VerticalCurve.java │ │ ├── models │ │ ├── Pieces.java │ │ └── PuzzlePiece.java │ │ └── puzzle │ │ ├── Puzzle.java │ │ └── PuzzleActivity.java │ └── res │ ├── drawable-hdpi │ ├── ic_1.png │ ├── ic_2.png │ ├── ic_3.png │ ├── ic_4.png │ ├── ic_5.png │ ├── ic_6.png │ ├── ic_7.png │ ├── ic_8.png │ └── ic_9.png │ ├── drawable-mdpi │ ├── ic_1.png │ ├── ic_2.png │ ├── ic_3.png │ ├── ic_4.png │ ├── ic_5.png │ ├── ic_6.png │ ├── ic_7.png │ ├── ic_8.png │ └── ic_9.png │ ├── drawable-xhdpi │ ├── ic_1.png │ ├── ic_2.png │ ├── ic_3.png │ ├── ic_4.png │ ├── ic_5.png │ ├── ic_6.png │ ├── ic_7.png │ ├── ic_8.png │ └── ic_9.png │ ├── drawable-xxhdpi │ ├── ic_1.png │ ├── ic_2.png │ ├── ic_3.png │ ├── ic_4.png │ ├── ic_5.png │ ├── ic_6.png │ ├── ic_7.png │ ├── ic_8.png │ └── ic_9.png │ ├── drawable-xxxhdpi │ ├── ic_1.png │ ├── ic_2.png │ ├── ic_3.png │ ├── ic_4.png │ ├── ic_5.png │ ├── ic_6.png │ ├── ic_7.png │ ├── ic_8.png │ └── ic_9.png │ ├── drawable │ ├── image.jpg │ ├── images1.png │ ├── jig.jpg │ ├── puzzle_border.xml │ ├── rsz_1jig.jpg │ ├── rsz_2jig.jpg │ ├── rsz_mano.jpg │ ├── sampleimage.png │ ├── test_image.jpg │ └── transparent_img.png │ ├── layout │ ├── puzzle_activity.xml │ └── puzzle_item.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ └── ic_launcher.png │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | 38 | # Keystore files 39 | *.jks 40 | 41 | # ========================= 42 | # Operating System Files 43 | # ========================= 44 | 45 | # OSX 46 | # ========================= 47 | 48 | .DS_Store 49 | .AppleDouble 50 | .LSOverride 51 | 52 | # Thumbnails 53 | ._* 54 | 55 | # Files that might appear in the root of a volume 56 | .DocumentRevisions-V100 57 | .fseventsd 58 | .Spotlight-V100 59 | .TemporaryItems 60 | .Trashes 61 | .VolumeIcon.icns 62 | 63 | # Directories potentially created on remote AFP share 64 | .AppleDB 65 | .AppleDesktop 66 | Network Trash Folder 67 | Temporary Items 68 | .apdisk 69 | 70 | # Windows 71 | # ========================= 72 | 73 | # Windows image file caches 74 | Thumbs.db 75 | ehthumbs.db 76 | 77 | # Folder config file 78 | Desktop.ini 79 | 80 | # Recycle Bin used on file shares 81 | $RECYCLE.BIN/ 82 | 83 | # Windows Installer files 84 | *.cab 85 | *.msi 86 | *.msm 87 | *.msp 88 | 89 | # Windows shortcuts 90 | *.lnk 91 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/libraries/animated_vector_drawable_25_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/appcompat_v7_25_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/design_25_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/recyclerview_v7_25_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/support_annotations_25_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/support_compat_25_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/support_core_ui_25_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/support_core_utils_25_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/support_fragment_25_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/support_media_compat_25_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/support_v4_25_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/support_vector_drawable_25_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/transition_25_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/markdown-navigator/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 36 | 37 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 85 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 112 | 113 | C:\Users\CIPL0349\AppData\Roaming\Subversion 114 | 115 | 116 | 117 | 118 | 119 | 1.8 120 | 121 | 126 | 127 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /G_20170802_1141099.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/G_20170802_1141099.gif -------------------------------------------------------------------------------- /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 {2016} {K Yuvaraj Kumar Yadav} 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JigSawPuzzle2-Android 2 | 3 | ![Alt Text](https://github.com/yuvaraj119/JigSawPuzzle2-Android/blob/master/G_20170802_1141099.gif) 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion '25.0.3' 6 | 7 | defaultConfig { 8 | applicationId "com.yuvaraj.jigsawpuzzle" 9 | minSdkVersion 14 10 | targetSdkVersion 25 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile 'com.android.support:appcompat-v7:25.3.1' 25 | compile 'com.android.support:recyclerview-v7:25.3.1' 26 | compile 'com.android.support:design:25.3.1' 27 | testCompile 'junit:junit:4.12' 28 | } 29 | -------------------------------------------------------------------------------- /app/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 /Programming/android_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 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/yuvaraj/jigsawpuzzle/adapter/AnimationUtils.java: -------------------------------------------------------------------------------- 1 | package com.yuvaraj.jigsawpuzzle.adapter; 2 | 3 | import android.animation.ObjectAnimator; 4 | import android.animation.PropertyValuesHolder; 5 | import android.support.v7.widget.RecyclerView; 6 | 7 | 8 | public class AnimationUtils { 9 | private static int counter = 0; 10 | 11 | public static void scaleXY(RecyclerView.ViewHolder holder) { 12 | holder.itemView.setScaleX(0); 13 | holder.itemView.setScaleY(0); 14 | 15 | PropertyValuesHolder propx = PropertyValuesHolder.ofFloat("scaleX", 1); 16 | PropertyValuesHolder propy = PropertyValuesHolder.ofFloat("scaleY", 1); 17 | 18 | ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(holder.itemView, propx, propy); 19 | 20 | 21 | animator.setDuration(800); 22 | animator.start(); 23 | } 24 | 25 | public static void scaleX(RecyclerView.ViewHolder holder) { 26 | holder.itemView.setScaleX(0); 27 | 28 | PropertyValuesHolder propx = PropertyValuesHolder.ofFloat("scaleX", 1); 29 | 30 | ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(holder.itemView, propx); 31 | 32 | 33 | animator.setDuration(800); 34 | animator.start(); 35 | } 36 | 37 | public static void scaleY(RecyclerView.ViewHolder holder) { 38 | holder.itemView.setScaleY(0); 39 | 40 | PropertyValuesHolder propy = PropertyValuesHolder.ofFloat("scaleY", 1); 41 | 42 | ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(holder.itemView, propy); 43 | 44 | animator.setDuration(800); 45 | animator.start(); 46 | } 47 | 48 | public static void animate(RecyclerView.ViewHolder holder, boolean goesDown) { 49 | ObjectAnimator animatorTranslateY = ObjectAnimator.ofFloat(holder.itemView, "translationY", goesDown == true ? 300 : -300, 0); 50 | animatorTranslateY.setDuration(1000); 51 | animatorTranslateY.start(); 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/yuvaraj/jigsawpuzzle/adapter/PuzzleAdapter.java: -------------------------------------------------------------------------------- 1 | package com.yuvaraj.jigsawpuzzle.adapter; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.content.Context; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.ImageView; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | import com.yuvaraj.jigsawpuzzle.R; 15 | import com.yuvaraj.jigsawpuzzle.models.Pieces; 16 | import com.yuvaraj.jigsawpuzzle.puzzle.PuzzleActivity; 17 | 18 | 19 | public class PuzzleAdapter extends RecyclerView.Adapter { 20 | 21 | int mPreviousPosition=0; 22 | Context context; 23 | List piecesModelList = new ArrayList(); 24 | 25 | public PuzzleAdapter(Context mContext, List piecesModelList) { 26 | this.context = mContext; 27 | this.piecesModelList = piecesModelList; 28 | } 29 | 30 | @Override 31 | public DateViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 32 | 33 | View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.puzzle_item, 34 | parent, false); 35 | return new DateViewHolder(view); 36 | } 37 | 38 | @SuppressLint("NewApi") 39 | @Override 40 | public void onBindViewHolder( DateViewHolder holder, int position) { 41 | holder.imageView.setImageBitmap(piecesModelList.get(position).getOriginalResource()); 42 | holder.imageView.setTag("" + piecesModelList.get(position).getpX() + "," + piecesModelList.get(position).getpY()); 43 | holder.imageView.setOnLongClickListener(new PuzzleActivity.MyClickListener()); 44 | animationmethod(holder,position); 45 | } 46 | 47 | @Override 48 | public int getItemCount() { 49 | return piecesModelList.size(); 50 | } 51 | 52 | 53 | public class DateViewHolder extends RecyclerView.ViewHolder { 54 | final ImageView imageView; 55 | 56 | public DateViewHolder(View itemView) { 57 | super(itemView); 58 | imageView = (ImageView) itemView.findViewById(R.id.imageView); 59 | } 60 | } 61 | void animationmethod(DateViewHolder holder, int position) 62 | { 63 | if (position > mPreviousPosition) { 64 | 65 | 66 | AnimationUtils.animate(holder,true); 67 | } else { 68 | 69 | AnimationUtils.animate(holder, false); 70 | } 71 | mPreviousPosition = position; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/java/com/yuvaraj/jigsawpuzzle/adapter/StorePreference.java: -------------------------------------------------------------------------------- 1 | package com.yuvaraj.jigsawpuzzle.adapter; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | 6 | /** 7 | * Created by Colan Infotech. 8 | */ 9 | 10 | public class StorePreference { 11 | private Context mContext; 12 | private SharedPreferences mSharedPreferences; 13 | private SharedPreferences.Editor mPreferenceEditor; 14 | 15 | public StorePreference(Context aContext) { 16 | mContext = aContext; 17 | mSharedPreferences = mContext.getSharedPreferences("JIGSAW", Context.MODE_PRIVATE); 18 | mPreferenceEditor = mSharedPreferences.edit(); 19 | } 20 | 21 | public StorePreference setString(String key, String value) { 22 | mPreferenceEditor.putString(key, value); 23 | mPreferenceEditor.commit(); 24 | return null; 25 | } 26 | 27 | public void setInt(String key, int value) { 28 | mPreferenceEditor.putInt(key, value); 29 | mPreferenceEditor.commit(); 30 | } 31 | 32 | public String getStringValue(String key) { 33 | String aName = ""; 34 | aName = mSharedPreferences.getString(key, null); 35 | return aName == null ? "" : aName; 36 | } 37 | 38 | public int getIntValue(String key) { 39 | return mSharedPreferences.getInt(key, -1); 40 | } 41 | 42 | public void setBoolean(String key, boolean value) { 43 | mPreferenceEditor.putBoolean(key, value); 44 | mPreferenceEditor.commit(); 45 | } 46 | 47 | public boolean getBooleanValue(String key) { 48 | return mSharedPreferences.getBoolean(key, false); 49 | } 50 | 51 | 52 | public void clearEditor(String name) { 53 | 54 | 55 | 56 | SharedPreferences sharedPrefs = mContext.getSharedPreferences(name, Context.MODE_PRIVATE); 57 | SharedPreferences.Editor editor = sharedPrefs.edit(); 58 | editor.clear(); 59 | editor.commit(); 60 | 61 | //Setting it for Remember me 62 | } 63 | 64 | } -------------------------------------------------------------------------------- /app/src/main/java/com/yuvaraj/jigsawpuzzle/cutter/CurveDrawer.java: -------------------------------------------------------------------------------- 1 | package com.yuvaraj.jigsawpuzzle.cutter; 2 | 3 | import android.graphics.Canvas; 4 | import android.graphics.Paint; 5 | import android.graphics.Path; 6 | import android.graphics.Point; 7 | 8 | public class CurveDrawer { 9 | 10 | private static final Point[] horizontalTabCoords = new Point[] { 11 | new Point(0, 0), new Point(35, 15), new Point(37, 5), 12 | new Point(40, 0), new Point(38, -5), new Point(20, -20), 13 | new Point(50, -20), new Point(80, -20), new Point(62, -5), 14 | new Point(60, 0), new Point(63, 5), new Point(65, 15), new Point(100, 0)}; 15 | private static final Point[] verticalTabCoords = new Point[] { 16 | new Point(0, 0), new Point(15, 35), new Point(5, 37), 17 | new Point(0, 40), new Point(-5, 38), new Point(-20, 20), 18 | new Point(-20, 50), new Point(-20, 80), new Point(-5, 62), 19 | new Point(0, 60), new Point(5, 63), new Point(15, 65), new Point(0, 100)}; 20 | 21 | public static void drawPuzzlePiece(Canvas canvas, PieceCurveSet pieceCurveSet, Point startPoint, 22 | int horizontalStep, int verticalStep, Paint paint) { 23 | float horizontalScale = horizontalStep / 100f; 24 | float verticalScale = verticalStep / 100f; 25 | drawHorizontalCurve(pieceCurveSet.top, canvas, startPoint, horizontalScale, verticalScale, paint); 26 | drawVerticalCurve(pieceCurveSet.left, canvas, startPoint, horizontalScale, verticalScale, paint); 27 | drawHorizontalCurve(pieceCurveSet.bottom, canvas, new Point(startPoint.x, startPoint.y + verticalStep), horizontalScale, verticalScale, paint); 28 | drawVerticalCurve(pieceCurveSet.right, canvas, new Point(startPoint.x + horizontalStep, startPoint.y), horizontalScale, verticalScale, paint); 29 | } 30 | 31 | public static void drawHorizontalCurve(HorizontalCurve curve, Canvas canvas, Point startPoint, 32 | float horizontalScale, float verticalScale, Paint paint) { 33 | if (curve == HorizontalCurve.NONE) { 34 | return; 35 | } 36 | int sign = curve == HorizontalCurve.TAB ? 1 : -1; 37 | Path path = new Path(); 38 | path.moveTo(startPoint.x, startPoint.y); 39 | for (int i = 0; i + 2 < horizontalTabCoords.length; i+=2) { 40 | path.cubicTo(startPoint.x + horizontalTabCoords[i].x * horizontalScale, startPoint.y + sign * horizontalTabCoords[i].y * verticalScale, 41 | startPoint.x + horizontalTabCoords[i+1].x * horizontalScale, startPoint.y + sign * horizontalTabCoords[i+1].y * verticalScale, 42 | startPoint.x + horizontalTabCoords[i+2].x * horizontalScale, startPoint.y + sign * horizontalTabCoords[i+2].y * verticalScale); 43 | } 44 | canvas.drawPath(path, paint); 45 | } 46 | 47 | public static void drawVerticalCurve(VerticalCurve curve, Canvas canvas, Point startPoint, 48 | float horizontalScale, float verticalScale, Paint paint) { 49 | if (curve == VerticalCurve.NONE) { 50 | return; 51 | } 52 | int sign = curve == VerticalCurve.TAB ? 1 : -1; 53 | Path path = new Path(); 54 | path.moveTo(startPoint.x, startPoint.y); 55 | for (int i = 0; i + 2 < verticalTabCoords.length; i+=2) { 56 | path.cubicTo(startPoint.x + sign * verticalTabCoords[i].x * horizontalScale, startPoint.y + verticalTabCoords[i].y * verticalScale, 57 | startPoint.x + sign * verticalTabCoords[i+1].x * horizontalScale, startPoint.y + verticalTabCoords[i+1].y * verticalScale, 58 | startPoint.x + sign * verticalTabCoords[i+2].x * horizontalScale, startPoint.y + verticalTabCoords[i+2].y * verticalScale); 59 | } 60 | canvas.drawPath(path, paint); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/yuvaraj/jigsawpuzzle/cutter/CutMap.java: -------------------------------------------------------------------------------- 1 | package com.yuvaraj.jigsawpuzzle.cutter; 2 | 3 | import java.util.Random; 4 | 5 | public class CutMap { 6 | 7 | private int horizontalResolution; 8 | private int verticalResolution; 9 | private final HorizontalCurve[][] horizontalCurveArray; 10 | private final VerticalCurve[][] verticalCurveArray; 11 | 12 | public CutMap(int horizontalResolution, int verticalResolution) { 13 | this.horizontalResolution = horizontalResolution; 14 | this.verticalResolution = verticalResolution; 15 | horizontalCurveArray = new HorizontalCurve[horizontalResolution][verticalResolution - 1]; 16 | verticalCurveArray = new VerticalCurve[horizontalResolution - 1][verticalResolution]; 17 | Random random = new Random(); 18 | 19 | for (int i = 0; i < horizontalResolution; i++) { 20 | for (int j = 0; j < verticalResolution - 1; j++) { 21 | horizontalCurveArray[i][j] = random.nextBoolean() ? HorizontalCurve.SLOT : HorizontalCurve.TAB; 22 | } 23 | } 24 | for (int i = 0; i < horizontalResolution - 1; i++) { 25 | for (int j = 0; j < verticalResolution; j++) { 26 | verticalCurveArray[i][j] = random.nextBoolean() ? VerticalCurve.SLOT : VerticalCurve.TAB; 27 | } 28 | } 29 | } 30 | 31 | public PieceCurveSet getCurveSetForPiece(int xIndex, int yIndex) { 32 | return new PieceCurveSet(yIndex == 0 ? HorizontalCurve.NONE : horizontalCurveArray[xIndex][yIndex - 1], 33 | xIndex == 0 ? VerticalCurve.NONE : verticalCurveArray[xIndex - 1][yIndex], 34 | xIndex == verticalResolution - 1 ? VerticalCurve.NONE : verticalCurveArray[xIndex][yIndex], 35 | yIndex == horizontalResolution - 1 ? HorizontalCurve.NONE : horizontalCurveArray[xIndex][yIndex]); 36 | } 37 | 38 | public HorizontalCurve[][] getHorizontalCurveArray() { 39 | return horizontalCurveArray; 40 | } 41 | 42 | public VerticalCurve[][] getVerticalCurveArray() { 43 | return verticalCurveArray; 44 | } 45 | 46 | public int getHorizontalResolution() { 47 | return horizontalResolution; 48 | } 49 | 50 | public int getVerticalResolution() { 51 | return verticalResolution; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/yuvaraj/jigsawpuzzle/cutter/HorizontalCurve.java: -------------------------------------------------------------------------------- 1 | package com.yuvaraj.jigsawpuzzle.cutter; 2 | 3 | public enum HorizontalCurve { 4 | NONE, 5 | /** 6 | * Curve head faced up 7 | */ 8 | TAB, 9 | /** 10 | * Curve head faced down 11 | */ 12 | SLOT 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/yuvaraj/jigsawpuzzle/cutter/ImageCutter.java: -------------------------------------------------------------------------------- 1 | package com.yuvaraj.jigsawpuzzle.cutter; 2 | 3 | import android.graphics.Bitmap; 4 | import android.graphics.Canvas; 5 | import android.graphics.Color; 6 | import android.graphics.Paint; 7 | import android.graphics.Point; 8 | import android.graphics.PorterDuff; 9 | import android.graphics.PorterDuffXfermode; 10 | import android.graphics.Rect; 11 | import android.os.Environment; 12 | import android.support.v7.app.AppCompatActivity; 13 | import android.util.Pair; 14 | 15 | import java.io.File; 16 | import java.io.FileOutputStream; 17 | import java.util.LinkedList; 18 | import java.util.Queue; 19 | 20 | import com.yuvaraj.jigsawpuzzle.models.PuzzlePiece; 21 | 22 | public class ImageCutter extends AppCompatActivity{ 23 | 24 | private Bitmap originalImage; 25 | private CutMap cutMap; 26 | private int horizontalStep; 27 | private int verticalStep; 28 | private float horizontalScale; 29 | private float verticalScale; 30 | private Paint cutterPaint; 31 | private String path; 32 | 33 | public ImageCutter(Bitmap originalImage, CutMap cutMap) { 34 | this.originalImage = originalImage; 35 | this.cutMap = cutMap; 36 | this.horizontalStep = originalImage.getWidth() / cutMap.getHorizontalResolution(); 37 | this.verticalStep = originalImage.getHeight() / cutMap.getVerticalResolution(); 38 | this.horizontalScale = horizontalStep / 100f; 39 | this.verticalScale = verticalStep / 100f; 40 | 41 | this.cutterPaint = new Paint(); 42 | cutterPaint.setColor(Color.RED); 43 | cutterPaint.setStrokeWidth(2); 44 | cutterPaint.setStyle(Paint.Style.STROKE); 45 | } 46 | 47 | public PuzzlePiece[][] cutImage() { 48 | PuzzlePiece[][] puzzlePieces = new PuzzlePiece[cutMap.getHorizontalResolution()][cutMap.getVerticalResolution()]; 49 | for (int i = 0; i < cutMap.getHorizontalResolution(); i++) { 50 | for (int j = 0; j < cutMap.getVerticalResolution(); j++) { 51 | PieceCurveSet pieceCurveSet = cutMap.getCurveSetForPiece(i, j); 52 | Bitmap pieceMask = drawSinglePuzzlePieceMask(i, j, pieceCurveSet); 53 | Bitmap maskedPiece = maskPuzzlePiece(pieceMask); 54 | Rect pieceBorder = PuzzlePieceBorderFinder.getBorders(pieceCurveSet, 55 | new Point(i * horizontalStep, j * verticalStep), horizontalStep, verticalStep); 56 | Pair pieceOffset = PuzzlePieceBorderFinder.getOffsets(pieceCurveSet, horizontalStep, verticalStep); 57 | Bitmap cuttedPiece = cutPuzzlePiece(maskedPiece, pieceBorder); 58 | 59 | saveSDcard(i,j,cuttedPiece); 60 | 61 | puzzlePieces[i][j] = new PuzzlePiece( 62 | cuttedPiece,path, 63 | new Point(i * horizontalStep + horizontalStep / 2, j * verticalStep + verticalStep/ 2), 64 | new Point(horizontalStep / 2 + pieceOffset.first, verticalStep/ 2 + pieceOffset.second), 65 | pieceCurveSet, 66 | pieceBorder.width(), 67 | pieceBorder.height()); 68 | } 69 | } 70 | return puzzlePieces; 71 | } 72 | 73 | private void saveSDcard(int i, int j, Bitmap cuttedPiece) 74 | { 75 | File file = new File(Environment.getExternalStorageDirectory().getPath() + "/puzzles/sav"+i+j+".png"); 76 | try { 77 | file.createNewFile(); 78 | FileOutputStream ostream = new FileOutputStream(file); 79 | cuttedPiece.compress(Bitmap.CompressFormat.PNG,0,ostream); 80 | ostream.close(); 81 | path=file.getAbsolutePath(); 82 | 83 | System.out.println("finalpath"+path); 84 | } catch (Exception e) { 85 | e.printStackTrace(); 86 | } 87 | } 88 | 89 | public Bitmap drawPuzzleCuttingOverlay(Paint paint) { 90 | Bitmap originalWithOverlay = Bitmap.createBitmap(originalImage.getWidth(), originalImage.getHeight(), Bitmap.Config.ARGB_8888); 91 | Canvas overlayCanvas = new Canvas(originalWithOverlay); 92 | Paint imagePaint = new Paint(); 93 | imagePaint.setColor(0x44000000); 94 | overlayCanvas.drawBitmap(originalImage, 0, 0, imagePaint); 95 | 96 | HorizontalCurve[][] horizontalCurves = cutMap.getHorizontalCurveArray(); 97 | for (int i = 0; i < cutMap.getHorizontalResolution(); i++) { 98 | for (int j = 1; j < cutMap.getVerticalResolution(); j++) { 99 | Point startPoint = new Point(i * horizontalStep, j * verticalStep); 100 | HorizontalCurve horizontalCurve = horizontalCurves[i][j - 1]; 101 | CurveDrawer.drawHorizontalCurve(horizontalCurve, overlayCanvas, startPoint, horizontalScale, verticalScale, paint); 102 | } 103 | } 104 | 105 | VerticalCurve[][] verticalCurves = cutMap.getVerticalCurveArray(); 106 | for (int i = 1; i < cutMap.getHorizontalResolution(); i++) { 107 | for (int j = 0; j < cutMap.getVerticalResolution(); j++) { 108 | Point startPoint = new Point(i * horizontalStep, j * verticalStep); 109 | VerticalCurve verticalCurve = verticalCurves[i - 1][j]; 110 | CurveDrawer.drawVerticalCurve(verticalCurve, overlayCanvas, startPoint, horizontalScale, verticalScale, paint); 111 | } 112 | } 113 | return originalWithOverlay; 114 | } 115 | 116 | public Bitmap drawSinglePuzzlePieceMask(int xIndex, int yIndex, PieceCurveSet pieceCurveSet) { 117 | Bitmap maskLayer = Bitmap.createBitmap(originalImage.getWidth(), originalImage.getHeight(), Bitmap.Config.ARGB_8888); 118 | Canvas canvas = new Canvas(maskLayer); 119 | Point startPoint = new Point(xIndex * horizontalStep, yIndex * verticalStep); 120 | int currentHorizontalStep = xIndex == cutMap.getHorizontalResolution() - 1 ? 121 | maskLayer.getWidth() - startPoint.x : 122 | horizontalStep; 123 | int currentVerticalStep = yIndex == cutMap.getVerticalResolution() - 1 ? 124 | maskLayer.getHeight() - startPoint.y : 125 | verticalStep; 126 | 127 | CurveDrawer.drawPuzzlePiece(canvas, pieceCurveSet, startPoint, currentHorizontalStep, currentVerticalStep, cutterPaint); 128 | floodFill(maskLayer, new Point(startPoint.x + horizontalStep / 2, startPoint.y + verticalStep / 2), Color.TRANSPARENT, Color.GREEN); 129 | if (xIndex == 0 && yIndex == 0) { 130 | floodFill(maskLayer, new Point(startPoint.x + horizontalStep, startPoint.y + verticalStep), Color.RED, Color.TRANSPARENT); 131 | } else { 132 | floodFill(maskLayer, startPoint, Color.RED, Color.TRANSPARENT); 133 | } 134 | return maskLayer; 135 | } 136 | 137 | private Bitmap maskPuzzlePiece(Bitmap mask) { 138 | Bitmap result = Bitmap.createBitmap(mask.getWidth(), mask.getHeight(), Bitmap.Config.ARGB_8888); 139 | Canvas mCanvas = new Canvas(result); 140 | Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); 141 | paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN)); 142 | mCanvas.drawBitmap(originalImage, 0, 0, null); 143 | mCanvas.drawBitmap(mask, 0, 0, paint); 144 | paint.setXfermode(null); 145 | return result; 146 | } 147 | 148 | private Bitmap cutPuzzlePiece(Bitmap original, Rect border) { 149 | return Bitmap.createBitmap(original, border.left, border.top, border.width(), border.height()); 150 | } 151 | 152 | private static void floodFill(Bitmap image, Point node, int targetColor, int replacementColor) { 153 | int width = image.getWidth(); 154 | int height = image.getHeight(); 155 | if (targetColor != replacementColor) { 156 | Queue queue = new LinkedList<>(); 157 | do { 158 | int x = node.x; 159 | int y = node.y; 160 | while (x > 0 && image.getPixel(x - 1, y) == targetColor) { 161 | x--; 162 | } 163 | boolean spanUp = false; 164 | boolean spanDown = false; 165 | while (x < width && image.getPixel(x, y) == targetColor) { 166 | image.setPixel(x, y, replacementColor); 167 | if (!spanUp && y > 0 && image.getPixel(x, y - 1) == targetColor) { 168 | queue.add(new Point(x, y - 1)); 169 | spanUp = true; 170 | } else if (spanUp && y > 0 171 | && image.getPixel(x, y - 1) != targetColor) { 172 | spanUp = false; 173 | } 174 | if (!spanDown && y < height - 1 175 | && image.getPixel(x, y + 1) == targetColor) { 176 | queue.add(new Point(x, y + 1)); 177 | spanDown = true; 178 | } else if (spanDown && y < height - 1 179 | && image.getPixel(x, y + 1) != targetColor) { 180 | spanDown = false; 181 | } 182 | x++; 183 | } 184 | } while ((node = queue.poll()) != null); 185 | } 186 | } 187 | } 188 | -------------------------------------------------------------------------------- /app/src/main/java/com/yuvaraj/jigsawpuzzle/cutter/PieceCurveSet.java: -------------------------------------------------------------------------------- 1 | package com.yuvaraj.jigsawpuzzle.cutter; 2 | 3 | public class PieceCurveSet { 4 | 5 | public final HorizontalCurve top; 6 | public final VerticalCurve left; 7 | public final VerticalCurve right; 8 | public final HorizontalCurve bottom; 9 | 10 | public PieceCurveSet(HorizontalCurve top, VerticalCurve left, VerticalCurve right, HorizontalCurve bottom) { 11 | this.top = top; 12 | this.left = left; 13 | this.right = right; 14 | this.bottom = bottom; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/yuvaraj/jigsawpuzzle/cutter/PuzzlePieceBorderFinder.java: -------------------------------------------------------------------------------- 1 | package com.yuvaraj.jigsawpuzzle.cutter; 2 | 3 | import android.graphics.Point; 4 | import android.graphics.Rect; 5 | import android.util.Pair; 6 | 7 | public class PuzzlePieceBorderFinder { 8 | 9 | public static Rect getBorders(PieceCurveSet pieceCurveSet, Point startPoint, int horizontalStep, int verticalStep) { 10 | return new Rect(leftmostPointForCurve(pieceCurveSet.left, startPoint, horizontalStep), 11 | topmostPointForCurve(pieceCurveSet.top, startPoint, verticalStep), 12 | rightmostPointForCurve(pieceCurveSet.right, startPoint, horizontalStep), 13 | bottommostPointForCurve(pieceCurveSet.bottom, startPoint, verticalStep)); 14 | } 15 | 16 | public static Pair getOffsets(PieceCurveSet curveSet, int horizontalStep, int verticalStep) { 17 | return new Pair<>(getLeftOffset(curveSet.left, horizontalStep), getTopOffset(curveSet.top, verticalStep)); 18 | } 19 | 20 | 21 | private static int topmostPointForCurve(HorizontalCurve curve, Point startPoint, int verticalStep) { 22 | if (curve == HorizontalCurve.NONE) { 23 | return startPoint.y; 24 | } 25 | int scale = verticalStep / 100; 26 | if (curve == HorizontalCurve.TAB) { 27 | return startPoint.y - 30 * scale; 28 | } else { 29 | return startPoint.y - 15 * scale; 30 | } 31 | } 32 | 33 | private static int bottommostPointForCurve(HorizontalCurve curve, Point startPoint, int verticalStep) { 34 | if (curve == HorizontalCurve.NONE) { 35 | return startPoint.y + verticalStep; 36 | } 37 | int scale = verticalStep / 100; 38 | if (curve == HorizontalCurve.TAB) { 39 | return startPoint.y + verticalStep + 15 * scale; 40 | } else { 41 | return startPoint.y + verticalStep + 30 * scale; 42 | } 43 | } 44 | 45 | private static int leftmostPointForCurve(VerticalCurve curve, Point startPoint, int horizontalStep) { 46 | if (curve == VerticalCurve.NONE) { 47 | return startPoint.x; 48 | } 49 | int scale = horizontalStep / 100; 50 | if (curve == VerticalCurve.TAB) { 51 | return startPoint.x - 30 * scale; 52 | } else { 53 | return startPoint.x - 15 * scale; 54 | } 55 | } 56 | 57 | private static int rightmostPointForCurve(VerticalCurve curve, Point startPoint, int horizontalStep) { 58 | if (curve == VerticalCurve.NONE) { 59 | return startPoint.x + horizontalStep; 60 | } 61 | int scale = horizontalStep / 100; 62 | if (curve == VerticalCurve.TAB) { 63 | return startPoint.x + horizontalStep + 15 * scale; 64 | } else { 65 | return startPoint.x + horizontalStep + 30 * scale; 66 | } 67 | } 68 | 69 | private static int getLeftOffset(VerticalCurve curve, int horizontalStep) { 70 | if (curve == VerticalCurve.NONE) { 71 | return 0; 72 | } 73 | int scale = horizontalStep / 100; 74 | if (curve == VerticalCurve.TAB) { 75 | return 30 * scale; 76 | } else { 77 | return 15 * scale; 78 | } 79 | } 80 | 81 | private static int getTopOffset(HorizontalCurve curve, int verticalStep) { 82 | if (curve == HorizontalCurve.NONE) { 83 | return 0; 84 | } 85 | int scale = verticalStep / 100; 86 | if (curve == HorizontalCurve.TAB) { 87 | return 30 * scale; 88 | } else { 89 | return 15 * scale; 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /app/src/main/java/com/yuvaraj/jigsawpuzzle/cutter/VerticalCurve.java: -------------------------------------------------------------------------------- 1 | package com.yuvaraj.jigsawpuzzle.cutter; 2 | 3 | /** 4 | * @author Vladimir Shevchenko vladimir@pantrylabs.com 05/04/16. 5 | */ 6 | public enum VerticalCurve { 7 | NONE, 8 | /** 9 | * Curve head faced left 10 | */ 11 | TAB, 12 | /** 13 | * Curve head faced right 14 | */ 15 | SLOT 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/yuvaraj/jigsawpuzzle/models/Pieces.java: -------------------------------------------------------------------------------- 1 | package com.yuvaraj.jigsawpuzzle.models; 2 | 3 | import android.graphics.Bitmap; 4 | 5 | /** 6 | * Created by Yuvaraj on 9/5/2016. 7 | */ 8 | public class Pieces { 9 | 10 | private int pX = 0; 11 | private int pY = 0; 12 | private Bitmap originalResource; 13 | private int position = 0; 14 | 15 | public int getpX() { 16 | return pX; 17 | } 18 | 19 | public void setpX(int pX) { 20 | this.pX = pX; 21 | } 22 | 23 | public int getpY() { 24 | return pY; 25 | } 26 | 27 | public void setpY(int pY) { 28 | this.pY = pY; 29 | } 30 | 31 | public Bitmap getOriginalResource() { 32 | return originalResource; 33 | } 34 | 35 | public void setOriginalResource( Bitmap originalResource) { 36 | this.originalResource = originalResource; 37 | } 38 | 39 | public int getPosition() { 40 | return position; 41 | } 42 | 43 | public void setPosition(int position) { 44 | this.position = position; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/yuvaraj/jigsawpuzzle/models/PuzzlePiece.java: -------------------------------------------------------------------------------- 1 | package com.yuvaraj.jigsawpuzzle.models; 2 | 3 | import android.graphics.Bitmap; 4 | import android.graphics.Point; 5 | 6 | import com.yuvaraj.jigsawpuzzle.cutter.PieceCurveSet; 7 | 8 | public class PuzzlePiece { 9 | 10 | private Bitmap image; 11 | private Point anchorPoint; 12 | private Point centerPoint; 13 | private PieceCurveSet pieceCurveSet; 14 | private int width; 15 | private int height; 16 | private String path; 17 | 18 | public PuzzlePiece(Bitmap image, String path, Point anchorPoint, Point centerPoint, PieceCurveSet pieceCurveSet, int width, int height) { 19 | this.image = image; 20 | this.anchorPoint = anchorPoint; 21 | this.centerPoint = centerPoint; 22 | this.pieceCurveSet = pieceCurveSet; 23 | this.width = width; 24 | this.height = height; 25 | this.path=path; 26 | } 27 | 28 | public PuzzlePiece(String path, Point anchorPoint, Point centerPoint, PieceCurveSet pieceCurveSet, int width, int height) { 29 | this.anchorPoint = anchorPoint; 30 | this.centerPoint = centerPoint; 31 | this.pieceCurveSet = pieceCurveSet; 32 | this.width = width; 33 | this.height = height; 34 | this.path=path; 35 | } 36 | 37 | public String getPath() { 38 | return path; 39 | } 40 | 41 | public void setPath(String path) { 42 | this.path = path; 43 | } 44 | 45 | public Bitmap getImage() { 46 | return image; 47 | } 48 | 49 | public Point getAnchorPoint() { 50 | return anchorPoint; 51 | } 52 | 53 | public Point getCenterPoint() { 54 | return centerPoint; 55 | } 56 | 57 | public PieceCurveSet getPieceCurveSet() { 58 | return pieceCurveSet; 59 | } 60 | 61 | public int getWidth() { 62 | return width; 63 | } 64 | 65 | public int getHeight() { 66 | return height; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/java/com/yuvaraj/jigsawpuzzle/puzzle/Puzzle.java: -------------------------------------------------------------------------------- 1 | package com.yuvaraj.jigsawpuzzle.puzzle; 2 | 3 | import android.app.Activity; 4 | import android.graphics.Bitmap; 5 | import android.graphics.BitmapFactory; 6 | import android.os.Environment; 7 | import android.widget.ImageView; 8 | 9 | import java.io.File; 10 | import java.util.ArrayList; 11 | 12 | 13 | import com.yuvaraj.jigsawpuzzle.R; 14 | import com.yuvaraj.jigsawpuzzle.cutter.CutMap; 15 | import com.yuvaraj.jigsawpuzzle.cutter.ImageCutter; 16 | import com.yuvaraj.jigsawpuzzle.models.PuzzlePiece; 17 | 18 | /** 19 | * Created by Yuvaraj. 20 | */ 21 | 22 | public class Puzzle { 23 | 24 | Activity mActivity; 25 | public Bitmap mSourceImage = null; 26 | ArrayList puzzlePieceArrayList; 27 | 28 | 29 | public ArrayList createPuzzlePieces(Activity aActivity, Bitmap aBitmap, int width, int height, 30 | ImageView imageView, String path, int horizontalResolution, int verticalResolution) { 31 | this.mActivity = aActivity; 32 | this.puzzlePieceArrayList = new ArrayList<>(); 33 | getDisplaySize(aBitmap, width, height, imageView); 34 | deleteDirectories(path); 35 | CutMap cutMap = new CutMap(horizontalResolution, verticalResolution); 36 | ImageCutter imageCutter = new ImageCutter(mSourceImage, cutMap); 37 | drawOrderedPuzzlePieces(imageCutter, cutMap); 38 | mSourceImage = null; 39 | return puzzlePieceArrayList; 40 | } 41 | 42 | private void getDisplaySize(Bitmap bitmap, int widthFinal, int heightFinal, final ImageView imageView) { 43 | Bitmap image = null; 44 | try { 45 | image = BitmapFactory.decodeResource(mActivity.getResources(), R.drawable.jig); 46 | mSourceImage = Bitmap.createScaledBitmap(image, widthFinal, heightFinal, false); 47 | } catch (OutOfMemoryError ex) { 48 | ex.printStackTrace(); 49 | } finally { 50 | image = null; 51 | } 52 | mActivity.runOnUiThread(new Runnable() { 53 | @Override 54 | public void run() { 55 | imageView.setImageBitmap(mSourceImage); 56 | } 57 | }); 58 | 59 | } 60 | 61 | private void deleteDirectories(String aPath) { 62 | File dir = new File(Environment.getExternalStorageDirectory().toString() + aPath); 63 | if (dir.exists() && dir.isDirectory()) { 64 | dir.delete(); 65 | dir.mkdir(); 66 | } else { 67 | dir.mkdir(); 68 | } 69 | } 70 | 71 | private void drawOrderedPuzzlePieces(ImageCutter imageCutter, CutMap cutMap) { 72 | PuzzlePiece[][] puzzlePieces = imageCutter.cutImage(); 73 | for (int i = 0; i < cutMap.getHorizontalResolution(); i++) { 74 | for (int j = 0; j < cutMap.getVerticalResolution(); j++) { 75 | PuzzlePiece piece = puzzlePieces[i][j]; 76 | puzzlePieceArrayList.add(piece); 77 | } 78 | } 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/com/yuvaraj/jigsawpuzzle/puzzle/PuzzleActivity.java: -------------------------------------------------------------------------------- 1 | package com.yuvaraj.jigsawpuzzle.puzzle; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.ClipData; 5 | import android.content.ClipDescription; 6 | import android.content.Context; 7 | import android.graphics.Bitmap; 8 | import android.graphics.BitmapFactory; 9 | import android.os.Build; 10 | import android.os.Bundle; 11 | import android.support.annotation.Nullable; 12 | import android.support.v7.app.AppCompatActivity; 13 | import android.support.v7.widget.LinearLayoutManager; 14 | import android.support.v7.widget.RecyclerView; 15 | import android.util.Base64; 16 | import android.view.DragEvent; 17 | import android.view.View; 18 | import android.view.ViewGroup; 19 | import android.view.ViewTreeObserver; 20 | import android.widget.FrameLayout; 21 | import android.widget.ImageView; 22 | 23 | import android.widget.RelativeLayout; 24 | import android.widget.Toast; 25 | 26 | import java.util.ArrayList; 27 | import java.util.Collections; 28 | import java.util.HashMap; 29 | import java.util.List; 30 | import java.util.concurrent.atomic.AtomicInteger; 31 | 32 | import com.yuvaraj.jigsawpuzzle.R; 33 | import com.yuvaraj.jigsawpuzzle.adapter.PuzzleAdapter; 34 | 35 | import com.yuvaraj.jigsawpuzzle.models.Pieces; 36 | import com.yuvaraj.jigsawpuzzle.models.PuzzlePiece; 37 | 38 | /** 39 | * Created by Yuvaraj on 9/5/2016. 40 | */ 41 | public class PuzzleActivity extends AppCompatActivity { 42 | RelativeLayout relativeLayout; 43 | FrameLayout scrollView; 44 | ImageView imageView; 45 | Context context; 46 | List piecesModelListMain = new ArrayList(); 47 | HashMap piecesModelHashMap = new HashMap(); 48 | int countGrid = 0; 49 | ArrayList puzzlePiecesList = new ArrayList(); 50 | private RecyclerView rvPuzzle; 51 | private RecyclerView.LayoutManager linearLayoutManager; 52 | private PuzzleAdapter puzzleListAdapter; 53 | Puzzle puzzle; 54 | 55 | boolean widthCheck = true; 56 | int widthFinal; 57 | int heightFinal; 58 | 59 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN) 60 | @Override 61 | protected void onCreate(@Nullable Bundle savedInstanceState) { 62 | super.onCreate(savedInstanceState); 63 | setContentView(R.layout.puzzle_activity); 64 | 65 | context = this; 66 | imageView = (ImageView) findViewById(R.id.frameImage); 67 | scrollView = (FrameLayout) findViewById(R.id.scrollView); 68 | scrollView.setOnDragListener(new MyDragListener(null)); 69 | relativeLayout = (RelativeLayout) findViewById(R.id.relativeLayout); 70 | relativeLayout.setOnDragListener(new MyDragListener(null)); 71 | rvPuzzle = (RecyclerView) findViewById(R.id.listView2); 72 | rvPuzzle.setOnDragListener(new MyDragListener(null)); 73 | linearLayoutManager = new LinearLayoutManager(getApplicationContext()); 74 | rvPuzzle.setLayoutManager(linearLayoutManager); 75 | puzzle = new Puzzle(); 76 | puzzlePiecesList.clear(); 77 | 78 | final ViewTreeObserver obs = scrollView.getViewTreeObserver(); 79 | obs.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { 80 | @Override 81 | public void onGlobalLayout() {//width=lGrid.getWidth(); 82 | if (widthCheck) { 83 | widthFinal = scrollView.getWidth(); 84 | heightFinal = scrollView.getHeight(); 85 | puzzlePiecesList = puzzle.createPuzzlePieces(PuzzleActivity.this, null, widthFinal, heightFinal, imageView, "/puzzles/", 3, 3); 86 | getAdapter(); 87 | widthCheck = false; 88 | } 89 | } 90 | }); 91 | 92 | setPuzzleListAdapter(); 93 | } 94 | 95 | public void getAdapter() { 96 | RelativeLayout.LayoutParams params; 97 | for (int i = 0; i < 3; i++) { 98 | for (int j = 0; j < 3; j++) { 99 | PuzzlePiece piece = puzzlePiecesList.get(countGrid); 100 | params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, 101 | RelativeLayout.LayoutParams.WRAP_CONTENT); 102 | 103 | int dimX = piece.getAnchorPoint().x - piece.getCenterPoint().x; 104 | int dimY = piece.getAnchorPoint().y - piece.getCenterPoint().y; 105 | 106 | params.setMargins(dimX, dimY, 0, 0); 107 | final ImageView button2 = new ImageView(this); 108 | button2.setId(generateViewId()); 109 | button2.setTag(i + "," + j); 110 | 111 | button2.setImageResource(R.drawable.ic_1); 112 | 113 | button2.setOnDragListener(new MyDragListener(button2)); 114 | button2.setLayoutParams(params); 115 | relativeLayout.addView(button2); 116 | 117 | Pieces piecesModel = new Pieces(); 118 | piecesModel.setpX(i); 119 | piecesModel.setpY(j); 120 | piecesModel.setPosition(countGrid); 121 | piecesModel.setOriginalResource(puzzlePiecesList.get(countGrid).getImage()); 122 | piecesModelListMain.add(piecesModel); 123 | Collections.shuffle(piecesModelListMain); 124 | piecesModelHashMap.put(i + "," + j, piecesModel); 125 | piecesModel = null; 126 | 127 | countGrid++; 128 | 129 | } 130 | } 131 | } 132 | 133 | 134 | public int generateViewId() { 135 | final AtomicInteger sNextGeneratedId = new AtomicInteger(1); 136 | for (; ; ) { 137 | final int result = sNextGeneratedId.get(); 138 | // aapt-generated IDs have the high byte nonzero; clamp to the range under that. 139 | int newValue = result + 1; 140 | if (newValue > 0x00FFFFFF) newValue = 1; // Roll over to 1, not 0. 141 | if (sNextGeneratedId.compareAndSet(result, newValue)) { 142 | return result; 143 | } 144 | } 145 | } 146 | 147 | public void setPuzzleListAdapter() { 148 | if (puzzleListAdapter != null) 149 | puzzleListAdapter = null; 150 | 151 | puzzleListAdapter = new PuzzleAdapter(this, piecesModelListMain); 152 | rvPuzzle.setHasFixedSize(true); 153 | rvPuzzle.setAdapter(puzzleListAdapter); 154 | 155 | puzzleListAdapter.notifyDataSetChanged(); 156 | } 157 | 158 | @Override 159 | protected void onResume() { 160 | super.onResume(); 161 | 162 | 163 | } 164 | 165 | @Override 166 | public void onBackPressed() { 167 | super.onBackPressed(); 168 | 169 | } 170 | 171 | static public class MyClickListener implements View.OnLongClickListener { 172 | 173 | // called when the item is long-clicked 174 | @Override 175 | public boolean onLongClick(View view) { 176 | // TODO Auto-generated method stub 177 | 178 | // create it from the object's tag 179 | ClipData.Item item = new ClipData.Item((CharSequence) view.getTag()); 180 | 181 | String[] mimeTypes = {ClipDescription.MIMETYPE_TEXT_PLAIN}; 182 | ClipData data = new ClipData(view.getTag().toString(), mimeTypes, item); 183 | View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view); 184 | 185 | view.startDrag(data, //data to be dragged 186 | shadowBuilder, //drag shadow 187 | view, //local data about the drag and drop operation 188 | 0 //no needed flags 189 | ); 190 | 191 | view.setVisibility(View.INVISIBLE); 192 | return true; 193 | } 194 | } 195 | 196 | public class MyDragListener implements View.OnDragListener { 197 | 198 | final ImageView imageView; 199 | 200 | public MyDragListener(final ImageView imageView) { 201 | this.imageView = imageView; 202 | } 203 | 204 | 205 | @Override 206 | public boolean onDrag(View v, DragEvent event) { 207 | 208 | // Handles each of the expected events 209 | switch (event.getAction()) { 210 | 211 | //signal for the start of a drag and drop operation. 212 | case DragEvent.ACTION_DRAG_STARTED: 213 | // do nothing 214 | break; 215 | 216 | //the drag point has entered the bounding box of the View 217 | case DragEvent.ACTION_DRAG_ENTERED: 218 | //v.setBackgroundResource(R.drawable.target_shape); //change the shape of the view 219 | break; 220 | 221 | //the user has moved the drag shadow outside the bounding box of the View 222 | case DragEvent.ACTION_DRAG_EXITED: 223 | //v.setBackgroundResource(R.drawable.normal_shape); //change the shape of the view back to normal 224 | break; 225 | 226 | //drag shadow has been released,the drag point is within the bounding box of the View 227 | case DragEvent.ACTION_DROP: 228 | //v is the dynamic grid imageView, we accept the drag item 229 | //view is listView imageView the dragged item 230 | if (v == imageView) { 231 | View view = (View) event.getLocalState(); 232 | 233 | ViewGroup owner = (ViewGroup) v.getParent(); 234 | if (owner == relativeLayout) { 235 | String selectedViewTag = view.getTag().toString(); 236 | 237 | Pieces piecesModel = piecesModelHashMap.get(v.getTag().toString()); 238 | String xy = piecesModel.getpX() + "," + piecesModel.getpY(); 239 | 240 | if (xy.equals(selectedViewTag)) { 241 | ImageView imageView = (ImageView) v; 242 | imageView.setImageBitmap(piecesModel.getOriginalResource()); 243 | piecesModelListMain.remove(piecesModel); 244 | setPuzzleListAdapter(); 245 | piecesModel = null; 246 | if (piecesModelListMain.size() == 0) { 247 | Toast.makeText(getApplicationContext(), "GAME OVER", Toast.LENGTH_LONG).show(); 248 | } else { 249 | Toast.makeText(getApplicationContext(), "The correct Puzzle", Toast.LENGTH_LONG).show(); 250 | } 251 | } else { 252 | piecesModel = null; 253 | view.setVisibility(View.VISIBLE); 254 | Toast.makeText(getApplicationContext(), "Not the correct Puzzle", Toast.LENGTH_LONG).show(); 255 | break; 256 | } 257 | } else { 258 | View view1 = (View) event.getLocalState(); 259 | view1.setVisibility(View.VISIBLE); 260 | Toast.makeText(getApplicationContext(), "You can't drop the image here", Toast.LENGTH_LONG).show(); 261 | break; 262 | } 263 | } else if (v == scrollView) { 264 | View view1 = (View) event.getLocalState(); 265 | view1.setVisibility(View.VISIBLE); 266 | Toast.makeText(getApplicationContext(), "You can't drop the image here", Toast.LENGTH_LONG).show(); 267 | break; 268 | } else if (v == rvPuzzle) { 269 | View view1 = (View) event.getLocalState(); 270 | view1.setVisibility(View.VISIBLE); 271 | Toast.makeText(getApplicationContext(), "You can't drop the image here", Toast.LENGTH_LONG).show(); 272 | break; 273 | } else { 274 | View view = (View) event.getLocalState(); 275 | view.setVisibility(View.VISIBLE); 276 | Toast.makeText(getApplicationContext(), "You can't drop the image here", Toast.LENGTH_LONG).show(); 277 | break; 278 | } 279 | break; 280 | //the drag and drop operation has concluded. 281 | case DragEvent.ACTION_DRAG_ENDED: 282 | //v.setBackgroundResource(R.drawable.normal_shape); //go back to normal shape 283 | default: 284 | break; 285 | } 286 | return true; 287 | } 288 | } 289 | } 290 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-hdpi/ic_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-hdpi/ic_2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-hdpi/ic_3.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-hdpi/ic_4.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-hdpi/ic_5.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-hdpi/ic_6.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-hdpi/ic_7.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-hdpi/ic_8.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-hdpi/ic_9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-mdpi/ic_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-mdpi/ic_2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-mdpi/ic_3.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-mdpi/ic_4.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-mdpi/ic_5.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-mdpi/ic_6.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-mdpi/ic_7.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-mdpi/ic_8.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-mdpi/ic_9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xhdpi/ic_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xhdpi/ic_2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xhdpi/ic_3.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xhdpi/ic_4.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xhdpi/ic_5.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xhdpi/ic_6.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xhdpi/ic_7.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xhdpi/ic_8.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xhdpi/ic_9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xxhdpi/ic_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xxhdpi/ic_2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xxhdpi/ic_3.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xxhdpi/ic_4.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xxhdpi/ic_5.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xxhdpi/ic_6.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xxhdpi/ic_7.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xxhdpi/ic_8.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xxhdpi/ic_9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xxxhdpi/ic_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xxxhdpi/ic_2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xxxhdpi/ic_3.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xxxhdpi/ic_4.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xxxhdpi/ic_5.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xxxhdpi/ic_6.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xxxhdpi/ic_7.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xxxhdpi/ic_8.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable-xxxhdpi/ic_9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable/image.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/images1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable/images1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/jig.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable/jig.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/puzzle_border.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/rsz_1jig.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable/rsz_1jig.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/rsz_2jig.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable/rsz_2jig.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/rsz_mano.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable/rsz_mano.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/sampleimage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable/sampleimage.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/test_image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable/test_image.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/transparent_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/drawable/transparent_img.png -------------------------------------------------------------------------------- /app/src/main/res/layout/puzzle_activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 17 | 18 | 25 | 26 | 27 | 28 | 34 | 35 | 36 | 37 | 38 | 43 | 44 | 49 | 50 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /app/src/main/res/layout/puzzle_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuvaraj119/JigSawPuzzle2-Android/4f112db76a6038fe1bb230ad1c8d93369c9de8e3/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #80FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 16dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | WaterfallPuzzle 3 | Main3Activity 4 | CheckActivity 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 |