├── .github
└── FUNDING.yml
├── .gitignore
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── gradle.xml
├── kotlinc.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── LICENSE
├── README.md
├── apk
└── image-picker-demo.apk
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── in
│ │ └── myinnos
│ │ └── imagepicker
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── in
│ │ │ └── myinnos
│ │ │ └── imagepicker
│ │ │ ├── Helper.java
│ │ │ └── MainActivity.java
│ └── res
│ │ ├── drawable
│ │ ├── image_result_background.xml
│ │ └── image_selector.xml
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── menu
│ │ └── main.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── in
│ └── myinnos
│ └── imagepicker
│ └── ExampleUnitTest.java
├── awesomeimagepicker
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── in
│ │ └── myinnos
│ │ └── awesomeimagepicker
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── in
│ │ │ └── myinnos
│ │ │ └── awesomeimagepicker
│ │ │ ├── activities
│ │ │ ├── AlbumSelectActivity.java
│ │ │ ├── HelperActivity.java
│ │ │ └── ImageSelectActivity.java
│ │ │ ├── adapter
│ │ │ ├── CustomAlbumSelectAdapter.java
│ │ │ ├── CustomGenericAdapter.java
│ │ │ └── CustomImageSelectAdapter.java
│ │ │ ├── helpers
│ │ │ └── ConstantsCustomGallery.java
│ │ │ └── models
│ │ │ ├── Album.java
│ │ │ └── Image.java
│ └── res
│ │ ├── drawable
│ │ ├── ic_arrow_left.png
│ │ └── ic_done_white.png
│ │ ├── layout
│ │ ├── activity_album_select.xml
│ │ ├── activity_image_select.xml
│ │ ├── custom_gallery_toolbar.xml
│ │ ├── grid_view_image_select.xml
│ │ └── grid_view_item_album_select.xml
│ │ ├── values-ar
│ │ └── strings.xml
│ │ └── values
│ │ ├── colors.xml
│ │ └── strings.xml
│ └── test
│ └── java
│ └── in
│ └── myinnos
│ └── awesomeimagepicker
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: [myinnos]
2 | custom: ['https://www.paypal.me/fansfolio']
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
11 | .idea/instapk.xml
12 | instapk.log*
--------------------------------------------------------------------------------
/.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 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/kotlinc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Awesome Image Picker
2 | Awesome Image Picker library will pick images/gifs with beautiful interface. Supports image or gif, Single and Multiple Image selection.
3 |
4 | 
5 | `` ``
6 | 
7 | `` ``
8 | 
9 | `` ``
10 | 
11 |
12 | #### Download Demo APK from [HERE](https://github.com/myinnos/AwesomeImagePicker/raw/master/apk/image-picker-demo.apk "APK")
13 |
14 | #### Kindly use the following links to use this library:
15 |
16 | In build.gradle (Project)
17 | ```java
18 | allprojects {
19 | repositories {
20 | ...
21 | maven { url "https://jitpack.io" }
22 | }
23 | }
24 | ```
25 | And then in the other gradle file(may be your app gradle or your own module library gradle, but never add in both of them to avoid conflict.)
26 | ```java
27 | dependencies {
28 | compile 'com.github.myinnos:AwesomeImagePicker:1.0.2'
29 | }
30 | ```
31 | How to use
32 | -----
33 | **Step 1:** start intent to open awesome image picker gallery:
34 | ```java
35 | Intent intent = new Intent(this, AlbumSelectActivity.class);
36 | intent.putExtra(ConstantsCustomGallery.INTENT_EXTRA_LIMIT, ); // set limit for image selection
37 | startActivityForResult(intent, ConstantsCustomGallery.REQUEST_CODE);
38 | ```
39 | **Step 2:** onActivityResult : [#Example](https://github.com/myinnos/AwesomeImagePicker/blob/master/app/src/main/java/in/myinnos/imagepicker/MainActivity.java "Example")
40 | ```java
41 | @Override
42 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
43 | super.onActivityResult(requestCode, resultCode, data);
44 |
45 | if (requestCode == ConstantsCustomGallery.REQUEST_CODE && resultCode == Activity.RESULT_OK && data != null) {
46 | //The array list has the image paths of the selected images
47 | ArrayList images = data.getParcelableArrayListExtra(ConstantsCustomGallery.INTENT_EXTRA_IMAGES);
48 |
49 | for (int i = 0; i < images.size(); i++) {
50 | Uri uri = Uri.fromFile(new File(images.get(i).path));
51 | // start play with image uri
52 | ..........
53 | }
54 | }
55 | }
56 | ```
57 | **IMP Note:** Require STORAGE_PERMISSIONS if Build.VERSION.SDK_INT >= 23.
58 | ##### Any Queries? or Feedback, please let me know by opening a [new issue](https://github.com/myinnos/AwesomeImagePicker/issues/new)!
59 |
60 | ## Contact
61 | #### Prabhakar Thota
62 | * :globe_with_meridians: Website: [myinnos.in](http://www.myinnos.in "Prabhakar Thota")
63 | * :email: e-mail: contact@myinnos.in
64 | * :mag_right: LinkedIn: [PrabhakarThota](https://www.linkedin.com/in/prabhakarthota "Prabhakar Thota on LinkedIn")
65 | * :thumbsup: Twitter: [@myinnos](https://twitter.com/myinnos "Prabhakar Thota on twitter")
66 | * :camera: Instagram: [@prabhakar_t_](https://www.instagram.com/prabhakar_t_/ "Prabhakar Thota on Instagram")
67 |
68 | > If you appreciate my work, consider buying me a cup of :coffee: to keep me recharged :metal: by [PayPal](https://www.paypal.me/fansfolio)
69 |
70 | License
71 | -------
72 |
73 | Copyright 2017 MyInnos
74 |
75 | Licensed under the Apache License, Version 2.0 (the "License");
76 | you may not use this file except in compliance with the License.
77 | You may obtain a copy of the License at
78 |
79 | http://www.apache.org/licenses/LICENSE-2.0
80 |
81 | Unless required by applicable law or agreed to in writing, software
82 | distributed under the License is distributed on an "AS IS" BASIS,
83 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
84 | See the License for the specific language governing permissions and
85 | limitations under the License.
86 |
--------------------------------------------------------------------------------
/apk/image-picker-demo.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/myinnos/AwesomeImagePicker/67a09265377918817dae57839dcdece2aa648adc/apk/image-picker-demo.apk
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.2"
6 | defaultConfig {
7 | applicationId "in.myinnos.imagepicker"
8 | minSdkVersion 15
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
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 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:25.2.0'
28 | testCompile 'junit:junit:4.12'
29 | compile project(path: ':awesomeimagepicker')
30 | }
31 |
--------------------------------------------------------------------------------
/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 C:\Users\10\AppData\Local\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 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/in/myinnos/imagepicker/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package in.myinnos.imagepicker;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("in.myinnos.imagepicker", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/in/myinnos/imagepicker/Helper.java:
--------------------------------------------------------------------------------
1 | package in.myinnos.imagepicker;
2 |
3 | import android.Manifest;
4 | import android.app.Activity;
5 | import android.content.pm.PackageManager;
6 | import android.os.Build;
7 | import android.support.v4.content.ContextCompat;
8 |
9 | /**
10 | * Created by MyInnos on 06-03-2017.
11 | */
12 |
13 | public class Helper {
14 |
15 | public static boolean checkPermissionForExternalStorage(Activity activity) {
16 | int result =
17 | ContextCompat.checkSelfPermission(activity, Manifest.permission.READ_EXTERNAL_STORAGE);
18 | if (result == PackageManager.PERMISSION_GRANTED) {
19 | return true;
20 | } else {
21 | return false;
22 | }
23 | }
24 |
25 | public static boolean requestStoragePermission(Activity activity, int READ_STORAGE_PERMISSION) {
26 | if (ContextCompat.checkSelfPermission(activity, Manifest.permission.READ_EXTERNAL_STORAGE)
27 | != PackageManager.PERMISSION_GRANTED) {
28 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
29 | activity.requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
30 | READ_STORAGE_PERMISSION);
31 | }
32 | } else {
33 | }
34 | return false;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/in/myinnos/imagepicker/MainActivity.java:
--------------------------------------------------------------------------------
1 | package in.myinnos.imagepicker;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.net.Uri;
6 | import android.os.Build;
7 | import android.os.Bundle;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.view.Menu;
10 | import android.view.MenuItem;
11 | import android.view.View;
12 | import android.widget.ImageView;
13 | import android.widget.TextView;
14 |
15 | import com.bumptech.glide.Glide;
16 |
17 | import java.io.File;
18 | import java.util.ArrayList;
19 |
20 | import in.myinnos.awesomeimagepicker.activities.AlbumSelectActivity;
21 | import in.myinnos.awesomeimagepicker.helpers.ConstantsCustomGallery;
22 | import in.myinnos.awesomeimagepicker.models.Image;
23 |
24 | public class MainActivity extends AppCompatActivity {
25 |
26 | private static final int READ_STORAGE_PERMISSION = 4000;
27 | private static final int LIMIT = 5;
28 | private ImageView imageView;
29 | private TextView txImageSelects;
30 |
31 | @Override
32 | protected void onCreate(Bundle savedInstanceState) {
33 | super.onCreate(savedInstanceState);
34 | setContentView(R.layout.activity_main);
35 |
36 | txImageSelects = (TextView) findViewById(R.id.txImageSelects);
37 | imageView = (ImageView) findViewById(R.id.imageView);
38 | imageView.setOnClickListener(new View.OnClickListener() {
39 | @Override
40 | public void onClick(View v) {
41 | if (Build.VERSION.SDK_INT >= 23) {
42 | if (!Helper.checkPermissionForExternalStorage(MainActivity.this)) {
43 | Helper.requestStoragePermission(MainActivity.this, READ_STORAGE_PERMISSION);
44 | } else {
45 | // opining custom gallery
46 | Intent intent = new Intent(MainActivity.this, AlbumSelectActivity.class);
47 | intent.putExtra(ConstantsCustomGallery.INTENT_EXTRA_LIMIT, LIMIT);
48 | startActivityForResult(intent, ConstantsCustomGallery.REQUEST_CODE);
49 | }
50 | }else{
51 | Intent intent = new Intent(MainActivity.this, AlbumSelectActivity.class);
52 | intent.putExtra(ConstantsCustomGallery.INTENT_EXTRA_LIMIT, LIMIT);
53 | startActivityForResult(intent, ConstantsCustomGallery.REQUEST_CODE);
54 | }
55 | }
56 | });
57 | }
58 |
59 | @Override
60 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
61 | super.onActivityResult(requestCode, resultCode, data);
62 |
63 | if (requestCode == ConstantsCustomGallery.REQUEST_CODE && resultCode == Activity.RESULT_OK && data != null) {
64 | //The array list has the image paths of the selected images
65 | ArrayList images = data.getParcelableArrayListExtra(ConstantsCustomGallery.INTENT_EXTRA_IMAGES);
66 |
67 | for (int i = 0; i < images.size(); i++) {
68 | Uri uri = Uri.fromFile(new File(images.get(i).path));
69 |
70 | Glide.with(this).load(uri)
71 | .placeholder(R.color.colorAccent)
72 | .override(400, 400)
73 | .crossFade()
74 | .centerCrop()
75 | .into(imageView);
76 |
77 | txImageSelects.setText(txImageSelects.getText().toString().trim()
78 | + "\n" +
79 | String.valueOf(i + 1) + ". " + String.valueOf(uri));
80 | }
81 |
82 | }
83 | }
84 |
85 |
86 | @Override
87 | public boolean onCreateOptionsMenu(Menu menu) {
88 | getMenuInflater().inflate(R.menu.main, menu);
89 | return true;
90 | }
91 |
92 | @Override
93 | public boolean onOptionsItemSelected(MenuItem item) {
94 |
95 | switch (item.getItemId()) {
96 | case R.id.github:
97 | startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/myinnos")));
98 | default:
99 | return super.onOptionsItemSelected(item);
100 | }
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_result_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
21 |
22 |
28 |
29 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/myinnos/AwesomeImagePicker/67a09265377918817dae57839dcdece2aa648adc/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/myinnos/AwesomeImagePicker/67a09265377918817dae57839dcdece2aa648adc/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/myinnos/AwesomeImagePicker/67a09265377918817dae57839dcdece2aa648adc/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/myinnos/AwesomeImagePicker/67a09265377918817dae57839dcdece2aa648adc/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/myinnos/AwesomeImagePicker/67a09265377918817dae57839dcdece2aa648adc/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/myinnos/AwesomeImagePicker/67a09265377918817dae57839dcdece2aa648adc/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/myinnos/AwesomeImagePicker/67a09265377918817dae57839dcdece2aa648adc/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/myinnos/AwesomeImagePicker/67a09265377918817dae57839dcdece2aa648adc/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/myinnos/AwesomeImagePicker/67a09265377918817dae57839dcdece2aa648adc/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/myinnos/AwesomeImagePicker/67a09265377918817dae57839dcdece2aa648adc/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #6d6d6d
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Image Picker
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/in/myinnos/imagepicker/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package in.myinnos.imagepicker;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/awesomeimagepicker/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/awesomeimagepicker/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.github.dcendents.android-maven'
3 | group='com.github.jitpack'
4 |
5 | android {
6 | compileSdkVersion 25
7 | buildToolsVersion "25.0.2"
8 |
9 | defaultConfig {
10 | minSdkVersion 15
11 | targetSdkVersion 25
12 | versionCode 1
13 | versionName "1.0"
14 |
15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16 |
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | }
25 |
26 | dependencies {
27 | compile fileTree(dir: 'libs', include: ['*.jar'])
28 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
29 | exclude group: 'com.android.support', module: 'support-annotations'
30 | })
31 | compile 'com.android.support:appcompat-v7:25.2.0'
32 | compile 'com.android.support:design:25.2.0'
33 | compile 'com.github.bumptech.glide:glide:3.7.0'
34 |
35 | testCompile 'junit:junit:4.12'
36 | }
37 |
38 | // build a jar with source files
39 | task sourcesJar(type: Jar) {
40 | from android.sourceSets.main.java.srcDirs
41 | classifier = 'sources'
42 | }
43 |
44 | task javadoc(type: Javadoc) {
45 | failOnError false
46 | source = android.sourceSets.main.java.sourceFiles
47 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
48 | classpath += configurations.compile
49 | }
50 |
51 | // build a jar with javadoc
52 | task javadocJar(type: Jar, dependsOn: javadoc) {
53 | classifier = 'javadoc'
54 | from javadoc.destinationDir
55 | }
56 |
57 | artifacts {
58 | archives sourcesJar
59 | archives javadocJar
60 | }
61 |
--------------------------------------------------------------------------------
/awesomeimagepicker/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 C:\Users\10\AppData\Local\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 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/androidTest/java/in/myinnos/awesomeimagepicker/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package in.myinnos.awesomeimagepicker;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("in.myinnos.awesomeimagepicker.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
13 |
14 |
18 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/java/in/myinnos/awesomeimagepicker/activities/AlbumSelectActivity.java:
--------------------------------------------------------------------------------
1 | package in.myinnos.awesomeimagepicker.activities;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.content.res.Configuration;
6 | import android.database.ContentObserver;
7 | import android.database.Cursor;
8 | import android.net.Uri;
9 | import android.os.Bundle;
10 | import android.os.Handler;
11 | import android.os.Message;
12 | import android.os.Process;
13 | import android.provider.MediaStore;
14 | import android.support.v7.app.ActionBar;
15 | import android.util.DisplayMetrics;
16 | import android.view.MenuItem;
17 | import android.view.View;
18 | import android.view.WindowManager;
19 | import android.widget.AdapterView;
20 | import android.widget.GridView;
21 | import android.widget.LinearLayout;
22 | import android.widget.ProgressBar;
23 | import android.widget.TextView;
24 |
25 | import java.io.File;
26 | import java.util.ArrayList;
27 | import java.util.HashSet;
28 |
29 | import in.myinnos.awesomeimagepicker.adapter.CustomAlbumSelectAdapter;
30 | import in.myinnos.awesomeimagepicker.R;
31 | import in.myinnos.awesomeimagepicker.helpers.ConstantsCustomGallery;
32 | import in.myinnos.awesomeimagepicker.models.Album;
33 |
34 | import static in.myinnos.awesomeimagepicker.R.anim.abc_fade_in;
35 | import static in.myinnos.awesomeimagepicker.R.anim.abc_fade_out;
36 |
37 | /**
38 | * Created by MyInnos on 03-11-2016.
39 | */
40 | public class AlbumSelectActivity extends HelperActivity {
41 | private ArrayList albums;
42 |
43 | private TextView errorDisplay, tvProfile;
44 | private LinearLayout liFinish;
45 |
46 | private ProgressBar loader;
47 | private GridView gridView;
48 | private CustomAlbumSelectAdapter adapter;
49 |
50 | private ActionBar actionBar;
51 |
52 | private ContentObserver observer;
53 | private Handler handler;
54 | private Thread thread;
55 |
56 | private final String[] projection = new String[]{
57 | MediaStore.Images.Media.BUCKET_ID,
58 | MediaStore.Images.Media.BUCKET_DISPLAY_NAME,
59 | MediaStore.Images.Media.DATA};
60 |
61 | @Override
62 | protected void onCreate(Bundle savedInstanceState) {
63 | super.onCreate(savedInstanceState);
64 | setContentView(R.layout.activity_album_select);
65 | setView(findViewById(R.id.layout_album_select));
66 |
67 | Intent intent = getIntent();
68 | if (intent == null) {
69 | finish();
70 | }
71 | ConstantsCustomGallery.limit = intent.getIntExtra(ConstantsCustomGallery.INTENT_EXTRA_LIMIT, ConstantsCustomGallery.DEFAULT_LIMIT);
72 |
73 | errorDisplay = (TextView) findViewById(R.id.text_view_error);
74 | errorDisplay.setVisibility(View.INVISIBLE);
75 |
76 | tvProfile = (TextView) findViewById(R.id.tvProfile);
77 | tvProfile.setText(R.string.album_view);
78 | liFinish = (LinearLayout) findViewById(R.id.liFinish);
79 |
80 | loader = (ProgressBar) findViewById(R.id.loader);
81 | gridView = (GridView) findViewById(R.id.grid_view_album_select);
82 | gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
83 | @Override
84 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
85 | if (albums.get(position).name.equals(getString(R.string.capture_photo))) {
86 | //HelperClass.displayMessageOnScreen(getApplicationContext(), "HMM!", false);
87 | } else {
88 | Intent intent = new Intent(getApplicationContext(), ImageSelectActivity.class);
89 | intent.putExtra(ConstantsCustomGallery.INTENT_EXTRA_ALBUM, albums.get(position).name);
90 | startActivityForResult(intent, ConstantsCustomGallery.REQUEST_CODE);
91 | }
92 | }
93 | });
94 |
95 | liFinish.setOnClickListener(new View.OnClickListener() {
96 | @Override
97 | public void onClick(View v) {
98 | finish();
99 | overridePendingTransition(abc_fade_in, abc_fade_out);
100 | }
101 | });
102 | }
103 |
104 | @Override
105 | protected void onStart() {
106 | super.onStart();
107 |
108 | handler = new Handler() {
109 | @Override
110 | public void handleMessage(Message msg) {
111 | switch (msg.what) {
112 | case ConstantsCustomGallery.PERMISSION_GRANTED: {
113 | loadAlbums();
114 | break;
115 | }
116 |
117 | case ConstantsCustomGallery.FETCH_STARTED: {
118 | loader.setVisibility(View.VISIBLE);
119 | gridView.setVisibility(View.INVISIBLE);
120 | break;
121 | }
122 |
123 | case ConstantsCustomGallery.FETCH_COMPLETED: {
124 | if (adapter == null) {
125 | adapter = new CustomAlbumSelectAdapter(AlbumSelectActivity.this, getApplicationContext(), albums);
126 | gridView.setAdapter(adapter);
127 |
128 | loader.setVisibility(View.GONE);
129 | gridView.setVisibility(View.VISIBLE);
130 | orientationBasedUI(getResources().getConfiguration().orientation);
131 |
132 | } else {
133 | adapter.notifyDataSetChanged();
134 | }
135 | break;
136 | }
137 |
138 | case ConstantsCustomGallery.ERROR: {
139 | loader.setVisibility(View.GONE);
140 | errorDisplay.setVisibility(View.VISIBLE);
141 | break;
142 | }
143 |
144 | default: {
145 | super.handleMessage(msg);
146 | }
147 | }
148 | }
149 | };
150 | observer = new ContentObserver(handler) {
151 | @Override
152 | public void onChange(boolean selfChange, Uri uri) {
153 | loadAlbums();
154 | }
155 | };
156 | getContentResolver().registerContentObserver(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, false, observer);
157 |
158 | checkPermission();
159 | }
160 |
161 | @Override
162 | protected void onStop() {
163 | super.onStop();
164 |
165 | stopThread();
166 |
167 | getContentResolver().unregisterContentObserver(observer);
168 | observer = null;
169 |
170 | if (handler != null) {
171 | handler.removeCallbacksAndMessages(null);
172 | handler = null;
173 | }
174 | }
175 |
176 | @Override
177 | protected void onDestroy() {
178 | super.onDestroy();
179 |
180 | if (actionBar != null) {
181 | actionBar.setHomeAsUpIndicator(null);
182 | }
183 | albums = null;
184 | if (adapter != null) {
185 | adapter.releaseResources();
186 | }
187 | gridView.setOnItemClickListener(null);
188 | }
189 |
190 | @Override
191 | public void onConfigurationChanged(Configuration newConfig) {
192 | super.onConfigurationChanged(newConfig);
193 | orientationBasedUI(newConfig.orientation);
194 | }
195 |
196 | private void orientationBasedUI(int orientation) {
197 | final WindowManager windowManager = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
198 | final DisplayMetrics metrics = new DisplayMetrics();
199 | windowManager.getDefaultDisplay().getMetrics(metrics);
200 |
201 | if (adapter != null) {
202 | int size = orientation == Configuration.ORIENTATION_PORTRAIT ? metrics.widthPixels / 2 : metrics.widthPixels / 4;
203 | adapter.setLayoutParams(size);
204 | }
205 | gridView.setNumColumns(orientation == Configuration.ORIENTATION_PORTRAIT ? 2 : 4);
206 | }
207 |
208 | @Override
209 | public void onBackPressed() {
210 | super.onBackPressed();
211 | setResult(RESULT_CANCELED);
212 | overridePendingTransition(abc_fade_in, abc_fade_out);
213 | finish();
214 | }
215 |
216 | @Override
217 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
218 | super.onActivityResult(requestCode, resultCode, data);
219 |
220 | if (requestCode == ConstantsCustomGallery.REQUEST_CODE
221 | && resultCode == RESULT_OK
222 | && data != null) {
223 | setResult(RESULT_OK, data);
224 | finish();
225 | }
226 | }
227 |
228 | @Override
229 | public boolean onOptionsItemSelected(MenuItem item) {
230 | switch (item.getItemId()) {
231 | case android.R.id.home: {
232 | onBackPressed();
233 | return true;
234 | }
235 |
236 | default: {
237 | return false;
238 | }
239 | }
240 | }
241 |
242 | private void loadAlbums() {
243 | startThread(new AlbumLoaderRunnable());
244 | }
245 |
246 | private class AlbumLoaderRunnable implements Runnable {
247 | @Override
248 | public void run() {
249 | Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
250 |
251 | if (adapter == null) {
252 | sendMessage(ConstantsCustomGallery.FETCH_STARTED);
253 | }
254 |
255 | Cursor cursor = getApplicationContext().getContentResolver()
256 | .query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection,
257 | null, null, MediaStore.Images.Media.DATE_MODIFIED);
258 | if (cursor == null) {
259 | sendMessage(ConstantsCustomGallery.ERROR);
260 | return;
261 | }
262 |
263 | ArrayList temp = new ArrayList<>(cursor.getCount());
264 | HashSet albumSet = new HashSet<>();
265 | File file;
266 | if (cursor.moveToLast()) {
267 | do {
268 | if (Thread.interrupted()) {
269 | return;
270 | }
271 |
272 | long albumId = cursor.getLong(cursor.getColumnIndex(projection[0]));
273 | String album = cursor.getString(cursor.getColumnIndex(projection[1]));
274 | String image = cursor.getString(cursor.getColumnIndex(projection[2]));
275 |
276 | if (!albumSet.contains(albumId)) {
277 | /*
278 | It may happen that some image file paths are still present in cache,
279 | though image file does not exist. These last as long as media
280 | scanner is not run again. To avoid get such image file paths, check
281 | if image file exists.
282 | */
283 | file = new File(image);
284 | if (file.exists()) {
285 |
286 | temp.add(new Album(album, image));
287 |
288 | /*if (!album.equals("Hiding particular folder")) {
289 | temp.add(new Album(album, image));
290 | }*/
291 | albumSet.add(albumId);
292 | }
293 | }
294 |
295 | } while (cursor.moveToPrevious());
296 | }
297 | cursor.close();
298 |
299 | if (albums == null) {
300 | albums = new ArrayList<>();
301 | }
302 | albums.clear();
303 | // adding taking photo from camera option!
304 | /*albums.add(new Album(getString(R.string.capture_photo),
305 | "https://image.freepik.com/free-vector/flat-white-camera_23-2147490625.jpg"));*/
306 | albums.addAll(temp);
307 |
308 | sendMessage(ConstantsCustomGallery.FETCH_COMPLETED);
309 | }
310 | }
311 |
312 | private void startThread(Runnable runnable) {
313 | stopThread();
314 | thread = new Thread(runnable);
315 | thread.start();
316 | }
317 |
318 | private void stopThread() {
319 | if (thread == null || !thread.isAlive()) {
320 | return;
321 | }
322 |
323 | thread.interrupt();
324 | try {
325 | thread.join();
326 | } catch (InterruptedException e) {
327 | e.printStackTrace();
328 | }
329 | }
330 |
331 | private void sendMessage(int what) {
332 | if (handler == null) {
333 | return;
334 | }
335 |
336 | Message message = handler.obtainMessage();
337 | message.what = what;
338 | message.sendToTarget();
339 | }
340 |
341 | @Override
342 | protected void permissionGranted() {
343 | Message message = handler.obtainMessage();
344 | message.what = ConstantsCustomGallery.PERMISSION_GRANTED;
345 | message.sendToTarget();
346 | }
347 |
348 | @Override
349 | protected void hideViews() {
350 | loader.setVisibility(View.GONE);
351 | gridView.setVisibility(View.INVISIBLE);
352 | }
353 | }
354 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/java/in/myinnos/awesomeimagepicker/activities/HelperActivity.java:
--------------------------------------------------------------------------------
1 | package in.myinnos.awesomeimagepicker.activities;
2 |
3 | import android.Manifest;
4 | import android.app.Activity;
5 | import android.content.Intent;
6 | import android.content.pm.PackageManager;
7 | import android.net.Uri;
8 | import android.provider.Settings;
9 | import android.support.annotation.NonNull;
10 | import android.support.design.widget.Snackbar;
11 | import android.support.v4.app.ActivityCompat;
12 | import android.support.v4.content.ContextCompat;
13 | import android.view.View;
14 |
15 | import in.myinnos.awesomeimagepicker.R;
16 | import in.myinnos.awesomeimagepicker.helpers.ConstantsCustomGallery;
17 |
18 |
19 | /**
20 | * Created by MyInnos on 03-11-2016.
21 | */
22 | public class HelperActivity extends Activity {
23 | protected View view;
24 |
25 | private final int maxLines = 4;
26 | private final String[] permissions = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE};
27 |
28 | protected void checkPermission() {
29 | if (ContextCompat.checkSelfPermission(this,
30 | Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
31 | permissionGranted();
32 |
33 | } else {
34 | ActivityCompat.requestPermissions(this, permissions, ConstantsCustomGallery.PERMISSION_REQUEST_CODE);
35 | }
36 | }
37 |
38 | private void requestPermission() {
39 | if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
40 | showRequestPermissionRationale();
41 |
42 | } else {
43 | showAppPermissionSettings();
44 | }
45 | }
46 |
47 | private void showRequestPermissionRationale() {
48 | Snackbar snackbar = Snackbar.make(
49 | view,
50 | getString(R.string.permission_info),
51 | Snackbar.LENGTH_INDEFINITE)
52 | .setAction(getString(R.string.permission_ok), new View.OnClickListener() {
53 | @Override
54 | public void onClick(View v) {
55 | ActivityCompat.requestPermissions(
56 | HelperActivity.this,
57 | permissions,
58 | ConstantsCustomGallery.PERMISSION_REQUEST_CODE);
59 | }
60 | });
61 |
62 | /*((TextView) snackbar.getView()
63 | .findViewById(android.support.design.R.id.snackbar_text)).setMaxLines(maxLines);*/
64 | snackbar.show();
65 | }
66 |
67 | private void showAppPermissionSettings() {
68 | Snackbar snackbar = Snackbar.make(
69 | view,
70 | getString(R.string.permission_force),
71 | Snackbar.LENGTH_INDEFINITE)
72 | .setAction(getString(R.string.permission_settings), new View.OnClickListener() {
73 | @Override
74 | public void onClick(View v) {
75 | Uri uri = Uri.fromParts(
76 | getString(R.string.permission_package),
77 | HelperActivity.this.getPackageName(),
78 | null);
79 |
80 | Intent intent = new Intent();
81 | intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
82 | intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
83 | intent.setData(uri);
84 | startActivityForResult(intent, ConstantsCustomGallery.PERMISSION_REQUEST_CODE);
85 | }
86 | });
87 |
88 | /*((TextView) snackbar.getView()
89 | .findViewById(android.support.design.R.id.snackbar_text)).setMaxLines(maxLines);*/
90 | snackbar.show();
91 | }
92 |
93 | @Override
94 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
95 | super.onRequestPermissionsResult(requestCode, permissions, grantResults);
96 | if (requestCode != ConstantsCustomGallery.PERMISSION_REQUEST_CODE
97 | || grantResults.length == 0
98 | || grantResults[0] == PackageManager.PERMISSION_DENIED) {
99 | permissionDenied();
100 |
101 | } else {
102 | permissionGranted();
103 | }
104 | }
105 |
106 | protected void permissionGranted() {
107 | }
108 |
109 | private void permissionDenied() {
110 | hideViews();
111 | requestPermission();
112 | }
113 |
114 | protected void hideViews() {
115 | }
116 |
117 | protected void setView(View view) {
118 | this.view = view;
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/java/in/myinnos/awesomeimagepicker/activities/ImageSelectActivity.java:
--------------------------------------------------------------------------------
1 | package in.myinnos.awesomeimagepicker.activities;
2 |
3 | import android.content.Intent;
4 | import android.content.res.Configuration;
5 | import android.database.ContentObserver;
6 | import android.database.Cursor;
7 | import android.os.Bundle;
8 | import android.os.Handler;
9 | import android.os.Message;
10 | import android.os.Process;
11 | import android.provider.MediaStore;
12 | import android.util.DisplayMetrics;
13 | import android.util.Log;
14 | import android.view.MenuItem;
15 | import android.view.View;
16 | import android.view.WindowManager;
17 | import android.widget.AdapterView;
18 | import android.widget.GridView;
19 | import android.widget.LinearLayout;
20 | import android.widget.ProgressBar;
21 | import android.widget.TextView;
22 | import android.widget.Toast;
23 |
24 | import java.io.File;
25 | import java.util.ArrayList;
26 | import java.util.HashSet;
27 |
28 | import in.myinnos.awesomeimagepicker.adapter.CustomImageSelectAdapter;
29 | import in.myinnos.awesomeimagepicker.R;
30 | import in.myinnos.awesomeimagepicker.helpers.ConstantsCustomGallery;
31 | import in.myinnos.awesomeimagepicker.models.Image;
32 |
33 | import static in.myinnos.awesomeimagepicker.R.anim.abc_fade_in;
34 | import static in.myinnos.awesomeimagepicker.R.anim.abc_fade_out;
35 |
36 | /**
37 | * Created by MyInnos on 03-11-2016.
38 | */
39 | public class ImageSelectActivity extends HelperActivity {
40 | private ArrayList images;
41 | private String album;
42 |
43 | private TextView errorDisplay, tvProfile, tvAdd, tvSelectCount;
44 | private LinearLayout liFinish;
45 |
46 | private ProgressBar loader;
47 | private GridView gridView;
48 | private CustomImageSelectAdapter adapter;
49 |
50 |
51 | private int countSelected;
52 |
53 | private ContentObserver observer;
54 | private Handler handler;
55 | private Thread thread;
56 |
57 | private final String[] projection = new String[]{MediaStore.Images.Media._ID, MediaStore.Images.Media.DISPLAY_NAME, MediaStore.Images.Media.DATA};
58 |
59 | @Override
60 | protected void onCreate(Bundle savedInstanceState) {
61 | super.onCreate(savedInstanceState);
62 | setContentView(R.layout.activity_image_select);
63 | setView(findViewById(R.id.layout_image_select));
64 |
65 | tvProfile = (TextView) findViewById(R.id.tvProfile);
66 | tvAdd = (TextView) findViewById(R.id.tvAdd);
67 | tvSelectCount = (TextView) findViewById(R.id.tvSelectCount);
68 | tvProfile.setText(R.string.image_view);
69 | liFinish = (LinearLayout) findViewById(R.id.liFinish);
70 |
71 | Intent intent = getIntent();
72 | if (intent == null) {
73 | finish();
74 | }
75 | album = intent.getStringExtra(ConstantsCustomGallery.INTENT_EXTRA_ALBUM);
76 |
77 | errorDisplay = (TextView) findViewById(R.id.text_view_error);
78 | errorDisplay.setVisibility(View.INVISIBLE);
79 |
80 | loader = (ProgressBar) findViewById(R.id.loader);
81 | gridView = (GridView) findViewById(R.id.grid_view_image_select);
82 | gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
83 | @Override
84 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
85 |
86 | toggleSelection(position);
87 | //actionMode.setTitle(countSelected + " " + getString(R.string.selected));
88 | tvSelectCount.setText(countSelected + " " + getString(R.string.selected));
89 | tvSelectCount.setVisibility(View.VISIBLE);
90 | tvAdd.setVisibility(View.VISIBLE);
91 | tvProfile.setVisibility(View.GONE);
92 |
93 | if (countSelected == 0) {
94 | //actionMode.finish();
95 | tvSelectCount.setVisibility(View.GONE);
96 | tvAdd.setVisibility(View.GONE);
97 | tvProfile.setVisibility(View.VISIBLE);
98 | }
99 | }
100 | });
101 |
102 | liFinish.setOnClickListener(new View.OnClickListener() {
103 | @Override
104 | public void onClick(View v) {
105 | if (tvSelectCount.getVisibility() == View.VISIBLE) {
106 | deselectAll();
107 | } else {
108 | finish();
109 | overridePendingTransition(abc_fade_in, abc_fade_out);
110 | }
111 | }
112 | });
113 |
114 | tvAdd.setOnClickListener(new View.OnClickListener() {
115 | @Override
116 | public void onClick(View v) {
117 | sendIntent();
118 | }
119 | });
120 | }
121 |
122 | @Override
123 | protected void onStart() {
124 | super.onStart();
125 |
126 | handler = new Handler() {
127 | @Override
128 | public void handleMessage(Message msg) {
129 | switch (msg.what) {
130 | case ConstantsCustomGallery.PERMISSION_GRANTED: {
131 | loadImages();
132 | break;
133 | }
134 |
135 | case ConstantsCustomGallery.FETCH_STARTED: {
136 | loader.setVisibility(View.VISIBLE);
137 | gridView.setVisibility(View.INVISIBLE);
138 | break;
139 | }
140 |
141 | case ConstantsCustomGallery.FETCH_COMPLETED: {
142 | /*
143 | If adapter is null, this implies that the loaded images will be shown
144 | for the first time, hence send FETCH_COMPLETED message.
145 | However, if adapter has been initialised, this thread was run either
146 | due to the activity being restarted or content being changed.
147 | */
148 | if (adapter == null) {
149 | adapter = new CustomImageSelectAdapter(ImageSelectActivity.this, getApplicationContext(), images);
150 | gridView.setAdapter(adapter);
151 |
152 | loader.setVisibility(View.GONE);
153 | gridView.setVisibility(View.VISIBLE);
154 | orientationBasedUI(getResources().getConfiguration().orientation);
155 |
156 | } else {
157 | adapter.notifyDataSetChanged();
158 | /*
159 | Some selected images may have been deleted
160 | hence update action mode title
161 | */
162 | countSelected = msg.arg1;
163 | //actionMode.setTitle(countSelected + " " + getString(R.string.selected));
164 | tvSelectCount.setText(countSelected + " " + getString(R.string.selected));
165 | tvSelectCount.setVisibility(View.VISIBLE);
166 | tvAdd.setVisibility(View.VISIBLE);
167 | tvProfile.setVisibility(View.GONE);
168 |
169 | }
170 | break;
171 | }
172 |
173 | case ConstantsCustomGallery.ERROR: {
174 | loader.setVisibility(View.GONE);
175 | errorDisplay.setVisibility(View.VISIBLE);
176 | break;
177 | }
178 |
179 | default: {
180 | super.handleMessage(msg);
181 | }
182 | }
183 | }
184 | };
185 | observer = new ContentObserver(handler) {
186 | @Override
187 | public void onChange(boolean selfChange) {
188 | loadImages();
189 | }
190 | };
191 | getContentResolver().registerContentObserver(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, false, observer);
192 |
193 | checkPermission();
194 | }
195 |
196 | @Override
197 | protected void onStop() {
198 | super.onStop();
199 |
200 | stopThread();
201 |
202 | getContentResolver().unregisterContentObserver(observer);
203 | observer = null;
204 |
205 | if (handler != null) {
206 | handler.removeCallbacksAndMessages(null);
207 | handler = null;
208 | }
209 | }
210 |
211 | @Override
212 | protected void onDestroy() {
213 | super.onDestroy();
214 |
215 | images = null;
216 | if (adapter != null) {
217 | adapter.releaseResources();
218 | }
219 | gridView.setOnItemClickListener(null);
220 | }
221 |
222 | @Override
223 | public void onConfigurationChanged(Configuration newConfig) {
224 | super.onConfigurationChanged(newConfig);
225 | orientationBasedUI(newConfig.orientation);
226 | }
227 |
228 | private void orientationBasedUI(int orientation) {
229 | final WindowManager windowManager = (WindowManager) getApplicationContext().getSystemService(WINDOW_SERVICE);
230 | final DisplayMetrics metrics = new DisplayMetrics();
231 | windowManager.getDefaultDisplay().getMetrics(metrics);
232 |
233 | if (adapter != null) {
234 | int size = orientation == Configuration.ORIENTATION_PORTRAIT ? metrics.widthPixels / 3 : metrics.widthPixels / 5;
235 | adapter.setLayoutParams(size);
236 | }
237 | gridView.setNumColumns(orientation == Configuration.ORIENTATION_PORTRAIT ? 3 : 5);
238 | }
239 |
240 | @Override
241 | public boolean onOptionsItemSelected(MenuItem item) {
242 | switch (item.getItemId()) {
243 | case android.R.id.home: {
244 | onBackPressed();
245 | return true;
246 | }
247 |
248 | default: {
249 | return false;
250 | }
251 | }
252 | }
253 |
254 | private void toggleSelection(int position) {
255 | if (!images.get(position).isSelected && countSelected >= ConstantsCustomGallery.limit) {
256 | Toast.makeText(
257 | getApplicationContext(),
258 | String.format(getString(R.string.limit_exceeded), ConstantsCustomGallery.limit),
259 | Toast.LENGTH_SHORT)
260 | .show();
261 | return;
262 | }
263 |
264 | images.get(position).isSelected = !images.get(position).isSelected;
265 | if (images.get(position).isSelected) {
266 | countSelected++;
267 | } else {
268 | countSelected--;
269 | }
270 | adapter.notifyDataSetChanged();
271 | }
272 |
273 | private void deselectAll() {
274 | tvProfile.setVisibility(View.VISIBLE);
275 | tvAdd.setVisibility(View.GONE);
276 | tvSelectCount.setVisibility(View.GONE);
277 |
278 | for (int i = 0, l = images.size(); i < l; i++) {
279 | images.get(i).isSelected = false;
280 | }
281 | countSelected = 0;
282 | adapter.notifyDataSetChanged();
283 | }
284 |
285 | private ArrayList getSelected() {
286 | ArrayList selectedImages = new ArrayList<>();
287 | for (int i = 0, l = images.size(); i < l; i++) {
288 | if (images.get(i).isSelected) {
289 | selectedImages.add(images.get(i));
290 | }
291 | }
292 | return selectedImages;
293 | }
294 |
295 | private void sendIntent() {
296 | Intent intent = new Intent();
297 | intent.putParcelableArrayListExtra(ConstantsCustomGallery.INTENT_EXTRA_IMAGES, getSelected());
298 | setResult(RESULT_OK, intent);
299 | finish();
300 | overridePendingTransition(abc_fade_in, abc_fade_out);
301 | }
302 |
303 | private void loadImages() {
304 | startThread(new ImageLoaderRunnable());
305 | }
306 |
307 | private class ImageLoaderRunnable implements Runnable {
308 | @Override
309 | public void run() {
310 | Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
311 | /*
312 | If the adapter is null, this is first time this activity's view is
313 | being shown, hence send FETCH_STARTED message to show progress bar
314 | while images are loaded from phone
315 | */
316 | if (adapter == null) {
317 | sendMessage(ConstantsCustomGallery.FETCH_STARTED);
318 | }
319 |
320 | File file;
321 | HashSet selectedImages = new HashSet<>();
322 | if (images != null) {
323 | Image image;
324 | for (int i = 0, l = images.size(); i < l; i++) {
325 | image = images.get(i);
326 | file = new File(image.path);
327 | if (file.exists() && image.isSelected) {
328 | selectedImages.add(image.id);
329 | }
330 | }
331 | }
332 |
333 | Cursor cursor = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection,
334 | MediaStore.Images.Media.BUCKET_DISPLAY_NAME + " =?", new String[]{album}, MediaStore.Images.Media.DATE_ADDED);
335 | if (cursor == null) {
336 | sendMessage(ConstantsCustomGallery.ERROR);
337 | return;
338 | }
339 |
340 | /*
341 | In case this runnable is executed to onChange calling loadImages,
342 | using countSelected variable can result in a race condition. To avoid that,
343 | tempCountSelected keeps track of number of selected images. On handling
344 | FETCH_COMPLETED message, countSelected is assigned value of tempCountSelected.
345 | */
346 | int tempCountSelected = 0;
347 | ArrayList temp = new ArrayList<>(cursor.getCount());
348 | if (cursor.moveToLast()) {
349 | do {
350 | if (Thread.interrupted()) {
351 | return;
352 | }
353 |
354 | long id = cursor.getLong(cursor.getColumnIndex(projection[0]));
355 | String name = cursor.getString(cursor.getColumnIndex(projection[1]));
356 | String path = cursor.getString(cursor.getColumnIndex(projection[2]));
357 | boolean isSelected = selectedImages.contains(id);
358 | if (isSelected) {
359 | tempCountSelected++;
360 | }
361 |
362 | file = null;
363 | try {
364 | file = new File(path);
365 | } catch (Exception e) {
366 | Log.d("Exception : ", e.toString());
367 | }
368 |
369 | if (file.exists()) {
370 | temp.add(new Image(id, name, path, isSelected));
371 | }
372 |
373 | } while (cursor.moveToPrevious());
374 | }
375 | cursor.close();
376 |
377 | if (images == null) {
378 | images = new ArrayList<>();
379 | }
380 | images.clear();
381 | images.addAll(temp);
382 |
383 | sendMessage(ConstantsCustomGallery.FETCH_COMPLETED, tempCountSelected);
384 | }
385 | }
386 |
387 | private void startThread(Runnable runnable) {
388 | stopThread();
389 | thread = new Thread(runnable);
390 | thread.start();
391 | }
392 |
393 | private void stopThread() {
394 | if (thread == null || !thread.isAlive()) {
395 | return;
396 | }
397 |
398 | thread.interrupt();
399 | try {
400 | thread.join();
401 | } catch (InterruptedException e) {
402 | e.printStackTrace();
403 | }
404 | }
405 |
406 | private void sendMessage(int what) {
407 | sendMessage(what, 0);
408 | }
409 |
410 | private void sendMessage(int what, int arg1) {
411 | if (handler == null) {
412 | return;
413 | }
414 |
415 | Message message = handler.obtainMessage();
416 | message.what = what;
417 | message.arg1 = arg1;
418 | message.sendToTarget();
419 | }
420 |
421 | @Override
422 | protected void permissionGranted() {
423 | sendMessage(ConstantsCustomGallery.PERMISSION_GRANTED);
424 | }
425 |
426 | @Override
427 | protected void hideViews() {
428 | loader.setVisibility(View.GONE);
429 | gridView.setVisibility(View.INVISIBLE);
430 | }
431 |
432 | @Override
433 | public void onBackPressed() {
434 | if (tvSelectCount.getVisibility() == View.VISIBLE) {
435 | deselectAll();
436 | } else {
437 | super.onBackPressed();
438 | overridePendingTransition(abc_fade_in, abc_fade_out);
439 | finish();
440 | }
441 |
442 | }
443 | }
444 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/java/in/myinnos/awesomeimagepicker/adapter/CustomAlbumSelectAdapter.java:
--------------------------------------------------------------------------------
1 | package in.myinnos.awesomeimagepicker.adapter;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.net.Uri;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 |
11 | import com.bumptech.glide.Glide;
12 |
13 | import java.io.File;
14 | import java.util.ArrayList;
15 |
16 | import in.myinnos.awesomeimagepicker.R;
17 | import in.myinnos.awesomeimagepicker.models.Album;
18 |
19 | /**
20 | * Created by MyInnos on 03-11-2016.
21 | */
22 | public class CustomAlbumSelectAdapter extends CustomGenericAdapter {
23 |
24 | public CustomAlbumSelectAdapter(Activity activity, Context context, ArrayList albums) {
25 | super(activity, context, albums);
26 | }
27 |
28 | @Override
29 | public View getView(int position, View convertView, ViewGroup parent) {
30 | final ViewHolder viewHolder;
31 |
32 | if (convertView == null) {
33 | convertView = layoutInflater.inflate(R.layout.grid_view_item_album_select, null);
34 |
35 | viewHolder = new ViewHolder();
36 | viewHolder.imageView = (ImageView) convertView.findViewById(R.id.image_view_album_image);
37 | viewHolder.textView = (TextView) convertView.findViewById(R.id.text_view_album_name);
38 |
39 | convertView.setTag(viewHolder);
40 |
41 | } else {
42 | viewHolder = (ViewHolder) convertView.getTag();
43 | }
44 |
45 | viewHolder.imageView.getLayoutParams().width = size;
46 | viewHolder.imageView.getLayoutParams().height = size;
47 |
48 | viewHolder.textView.setText(arrayList.get(position).name);
49 |
50 | if (arrayList.get(position).name.equals("Take Photo")) {
51 |
52 | Glide.with(context).load(arrayList.get(position).cover)
53 | .placeholder(R.color.colorAccent)
54 | .override(200, 200)
55 | .crossFade()
56 | .centerCrop()
57 | .into(viewHolder.imageView);
58 | } else {
59 | final Uri uri = Uri.fromFile(new File(arrayList.get(position).cover));
60 | Glide.with(context).load(uri)
61 | .placeholder(R.color.colorAccent)
62 | .override(200, 200)
63 | .crossFade()
64 | .centerCrop()
65 | .into(viewHolder.imageView);
66 | }
67 |
68 | return convertView;
69 | }
70 |
71 | private static class ViewHolder {
72 | ImageView imageView;
73 | TextView textView;
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/java/in/myinnos/awesomeimagepicker/adapter/CustomGenericAdapter.java:
--------------------------------------------------------------------------------
1 | package in.myinnos.awesomeimagepicker.adapter;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.view.LayoutInflater;
6 | import android.widget.BaseAdapter;
7 |
8 | import java.util.ArrayList;
9 |
10 | /**
11 | * Created by MyInnos on 03-11-2016.
12 | */
13 | public abstract class CustomGenericAdapter extends BaseAdapter {
14 | protected ArrayList arrayList;
15 | protected Context context;
16 | protected Activity activity;
17 | protected LayoutInflater layoutInflater;
18 |
19 | protected int size;
20 |
21 | public CustomGenericAdapter(Activity activity, Context context, ArrayList arrayList) {
22 | this.arrayList = arrayList;
23 | this.context = context;
24 | this.activity = activity;
25 | this.layoutInflater = LayoutInflater.from(this.context);
26 | }
27 |
28 | @Override
29 | public int getCount() {
30 | return arrayList.size();
31 | }
32 |
33 | public T getItem(int position) {
34 | return arrayList.get(position);
35 | }
36 |
37 | @Override
38 | public long getItemId(int position) {
39 | return position;
40 | }
41 |
42 | public void setLayoutParams(int size) {
43 | this.size = size;
44 | }
45 |
46 | public void releaseResources() {
47 | arrayList = null;
48 | context = null;
49 | activity = null;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/java/in/myinnos/awesomeimagepicker/adapter/CustomImageSelectAdapter.java:
--------------------------------------------------------------------------------
1 | package in.myinnos.awesomeimagepicker.adapter;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.net.Uri;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.FrameLayout;
9 | import android.widget.ImageView;
10 |
11 | import com.bumptech.glide.Glide;
12 |
13 | import java.io.File;
14 | import java.util.ArrayList;
15 |
16 | import in.myinnos.awesomeimagepicker.R;
17 | import in.myinnos.awesomeimagepicker.models.Image;
18 |
19 | /**
20 | * Created by MyInnos on 03-11-2016.
21 | */
22 | public class CustomImageSelectAdapter extends CustomGenericAdapter {
23 |
24 | public CustomImageSelectAdapter(Activity activity, Context context, ArrayList images) {
25 | super(activity, context, images);
26 | }
27 |
28 | @Override
29 | public View getView(int position, View convertView, ViewGroup parent) {
30 | final ViewHolder viewHolder;
31 |
32 | if (convertView == null) {
33 | convertView = layoutInflater.inflate(R.layout.grid_view_image_select, null);
34 |
35 | viewHolder = new ViewHolder();
36 | viewHolder.imageView = (ImageView) convertView.findViewById(R.id.image_view_image_select);
37 | viewHolder.view = convertView.findViewById(R.id.view_alpha);
38 |
39 | convertView.setTag(viewHolder);
40 |
41 | } else {
42 | viewHolder = (ViewHolder) convertView.getTag();
43 | }
44 |
45 | viewHolder.imageView.getLayoutParams().width = size;
46 | viewHolder.imageView.getLayoutParams().height = size;
47 |
48 | viewHolder.view.getLayoutParams().width = size;
49 | viewHolder.view.getLayoutParams().height = size;
50 |
51 | if (arrayList.get(position).isSelected) {
52 | viewHolder.view.setAlpha(0.5f);
53 | ((FrameLayout) convertView).setForeground(context.getResources().getDrawable(R.drawable.ic_done_white));
54 |
55 | } else {
56 | viewHolder.view.setAlpha(0.0f);
57 | ((FrameLayout) convertView).setForeground(null);
58 | }
59 |
60 | Uri uri = Uri.fromFile(new File(arrayList.get(position).path));
61 |
62 | Glide.with(context).load(uri)
63 | .placeholder(R.color.colorAccent)
64 | .override(200, 200)
65 | .crossFade()
66 | .centerCrop()
67 | .into(viewHolder.imageView);
68 |
69 | return convertView;
70 | }
71 |
72 | private static class ViewHolder {
73 | public ImageView imageView;
74 | public View view;
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/java/in/myinnos/awesomeimagepicker/helpers/ConstantsCustomGallery.java:
--------------------------------------------------------------------------------
1 | package in.myinnos.awesomeimagepicker.helpers;
2 |
3 | /**
4 | * Created by MyInnos on 03-11-2016.
5 | */
6 | public class ConstantsCustomGallery {
7 | public static final int PERMISSION_REQUEST_CODE = 1000;
8 | public static final int PERMISSION_GRANTED = 1001;
9 | public static final int PERMISSION_DENIED = 1002;
10 |
11 | public static final int REQUEST_CODE = 2000;
12 |
13 | public static final int FETCH_STARTED = 2001;
14 | public static final int FETCH_COMPLETED = 2002;
15 | public static final int ERROR = 2005;
16 |
17 | /**
18 | * Request code for permission has to be < (1 << 8)
19 | * Otherwise throws java.lang.IllegalArgumentException: Can only use lower 8 bits for requestCode
20 | */
21 | public static final int PERMISSION_REQUEST_READ_EXTERNAL_STORAGE = 23;
22 |
23 | public static final String INTENT_EXTRA_ALBUM = "album";
24 | public static final String INTENT_EXTRA_IMAGES = "images";
25 | public static final String INTENT_EXTRA_LIMIT = "limit";
26 | public static final int DEFAULT_LIMIT = 10;
27 |
28 | //Maximum number of images that can be selected at a time
29 | public static int limit;
30 | }
31 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/java/in/myinnos/awesomeimagepicker/models/Album.java:
--------------------------------------------------------------------------------
1 | package in.myinnos.awesomeimagepicker.models;
2 |
3 | /**
4 | * Created by MyInnos on 03-11-2016.
5 | */
6 | public class Album {
7 | public String name;
8 | public String cover;
9 |
10 | public Album(String name, String cover) {
11 | this.name = name;
12 | this.cover = cover;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/java/in/myinnos/awesomeimagepicker/models/Image.java:
--------------------------------------------------------------------------------
1 | package in.myinnos.awesomeimagepicker.models;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | /**
7 | * Created by MyInnos on 03-11-2016.
8 | */
9 | public class Image implements Parcelable {
10 | public long id;
11 | public String name;
12 | public String path;
13 | public boolean isSelected;
14 |
15 | public Image(long id, String name, String path, boolean isSelected) {
16 | this.id = id;
17 | this.name = name;
18 | this.path = path;
19 | this.isSelected = isSelected;
20 | }
21 |
22 | @Override
23 | public int describeContents() {
24 | return 0;
25 | }
26 |
27 | @Override
28 | public void writeToParcel(Parcel dest, int flags) {
29 | dest.writeLong(id);
30 | dest.writeString(name);
31 | dest.writeString(path);
32 | }
33 |
34 | public static final Creator CREATOR = new Creator() {
35 | @Override
36 | public Image createFromParcel(Parcel source) {
37 | return new Image(source);
38 | }
39 |
40 | @Override
41 | public Image[] newArray(int size) {
42 | return new Image[size];
43 | }
44 | };
45 |
46 | private Image(Parcel in) {
47 | id = in.readLong();
48 | name = in.readString();
49 | path = in.readString();
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/res/drawable/ic_arrow_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/myinnos/AwesomeImagePicker/67a09265377918817dae57839dcdece2aa648adc/awesomeimagepicker/src/main/res/drawable/ic_arrow_left.png
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/res/drawable/ic_done_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/myinnos/AwesomeImagePicker/67a09265377918817dae57839dcdece2aa648adc/awesomeimagepicker/src/main/res/drawable/ic_done_white.png
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/res/layout/activity_album_select.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
20 |
21 |
27 |
28 |
38 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/res/layout/activity_image_select.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
20 |
21 |
27 |
28 |
38 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/res/layout/custom_gallery_toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
21 |
22 |
25 |
26 |
38 |
39 |
47 |
48 |
62 |
63 |
67 |
68 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/res/layout/grid_view_image_select.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
17 |
18 |
23 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/res/layout/grid_view_item_album_select.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
19 |
20 |
31 |
32 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/res/values-ar/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Awesome Image Picker
4 | إضافة
5 | إختر ألبوم الصور
6 | إلتقاط صورة
7 | لقد حصل خطأ
8 | أنقر لختيار صورةأ
9 | \"يمكنك إختيار %d صور \"
10 | التطبيق يحتاج لذن فتح الملفات لمعاينة الصور . أنقر إعدادات لمنح الأذن .
11 | التطبيق يحتاج لذن فتح الملفات لمعاينة الصور . .
12 | حسنا
13 | المجلد
14 | الاعدادات
15 | مختارة
16 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #3F51B5
5 | #FF4081
6 |
7 | #FFFFFF
8 | @color/colorPrimary
9 | #000000
10 |
11 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Awesome Image Picker
3 |
4 |
5 | App requires permission to Storage to view images.
6 | App requires permission to Storage to view images. Tap Settings and go to Permissions to grant permission.
7 | OK
8 | Settings
9 | package
10 |
11 | Select photo album
12 | Tap to select images
13 |
14 | selected
15 | Can select a maximum of %d images
16 | Oops, something went wrong!
17 | ADD
18 | Capture Photo
19 |
20 |
--------------------------------------------------------------------------------
/awesomeimagepicker/src/test/java/in/myinnos/awesomeimagepicker/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package in.myinnos.awesomeimagepicker;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/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 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.2'
9 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/myinnos/AwesomeImagePicker/67a09265377918817dae57839dcdece2aa648adc/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Mar 06 15:25:11 IST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':awesomeimagepicker'
2 |
--------------------------------------------------------------------------------