├── .gitignore
├── LICENSE
├── README.md
├── bintray.gradle
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── install.gradle
├── keystores
├── debug.keystore
└── pseudo-release.keystore
├── pixelperfect
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── is
│ │ └── handsome
│ │ └── pixelperfect
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ └── crashlytics-build.properties
│ ├── java
│ │ └── is
│ │ │ └── handsome
│ │ │ └── pixelperfect
│ │ │ ├── ActivityLifeCycleObserver.java
│ │ │ ├── ImagesAdapter.java
│ │ │ ├── Overlay.java
│ │ │ ├── OverlayPositionStore.java
│ │ │ ├── OverlayStateStore.java
│ │ │ ├── OverlayView.java
│ │ │ ├── PixelPerfect.java
│ │ │ ├── SettingsView.java
│ │ │ └── Utils.java
│ └── res
│ │ ├── drawable-hdpi
│ │ ├── apptheme_btn_check_off_disabled_focused_holo_light.png
│ │ ├── apptheme_btn_check_off_disabled_holo_light.png
│ │ ├── apptheme_btn_check_off_focused_holo_light.png
│ │ ├── apptheme_btn_check_off_holo_light.png
│ │ ├── apptheme_btn_check_off_pressed_holo_light.png
│ │ ├── apptheme_btn_check_on_disabled_focused_holo_light.png
│ │ ├── apptheme_btn_check_on_disabled_holo_light.png
│ │ ├── apptheme_btn_check_on_focused_holo_light.png
│ │ ├── apptheme_btn_check_on_holo_light.png
│ │ ├── apptheme_btn_check_on_pressed_holo_light.png
│ │ ├── apptheme_scrubber_control_disabled_holo.png
│ │ ├── apptheme_scrubber_control_focused_holo.png
│ │ ├── apptheme_scrubber_control_normal_holo.png
│ │ ├── apptheme_scrubber_control_pressed_holo.png
│ │ ├── apptheme_scrubber_primary_holo.9.png
│ │ ├── apptheme_scrubber_secondary_holo.9.png
│ │ └── apptheme_scrubber_track_holo_light.9.png
│ │ ├── drawable-mdpi
│ │ ├── apptheme_btn_check_off_disabled_focused_holo_light.png
│ │ ├── apptheme_btn_check_off_disabled_holo_light.png
│ │ ├── apptheme_btn_check_off_focused_holo_light.png
│ │ ├── apptheme_btn_check_off_holo_light.png
│ │ ├── apptheme_btn_check_off_pressed_holo_light.png
│ │ ├── apptheme_btn_check_on_disabled_focused_holo_light.png
│ │ ├── apptheme_btn_check_on_disabled_holo_light.png
│ │ ├── apptheme_btn_check_on_focused_holo_light.png
│ │ ├── apptheme_btn_check_on_holo_light.png
│ │ ├── apptheme_btn_check_on_pressed_holo_light.png
│ │ ├── apptheme_scrubber_control_disabled_holo.png
│ │ ├── apptheme_scrubber_control_focused_holo.png
│ │ ├── apptheme_scrubber_control_normal_holo.png
│ │ ├── apptheme_scrubber_control_pressed_holo.png
│ │ ├── apptheme_scrubber_primary_holo.9.png
│ │ ├── apptheme_scrubber_secondary_holo.9.png
│ │ └── apptheme_scrubber_track_holo_light.9.png
│ │ ├── drawable-xhdpi
│ │ ├── apptheme_btn_check_off_disabled_focused_holo_light.png
│ │ ├── apptheme_btn_check_off_disabled_holo_light.png
│ │ ├── apptheme_btn_check_off_focused_holo_light.png
│ │ ├── apptheme_btn_check_off_holo_light.png
│ │ ├── apptheme_btn_check_off_pressed_holo_light.png
│ │ ├── apptheme_btn_check_on_disabled_focused_holo_light.png
│ │ ├── apptheme_btn_check_on_disabled_holo_light.png
│ │ ├── apptheme_btn_check_on_focused_holo_light.png
│ │ ├── apptheme_btn_check_on_holo_light.png
│ │ ├── apptheme_btn_check_on_pressed_holo_light.png
│ │ ├── apptheme_scrubber_control_disabled_holo.png
│ │ ├── apptheme_scrubber_control_focused_holo.png
│ │ ├── apptheme_scrubber_control_normal_holo.png
│ │ ├── apptheme_scrubber_control_pressed_holo.png
│ │ ├── apptheme_scrubber_primary_holo.9.png
│ │ ├── apptheme_scrubber_secondary_holo.9.png
│ │ ├── apptheme_scrubber_track_holo_light.9.png
│ │ ├── ic_back.png
│ │ ├── ic_placeholder.png
│ │ └── ic_settings_cancel.png
│ │ ├── drawable-xxhdpi
│ │ ├── apptheme_btn_check_off_disabled_focused_holo_light.png
│ │ ├── apptheme_btn_check_off_disabled_holo_light.png
│ │ ├── apptheme_btn_check_off_focused_holo_light.png
│ │ ├── apptheme_btn_check_off_holo_light.png
│ │ ├── apptheme_btn_check_off_pressed_holo_light.png
│ │ ├── apptheme_btn_check_on_disabled_focused_holo_light.png
│ │ ├── apptheme_btn_check_on_disabled_holo_light.png
│ │ ├── apptheme_btn_check_on_focused_holo_light.png
│ │ ├── apptheme_btn_check_on_holo_light.png
│ │ ├── apptheme_btn_check_on_pressed_holo_light.png
│ │ ├── apptheme_scrubber_control_disabled_holo.png
│ │ ├── apptheme_scrubber_control_focused_holo.png
│ │ ├── apptheme_scrubber_control_normal_holo.png
│ │ ├── apptheme_scrubber_control_pressed_holo.png
│ │ ├── apptheme_scrubber_primary_holo.9.png
│ │ ├── apptheme_scrubber_secondary_holo.9.png
│ │ └── apptheme_scrubber_track_holo_light.9.png
│ │ ├── drawable
│ │ ├── apptheme_btn_check_holo_light.xml
│ │ ├── apptheme_scrubber_control_selector_holo_light.xml
│ │ ├── apptheme_scrubber_progress_horizontal_holo_light.xml
│ │ ├── bg_opacity_demo_view.xml
│ │ ├── bg_overlay.xml
│ │ ├── bg_settings_image_border.xml
│ │ ├── bg_settings_image_label.xml
│ │ ├── bg_settings_item.xml
│ │ └── bg_settings_view_border.xml
│ │ ├── layout
│ │ ├── layout_recycler_view_item.xml
│ │ ├── layout_settings.xml
│ │ └── view_offset_pixels.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── com_crashlytics_export_strings.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ ├── styles.xml
│ │ └── themes.xml
│ └── test
│ └── java
│ └── is
│ └── handsome
│ └── pixelperfect
│ └── ExampleUnitTest.java
├── sample
├── .gitignore
├── build.gradle
├── fabric.properties
├── proguard-rules.pro
├── src
│ ├── androidTest
│ │ └── java
│ │ │ └── is
│ │ │ └── handsome
│ │ │ └── pixelperfectsample
│ │ │ └── ApplicationTest.java
│ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── assets
│ │ │ ├── overlays-1080
│ │ │ │ ├── landscape.png
│ │ │ │ └── portrait.png
│ │ │ ├── overlays-1440
│ │ │ │ ├── landscape.png
│ │ │ │ └── portrait.png
│ │ │ ├── overlays-480
│ │ │ │ ├── landscape.png
│ │ │ │ └── portrait.png
│ │ │ └── overlays-720
│ │ │ │ ├── landscape.png
│ │ │ │ └── portrait.png
│ │ ├── java
│ │ │ └── is
│ │ │ │ └── handsome
│ │ │ │ └── pixelperfectsample
│ │ │ │ ├── HomeActivity.java
│ │ │ │ └── SampleUtils.java
│ │ └── res
│ │ │ ├── layout-land
│ │ │ └── activity_home.xml
│ │ │ ├── layout
│ │ │ └── activity_home.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ └── test
│ │ └── java
│ │ └── is
│ │ └── handsome
│ │ └── pixelperfectsample
│ │ └── ExampleUnitTest.java
└── version.properties
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Built application files
3 | *.apk
4 | *.ap_
5 |
6 | .DS_Store
7 |
8 | # IDEA/Android Studio project files, because
9 | # the project can be imported from settings.gradle
10 | .idea
11 | *.iml
12 |
13 | # Files for the Dalvik VM
14 | *.dex
15 |
16 | # Java class files
17 | *.class
18 |
19 | # Generated files
20 | bin/
21 | gen/
22 |
23 | # Gradle files
24 | .gradle/
25 | build/
26 | /*/build/
27 |
28 | # Old-style IDEA project files
29 | *.ipr
30 | *.iws
31 |
32 | # Local configuration file (sdk path, etc)
33 | /local.properties
34 |
35 | # Proguard folder generated by Eclipse
36 | proguard/
37 |
38 | # Log Files
39 | *.log
40 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # PixelPerfect
2 |
3 | PixelPerfect is aimed to help you to create pixel perfect UI for Android apps. It lets developers and designers easily compare implementation with reference design and fix visual difference between them.
4 |
5 | 
6 |
7 | #### Supported features:
8 | - Picking overlay image.
9 | - Adjustment transparency.
10 | - Moving overlay.
11 | - Measuring offset.
12 | - Inverse mode.
13 |
14 | ## Download
15 |
16 | Grab via Gradle:
17 |
18 | ```gradle
19 | compile 'is.handsome.pixelperfect:pixelperfect:1.0.1'
20 | ```
21 |
22 | or Maven:
23 |
24 | ```maven
25 |
26 | is.handsome.pixelperfect
27 | pixelperfect
28 | 1.0.1
29 | pom
30 |
31 | ```
32 |
33 | ## Getting started
34 |
35 | #### Show PixelPerfect
36 | ```java
37 | PixelPerfect.show(HomeActivity.this);
38 | ```
39 |
40 | In default configuration PixelPerfect will be linked with 'pixelperfect' assets folder.
41 |
42 | 
43 |
44 | If you want to use different folder, please read `Configuration` section.
45 |
46 | #### Hide PixelPerfect
47 | ```java
48 | PixelPerfect.hide();
49 | ```
50 |
51 | ## Configuration
52 |
53 | `PixelPerfect.Config` provides possibility to configure major attributes of PixelPerfect. This snippet demonstrates usage of custom `overlayImagesAssetsPath` (assets folder for overlay images) and `overlayActiveImageName` (name of active by default overlay image):
54 |
55 | ```java
56 | PixelPerfect.Config config = new PixelPerfect.Config.Builder()
57 | .overlayImagesAssetsPath("my_overlays")
58 | .overlayActiveImageName("main.png")
59 | .build();
60 | PixelPerfect.show(HomeActivity.this, config);
61 | ```
62 |
63 | ## Permissions and Android Marshmallow+
64 |
65 | PixelPerfect requires SYSTEM_ALERT_WINDOW permission to run properly. So, for Marshmallow and later versions you have to handle permissions with `PixelPerfect.hasPermission(context)` and `PixelPerfect.askForPermission(context)` methods.
66 |
67 | You can find demonstartion of its usage in Sample app.
68 |
69 |
--------------------------------------------------------------------------------
/bintray.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.jfrog.bintray'
2 |
3 | version = libraryVersion
4 |
5 | task sourcesJar(type: Jar) {
6 | from android.sourceSets.main.java.srcDirs
7 | classifier = 'sources'
8 | }
9 |
10 | task javadoc(type: Javadoc) {
11 | source = android.sourceSets.main.java.srcDirs
12 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
13 | }
14 |
15 | task javadocJar(type: Jar, dependsOn: javadoc) {
16 | classifier = 'javadoc'
17 | from javadoc.destinationDir
18 | }
19 |
20 | artifacts {
21 | archives javadocJar
22 | archives sourcesJar
23 | }
24 |
25 | // Bintray
26 | Properties properties = new Properties()
27 | properties.load(project.rootProject.file('local.properties').newDataInputStream())
28 |
29 | bintray {
30 | user = properties.getProperty("bintray.user")
31 | key = properties.getProperty("bintray.apikey")
32 |
33 | configurations = ['archives']
34 | pkg {
35 | repo = bintrayRepo
36 | name = bintrayName
37 | desc = libraryDescription
38 | websiteUrl = siteUrl
39 | vcsUrl = gitUrl
40 | licenses = allLicenses
41 | publish = true
42 | publicDownloadNumbers = true
43 | version {
44 | desc = libraryDescription
45 | gpg {
46 | sign = true //Determines whether to GPG sign the files. The default is false
47 | passphrase = properties.getProperty("bintray.gpg.password")
48 | //Optional. The passphrase for GPG signing'
49 | }
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | jcenter()
4 | }
5 |
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:2.1.0'
8 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
9 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
10 | }
11 | }
12 |
13 | allprojects {
14 | repositories {
15 | jcenter()
16 | }
17 | }
18 |
19 | task clean(type: Delete) {
20 | delete rootProject.buildDir
21 | }
22 |
--------------------------------------------------------------------------------
/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 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Apr 18 19:05:11 OMST 2016
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-2.10-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 |
--------------------------------------------------------------------------------
/install.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.github.dcendents.android-maven'
2 |
3 | group = publishedGroupId // Maven Group ID for the artifact
4 |
5 | install {
6 | repositories.mavenInstaller {
7 | // This generates POM.xml with proper parameters
8 | pom {
9 | project {
10 | packaging 'aar'
11 | groupId publishedGroupId
12 | artifactId artifact
13 |
14 | // Add your description here
15 | name libraryName
16 | description libraryDescription
17 | url siteUrl
18 |
19 | // Set your license
20 | licenses {
21 | license {
22 | name licenseName
23 | url licenseUrl
24 | }
25 | }
26 | developers {
27 | developer {
28 | id developerId
29 | name developerName
30 | email developerEmail
31 | }
32 | }
33 | scm {
34 | connection gitUrl
35 | developerConnection gitUrl
36 | url siteUrl
37 |
38 | }
39 | }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/keystores/debug.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/keystores/debug.keystore
--------------------------------------------------------------------------------
/keystores/pseudo-release.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/keystores/pseudo-release.keystore
--------------------------------------------------------------------------------
/pixelperfect/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/pixelperfect/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | ext {
4 | bintrayRepo = 'maven'
5 | bintrayName = 'pixel-perfect'
6 |
7 | publishedGroupId = 'is.handsome.pixelperfect'
8 | libraryName = 'PixelPerfect'
9 | artifact = 'pixelperfect'
10 |
11 | libraryDescription = 'A library for creating Pixel Perfect UI on Android'
12 |
13 | siteUrl = 'https://github.com/handsomecode/pixel-perfect-for-android'
14 | gitUrl = 'https://github.com/handsomecode/pixel-perfect-for-android.git'
15 |
16 | libraryVersion = '1.0.1'
17 |
18 | developerId = 'handsomecode'
19 | developerName = 'Handsome'
20 | developerEmail = 'code@handsome.is'
21 |
22 | licenseName = 'The Apache Software License, Version 2.0'
23 | licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
24 | allLicenses = ["Apache-2.0"]
25 | }
26 |
27 | android {
28 | compileSdkVersion 23
29 | buildToolsVersion "23.0.3"
30 |
31 | defaultConfig {
32 | minSdkVersion 16
33 | targetSdkVersion 23
34 | versionCode 2
35 | versionName "0.2"
36 | }
37 | buildTypes {
38 | release {
39 | minifyEnabled false
40 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
41 | }
42 | }
43 | }
44 |
45 | dependencies {
46 | compile 'com.android.support:appcompat-v7:23.4.0'
47 | compile 'com.android.support:recyclerview-v7:23.4.0'
48 | compile 'com.squareup.picasso:picasso:2.5.2'
49 | compile 'com.android.support:support-annotations:23.4.0'
50 | }
51 |
52 | /* commented because of TeamCity distribution
53 | (during project building Team City could not find local.properties that is used in bintray.gradle) */
54 |
55 | //apply from: '../install.gradle'
56 | //apply from: '../bintray.gradle'
--------------------------------------------------------------------------------
/pixelperfect/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 /Users/okonoreva/Library/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 |
--------------------------------------------------------------------------------
/pixelperfect/src/androidTest/java/is/handsome/pixelperfect/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package is.handsome.pixelperfect;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/pixelperfect/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/assets/crashlytics-build.properties:
--------------------------------------------------------------------------------
1 | #This file is automatically generated by Crashlytics to uniquely
2 | #identify individual builds of your Android application.
3 | #
4 | #Do NOT modify, delete, or commit to source control!
5 | #
6 | #Mon Dec 14 18:12:45 OMST 2015
7 | version_name=0.0
8 | package_name=is.handsome.pixelperfect
9 | build_id=20988447-edce-4818-86e8-ff16a362c022
10 | version_code=0
11 | app_name=PixelPerfect
12 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/java/is/handsome/pixelperfect/ActivityLifeCycleObserver.java:
--------------------------------------------------------------------------------
1 | package is.handsome.pixelperfect;
2 |
3 | import android.app.Activity;
4 | import android.app.Application;
5 | import android.content.Context;
6 | import android.os.Bundle;
7 | import android.os.Handler;
8 | import android.util.Log;
9 |
10 | import java.util.List;
11 | import java.util.concurrent.CopyOnWriteArrayList;
12 |
13 | // Thanks to https://gist.github.com/steveliles/11116937
14 |
15 | class ActivityLifeCycleObserver implements Application.ActivityLifecycleCallbacks {
16 |
17 | public static final String TAG = ActivityLifeCycleObserver.class.getSimpleName();
18 | public static final long CHECK_DELAY = 500;
19 |
20 | public interface Listener {
21 |
22 | void onBecameForeground();
23 | void onBecameBackground();
24 | void onActivityStopped(Activity activity);
25 | }
26 |
27 | private static ActivityLifeCycleObserver instance;
28 |
29 | private boolean foreground = true, paused = true;
30 | private Handler handler = new Handler();
31 | private List listeners = new CopyOnWriteArrayList<>();
32 | private Runnable checkRunnable;
33 |
34 | public static ActivityLifeCycleObserver get(Context context){
35 | if (instance == null) {
36 | Context applicationContext = context;
37 | if (!(applicationContext instanceof Application)) {
38 | applicationContext = context.getApplicationContext();
39 | }
40 | return init((Application) applicationContext);
41 | }
42 | return instance;
43 | }
44 |
45 | public static ActivityLifeCycleObserver get(){
46 | if (instance == null) {
47 | throw new IllegalStateException (
48 | "Foreground is not initialized - invoke " +
49 | "at least once with parameterized init/get");
50 | }
51 | return instance;
52 | }
53 |
54 | public ActivityLifeCycleObserver() {
55 | checkRunnable = new Runnable(){
56 | @Override
57 | public void run() {
58 | if (foreground && paused) {
59 | foreground = false;
60 | Log.i(TAG, "went background");
61 | for (Listener listener : listeners) {
62 | try {
63 | listener.onBecameBackground();
64 | } catch (Exception exception) {
65 | Log.i(TAG, "Listener threw exception!", exception);
66 | }
67 | }
68 | } else {
69 | Log.i(TAG, "still foreground");
70 | }
71 | }
72 | };
73 | }
74 |
75 | public boolean isForeground(){
76 | return foreground;
77 | }
78 |
79 | public boolean isBackground(){
80 | return !foreground;
81 | }
82 |
83 | public void addListener(Listener listener){
84 | listeners.add(listener);
85 | }
86 |
87 | public void removeListener(Listener listener){
88 | listeners.remove(listener);
89 | }
90 |
91 | @Override
92 | public void onActivityResumed(Activity activity) {
93 | paused = false;
94 | boolean wasBackground = !foreground;
95 | foreground = true;
96 |
97 | if (checkRunnable != null)
98 | handler.removeCallbacks(checkRunnable);
99 |
100 | if (wasBackground){
101 | Log.i(TAG, "went foreground");
102 | for (Listener listener : listeners) {
103 | try {
104 | listener.onBecameForeground();
105 | } catch (Exception exception) {
106 | Log.i(TAG, "Listener threw exception!", exception);
107 | }
108 | }
109 | } else {
110 | Log.i(TAG, "still foreground");
111 | }
112 | }
113 |
114 | @Override
115 | public void onActivityPaused(Activity activity) {
116 | paused = true;
117 | if (checkRunnable != null) {
118 | handler.removeCallbacks(checkRunnable);
119 | }
120 | handler.postDelayed(checkRunnable, CHECK_DELAY);
121 | }
122 |
123 | @Override
124 | public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
125 | }
126 |
127 | @Override
128 | public void onActivityStarted(Activity activity) {
129 | OverlayStateStore overlayStateStore = OverlayStateStore.getInstance(activity);
130 | if (overlayStateStore.isPixelPerfectActive()) {
131 | PixelPerfect.showOverlayInner(activity);
132 | }
133 | }
134 |
135 | @Override
136 | public void onActivityStopped(Activity activity) {
137 | for (Listener listener : listeners) {
138 | try {
139 | listener.onActivityStopped(activity);
140 | } catch (Exception exception) {
141 | Log.i(TAG, "Listener threw exception!", exception);
142 | }
143 | }
144 | }
145 |
146 | @Override
147 | public void onActivitySaveInstanceState(Activity activity, Bundle outState) {}
148 |
149 | @Override
150 | public void onActivityDestroyed(Activity activity) {}
151 |
152 | private static ActivityLifeCycleObserver init(Application application){
153 | if (instance == null) {
154 | instance = new ActivityLifeCycleObserver();
155 | application.registerActivityLifecycleCallbacks(instance);
156 | }
157 | return instance;
158 | }
159 | }
--------------------------------------------------------------------------------
/pixelperfect/src/main/java/is/handsome/pixelperfect/ImagesAdapter.java:
--------------------------------------------------------------------------------
1 | package is.handsome.pixelperfect;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 |
11 | import com.squareup.picasso.Picasso;
12 |
13 | import java.util.Collections;
14 | import java.util.List;
15 |
16 | class ImagesAdapter extends RecyclerView.Adapter {
17 |
18 | public static class ViewHolder extends RecyclerView.ViewHolder {
19 | public TextView textView;
20 | public ImageView imageView;
21 | public View borderView;
22 |
23 | public ViewHolder(View itemView) {
24 | super(itemView);
25 | textView = (TextView) itemView.findViewById(R.id.recycler_item_text_view);
26 | borderView = itemView.findViewById(R.id.recycler_item_image_container_frame_layout);
27 | imageView = (ImageView) itemView.findViewById(R.id.recycler_item_image_view);
28 | }
29 | }
30 |
31 | private Context context;
32 | private String overlayImagesAssetsPath;
33 | private List imageNames = Collections.EMPTY_LIST;
34 | private SettingsView.AdapterListener listener;
35 | private final LayoutInflater layoutInflater;
36 | private int selectedPosition = -1;
37 |
38 | public ImagesAdapter(Context context, List imageNames, String overlayImagesAssetsPath, SettingsView.AdapterListener listener) {
39 | this.context = context;
40 | this.imageNames = imageNames;
41 | this.overlayImagesAssetsPath = overlayImagesAssetsPath;
42 | this.listener = listener;
43 | this.layoutInflater = LayoutInflater.from(context);
44 | }
45 |
46 | @Override
47 | public ImagesAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
48 | View view = layoutInflater.inflate(R.layout.layout_recycler_view_item, parent, false);
49 | return new ViewHolder(view);
50 | }
51 |
52 | @Override
53 | public void onBindViewHolder(final ViewHolder holder, int position) {
54 | String name = imageNames.get(position);
55 | holder.textView.setText(name.contains(".") ? name.substring(0, name.indexOf(".")) : name);
56 | Picasso.with(context)
57 | .load("file:///android_asset/" + overlayImagesAssetsPath + "/" + imageNames.get(position))
58 | .placeholder(R.drawable.ic_placeholder)
59 | .resizeDimen(R.dimen.settings_screen_recycler_item_width, R.dimen.settings_screen_recycler_item_height)
60 | .centerCrop()
61 | .into(holder.imageView);
62 | holder.textView.setSelected(position == selectedPosition);
63 | holder.borderView.setSelected(position == selectedPosition);
64 | holder.imageView.setOnClickListener(new View.OnClickListener() {
65 | @Override
66 | public void onClick(View v) {
67 | notifyItemChanged(selectedPosition);
68 | selectedPosition = holder.getAdapterPosition();
69 | holder.textView.setSelected(true);
70 | holder.borderView.setSelected(true);
71 | listener.onItemSelected(selectedPosition);
72 | }
73 | });
74 | }
75 |
76 | @Override
77 | public int getItemCount() {
78 | return imageNames.size();
79 | }
80 |
81 | public void setSelectedPosition(int newSelectedPosition) {
82 | notifyItemChanged(selectedPosition);
83 | selectedPosition = newSelectedPosition;
84 | notifyItemChanged(selectedPosition);
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/java/is/handsome/pixelperfect/Overlay.java:
--------------------------------------------------------------------------------
1 | package is.handsome.pixelperfect;
2 |
3 | import android.app.Activity;
4 | import android.app.Service;
5 | import android.content.Context;
6 | import android.content.res.Configuration;
7 | import android.graphics.Bitmap;
8 | import android.graphics.PixelFormat;
9 | import android.text.TextUtils;
10 | import android.util.Log;
11 | import android.view.Gravity;
12 | import android.view.LayoutInflater;
13 | import android.view.View;
14 | import android.view.ViewGroup;
15 | import android.view.WindowManager;
16 | import android.widget.TextView;
17 |
18 | class Overlay {
19 |
20 | public interface LayoutListener {
21 | void onOverlayMoveX(int dx);
22 |
23 | void onOverlayMoveY(int dy);
24 |
25 | void onOverlayUpdate(int imageWidth, int imageHeight);
26 |
27 | void onOffsetViewMoveX(int dx);
28 |
29 | void onOffsetViewMoveY(int dy);
30 |
31 | void hideOffsetView();
32 |
33 | void showOffsetView(int xPos, int yPos);
34 |
35 | void openSettings(boolean goToImages);
36 |
37 | void setInverseMode();
38 |
39 | void onFixOffset();
40 | }
41 |
42 | public interface SettingsListener {
43 | void onSetImageAlpha(float alpha);
44 |
45 | void onUpdateImage(Bitmap bitmap, boolean resetPosition);
46 |
47 | void onFixOffset();
48 |
49 | boolean onInverseChecked(boolean saveOpacity);
50 | }
51 |
52 | private WindowManager windowManager;
53 |
54 | private SettingsView settingsView;
55 | private OverlayView overlayView;
56 | private ViewGroup offsetPixelsView;
57 | private TextView offsetXTextView;
58 | private TextView offsetYTextView;
59 |
60 | private WindowManager.LayoutParams offsetPixelsViewParams;
61 | private WindowManager.LayoutParams overlayParams;
62 | private WindowManager.LayoutParams settingsParams;
63 |
64 | private int fixedOffsetX = 0;
65 | private int fixedOffsetY = 0;
66 |
67 | private int overlayBorderSize;
68 | private int statusBarHeight;
69 | private String offsetTextTemplate;
70 | private float overlayScaleFactor = 1;
71 |
72 | private OverlayStateStore overlayStateStore;
73 | private OverlayPositionStore overlayPositionStore;
74 |
75 | public Overlay(Context context, boolean restoreState) {
76 | initOverlay(context, restoreState);
77 | show();
78 | }
79 |
80 | public Overlay(Context context, PixelPerfect.Config config) {
81 | overlayScaleFactor = config.getOverlayScaleFactor();
82 | initOverlay(context, false);
83 | if (!TextUtils.isEmpty(config.getOverlayImageAssetsPath())) {
84 | settingsView.setImageAssetsPath(config.getOverlayImageAssetsPath());
85 | }
86 | if (!TextUtils.isEmpty(config.overlayActiveImageName())) {
87 | settingsView.setImageOverlay(config.overlayActiveImageName());
88 | }
89 | show();
90 | }
91 |
92 | public void show() {
93 | overlayView.setImageVisible(true);
94 | overlayView.setVisibility(View.VISIBLE);
95 | if (overlayStateStore.getSettingsState() != OverlayStateStore.SettingsState.CLOSED) {
96 | displaySettingsView();
97 | if (overlayStateStore.getSettingsState() == OverlayStateStore.SettingsState.OPENED_IMAGES) {
98 | settingsView.openImagesSettingsScreen();
99 | }
100 | }
101 | }
102 |
103 | public boolean isShown() {
104 | return overlayView.getVisibility() == View.VISIBLE;
105 | }
106 |
107 | public void calculatePositionAfterRotation() {
108 | if (overlayPositionStore.getPositionX() != 0 && overlayPositionStore.getPositionY() != 0) {
109 | overlayParams.x = overlayPositionStore.getPositionX();
110 | overlayParams.y = overlayPositionStore.getPositionY();
111 |
112 | fixedOffsetX = overlayPositionStore.getFixedOffsetX();
113 | fixedOffsetY = overlayPositionStore.getFixedOffsetY();
114 | } else {
115 | calculateFirstRotationPosition();
116 | }
117 | overlayView.updateNoImageTextViewSize();
118 | windowManager.updateViewLayout(overlayView, overlayParams);
119 | }
120 |
121 | public void resetState() {
122 | overlayStateStore.reset();
123 | }
124 |
125 | public void saveState(Activity activity) {
126 | overlayStateStore.savePixelPerfectActive(true);
127 | overlayStateStore.saveSize(overlayView.getWidth(), overlayView.getHeight());
128 | overlayPositionStore.savePosition(overlayParams.x, overlayParams.y);
129 | overlayPositionStore.saveFixedOffset(fixedOffsetX, fixedOffsetY);
130 | if (overlayView.isNoImageOverlay()) {
131 | overlayStateStore.saveImageName("no_image");
132 | } else {
133 | overlayStateStore.saveImageName(settingsView.currentImageName());
134 | }
135 | overlayStateStore.saveAssetsFolderName(settingsView.getOverlayImageAssetsPath());
136 | overlayStateStore.saveOpacity(overlayView.getImageAlpha());
137 | overlayStateStore.saveInverse(settingsView.isInverse());
138 | overlayStateStore.saveSettingsState(settingsView.getSettingsState());
139 | }
140 |
141 | public void hide() {
142 | overlayView.setImageVisible(false);
143 | overlayView.setVisibility(View.GONE);
144 | offsetPixelsView.setVisibility(View.GONE);
145 | settingsView.setVisibility(View.GONE);
146 | }
147 |
148 | public void destroy() {
149 | windowManager.removeView(overlayView);
150 | windowManager.removeView(offsetPixelsView);
151 | windowManager.removeView(settingsView);
152 | }
153 |
154 | private void calculateFirstRotationPosition() {
155 | int width = Utils.getWindowWidth(windowManager);
156 | int height = Utils.getWindowHeight(windowManager);
157 |
158 | int overlayMinimumVisibleSize = (int) overlayView.getContext().getResources().getDimension(R.dimen.overlay_minimum_visible_size);
159 |
160 | overlayParams.x = (overlayParams.x + overlayStateStore.getWidth() / 2) * width / height
161 | - overlayStateStore.getWidth() / 2;
162 |
163 | if (overlayParams.x + overlayStateStore.getWidth() < overlayMinimumVisibleSize) {
164 | overlayParams.x = overlayMinimumVisibleSize - overlayStateStore.getWidth();
165 | } else if (overlayParams.x > Utils.getWindowWidth(windowManager) - overlayMinimumVisibleSize) {
166 | overlayParams.x = Utils.getWindowWidth(windowManager) - overlayMinimumVisibleSize;
167 | }
168 | fixedOffsetX = -overlayParams.x;
169 |
170 | overlayParams.y = (overlayParams.y + overlayStateStore.getHeight() / 2) * height / width
171 | - overlayStateStore.getHeight() / 2;
172 |
173 | if (overlayParams.y + overlayStateStore.getHeight() < overlayMinimumVisibleSize) {
174 | overlayParams.y = overlayMinimumVisibleSize - overlayStateStore.getHeight();
175 | } else if (overlayParams.y > Utils.getWindowHeight(windowManager) - overlayMinimumVisibleSize - statusBarHeight) {
176 | overlayParams.y = Utils.getWindowHeight(windowManager) - overlayMinimumVisibleSize - statusBarHeight;
177 | }
178 | fixedOffsetY = -overlayParams.y;
179 | }
180 |
181 | private void restoreState(Context context) {
182 | if (overlayStateStore.getImageName() != null) {
183 | settingsView.setImageAssetsPath(overlayStateStore.getAssetsFolderName());
184 | if (!overlayStateStore.getImageName().equalsIgnoreCase("no_image")) {
185 | settingsView.setImageOverlay(overlayStateStore.getImageName());
186 | }
187 | if (overlayStateStore.isInverse()) {
188 | settingsView.setInverseMode();
189 | }
190 | settingsView.updateOpacityProgress(overlayStateStore.getOpacity());
191 | if (overlayPositionStore.getOrientation() != Configuration.ORIENTATION_UNDEFINED &&
192 | context.getResources().getConfiguration().orientation != overlayPositionStore.getOrientation()) {
193 | overlayPositionStore.saveOrientation(context.getResources().getConfiguration().orientation);
194 | calculatePositionAfterRotation();
195 | }
196 | }
197 | overlayPositionStore.saveOrientation(context.getResources().getConfiguration().orientation);
198 | }
199 |
200 | private void initOverlay(final Context context, boolean restoreState) {
201 | Context applicationContext = context.getApplicationContext();
202 | overlayStateStore = OverlayStateStore.getInstance(applicationContext);
203 | overlayPositionStore = OverlayPositionStore.getInstance(applicationContext);
204 | if (!restoreState) {
205 | overlayStateStore.reset();
206 | overlayPositionStore.reset();
207 | }
208 | overlayView = new OverlayView(applicationContext);
209 | settingsView = new SettingsView(applicationContext);
210 | offsetPixelsView = (ViewGroup) LayoutInflater.from(applicationContext).inflate(R.layout.view_offset_pixels, null);
211 | offsetXTextView = (TextView) offsetPixelsView.findViewById(R.id.offset_x_text_view);
212 | offsetYTextView = (TextView) offsetPixelsView.findViewById(R.id.offset_y_text_view);
213 |
214 | overlayBorderSize = (int) applicationContext.getResources().getDimension(R.dimen.overlay_border_size);
215 | statusBarHeight = Utils.getStatusBarHeight(context);
216 | offsetTextTemplate = applicationContext.getString(R.string.offset_text);
217 |
218 | windowManager = (WindowManager) applicationContext.getSystemService(Service.WINDOW_SERVICE);
219 | addViewsToWindow(applicationContext);
220 | restoreState(context);
221 | }
222 |
223 | private void addViewsToWindow(Context context) {
224 | addOverlayView(context);
225 | addOffsetPixelsView();
226 | addSettingsView();
227 | }
228 |
229 | private void addOverlayView(final Context context) {
230 | overlayParams = new WindowManager.LayoutParams(
231 | ViewGroup.LayoutParams.WRAP_CONTENT,
232 | ViewGroup.LayoutParams.WRAP_CONTENT,
233 | WindowManager.LayoutParams.TYPE_PHONE,
234 | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
235 | PixelFormat.TRANSLUCENT);
236 |
237 | updateInitialOverlayPosition();
238 | disableOverlayAnimations();
239 | windowManager.addView(overlayView, overlayParams);
240 |
241 | final int overlayMinimumVisibleSize = (int) context.getResources().getDimension(R.dimen.overlay_minimum_visible_size);
242 |
243 | overlayView.setLayoutListener(new LayoutListener() {
244 |
245 | @Override
246 | public void onOverlayMoveX(int dx) {
247 | if (overlayParams.x + dx + overlayView.getWidth() >= overlayMinimumVisibleSize
248 | && Utils.getWindowWidth(windowManager) - overlayParams.x - dx >= overlayMinimumVisibleSize) {
249 | overlayParams.x += dx;
250 | windowManager.updateViewLayout(overlayView, overlayParams);
251 |
252 | offsetXTextView.setText(String.format(offsetTextTemplate, fixedOffsetX + overlayParams.x));
253 | }
254 | }
255 |
256 | @Override
257 | public void onOverlayMoveY(int dy) {
258 | if (overlayParams.y + dy + overlayView.getHeight() >= overlayMinimumVisibleSize
259 | && Utils.getWindowHeight(windowManager) - statusBarHeight - overlayParams.y - dy >= overlayMinimumVisibleSize) {
260 | overlayParams.y += dy;
261 | windowManager.updateViewLayout(overlayView, overlayParams);
262 |
263 | offsetYTextView.setText(String.format(offsetTextTemplate, fixedOffsetY + overlayParams.y));
264 | }
265 | }
266 |
267 | @Override
268 | public void onOverlayUpdate(int width, int height) {
269 | updateInitialOverlayPosition(width, height);
270 | windowManager.updateViewLayout(overlayView, overlayParams);
271 | }
272 |
273 | @Override
274 | public void onOffsetViewMoveX(int dx) {
275 | offsetPixelsViewParams.x += dx;
276 | windowManager.updateViewLayout(offsetPixelsView, offsetPixelsViewParams);
277 | }
278 |
279 | @Override
280 | public void onOffsetViewMoveY(int dy) {
281 | offsetPixelsViewParams.y += dy;
282 | windowManager.updateViewLayout(offsetPixelsView, offsetPixelsViewParams);
283 | }
284 |
285 | @Override
286 | public void hideOffsetView() {
287 | offsetPixelsView.setVisibility(View.INVISIBLE);
288 | }
289 |
290 | @Override
291 | public void showOffsetView(int xPos, int yPos) {
292 | if (offsetPixelsView.getVisibility() != View.VISIBLE) {
293 | offsetPixelsViewParams.x = xPos - offsetPixelsView.getWidth() / 2;
294 | offsetPixelsViewParams.y = yPos - offsetPixelsView.getHeight() * 3;
295 | windowManager.updateViewLayout(offsetPixelsView, offsetPixelsViewParams);
296 | offsetXTextView.setText(String.format(offsetTextTemplate, fixedOffsetX + overlayParams.x));
297 | offsetYTextView.setText(String.format(offsetTextTemplate, fixedOffsetY + overlayParams.y));
298 | offsetPixelsView.setVisibility(View.VISIBLE);
299 | }
300 | }
301 |
302 | @Override
303 | public void openSettings(boolean showImages) {
304 | displaySettingsView();
305 | if (showImages) {
306 | settingsView.openImagesSettingsScreen();
307 | }
308 | }
309 |
310 | @Override
311 | public void setInverseMode() {
312 | settingsView.setInverseMode();
313 | }
314 |
315 | @Override
316 | public void onFixOffset() {
317 | fixOffset();
318 | }
319 | });
320 | }
321 |
322 | private void updateInitialOverlayPosition(int imageWidth, int imageHeight) {
323 | overlayParams.gravity = Gravity.TOP | Gravity.START;
324 |
325 | int screenWidth = Utils.getWindowWidth(windowManager);
326 | int screenHeight = Utils.getWindowHeight(windowManager);
327 |
328 | int marginHorizontal = (screenWidth - imageWidth) / 2;
329 | int marginVertical = (screenHeight - imageHeight) / 2;
330 |
331 | if (overlayStateStore.getImageName() != null) {
332 | overlayParams.x = overlayPositionStore.getPositionX();
333 | fixedOffsetX = overlayPositionStore.getFixedOffsetX();
334 |
335 | overlayParams.y = overlayPositionStore.getPositionY();
336 | fixedOffsetY = overlayPositionStore.getFixedOffsetY();
337 | } else {
338 | overlayParams.x = -1 * overlayBorderSize + (marginHorizontal > 0 ? marginHorizontal : 0);
339 | fixedOffsetX = -1 * overlayParams.x;
340 |
341 | overlayParams.y = -1 * overlayBorderSize - statusBarHeight + (marginVertical > 0 ? marginVertical : 0);
342 | fixedOffsetY = -1 * overlayParams.y;
343 | }
344 | windowManager.updateViewLayout(overlayView, settingsParams);
345 | }
346 |
347 | private void disableOverlayAnimations() {
348 | try {
349 | int currentFlags = (Integer) overlayParams.getClass().getField("privateFlags").get(overlayParams);
350 | overlayParams.getClass().getField("privateFlags").set(overlayParams, currentFlags|0x00000040);
351 | } catch (Exception e) {
352 | Log.e(Overlay.class.getSimpleName(), "Error trying to disable window scale animation", e);
353 | }
354 | }
355 |
356 | private void updateInitialOverlayPosition() {
357 | overlayParams.gravity = Gravity.TOP | Gravity.START;
358 |
359 | if (overlayStateStore.getImageName() != null) {
360 | overlayParams.x = overlayPositionStore.getPositionX();
361 | fixedOffsetX = overlayPositionStore.getFixedOffsetX();
362 |
363 | overlayParams.y = overlayPositionStore.getPositionY();
364 | fixedOffsetY = overlayPositionStore.getFixedOffsetY();
365 | } else {
366 | overlayParams.x = -1 * overlayBorderSize + statusBarHeight;
367 | fixedOffsetX = -1 * overlayParams.x;
368 |
369 | overlayParams.y = -1 * overlayBorderSize + statusBarHeight;
370 | fixedOffsetY = -1 * overlayParams.y;
371 | }
372 | }
373 |
374 | private void displaySettingsView() {
375 | settingsView.updateOpacityProgress(overlayView.getImageAlpha());
376 | settingsView.updateOffset(fixedOffsetX + overlayParams.x, fixedOffsetY + overlayParams.y);
377 | settingsView.setVisibility(View.VISIBLE);
378 | }
379 |
380 | private void addSettingsView() {
381 | settingsParams = new WindowManager.LayoutParams(
382 | ViewGroup.LayoutParams.MATCH_PARENT,
383 | ViewGroup.LayoutParams.MATCH_PARENT,
384 | WindowManager.LayoutParams.TYPE_PHONE,
385 | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
386 | PixelFormat.TRANSLUCENT);
387 |
388 | settingsParams.gravity = Gravity.TOP | Gravity.START;
389 | windowManager.addView(settingsView, settingsParams);
390 |
391 | settingsView.setVisibility(View.GONE);
392 | settingsView.setListener(new SettingsListener() {
393 | @Override
394 | public void onSetImageAlpha(float alpha) {
395 | overlayView.setImageAlpha(alpha);
396 | }
397 |
398 | @Override
399 | public void onUpdateImage(Bitmap bitmap, boolean resetPosition) {
400 | overlayView.updateImage(bitmap, overlayScaleFactor);
401 | if (resetPosition) {
402 | overlayPositionStore.reset();
403 | overlayPositionStore.saveOrientation(overlayView.getResources().getConfiguration().orientation);
404 | }
405 | }
406 |
407 | @Override
408 | public void onFixOffset() {
409 | fixOffset();
410 | }
411 |
412 | @Override
413 | public boolean onInverseChecked(boolean saveOpacity) {
414 | boolean inverted = overlayView.invertImageBitmap(saveOpacity);
415 | settingsView.updateOpacityProgress(overlayView.getImageAlpha());
416 | return inverted;
417 | }
418 | });
419 | }
420 |
421 | private void fixOffset() {
422 | fixedOffsetX = -1 * overlayParams.x;
423 | fixedOffsetY = -1 * overlayParams.y;
424 |
425 | offsetXTextView.setText(String.format(offsetTextTemplate, fixedOffsetX + overlayParams.x));
426 | offsetYTextView.setText(String.format(offsetTextTemplate, fixedOffsetY + overlayParams.y));
427 | }
428 |
429 | private void addOffsetPixelsView() {
430 | offsetPixelsViewParams = new WindowManager.LayoutParams(
431 | ViewGroup.LayoutParams.WRAP_CONTENT,
432 | ViewGroup.LayoutParams.WRAP_CONTENT,
433 | WindowManager.LayoutParams.TYPE_SYSTEM_ERROR,
434 | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
435 | PixelFormat.TRANSLUCENT);
436 |
437 | offsetPixelsViewParams.gravity = Gravity.TOP | Gravity.START;
438 | offsetPixelsView.setVisibility(View.INVISIBLE);
439 | windowManager.addView(offsetPixelsView, offsetPixelsViewParams);
440 | }
441 | }
442 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/java/is/handsome/pixelperfect/OverlayPositionStore.java:
--------------------------------------------------------------------------------
1 | package is.handsome.pixelperfect;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import android.content.res.Configuration;
6 |
7 | class OverlayPositionStore {
8 |
9 | private static OverlayPositionStore mInstance = null;
10 |
11 | public static OverlayPositionStore getInstance(Context context) {
12 | if (mInstance == null) {
13 | mInstance = new OverlayPositionStore(context);
14 | }
15 | return mInstance;
16 | }
17 |
18 | private final SharedPreferences preferences;
19 |
20 | private int positionX;
21 | private int positionY;
22 | private int positionXLand;
23 | private int positionYLand;
24 | private int fixedOffsetX;
25 | private int fixedOffsetY;
26 | private int fixedOffsetXLand;
27 | private int fixedOffsetYLand;
28 | private int orientation;
29 |
30 | public OverlayPositionStore(Context context) {
31 | preferences = context.getSharedPreferences(OverlayPositionStore.class.getSimpleName(), Context.MODE_PRIVATE);
32 | positionX = preferences.getInt("positionX", 0);
33 | positionY = preferences.getInt("positionY", 0);
34 | positionXLand = preferences.getInt("positionXLand", 0);
35 | positionYLand = preferences.getInt("positionYLand", 0);
36 | fixedOffsetX = preferences.getInt("fixedOffsetX", 0);
37 | fixedOffsetY = preferences.getInt("fixedOffsetY", 0);
38 | fixedOffsetXLand = preferences.getInt("fixedOffsetXLand", 0);
39 | fixedOffsetYLand = preferences.getInt("fixedOffsetYLand", 0);
40 | orientation = preferences.getInt("orientation", Configuration.ORIENTATION_UNDEFINED);
41 | }
42 |
43 | public int getPositionX() {
44 | if (orientation == Configuration.ORIENTATION_PORTRAIT) {
45 | return positionX;
46 | } else {
47 | return positionXLand;
48 | }
49 | }
50 |
51 | public int getPositionY() {
52 | if (orientation == Configuration.ORIENTATION_PORTRAIT) {
53 | return positionY;
54 | } else {
55 | return positionYLand;
56 | }
57 | }
58 |
59 | public void savePosition(int x, int y) {
60 | if (orientation == Configuration.ORIENTATION_PORTRAIT) {
61 | this.positionX = x;
62 | this.positionY = y;
63 | preferences.edit().putInt("positionX", positionX).apply();
64 | preferences.edit().putInt("positionY", positionY).apply();
65 | } else {
66 | this.positionXLand = x;
67 | this.positionYLand = y;
68 | preferences.edit().putInt("positionXLand", positionXLand).apply();
69 | preferences.edit().putInt("positionYLand", positionYLand).apply();
70 | }
71 | }
72 |
73 | public int getFixedOffsetX() {
74 | if (orientation == Configuration.ORIENTATION_PORTRAIT) {
75 | return fixedOffsetX;
76 | } else {
77 | return fixedOffsetXLand;
78 | }
79 | }
80 |
81 | public int getFixedOffsetY() {
82 | if (orientation == Configuration.ORIENTATION_PORTRAIT) {
83 | return fixedOffsetY;
84 | } else {
85 | return fixedOffsetYLand;
86 | }
87 | }
88 |
89 | public void saveFixedOffset(int x, int y) {
90 | if (orientation == Configuration.ORIENTATION_PORTRAIT) {
91 | this.fixedOffsetX = x;
92 | this.fixedOffsetY = y;
93 | preferences.edit().putInt("fixedOffsetX", fixedOffsetX).apply();
94 | preferences.edit().putInt("fixedOffsetY", fixedOffsetY).apply();
95 | } else {
96 | this.fixedOffsetXLand = x;
97 | this.fixedOffsetYLand = y;
98 | preferences.edit().putInt("fixedOffsetXLand", fixedOffsetXLand).apply();
99 | preferences.edit().putInt("fixedOffsetYLand", fixedOffsetYLand).apply();
100 | }
101 | }
102 |
103 | public int getOrientation() {
104 | return orientation;
105 | }
106 |
107 | public void saveOrientation(int orientation) {
108 | this.orientation = orientation;
109 | preferences.edit().putInt("orientation", orientation).apply();
110 | }
111 |
112 | public void reset() {
113 | positionX = 0;
114 | positionY = 0;
115 | positionXLand = 0;
116 | positionYLand = 0;
117 | fixedOffsetX = 0;
118 | fixedOffsetY = 0;
119 | fixedOffsetXLand = 0;
120 | fixedOffsetYLand = 0;
121 | orientation = Configuration.ORIENTATION_UNDEFINED;
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/java/is/handsome/pixelperfect/OverlayStateStore.java:
--------------------------------------------------------------------------------
1 | package is.handsome.pixelperfect;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 |
6 | class OverlayStateStore {
7 |
8 | public enum SettingsState {
9 | CLOSED,
10 | OPENED_MAIN,
11 | OPENED_IMAGES;
12 |
13 | public static SettingsState fromInteger(int x) {
14 | switch (x) {
15 | case 0:
16 | return CLOSED;
17 | case 1:
18 | return OPENED_MAIN;
19 | case 2:
20 | return OPENED_IMAGES;
21 | }
22 | return CLOSED;
23 | }
24 | }
25 |
26 | private static OverlayStateStore mInstance = null;
27 |
28 | public static OverlayStateStore getInstance(Context context) {
29 | if (mInstance == null) {
30 | mInstance = new OverlayStateStore(context);
31 | }
32 | return mInstance;
33 | }
34 |
35 | private final SharedPreferences preferences;
36 |
37 | private boolean isPixelPerfectActive;
38 |
39 | private String imageName;
40 | private String assetsFolderName;
41 | private boolean isInverse;
42 | private float opacity;
43 | private int width;
44 | private int height;
45 | private SettingsState settingsState;
46 |
47 | public OverlayStateStore(Context context) {
48 | preferences = context.getSharedPreferences(OverlayStateStore.class.getSimpleName(), Context.MODE_PRIVATE);
49 | isPixelPerfectActive = preferences.getBoolean("isActive", false);
50 | imageName = preferences.getString("image", null);
51 | assetsFolderName = preferences.getString("assetsName", "pixelperfect");
52 | isInverse = preferences.getBoolean("inverse", false);
53 | opacity = preferences.getFloat("getOpacity", 0.5f);
54 | width = preferences.getInt("width", 0);
55 | height = preferences.getInt("height", 0);
56 | settingsState = SettingsState.fromInteger(preferences.getInt("settingsState", 0));
57 | }
58 |
59 | public boolean isInverse() {
60 | return isInverse;
61 | }
62 |
63 | public void saveInverse(boolean isInverse) {
64 | this.isInverse = isInverse;
65 | preferences.edit().putBoolean("inverse", isInverse).apply();
66 | }
67 |
68 | public boolean isPixelPerfectActive() {
69 | return isPixelPerfectActive;
70 | }
71 |
72 | public void savePixelPerfectActive(boolean isPixelPerfectActive) {
73 | this.isPixelPerfectActive = isPixelPerfectActive;
74 | preferences.edit().putBoolean("isActive", isPixelPerfectActive).apply();
75 | }
76 |
77 | public float getOpacity() {
78 | return opacity;
79 | }
80 |
81 | public void saveOpacity(float opacity) {
82 | this.opacity = opacity;
83 | preferences.edit().putFloat("getOpacity", opacity).apply();
84 | }
85 |
86 | public int getWidth() {
87 | return width;
88 | }
89 |
90 | public int getHeight() {
91 | return height;
92 | }
93 |
94 | public void saveSize(int width, int height) {
95 | this.width = width;
96 | this.height = height;
97 | preferences.edit().putInt("width", width).apply();
98 | preferences.edit().putInt("height", height).apply();
99 | }
100 |
101 | public String getImageName() {
102 | return imageName;
103 | }
104 |
105 | public void saveImageName(String imageName) {
106 | this.imageName = imageName;
107 | preferences.edit().putString("image", imageName).apply();
108 | }
109 |
110 | public String getAssetsFolderName() {
111 | return assetsFolderName;
112 | }
113 |
114 | public void saveAssetsFolderName(String assetsFolderName) {
115 | this.assetsFolderName = assetsFolderName;
116 | preferences.edit().putString("assetsName", assetsFolderName).apply();
117 | }
118 |
119 | public SettingsState getSettingsState() {
120 | return settingsState;
121 | }
122 |
123 | public void saveSettingsState(SettingsState settingsState) {
124 | this.settingsState = settingsState;
125 | preferences.edit().putInt("settingsState", settingsState.ordinal()).apply();
126 | }
127 |
128 | public void reset() {
129 | isPixelPerfectActive = false;
130 | imageName = null;
131 | assetsFolderName = "pixelperfect";
132 | isInverse = false;
133 | opacity = 0.5f;
134 | width = 0;
135 | height = 0;
136 | settingsState = SettingsState.CLOSED;
137 | preferences.edit().clear().apply();
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/java/is/handsome/pixelperfect/OverlayView.java:
--------------------------------------------------------------------------------
1 | package is.handsome.pixelperfect;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.graphics.Bitmap;
6 | import android.graphics.Color;
7 | import android.graphics.drawable.BitmapDrawable;
8 | import android.os.Build;
9 | import android.util.AttributeSet;
10 | import android.view.GestureDetector;
11 | import android.view.Gravity;
12 | import android.view.MotionEvent;
13 | import android.view.View;
14 | import android.view.ViewConfiguration;
15 | import android.view.ViewGroup;
16 | import android.widget.FrameLayout;
17 | import android.widget.ImageView;
18 | import android.widget.TextView;
19 |
20 | class OverlayView extends FrameLayout {
21 |
22 | private static int MICRO_OFFSET = 8;
23 | private static int OFFSET_VIEW_TIMEOUT = 500;
24 |
25 | public enum MoveMode {
26 | VERTICAL, HORIZONTAL, UNDEFINED
27 | }
28 |
29 | private ImageView pixelPerfectOverlayImageView;
30 | private TextView noOverlayImageTextView;
31 | private Overlay.LayoutListener layoutListener;
32 | private MoveMode moveMode = MoveMode.UNDEFINED;
33 | private int touchSlop;
34 | private OverlayStateStore overlayStateStore;
35 |
36 | private GestureDetector gestureDetector;
37 | private MotionEvent lastMotionEvent;
38 | private MotionEvent doubleTapEvent;
39 | private boolean justClick;
40 | private boolean wasActionDown;
41 | private boolean wasDoubleAction;
42 | private boolean letFastActions;
43 |
44 | private float microOffsetDx;
45 | private float microOffsetDy;
46 | private float offsetViewDx;
47 | private float offsetViewDy;
48 |
49 | public OverlayView(Context context) {
50 | super(context);
51 | init();
52 | }
53 |
54 | public OverlayView(Context context, AttributeSet attrs) {
55 | super(context, attrs);
56 | init();
57 | }
58 |
59 | public OverlayView(Context context, AttributeSet attrs, int defStyleAttr) {
60 | super(context, attrs, defStyleAttr);
61 | init();
62 | }
63 |
64 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
65 | public OverlayView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
66 | super(context, attrs, defStyleAttr, defStyleRes);
67 | init();
68 | }
69 |
70 | @Override
71 | public boolean onTouchEvent(MotionEvent event) {
72 | if (pixelPerfectOverlayImageView.getVisibility() == VISIBLE) {
73 | gestureDetector.onTouchEvent(event);
74 | return handleTouch(event);
75 | }
76 | clearTouchData();
77 | return false;
78 | }
79 |
80 | public void updateNoImageTextViewSize() {
81 | if (noOverlayImageTextView.getVisibility() == View.VISIBLE) {
82 | ViewGroup.LayoutParams containerParams = getLayoutParams();
83 | containerParams.width = overlayStateStore.getWidth() + 2 * (int) getResources().getDimension(R.dimen.overlay_border_size);
84 | containerParams.height = overlayStateStore.getHeight() + 2 * (int) getResources().getDimension(R.dimen.overlay_border_size);
85 | setLayoutParams(containerParams);
86 | }
87 | }
88 |
89 | public void setLayoutListener(Overlay.LayoutListener listener) {
90 | layoutListener = listener;
91 | }
92 |
93 | public void setImageVisible(boolean visible) {
94 | pixelPerfectOverlayImageView.setVisibility(visible ? VISIBLE : GONE);
95 | }
96 |
97 | public void setImageAlpha(float alpha) {
98 | pixelPerfectOverlayImageView.setAlpha(alpha);
99 | }
100 |
101 | public float getImageAlpha() {
102 | return pixelPerfectOverlayImageView.getAlpha();
103 | }
104 |
105 | public void updateImage(Bitmap bitmap, float overlayScaleFactor) {
106 | if (bitmap != null) {
107 | if (noOverlayImageTextView.getVisibility() == VISIBLE) {
108 | noOverlayImageTextView.setVisibility(GONE);
109 | letFastActions = true;
110 | }
111 | ViewGroup.LayoutParams layoutParams = pixelPerfectOverlayImageView.getLayoutParams();
112 | layoutParams.width = (int) (bitmap.getWidth() * overlayScaleFactor);
113 | layoutParams.height = (int) (bitmap.getHeight() * overlayScaleFactor);
114 | pixelPerfectOverlayImageView.setLayoutParams(layoutParams);
115 | pixelPerfectOverlayImageView.setImageBitmap(bitmap);
116 |
117 | ViewGroup.LayoutParams containerParams = getLayoutParams();
118 | containerParams.width = layoutParams.width + 2 * (int) getResources().getDimension(R.dimen.overlay_border_size);
119 | containerParams.height = layoutParams.height + 2 * (int) getResources().getDimension(R.dimen.overlay_border_size);
120 | setLayoutParams(containerParams);
121 |
122 | layoutListener.onOverlayUpdate(layoutParams.width, layoutParams.height);
123 | }
124 | }
125 |
126 | public boolean invertImageBitmap(boolean saveOpacity) {
127 | if (!saveOpacity) {
128 | setImageAlpha(0.5f);
129 | }
130 | if (pixelPerfectOverlayImageView.getDrawable() != null) {
131 | Bitmap srcBitmap = ((BitmapDrawable) pixelPerfectOverlayImageView.getDrawable()).getBitmap();
132 | Bitmap invertedBitmap = Utils.invertBitmap(srcBitmap);
133 | pixelPerfectOverlayImageView.setImageBitmap(invertedBitmap);
134 | return true;
135 | }
136 | return false;
137 | }
138 |
139 | public boolean isNoImageOverlay() {
140 | return noOverlayImageTextView.getVisibility() == VISIBLE;
141 | }
142 |
143 | private void initOverlay() {
144 | pixelPerfectOverlayImageView = new ImageView(getContext());
145 | final FrameLayout.LayoutParams layoutParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
146 | ViewGroup.LayoutParams.WRAP_CONTENT);
147 | int margin = (int) getResources().getDimension(R.dimen.overlay_border_size);
148 | layoutParams.setMargins(margin, margin, margin, margin);
149 | pixelPerfectOverlayImageView.setLayoutParams(layoutParams);
150 | pixelPerfectOverlayImageView.setVisibility(INVISIBLE);
151 | pixelPerfectOverlayImageView.setAlpha(0.5f);
152 | pixelPerfectOverlayImageView.setImageDrawable(null);
153 | addView(pixelPerfectOverlayImageView);
154 | initNoOverlayTextView();
155 | }
156 |
157 | private void initNoOverlayTextView() {
158 | int marginPortion = (int) getContext().getResources().getDimension(R.dimen.stub_overlay_margin_portion);
159 | int overlayWidth = overlayStateStore.getWidth() == 0 ?
160 | Utils.getWindowWidth(getContext()) - marginPortion * 2 : overlayStateStore.getWidth();
161 | int overlayHeight = overlayStateStore.getHeight() == 0 ?
162 | Utils.getWindowHeight(getContext()) - marginPortion * 3 : overlayStateStore.getHeight();
163 |
164 | final FrameLayout.LayoutParams noOverlayParams = new LayoutParams(overlayWidth, overlayHeight);
165 | int margin = (int) getResources().getDimension(R.dimen.overlay_border_size);
166 | noOverlayParams.setMargins(margin, margin, margin, margin);
167 |
168 | noOverlayImageTextView = new TextView(getContext());
169 | noOverlayImageTextView.setBackgroundResource(R.color.black_50_alpha);
170 | noOverlayImageTextView.setText(R.string.no_overlay_image_text);
171 | noOverlayImageTextView.setTextSize(22);
172 | noOverlayImageTextView.setGravity(Gravity.CENTER);
173 | noOverlayImageTextView.setTextColor(Color.WHITE);
174 | addView(noOverlayImageTextView, noOverlayParams);
175 | }
176 |
177 | private void init() {
178 | overlayStateStore = OverlayStateStore.getInstance(getContext());
179 | touchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
180 | setBackgroundResource(R.drawable.bg_overlay);
181 | initOverlay();
182 |
183 | gestureDetector = new GestureDetector(getContext(), new PixelPerfectLayoutGestureListener());
184 | }
185 |
186 | private void moveMockupOverlay(MotionEvent event) {
187 | if (justClick
188 | && Math.abs(event.getY() - lastMotionEvent.getY()) < touchSlop
189 | && Math.abs(event.getX() - lastMotionEvent.getX()) < touchSlop) {
190 | return;
191 | }
192 | if (justClick) {
193 | float dx = event.getRawX() - lastMotionEvent.getRawX();
194 | float dy = event.getRawY() - lastMotionEvent.getRawY();
195 | if (Math.abs(dx) >= Math.abs(dy)) {
196 | moveMode = MoveMode.HORIZONTAL;
197 | } else {
198 | moveMode = MoveMode.VERTICAL;
199 | }
200 | justClick = false;
201 | microOffsetDx = 0;
202 | microOffsetDy = 0;
203 | lastMotionEvent = MotionEvent.obtain(event);
204 | if (letFastActions) {
205 | layoutListener.showOffsetView((int) event.getRawX(), (int) event.getRawY());
206 | }
207 | } else {
208 | if (moveMode == MoveMode.HORIZONTAL) {
209 | float dx = event.getRawX() - lastMotionEvent.getRawX();
210 | if (Math.abs(dx) < MICRO_OFFSET) {
211 | microOffsetDx += dx / (MICRO_OFFSET * 2);
212 | dx = Math.round(microOffsetDx);
213 | if (dx != 0) {
214 | microOffsetDx = 0;
215 | }
216 | } else {
217 | microOffsetDx = 0;
218 | }
219 | layoutListener.onOverlayMoveX((int) dx);
220 | } else {
221 | float dy = event.getRawY() - lastMotionEvent.getRawY();
222 | if (Math.abs(dy) < MICRO_OFFSET) {
223 | microOffsetDy += dy / (MICRO_OFFSET * 2);
224 | dy = Math.round(microOffsetDy);
225 | if (dy != 0) {
226 | microOffsetDy = 0;
227 | }
228 | } else {
229 | microOffsetDy = 0;
230 | }
231 | layoutListener.onOverlayMoveY((int) dy);
232 | }
233 | if (letFastActions) {
234 | if ((int) (event.getRawX() - lastMotionEvent.getRawX() + offsetViewDx) == 0) {
235 | offsetViewDx += event.getRawX() - lastMotionEvent.getRawX();
236 | } else {
237 | layoutListener.onOffsetViewMoveX((int) (event.getRawX() - lastMotionEvent.getRawX() + offsetViewDx));
238 | offsetViewDx = (event.getRawX() - lastMotionEvent.getRawX() + offsetViewDx) % 1;
239 | }
240 |
241 | if ((int) (event.getRawY() - lastMotionEvent.getRawY() + offsetViewDy) == 0) {
242 | offsetViewDy += event.getRawY() - lastMotionEvent.getRawY();
243 | } else {
244 | layoutListener.onOffsetViewMoveY((int) (event.getRawY() - lastMotionEvent.getRawY() + offsetViewDy));
245 | offsetViewDy = (event.getRawY() - lastMotionEvent.getRawY() + offsetViewDy) % 1;
246 | }
247 | }
248 | lastMotionEvent = MotionEvent.obtain(event);
249 | }
250 | }
251 |
252 | private boolean handleTouch(final MotionEvent event) {
253 | if (event.getAction() == MotionEvent.ACTION_DOWN) {
254 | justClick = true;
255 | wasActionDown = true;
256 | lastMotionEvent = MotionEvent.obtain(event);
257 | return true;
258 | } else if (event.getAction() == MotionEvent.ACTION_MOVE && wasActionDown) {
259 | moveMockupOverlay(event);
260 | return true;
261 | }
262 | if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
263 | clearTouchData();
264 | return true;
265 | }
266 | clearTouchData();
267 | return false;
268 | }
269 |
270 | private void clearTouchData() {
271 | if (layoutListener != null) {
272 | layoutListener.hideOffsetView();
273 | }
274 | moveMode = MoveMode.UNDEFINED;
275 | wasActionDown = false;
276 | justClick = false;
277 | }
278 |
279 | private class PixelPerfectLayoutGestureListener extends GestureDetector.SimpleOnGestureListener {
280 |
281 | @Override
282 | public boolean onDown(MotionEvent event) {
283 | return true;
284 | }
285 |
286 | @Override
287 | public boolean onDoubleTap(final MotionEvent event) {
288 | wasDoubleAction = false;
289 | doubleTapEvent = MotionEvent.obtain(event);
290 | postDelayed(new Runnable() {
291 | @Override
292 | public void run() {
293 | if (letFastActions && !wasDoubleAction
294 | && Math.abs(event.getY() - doubleTapEvent.getY()) < touchSlop
295 | && Math.abs(event.getX() - doubleTapEvent.getX()) < touchSlop) {
296 | layoutListener.onFixOffset();
297 | }
298 | wasDoubleAction = true;
299 | }
300 | }, OFFSET_VIEW_TIMEOUT);
301 | return true;
302 | }
303 |
304 | @Override
305 | public boolean onDoubleTapEvent(MotionEvent event) {
306 | if (letFastActions && event.getAction() == MotionEvent.ACTION_UP && !wasDoubleAction) {
307 | layoutListener.setInverseMode();
308 | wasDoubleAction = true;
309 | return true;
310 | }
311 | return super.onDoubleTapEvent(event);
312 | }
313 |
314 | @Override
315 | public boolean onSingleTapConfirmed(MotionEvent event) {
316 | layoutListener.openSettings(noOverlayImageTextView.getVisibility() == VISIBLE);
317 | return true;
318 | }
319 |
320 | @Override
321 | public void onLongPress(MotionEvent event) {
322 | if (letFastActions && justClick) {
323 | layoutListener.showOffsetView((int) event.getRawX(), (int) event.getRawY());
324 | }
325 | }
326 | }
327 | }
328 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/java/is/handsome/pixelperfect/PixelPerfect.java:
--------------------------------------------------------------------------------
1 | package is.handsome.pixelperfect;
2 |
3 | import android.annotation.TargetApi;
4 | import android.app.Activity;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.net.Uri;
8 | import android.os.Build;
9 | import android.provider.Settings;
10 | import android.support.annotation.NonNull;
11 | import android.util.Log;
12 |
13 | public class PixelPerfect {
14 |
15 | public static class Config {
16 |
17 | private String overlayImageAssetsPath;
18 | private String overlayActiveImageName;
19 | private float overlayScaleFactor;
20 |
21 | private Config(Config.Builder configBuilder) {
22 | this.overlayImageAssetsPath = configBuilder.overlayImageAssetsPath;
23 | this.overlayActiveImageName = configBuilder.overlayActiveImageName;
24 | this.overlayScaleFactor = configBuilder.overlayScaleFactor;
25 | }
26 |
27 | public String getOverlayImageAssetsPath() {
28 | return overlayImageAssetsPath;
29 | }
30 |
31 | public String overlayActiveImageName() {
32 | return overlayActiveImageName;
33 | }
34 |
35 | public float getOverlayScaleFactor() {
36 | return overlayScaleFactor;
37 | }
38 |
39 | public static class Builder {
40 |
41 | private String overlayImageAssetsPath;
42 | private String overlayActiveImageName;
43 | private float overlayScaleFactor = 1;
44 |
45 | /**
46 | * Set custom path in assets folder
47 | * to overlay images
48 | *
49 | * @param overlayImagesAssetsPath
50 | * @return builder
51 | */
52 | public Builder overlayImagesAssetsPath(String overlayImagesAssetsPath) {
53 | this.overlayImageAssetsPath = overlayImagesAssetsPath;
54 | return this;
55 | }
56 |
57 | /**
58 | * Set active image name for overlay
59 | * that will be visible right after
60 | * creating PixelPerfect tool
61 | *
62 | * @param overlayActiveImageName
63 | * @return builder
64 | */
65 | public Builder overlayActiveImageName(String overlayActiveImageName) {
66 | this.overlayActiveImageName = overlayActiveImageName;
67 | return this;
68 | }
69 |
70 | /**
71 | * Add overlay scale factor that
72 | * is used for all overlay
73 | *
74 | * @param overlayScaleFactor
75 | * @return builder
76 | */
77 | public Builder overlayScaleFactor(float overlayScaleFactor) {
78 | this.overlayScaleFactor = overlayScaleFactor;
79 | return this;
80 | }
81 |
82 | public Config build() {
83 | return new Config(this);
84 | }
85 | }
86 | }
87 |
88 | private static Overlay overlay;
89 |
90 | private static ActivityLifeCycleObserver.Listener foregroundListener = new ActivityLifeCycleObserver.Listener() {
91 | @Override
92 | public void onBecameForeground() {
93 | overlay.show();
94 | }
95 |
96 | @Override
97 | public void onBecameBackground() {
98 | overlay.hide();
99 | }
100 |
101 | @Override
102 | public void onActivityStopped(Activity activity) {
103 | overlay.saveState(activity);
104 | hide();
105 | }
106 | };
107 |
108 | /**
109 | * Show pixel perfect tool that
110 | * displays screen overlay and settings view
111 | *
112 | * @param context
113 | */
114 | public static void show(@NonNull Context context) {
115 | showOverlay(context, null);
116 | }
117 |
118 | /**
119 | * Show pixel perfect tool
120 | * according to Config settings that
121 | * displays screen overlay and settings view
122 | *
123 | * @param context
124 | * @param config
125 | */
126 | public static void show(@NonNull Context context, PixelPerfect.Config config) {
127 | showOverlay(context, config);
128 | }
129 |
130 | /**
131 | * Check if PixelPerfect overlay is created
132 | * and is shown
133 | *
134 | * @return PixelPerfect overlay is shown or not
135 | */
136 | public static boolean isShown() {
137 | return overlay != null && overlay.isShown();
138 | }
139 |
140 | /**
141 | * Stop foreground listener and
142 | * remove overlay views from the window
143 | */
144 | public static void hide() {
145 | try {
146 | ActivityLifeCycleObserver.get().removeListener(foregroundListener);
147 | } catch (IllegalStateException exception) {
148 | Log.w(PixelPerfect.class.getSimpleName(), "Error during listener removing", exception);
149 | }
150 |
151 | if (overlay != null) {
152 | overlay.destroy();
153 | overlay = null;
154 | }
155 | }
156 |
157 | /**
158 | * Check if app has SYSTEM_ALERT_WINDOW for
159 | * Android M
160 | *
161 | * @param context
162 | * @return Is app has permission or not
163 | */
164 | @TargetApi(Build.VERSION_CODES.M)
165 | public static boolean hasPermission(Context context) {
166 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
167 | return Settings.canDrawOverlays(context);
168 | }
169 | return true;
170 | }
171 |
172 | /**
173 | * Ask for SYSTEM_ALERT_WINDOW permission
174 | * Android M
175 | *
176 | * @param context
177 | */
178 | @TargetApi(Build.VERSION_CODES.M)
179 | public static void askForPermission(Context context) {
180 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
181 | Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
182 | Uri.parse("package:" + context.getPackageName()));
183 | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
184 | context.startActivity(intent);
185 | }
186 | }
187 |
188 | private static void showOverlay(Context context, PixelPerfect.Config config) {
189 | if (overlay != null) {
190 | overlay.resetState();
191 | overlay.show();
192 | return;
193 | }
194 |
195 | if (!hasPermission(context)) {
196 | throw new IllegalStateException("permissions are not granted. You have to call askForPermission method before using showOverlay");
197 | }
198 |
199 | overlay = config == null ? new Overlay(context, false) :
200 | new Overlay(context, config);
201 | ActivityLifeCycleObserver.get(context.getApplicationContext()).addListener(foregroundListener);
202 | }
203 |
204 | static void showOverlayInner(Context context) {
205 | if (overlay != null) {
206 | overlay.show();
207 | return;
208 | }
209 |
210 | if (!hasPermission(context)) {
211 | throw new IllegalStateException("permissions are not granted. You have to call askForPermission method before using showOverlay");
212 | }
213 |
214 | overlay = new Overlay(context, true);
215 | ActivityLifeCycleObserver.get(context.getApplicationContext()).addListener(foregroundListener);
216 | overlay.resetState();
217 | }
218 | }
219 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/java/is/handsome/pixelperfect/SettingsView.java:
--------------------------------------------------------------------------------
1 | package is.handsome.pixelperfect;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.graphics.Bitmap;
6 | import android.graphics.Color;
7 | import android.os.Build;
8 | import android.support.v7.widget.GridLayoutManager;
9 | import android.support.v7.widget.RecyclerView;
10 | import android.util.AttributeSet;
11 | import android.view.KeyEvent;
12 | import android.view.View;
13 | import android.widget.CheckBox;
14 | import android.widget.CompoundButton;
15 | import android.widget.FrameLayout;
16 | import android.widget.ImageView;
17 | import android.widget.LinearLayout;
18 | import android.widget.SeekBar;
19 | import android.widget.TextView;
20 |
21 | import java.io.IOException;
22 | import java.util.ArrayList;
23 | import java.util.Arrays;
24 | import java.util.List;
25 |
26 | class SettingsView extends FrameLayout {
27 |
28 | public interface AdapterListener {
29 | void onItemSelected(int position);
30 | }
31 |
32 | private Overlay.SettingsListener settingsListener;
33 | private List imageNames = new ArrayList<>();
34 | private String overlayImageAssetsPath = "pixelperfect";
35 |
36 | private SeekBar opacitySeekBar;
37 | private TextView opacityTitleTextView;
38 | private LinearLayout firstScreenSettingsLinearLayout;
39 | private View secondScreenSettingsView;
40 | private ImageView exitButton;
41 | private TextView imageNameTextView;
42 | private String imageName;
43 | private TextView offsetTextView;
44 | private CheckBox inverseCheckbox;
45 |
46 | private RecyclerView recyclerView;
47 | private TextView emptyListTextView;
48 |
49 | private View backgroundLayout;
50 | private View mainLayout;
51 | private View toolbarView;
52 | private View opacityLayout;
53 |
54 | public SettingsView(Context context) {
55 | super(context);
56 | init();
57 | }
58 |
59 | public SettingsView(Context context, AttributeSet attrs) {
60 | super(context, attrs);
61 | init();
62 | }
63 |
64 |
65 | public SettingsView(Context context, AttributeSet attrs, int defStyleAttr) {
66 | super(context, attrs, defStyleAttr);
67 | init();
68 | }
69 |
70 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
71 | public SettingsView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
72 | super(context, attrs, defStyleAttr, defStyleRes);
73 | init();
74 | }
75 |
76 | @Override
77 | public boolean dispatchKeyEvent(KeyEvent event) {
78 | int action = event.getAction();
79 | int keyCode = event.getKeyCode();
80 |
81 | if (keyCode == KeyEvent.KEYCODE_BACK && action == KeyEvent.ACTION_DOWN) {
82 | onBack();
83 | return true;
84 | }
85 |
86 | return super.dispatchKeyEvent(event);
87 | }
88 |
89 | public void setListener(Overlay.SettingsListener listener) {
90 | this.settingsListener = listener;
91 | }
92 |
93 | public void setInverseMode() {
94 | inverseCheckbox.setChecked(!inverseCheckbox.isChecked());
95 | }
96 |
97 | public boolean isInverse() {
98 | return inverseCheckbox.isChecked();
99 | }
100 |
101 | public void setImageAssetsPath(String overlayImageAssetsPath) {
102 | this.overlayImageAssetsPath = overlayImageAssetsPath;
103 | updateAdapter();
104 | }
105 |
106 | public void setImageOverlay(int position) {
107 | if (position >= 0 && position < imageNames.size()) {
108 | Bitmap entireBitmap = Utils.getBitmapFromAssets(getContext(),
109 | overlayImageAssetsPath + "/" + imageNames.get(position));
110 | settingsListener.onUpdateImage(entireBitmap, false);
111 | imageNameTextView.setText(imageNames.get(position));
112 | ((ImagesAdapter) recyclerView.getAdapter()).setSelectedPosition(position);
113 | }
114 | }
115 |
116 | public void setImageOverlay(String imageName) {
117 | int position = indexOfImage(imageName);
118 | this.imageName = imageName;
119 | setImageOverlay(position);
120 | }
121 |
122 | public int indexOfImage(String imageName) {
123 | for (String image : imageNames) {
124 | if (image.equalsIgnoreCase(imageName)) {
125 | return imageNames.indexOf(image);
126 | }
127 | }
128 | return -1;
129 | }
130 |
131 | public void updateOpacityProgress(float currentAlpha) {
132 | opacitySeekBar.setProgress((int) (currentAlpha * 100));
133 | }
134 |
135 | public void onBack() {
136 | if (secondScreenSettingsView.getVisibility() == VISIBLE) {
137 | secondScreenSettingsView.setVisibility(GONE);
138 | firstScreenSettingsLinearLayout.setVisibility(VISIBLE);
139 | exitButton.setImageResource(R.drawable.ic_settings_cancel);
140 | } else {
141 | setVisibility(GONE);
142 | }
143 | }
144 |
145 | public void openImagesSettingsScreen() {
146 | secondScreenSettingsView.setVisibility(VISIBLE);
147 | exitButton.setImageResource(R.drawable.ic_back);
148 | }
149 |
150 | public OverlayStateStore.SettingsState getSettingsState() {
151 | if (getVisibility() != VISIBLE) {
152 | return OverlayStateStore.SettingsState.CLOSED;
153 | }
154 | if (secondScreenSettingsView.getVisibility() == VISIBLE) {
155 | return OverlayStateStore.SettingsState.OPENED_IMAGES;
156 | }
157 | return OverlayStateStore.SettingsState.OPENED_MAIN;
158 | }
159 |
160 | public void updateOffset(int x, int y) {
161 | offsetTextView.setText(String.format(getResources().getString(R.string.settings_offset_text), x, y));
162 | }
163 |
164 | public String currentImageName() {
165 | return imageName;
166 | }
167 |
168 | public String getOverlayImageAssetsPath() {
169 | return overlayImageAssetsPath;
170 | }
171 |
172 | private void init() {
173 | inflate(getContext(), R.layout.layout_settings, this);
174 | exitButton = (ImageView) findViewById(R.id.settings_exit_button);
175 | OnClickListener exitButtonListener = new OnClickListener() {
176 |
177 | @Override
178 | public void onClick(View v) {
179 | onBack();
180 | }
181 | };
182 | exitButton.setOnClickListener(exitButtonListener);
183 |
184 | backgroundLayout = findViewById(R.id.settings_background_frame_layout);
185 | mainLayout = findViewById(R.id.settings_main_linear_layout);
186 | opacityLayout = findViewById(R.id.settings_opacity_linear_layout);
187 | toolbarView = findViewById(R.id.settings_toolbar_linear_layout);
188 |
189 | initOpacityWidget();
190 | initImagesRecyclerView();
191 |
192 | findViewById(R.id.settings_images_option_linear_layout).setOnClickListener(new OnClickListener() {
193 | @Override
194 | public void onClick(View v) {
195 | findViewById(R.id.settings_first_screen_linear_layout).setVisibility(GONE);
196 | secondScreenSettingsView.setVisibility(VISIBLE);
197 | exitButton.setImageResource(R.drawable.ic_back);
198 | }
199 | });
200 |
201 | findViewById(R.id.settings_offset_option_linear_layout).setOnClickListener(new OnClickListener() {
202 | @Override
203 | public void onClick(View v) {
204 | settingsListener.onFixOffset();
205 | offsetTextView.setText(String.format(getResources().getString(R.string.settings_offset_text), 0, 0));
206 | }
207 | });
208 |
209 | firstScreenSettingsLinearLayout = (LinearLayout) findViewById(R.id.settings_first_screen_linear_layout);
210 | secondScreenSettingsView = findViewById(R.id.settings_second_screen_frame_layout);
211 | imageNameTextView = (TextView) findViewById(R.id.settings_image_name);
212 | offsetTextView = (TextView) findViewById(R.id.settings_offset_text_view);
213 | inverseCheckbox = (CheckBox) findViewById(R.id.inverse_checkbox);
214 | inverseCheckbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
215 | @Override
216 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
217 | settingsListener.onInverseChecked(!isChecked);
218 | }
219 | });
220 | }
221 |
222 | private void initOpacityWidget() {
223 | opacitySeekBar = (SeekBar) findViewById(R.id.settings_opacity_seek_bar);
224 | opacitySeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
225 | @Override
226 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
227 | if (settingsListener != null) {
228 | settingsListener.onSetImageAlpha(progress / 100.0f);
229 | }
230 | }
231 |
232 | @Override
233 | public void onStartTrackingTouch(SeekBar seekBar) {
234 | hideNonOpacityElements();
235 | }
236 |
237 | @Override
238 | public void onStopTrackingTouch(SeekBar seekBar) {
239 | showNonOpacityElements();
240 | }
241 | });
242 | opacityTitleTextView = (TextView) findViewById(R.id.opacity_title_text_view);
243 | }
244 |
245 | private void hideNonOpacityElements() {
246 | backgroundLayout.setBackgroundColor(Color.TRANSPARENT);
247 | mainLayout.setBackgroundColor(Color.TRANSPARENT);
248 | toolbarView.setVisibility(INVISIBLE);
249 | for (int i = 0; i < firstScreenSettingsLinearLayout.getChildCount(); i++) {
250 | firstScreenSettingsLinearLayout.getChildAt(i).setVisibility(INVISIBLE);
251 | }
252 | opacityLayout.setVisibility(VISIBLE);
253 | opacityLayout.setBackgroundResource(R.color.black_50_alpha);
254 | opacityTitleTextView.setTextColor(Color.WHITE);
255 | }
256 |
257 | private void showNonOpacityElements() {
258 | backgroundLayout.setBackgroundResource(R.color.black_30_alpha);
259 | mainLayout.setBackgroundResource(R.drawable.bg_settings_view_border);
260 | toolbarView.setVisibility(VISIBLE);
261 | for (int i = 0; i < firstScreenSettingsLinearLayout.getChildCount(); i++) {
262 | firstScreenSettingsLinearLayout.getChildAt(i).setVisibility(VISIBLE);
263 | }
264 | opacityLayout.setBackgroundColor(Color.TRANSPARENT);
265 | opacityTitleTextView.setTextColor(Color.BLACK);
266 | }
267 |
268 | private void initImagesRecyclerView() {
269 | recyclerView = (RecyclerView) findViewById(R.id.settings_images_recycler_view);
270 | emptyListTextView = (TextView) findViewById(R.id.settings_empty_list_text_view);
271 |
272 | recyclerView.setHasFixedSize(true);
273 |
274 | RecyclerView.LayoutManager layoutManager = new GridLayoutManager(getContext(), 3);
275 | recyclerView.setLayoutManager(layoutManager);
276 |
277 | updateAdapter();
278 | }
279 |
280 | private void updateAdapter() {
281 | updateImagesContent();
282 |
283 | if (imageNames.isEmpty()) {
284 | recyclerView.setVisibility(GONE);
285 | emptyListTextView.setVisibility(VISIBLE);
286 | emptyListTextView.setText(String.format(getResources().getString(R.string.settings_empty_list_message),
287 | overlayImageAssetsPath));
288 | } else {
289 | recyclerView.setVisibility(VISIBLE);
290 | emptyListTextView.setVisibility(GONE);
291 | recyclerView.setAdapter(new ImagesAdapter(getContext(), imageNames, overlayImageAssetsPath,
292 | new AdapterListener() {
293 |
294 | @Override
295 | public void onItemSelected(int position) {
296 | if (settingsListener != null) {
297 | Bitmap entireBitmap = Utils.getBitmapFromAssets(getContext(),
298 | overlayImageAssetsPath + "/" + imageNames.get(position));
299 | settingsListener.onUpdateImage(entireBitmap, true);
300 | if (inverseCheckbox.isChecked()) {
301 | settingsListener.onInverseChecked(true);
302 | }
303 | imageNameTextView.setText(imageNames.get(position));
304 | imageName = imageNames.get(position);
305 | exitSettingsView();
306 | }
307 | }
308 | }));
309 | }
310 | }
311 |
312 | private void updateImagesContent() {
313 | String[] filenames;
314 | try {
315 | filenames = getContext().getAssets().list(overlayImageAssetsPath);
316 | } catch (IOException e) {
317 | filenames = new String[0];
318 | }
319 | imageNames = Arrays.asList(filenames);
320 | }
321 |
322 | private void exitSettingsView() {
323 | firstScreenSettingsLinearLayout.setVisibility(VISIBLE);
324 | secondScreenSettingsView.setVisibility(GONE);
325 | exitButton.setImageResource(R.drawable.ic_settings_cancel);
326 | setVisibility(GONE);
327 | }
328 | }
329 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/java/is/handsome/pixelperfect/Utils.java:
--------------------------------------------------------------------------------
1 | package is.handsome.pixelperfect;
2 |
3 | import android.annotation.TargetApi;
4 | import android.app.Activity;
5 | import android.app.Service;
6 | import android.content.Context;
7 | import android.graphics.Bitmap;
8 | import android.graphics.BitmapFactory;
9 | import android.graphics.Canvas;
10 | import android.graphics.ColorFilter;
11 | import android.graphics.ColorMatrix;
12 | import android.graphics.ColorMatrixColorFilter;
13 | import android.graphics.Paint;
14 | import android.graphics.Point;
15 | import android.os.Build;
16 | import android.util.DisplayMetrics;
17 | import android.util.TypedValue;
18 | import android.view.Window;
19 | import android.view.WindowManager;
20 |
21 | import java.io.IOException;
22 | import java.io.InputStream;
23 |
24 | class Utils {
25 |
26 | public static int getWindowWidth(WindowManager windowManager) {
27 | Point displaySize = new Point();
28 | windowManager.getDefaultDisplay().getSize(displaySize);
29 | return displaySize.x;
30 | }
31 |
32 | public static int getWindowHeight(WindowManager windowManager) {
33 | Point displaySize = new Point();
34 | windowManager.getDefaultDisplay().getSize(displaySize);
35 | return displaySize.y;
36 | }
37 |
38 | public static int getWindowWidth(Context context) {
39 | WindowManager windowManager = (WindowManager) context.getSystemService(Service.WINDOW_SERVICE);
40 | return getWindowWidth(windowManager);
41 | }
42 |
43 | public static int getWindowHeight(Context context) {
44 | WindowManager windowManager = (WindowManager) context.getSystemService(Service.WINDOW_SERVICE);
45 | return getWindowHeight(windowManager);
46 | }
47 |
48 | @TargetApi(Build.VERSION_CODES.KITKAT)
49 | public static boolean isTranslucentStatusBar(Context context) {
50 | Window window = ((Activity) context).getWindow();
51 | int flags = window.getAttributes().flags;
52 | return (flags & WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
53 | == WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
54 | }
55 |
56 | public static int getStatusBarHeight(Context context) {
57 | int statusBarHeightDp = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? 24 : 25;
58 | return convertDipsToPixels(context, statusBarHeightDp);
59 | }
60 |
61 | private static int convertDipsToPixels(Context context, int dips) {
62 | DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
63 | return (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dips, displayMetrics);
64 | }
65 |
66 | public static Bitmap invertBitmap(Bitmap src) {
67 | ColorMatrix invertedColorMatrix =
68 | new ColorMatrix(new float[]{
69 | -1, 0, 0, 0, 255,
70 | 0, -1, 0, 0, 255,
71 | 0, 0, -1, 0, 255,
72 | 0, 0, 0, 1, 0});
73 |
74 | ColorFilter sepiaColorFilter = new ColorMatrixColorFilter(invertedColorMatrix);
75 | Bitmap bitmap = Bitmap.createBitmap(src.getWidth(), src.getHeight(), Bitmap.Config.ARGB_8888);
76 | Canvas canvas = new Canvas(bitmap);
77 | Paint paint = new Paint();
78 | paint.setColorFilter(sepiaColorFilter);
79 | canvas.drawBitmap(src, 0, 0, paint);
80 | return bitmap;
81 | }
82 |
83 | public static Bitmap getBitmapFromAssets(Context context, String fullName) {
84 | InputStream inputStream = null;
85 | try {
86 | inputStream = context.getAssets().open(fullName);
87 | return BitmapFactory.decodeStream(inputStream);
88 | } catch (IOException e) {
89 | return null;
90 | } finally {
91 | if (inputStream != null) {
92 | try {
93 | inputStream.close();
94 | } catch (IOException e) {
95 | e.printStackTrace();
96 | }
97 | }
98 | }
99 | }
100 |
101 | private Utils() {
102 | throw new AssertionError("no instances");
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_off_disabled_focused_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_off_disabled_focused_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_off_disabled_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_off_disabled_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_off_focused_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_off_focused_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_off_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_off_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_off_pressed_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_off_pressed_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_on_disabled_focused_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_on_disabled_focused_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_on_disabled_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_on_disabled_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_on_focused_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_on_focused_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_on_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_on_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_on_pressed_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-hdpi/apptheme_btn_check_on_pressed_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-hdpi/apptheme_scrubber_control_disabled_holo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-hdpi/apptheme_scrubber_control_disabled_holo.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-hdpi/apptheme_scrubber_control_focused_holo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-hdpi/apptheme_scrubber_control_focused_holo.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-hdpi/apptheme_scrubber_control_normal_holo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-hdpi/apptheme_scrubber_control_normal_holo.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-hdpi/apptheme_scrubber_control_pressed_holo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-hdpi/apptheme_scrubber_control_pressed_holo.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-hdpi/apptheme_scrubber_primary_holo.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-hdpi/apptheme_scrubber_primary_holo.9.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-hdpi/apptheme_scrubber_secondary_holo.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-hdpi/apptheme_scrubber_secondary_holo.9.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-hdpi/apptheme_scrubber_track_holo_light.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-hdpi/apptheme_scrubber_track_holo_light.9.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_off_disabled_focused_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_off_disabled_focused_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_off_disabled_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_off_disabled_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_off_focused_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_off_focused_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_off_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_off_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_off_pressed_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_off_pressed_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_on_disabled_focused_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_on_disabled_focused_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_on_disabled_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_on_disabled_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_on_focused_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_on_focused_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_on_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_on_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_on_pressed_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-mdpi/apptheme_btn_check_on_pressed_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-mdpi/apptheme_scrubber_control_disabled_holo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-mdpi/apptheme_scrubber_control_disabled_holo.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-mdpi/apptheme_scrubber_control_focused_holo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-mdpi/apptheme_scrubber_control_focused_holo.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-mdpi/apptheme_scrubber_control_normal_holo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-mdpi/apptheme_scrubber_control_normal_holo.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-mdpi/apptheme_scrubber_control_pressed_holo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-mdpi/apptheme_scrubber_control_pressed_holo.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-mdpi/apptheme_scrubber_primary_holo.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-mdpi/apptheme_scrubber_primary_holo.9.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-mdpi/apptheme_scrubber_secondary_holo.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-mdpi/apptheme_scrubber_secondary_holo.9.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-mdpi/apptheme_scrubber_track_holo_light.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-mdpi/apptheme_scrubber_track_holo_light.9.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_off_disabled_focused_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_off_disabled_focused_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_off_disabled_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_off_disabled_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_off_focused_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_off_focused_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_off_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_off_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_off_pressed_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_off_pressed_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_on_disabled_focused_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_on_disabled_focused_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_on_disabled_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_on_disabled_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_on_focused_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_on_focused_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_on_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_on_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_on_pressed_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/apptheme_btn_check_on_pressed_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/apptheme_scrubber_control_disabled_holo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/apptheme_scrubber_control_disabled_holo.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/apptheme_scrubber_control_focused_holo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/apptheme_scrubber_control_focused_holo.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/apptheme_scrubber_control_normal_holo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/apptheme_scrubber_control_normal_holo.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/apptheme_scrubber_control_pressed_holo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/apptheme_scrubber_control_pressed_holo.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/apptheme_scrubber_primary_holo.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/apptheme_scrubber_primary_holo.9.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/apptheme_scrubber_secondary_holo.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/apptheme_scrubber_secondary_holo.9.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/apptheme_scrubber_track_holo_light.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/apptheme_scrubber_track_holo_light.9.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/ic_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/ic_back.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/ic_placeholder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/ic_placeholder.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xhdpi/ic_settings_cancel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xhdpi/ic_settings_cancel.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_off_disabled_focused_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_off_disabled_focused_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_off_disabled_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_off_disabled_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_off_focused_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_off_focused_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_off_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_off_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_off_pressed_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_off_pressed_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_on_disabled_focused_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_on_disabled_focused_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_on_disabled_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_on_disabled_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_on_focused_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_on_focused_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_on_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_on_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_on_pressed_holo_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_btn_check_on_pressed_holo_light.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_scrubber_control_disabled_holo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_scrubber_control_disabled_holo.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_scrubber_control_focused_holo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_scrubber_control_focused_holo.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_scrubber_control_normal_holo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_scrubber_control_normal_holo.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_scrubber_control_pressed_holo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_scrubber_control_pressed_holo.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_scrubber_primary_holo.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_scrubber_primary_holo.9.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_scrubber_secondary_holo.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_scrubber_secondary_holo.9.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_scrubber_track_holo_light.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/pixelperfect/src/main/res/drawable-xxhdpi/apptheme_scrubber_track_holo_light.9.png
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable/apptheme_btn_check_holo_light.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
12 |
13 |
16 |
19 |
20 |
23 |
26 |
27 |
30 |
33 |
34 |
35 |
36 |
37 |
39 |
41 |
42 |
44 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable/apptheme_scrubber_control_selector_holo_light.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable/apptheme_scrubber_progress_horizontal_holo_light.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 | -
6 |
8 |
9 | -
10 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable/bg_opacity_demo_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable/bg_overlay.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
12 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable/bg_settings_image_border.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable/bg_settings_image_label.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable/bg_settings_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/drawable/bg_settings_view_border.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
10 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/layout/layout_recycler_view_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
23 |
24 |
25 |
36 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/layout/layout_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
20 |
21 |
26 |
27 |
33 |
34 |
41 |
42 |
50 |
51 |
52 |
53 |
57 |
58 |
63 |
64 |
65 |
71 |
72 |
76 |
77 |
85 |
86 |
87 |
88 |
91 |
92 |
97 |
98 |
99 |
100 |
109 |
110 |
116 |
117 |
125 |
126 |
127 |
128 |
133 |
134 |
135 |
136 |
143 |
144 |
151 |
152 |
159 |
160 |
161 |
162 |
167 |
168 |
169 |
170 |
176 |
177 |
184 |
185 |
190 |
191 |
192 |
193 |
198 |
199 |
200 |
201 |
208 |
209 |
215 |
216 |
221 |
222 |
223 |
224 |
225 |
226 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/layout/view_offset_pixels.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
26 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #00000000
4 | #FFFFFF
5 | #4D000000
6 | #66000000
7 | #80000000
8 | #B3000000
9 | #000000
10 | #dddddd
11 |
12 | #00a5c4
13 | #D900a5c4
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/values/com_crashlytics_export_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 | 20988447-edce-4818-86e8-ff16a362c022
10 |
11 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 1dp
4 | 50dp
5 | 25dp
6 | 90dp
7 | 150dp
8 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | PixelPerfect
3 | Tap to set\noverlay image
4 | %d px
5 |
6 | Pixel Perfect
7 | Image
8 | No overlay image
9 | Transparency
10 | Inverse
11 | Fix offset as reference
12 | (%1$dpx, %2$dpx)
13 | Please, add overlay imageNames to\n\'%s\' assets folder
14 |
15 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/pixelperfect/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/pixelperfect/src/test/java/is/handsome/pixelperfect/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package is.handsome.pixelperfect;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/sample/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/sample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'io.fabric'
3 | apply plugin: 'org.moallemi.advanced-build-version'
4 |
5 | buildscript {
6 | repositories {
7 | jcenter()
8 | maven { url 'https://maven.fabric.io/public' }
9 | }
10 |
11 | dependencies {
12 | classpath 'io.fabric.tools:gradle:1.21.2'
13 | classpath 'org.moallemi.gradle.advanced-build-version:gradle-plugin:1.5.3'
14 | }
15 | }
16 |
17 | advancedVersioning {
18 | nameOptions {
19 | versionMajor 1
20 | versionMinor 0
21 | }
22 |
23 | codeOptions {
24 | versionCodeType org.moallemi.gradle.internal.VersionCodeType.DATE
25 | }
26 | }
27 |
28 | android {
29 | compileSdkVersion 23
30 | buildToolsVersion "23.0.3"
31 |
32 | defaultConfig {
33 | applicationId "is.handsome.pixelperfectsample"
34 | minSdkVersion 16
35 | targetSdkVersion 23
36 | versionCode advancedVersioning.versionCode
37 | versionName advancedVersioning.versionName
38 | }
39 |
40 | signingConfigs {
41 | debug {
42 | storeFile file('../keystores/debug.keystore')
43 | storePassword 'android'
44 | keyAlias 'androiddebugkey'
45 | keyPassword 'android'
46 | }
47 | release {
48 | storeFile file('../keystores/pseudo-release.keystore')
49 | storePassword 'android'
50 | keyAlias 'androiddebugkey'
51 | keyPassword 'android'
52 | }
53 | }
54 |
55 | buildTypes {
56 | debug {
57 | signingConfig signingConfigs.debug
58 | }
59 | release {
60 | minifyEnabled false
61 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
62 |
63 | ext.betaDistributionReleaseNotesFilePath = "releaseNotes.txt"
64 | ext.betaDistributionGroupAliasesFilePath = "groupAliases.txt"
65 | ext.betaDistributionNotifications = false
66 |
67 | signingConfig signingConfigs.release
68 | }
69 | }
70 | }
71 |
72 | repositories {
73 | maven { url 'https://maven.fabric.io/public' }
74 | }
75 |
76 | dependencies {
77 | compile project(':pixelperfect')
78 |
79 | compile 'com.android.support:appcompat-v7:23.4.0'
80 | compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
81 | transitive = true;
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/sample/fabric.properties:
--------------------------------------------------------------------------------
1 | #Contains API Secret used to validate your application. Commit to internal source control; avoid making secret public.
2 | #Mon Dec 14 18:09:35 OMST 2015
3 | apiSecret=e4acd8ed59fd72975605a06ed7d217885c52a41b729ff615050b004f5b0afd59
4 |
--------------------------------------------------------------------------------
/sample/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/okonoreva/Library/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 |
--------------------------------------------------------------------------------
/sample/src/androidTest/java/is/handsome/pixelperfectsample/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package is.handsome.pixelperfectsample;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/sample/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
13 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/sample/src/main/assets/overlays-1080/landscape.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/sample/src/main/assets/overlays-1080/landscape.png
--------------------------------------------------------------------------------
/sample/src/main/assets/overlays-1080/portrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/sample/src/main/assets/overlays-1080/portrait.png
--------------------------------------------------------------------------------
/sample/src/main/assets/overlays-1440/landscape.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/sample/src/main/assets/overlays-1440/landscape.png
--------------------------------------------------------------------------------
/sample/src/main/assets/overlays-1440/portrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/sample/src/main/assets/overlays-1440/portrait.png
--------------------------------------------------------------------------------
/sample/src/main/assets/overlays-480/landscape.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/sample/src/main/assets/overlays-480/landscape.png
--------------------------------------------------------------------------------
/sample/src/main/assets/overlays-480/portrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/sample/src/main/assets/overlays-480/portrait.png
--------------------------------------------------------------------------------
/sample/src/main/assets/overlays-720/landscape.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/sample/src/main/assets/overlays-720/landscape.png
--------------------------------------------------------------------------------
/sample/src/main/assets/overlays-720/portrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/sample/src/main/assets/overlays-720/portrait.png
--------------------------------------------------------------------------------
/sample/src/main/java/is/handsome/pixelperfectsample/HomeActivity.java:
--------------------------------------------------------------------------------
1 | package is.handsome.pixelperfectsample;
2 |
3 | import android.graphics.Bitmap;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.view.View;
7 | import android.widget.CheckBox;
8 | import android.widget.CompoundButton;
9 | import android.widget.ImageView;
10 |
11 | import is.handsome.pixelperfect.PixelPerfect;
12 |
13 | public class HomeActivity extends AppCompatActivity {
14 |
15 | private ImageView imageView;
16 | private CheckBox pixelPerfectCheckBox;
17 | private View permissionLinearLayout;
18 |
19 | private int[] portraitDimens = {1440, 1080, 720, 480};
20 |
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | setContentView(R.layout.activity_home);
25 |
26 | final String overlayImagesAssetsPath = constructOverlayImagesAssetsPath();
27 | final String coverImageAssetsPath = constructCoverImageAssetsPath(overlayImagesAssetsPath);
28 |
29 | imageView = (ImageView) findViewById(R.id.home_image_view);
30 | Bitmap bitmap = SampleUtils.getBitmapFromAssets(this, coverImageAssetsPath);
31 | imageView.setImageBitmap(bitmap);
32 |
33 | pixelPerfectCheckBox = (CheckBox) findViewById(R.id.pixel_perfect_checkbox);
34 | pixelPerfectCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
35 | @Override
36 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
37 | if (isChecked) {
38 | PixelPerfect.Config config = new PixelPerfect.Config.Builder()
39 | .overlayImagesAssetsPath(overlayImagesAssetsPath)
40 | .build();
41 | PixelPerfect.show(HomeActivity.this, config);
42 | } else {
43 | PixelPerfect.hide();
44 | }
45 | }
46 | });
47 |
48 | permissionLinearLayout = findViewById(R.id.pixel_perfect_permission_linear_layout);
49 | }
50 |
51 | @Override
52 | protected void onResume() {
53 | super.onResume();
54 | if (PixelPerfect.hasPermission(this)) {
55 | pixelPerfectCheckBox.setVisibility(View.VISIBLE);
56 | permissionLinearLayout.setVisibility(View.GONE);
57 |
58 | if (PixelPerfect.isShown()) {
59 | pixelPerfectCheckBox.setChecked(true);
60 | }
61 | } else {
62 | pixelPerfectCheckBox.setVisibility(View.GONE);
63 | permissionLinearLayout.setVisibility(View.VISIBLE);
64 | }
65 | }
66 |
67 | public void openPermissionSettings(View view) {
68 | PixelPerfect.askForPermission(this);
69 | }
70 |
71 |
72 | private String constructOverlayImagesAssetsPath() {
73 | int screenMinDimension = Math.min(SampleUtils.getWindowWidth(this), SampleUtils.getWindowHeight(this));
74 | for (int width : portraitDimens) {
75 | if (width <= screenMinDimension) {
76 | return "overlays-" + String.valueOf(width);
77 | }
78 | }
79 | return "overlays-" + 480;
80 | }
81 |
82 | private String constructCoverImageAssetsPath(String overlayImagesAssetsPath) {
83 | int screenMinDimension = Math.min(SampleUtils.getWindowWidth(this), SampleUtils.getWindowHeight(this));
84 | return screenMinDimension == SampleUtils.getWindowWidth(this)
85 | ? overlayImagesAssetsPath + "/portrait.png" : overlayImagesAssetsPath + "/landscape.png";
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/sample/src/main/java/is/handsome/pixelperfectsample/SampleUtils.java:
--------------------------------------------------------------------------------
1 | package is.handsome.pixelperfectsample;
2 |
3 | import android.app.Service;
4 | import android.content.Context;
5 | import android.graphics.Bitmap;
6 | import android.graphics.BitmapFactory;
7 | import android.graphics.Point;
8 | import android.view.WindowManager;
9 |
10 | import java.io.IOException;
11 | import java.io.InputStream;
12 |
13 | public class SampleUtils {
14 |
15 | public static int getWindowWidth(Context context) {
16 | WindowManager windowManager = (WindowManager) context.getSystemService(Service.WINDOW_SERVICE);
17 | Point displaySize = new Point();
18 | windowManager.getDefaultDisplay().getSize(displaySize);
19 | return displaySize.x;
20 | }
21 |
22 | public static int getWindowHeight(Context context) {
23 | WindowManager windowManager = (WindowManager) context.getSystemService(Service.WINDOW_SERVICE);
24 | Point displaySize = new Point();
25 | windowManager.getDefaultDisplay().getSize(displaySize);
26 | return displaySize.y;
27 | }
28 |
29 | public static Bitmap getBitmapFromAssets(Context context, String fullName) {
30 | int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
31 | InputStream inputStream = null;
32 | try {
33 | inputStream = context.getAssets().open(fullName);
34 | return decodeBitmapFromInputStream(inputStream, screenWidth);
35 | } catch (IOException e) {
36 | return null;
37 | } finally {
38 | if (inputStream != null) {
39 | try {
40 | inputStream.close();
41 | } catch (IOException e) {
42 | e.printStackTrace();
43 | }
44 | }
45 | }
46 | }
47 |
48 | private static Bitmap decodeBitmapFromInputStream(InputStream inputStream, int reqWidth) {
49 | final BitmapFactory.Options options = new BitmapFactory.Options();
50 | options.inJustDecodeBounds = true;
51 | BitmapFactory.decodeStream(inputStream, null, options);
52 | options.inSampleSize = calculateInSampleSize(options, reqWidth);
53 | options.inJustDecodeBounds = false;
54 | try {
55 | inputStream.reset();
56 | } catch (IOException e) {
57 | e.printStackTrace();
58 | }
59 | return BitmapFactory.decodeStream(inputStream, null, options);
60 | }
61 |
62 | private static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth) {
63 | final int width = options.outWidth;
64 | int inSampleSize = 1;
65 |
66 | if (width > reqWidth) {
67 | final int halfWidth = width / 2;
68 | while ((halfWidth / inSampleSize) > reqWidth) {
69 | inSampleSize *= 2;
70 | }
71 | }
72 | return inSampleSize;
73 | }
74 |
75 | private SampleUtils() {
76 | throw new AssertionError("no instances");
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout-land/activity_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
21 |
22 |
23 |
33 |
34 |
42 |
43 |
49 |
50 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/activity_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
20 |
21 |
22 |
33 |
34 |
42 |
43 |
48 |
49 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/sample/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/sample/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/handsomecode/pixel-perfect-for-android/fe70f83626a1a5383e718b84196ca17dfc58577b/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #2196F3
4 | #1976D2
5 | #448AFF
6 |
7 | #00000000
8 | #FFFFFF
9 | #66000000
10 | #80000000
11 | #B3000000
12 |
13 | #0000ff
14 |
15 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | PixelPerfectSample
3 | Pixel Perfect
4 | Please go to Settings and turn on \'Drawing over other apps\' option to enable Pixel Perfect.
5 | Go to settings
6 |
7 |
--------------------------------------------------------------------------------
/sample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/sample/src/test/java/is/handsome/pixelperfectsample/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package is.handsome.pixelperfectsample;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/sample/version.properties:
--------------------------------------------------------------------------------
1 | #Fri Dec 18 15:30:51 OMST 2015
2 | AI_VERSION_CODE=20
3 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':sample', ':pixelperfect'
2 |
--------------------------------------------------------------------------------