├── .github └── workflows │ ├── main.yml │ └── pull_requests.yml ├── .gitignore ├── .idea ├── .name ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── gradle.xml ├── misc.xml ├── runConfigurations.xml └── vcs.xml ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── layoutSnapshots │ ├── e1_flat_layout.json │ ├── e1_flat_layout_240x320.json │ ├── e2_nested_layout.json │ └── e2_nested_layout_only_specified views.json └── src │ ├── main │ ├── AndroidManifest.xml │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── e1_flat_layout.xml │ │ └── e2_nested_layout.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── redapparat │ └── demo │ └── DemoLayoutTest.kt ├── build.gradle ├── deploy.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── layoutverifier-tests ├── .gitignore ├── build.gradle ├── layoutSnapshots │ ├── flat_layout.json │ ├── flat_layout__small_screen.json │ ├── flat_layout__view_subset.json │ ├── generated_view_id.json │ ├── nested_layout.json │ ├── recycler_view__3_elements.json │ ├── recycler_view__50_elements.json │ └── schema_v3_features.json └── src │ ├── main │ ├── AndroidManifest.xml │ └── res │ │ └── layout │ │ ├── case_001.xml │ │ ├── case_002.xml │ │ ├── case_003.xml │ │ ├── case_004.xml │ │ ├── case_005.xml │ │ ├── case_006.xml │ │ ├── case_007.xml │ │ ├── case_008.xml │ │ ├── case_009.xml │ │ ├── case_014.xml │ │ └── case_015.xml │ └── test │ └── java │ └── com │ └── redapparat │ └── layoutverifier │ └── tests │ ├── LayoutVerifierIntegrationTests.kt │ └── view │ └── SimpleAdapter.kt ├── layoutverifier ├── .gitignore ├── build.gradle └── src │ ├── main │ ├── AndroidManifest.xml │ └── java │ │ └── com │ │ └── redapparat │ │ └── layoutverifier │ │ ├── LayoutMatcher.kt │ │ ├── LayoutVerifier.kt │ │ ├── Schemas.kt │ │ ├── extractor │ │ ├── CommonExtractor.kt │ │ ├── CompositeFeatureExtractor.kt │ │ ├── DefaultFeatures.kt │ │ ├── FeatureExtractor.kt │ │ └── content │ │ │ └── TextViewExtractor.kt │ │ └── serializer │ │ ├── GsonSerializer.kt │ │ └── Serializer.kt │ └── test │ └── java │ └── com │ └── redapparat │ └── layoutverifier │ ├── ExampleUnitTest.kt │ └── SchemasTest.kt └── settings.gradle /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Android Master CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | 8 | jobs: 9 | test: 10 | name: Run Unit Tests 11 | runs-on: ubuntu-18.04 12 | 13 | steps: 14 | - uses: actions/checkout@v1 15 | - name: set up JDK 1.9 16 | uses: actions/setup-java@v1 17 | with: 18 | java-version: 1.9 19 | - name: Unit tests 20 | run: bash ./gradlew :layoutverifier-tests:testDebugUnitTest --stacktrace 21 | -------------------------------------------------------------------------------- /.github/workflows/pull_requests.yml: -------------------------------------------------------------------------------- 1 | name: Android Pull Request 2 | 3 | on: pull_request 4 | 5 | jobs: 6 | test: 7 | name: Run Unit Tests 8 | runs-on: ubuntu-18.04 9 | 10 | steps: 11 | - uses: actions/checkout@v1 12 | - name: set up JDK 1.9 13 | uses: actions/setup-java@v1 14 | with: 15 | java-version: 1.9 16 | - name: Unit tests 17 | run: bash ./gradlew :layoutverifier-tests:testDebugUnitTest --stacktrace 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | My Application -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | xmlns:android 17 | 18 | ^$ 19 | 20 | 21 | 22 |
23 |
24 | 25 | 26 | 27 | xmlns:.* 28 | 29 | ^$ 30 | 31 | 32 | BY_NAME 33 | 34 |
35 |
36 | 37 | 38 | 39 | .*:id 40 | 41 | http://schemas.android.com/apk/res/android 42 | 43 | 44 | 45 |
46 |
47 | 48 | 49 | 50 | .*:name 51 | 52 | http://schemas.android.com/apk/res/android 53 | 54 | 55 | 56 |
57 |
58 | 59 | 60 | 61 | name 62 | 63 | ^$ 64 | 65 | 66 | 67 |
68 |
69 | 70 | 71 | 72 | style 73 | 74 | ^$ 75 | 76 | 77 | 78 |
79 |
80 | 81 | 82 | 83 | .* 84 | 85 | ^$ 86 | 87 | 88 | BY_NAME 89 | 90 |
91 |
92 | 93 | 94 | 95 | .* 96 | 97 | http://schemas.android.com/apk/res/android 98 | 99 | 100 | ANDROID_ATTRIBUTE_ORDER 101 | 102 |
103 |
104 | 105 | 106 | 107 | .* 108 | 109 | .* 110 | 111 | 112 | BY_NAME 113 | 114 |
115 |
116 |
117 |
118 | 119 | 121 |
122 |
-------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LayoutVerifier 2 | 3 | ![](https://github.com/dmitry-zaitsev/LayoutVerifier/workflows/Android%20Master%20CI/badge.svg) 4 | 5 | Test Android layouts without device. LayoutVerifier is a Robolectric-based testing library which 6 | makes sure your Android screens are never broken again. 7 | 8 | **What's in the box:** 9 | - Library which makes sure that your Views are where they are supposed to be on the screen. 10 | - No need for an emulator. 11 | - No need for a build plugin or complex initial setup. Single library is all it takes. 12 | - As little as 3 lines to write a test. 13 | - Similar to Screenshot tests but much faster. 14 | 15 | ## Usage 16 | 17 | Get started by adding LayoutVerifier to your test dependencies and do some minimal configuration: 18 | 19 | ``` 20 | android { 21 | 22 | testOptions { 23 | unitTests { 24 | includeAndroidResources = true 25 | } 26 | } 27 | 28 | } 29 | 30 | dependencies { 31 | 32 | // Make sure Robolectric is included 33 | 34 | testImplementation 'com.redapparat:layoutverifier:1.1.2' 35 | } 36 | 37 | ``` 38 | 39 | Then, simply write a JUnit test: 40 | 41 | ``` 42 | // LayoutVerifier instance can be reused between tests 43 | val layoutVerifier = LayoutVerifier.Builder(getApplicationContext()) 44 | .build() 45 | 46 | // For each new test, pick a layout and call match() 47 | layoutVerifier 48 | .layout(R.layout.myLayout) 49 | .screenSize(600, 800) // optional: screen size in DP 50 | .views( // optional: those views which you care about, otherwise compare all views 51 | R.id.buyButton, 52 | R.id.totalPrice 53 | ) 54 | .match("test_case_name") // optional: arbitraty test case name which is unique to your module 55 | ``` 56 | 57 | That is it. On the first run the test will pass and save a pre-recorded version of the layout to 58 | disk. Make sure to keep this file and include it into your commits. 59 | 60 | ### Updating to a new version 61 | 62 | New versions of LayoutVerifier might include new attributes into view comparison which were not previously recorded in a snapshot file. LayoutVerifier takes care of backward compatibility and generates a new snapshot file if version update is detected. 63 | 64 | As such, after upgrading to a new version you might see that snapshot files have changed. That is expected, be sure to commit them as part of your repository as you would do for any new test. 65 | 66 | ## How it works 67 | 68 | ### Concept 69 | 70 | LayoutVerifier captures essential information about your View (i.e. elements position, 71 | text content) and then compares it to a pre-recorded "standard" version of the layout. If there is 72 | no pre-recorded version available, current state of the view is assumed to be correct and then 73 | recorded as a new standard for future comparisons. 74 | 75 | If you have worked with Screenshot-tests before all of that might sound familiar to you. 76 | LayoutVerifier uses a very similar concept but instead of comparing screenshots it compares data. 77 | 78 | ### How views are compared 79 | 80 | The following view features (aka attrbiutes) are compared: 81 | 82 | - Position (left, top, right, bottom) 83 | - Text (children of a `TextView`, including `EditText` and `Button`) 84 | - Enabled state 85 | - Clickable state 86 | 87 | Furthermore, new features can easily be added by providing a custom implementation of 88 | `FeatureExtractor`. 89 | 90 | ## License 91 | 92 | ``` 93 | Copyright 2020 LayoutVerifier 94 | 95 | Licensed under the Apache License, Version 2.0 (the "License"); 96 | you may not use this file except in compliance with the License. 97 | You may obtain a copy of the License at 98 | 99 | http://www.apache.org/licenses/LICENSE-2.0 100 | 101 | Unless required by applicable law or agreed to in writing, software 102 | distributed under the License is distributed on an "AS IS" BASIS, 103 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 104 | See the License for the specific language governing permissions and 105 | limitations under the License. 106 | ``` 107 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | 5 | android { 6 | compileSdkVersion 29 7 | buildToolsVersion "29.0.3" 8 | 9 | defaultConfig { 10 | applicationId "com.redapparat.demo" 11 | minSdkVersion 16 12 | targetSdkVersion 29 13 | versionCode 1 14 | versionName "1.0" 15 | 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 | } 18 | 19 | testOptions { 20 | unitTests { 21 | includeAndroidResources = true 22 | } 23 | } 24 | 25 | } 26 | 27 | dependencies { 28 | implementation fileTree(dir: 'libs', include: ['*.jar']) 29 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 30 | implementation 'androidx.appcompat:appcompat:1.1.0' 31 | implementation 'androidx.core:core-ktx:1.2.0' 32 | 33 | testImplementation 'junit:junit:4.12' 34 | testImplementation 'androidx.test:core:1.2.0' 35 | testImplementation 'androidx.test.ext:junit:1.1.1' 36 | testImplementation 'androidx.test:runner:1.2.0' 37 | testImplementation 'androidx.test:rules:1.2.0' 38 | testImplementation 'org.robolectric:robolectric:4.3.1' 39 | testImplementation project(':layoutverifier') 40 | } 41 | -------------------------------------------------------------------------------- /app/layoutSnapshots/e1_flat_layout.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 3, 3 | "features": { 4 | "left": 0.0, 5 | "top": 0.0, 6 | "right": 600.0, 7 | "bottom": 800.0, 8 | "type": "android.widget.LinearLayout", 9 | "enabled": true, 10 | "clickable": false, 11 | "id": "No id", 12 | "visibility": "VISIBLE", 13 | "background": "null", 14 | "children": [ 15 | { 16 | "left": 0.0, 17 | "top": 0.0, 18 | "right": 600.0, 19 | "bottom": 41.0, 20 | "type": "android.widget.TextView", 21 | "enabled": true, 22 | "clickable": false, 23 | "id": "com.redapparat.demo:id/textView", 24 | "visibility": "VISIBLE", 25 | "background": "null", 26 | "paddingStart": 0.0, 27 | "paddingTop": 0.0, 28 | "paddingEnd": 0.0, 29 | "paddingBottom": 0.0, 30 | "text": "Hello World", 31 | "textColor": "#8a000000", 32 | "textSize": 14.0 33 | }, 34 | { 35 | "left": 0.0, 36 | "top": 41.0, 37 | "right": 600.0, 38 | "bottom": 102.0, 39 | "type": "android.widget.Button", 40 | "enabled": true, 41 | "clickable": true, 42 | "id": "com.redapparat.demo:id/button", 43 | "visibility": "VISIBLE", 44 | "background": "Drawable", 45 | "paddingStart": 12.0, 46 | "paddingTop": 10.0, 47 | "paddingEnd": 12.0, 48 | "paddingBottom": 10.0, 49 | "text": "Button", 50 | "textColor": "#de000000", 51 | "textSize": 14.0 52 | } 53 | ] 54 | } 55 | } -------------------------------------------------------------------------------- /app/layoutSnapshots/e1_flat_layout_240x320.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 3, 3 | "features": { 4 | "left": 0.0, 5 | "top": 0.0, 6 | "right": 240.0, 7 | "bottom": 320.0, 8 | "type": "android.widget.LinearLayout", 9 | "enabled": true, 10 | "clickable": false, 11 | "id": "No id", 12 | "visibility": "VISIBLE", 13 | "background": "null", 14 | "children": [ 15 | { 16 | "left": 0.0, 17 | "top": 0.0, 18 | "right": 240.0, 19 | "bottom": 41.0, 20 | "type": "android.widget.TextView", 21 | "enabled": true, 22 | "clickable": false, 23 | "id": "com.redapparat.demo:id/textView", 24 | "visibility": "VISIBLE", 25 | "background": "null", 26 | "paddingStart": 0.0, 27 | "paddingTop": 0.0, 28 | "paddingEnd": 0.0, 29 | "paddingBottom": 0.0, 30 | "text": "Hello World", 31 | "textColor": "#8a000000", 32 | "textSize": 14.0 33 | }, 34 | { 35 | "left": 0.0, 36 | "top": 41.0, 37 | "right": 240.0, 38 | "bottom": 102.0, 39 | "type": "android.widget.Button", 40 | "enabled": true, 41 | "clickable": true, 42 | "id": "com.redapparat.demo:id/button", 43 | "visibility": "VISIBLE", 44 | "background": "Drawable", 45 | "paddingStart": 12.0, 46 | "paddingTop": 10.0, 47 | "paddingEnd": 12.0, 48 | "paddingBottom": 10.0, 49 | "text": "Button", 50 | "textColor": "#de000000", 51 | "textSize": 14.0 52 | } 53 | ] 54 | } 55 | } -------------------------------------------------------------------------------- /app/layoutSnapshots/e2_nested_layout.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 3, 3 | "features": { 4 | "left": 0.0, 5 | "top": 0.0, 6 | "right": 600.0, 7 | "bottom": 800.0, 8 | "type": "android.widget.RelativeLayout", 9 | "enabled": true, 10 | "clickable": false, 11 | "id": "No id", 12 | "visibility": "VISIBLE", 13 | "background": "null", 14 | "children": [ 15 | { 16 | "left": 0.0, 17 | "top": 0.0, 18 | "right": 600.0, 19 | "bottom": 41.0, 20 | "type": "android.widget.LinearLayout", 21 | "enabled": true, 22 | "clickable": false, 23 | "id": "No id", 24 | "visibility": "VISIBLE", 25 | "background": "null", 26 | "children": [ 27 | { 28 | "left": 298.0, 29 | "top": 0.0, 30 | "right": 301.0, 31 | "bottom": 41.0, 32 | "type": "android.widget.TextView", 33 | "enabled": true, 34 | "clickable": false, 35 | "id": "com.redapparat.demo:id/text_top", 36 | "visibility": "VISIBLE", 37 | "background": "null", 38 | "paddingStart": 0.0, 39 | "paddingTop": 0.0, 40 | "paddingEnd": 0.0, 41 | "paddingBottom": 0.0, 42 | "text": "Top", 43 | "textColor": "#8a000000", 44 | "textSize": 14.0 45 | } 46 | ] 47 | }, 48 | { 49 | "left": 0.0, 50 | "top": 759.0, 51 | "right": 600.0, 52 | "bottom": 800.0, 53 | "type": "android.widget.LinearLayout", 54 | "enabled": true, 55 | "clickable": false, 56 | "id": "No id", 57 | "visibility": "VISIBLE", 58 | "background": "null", 59 | "children": [ 60 | { 61 | "left": 297.0, 62 | "top": 0.0, 63 | "right": 303.0, 64 | "bottom": 41.0, 65 | "type": "android.widget.TextView", 66 | "enabled": true, 67 | "clickable": false, 68 | "id": "com.redapparat.demo:id/text_bottom", 69 | "visibility": "VISIBLE", 70 | "background": "null", 71 | "paddingStart": 0.0, 72 | "paddingTop": 0.0, 73 | "paddingEnd": 0.0, 74 | "paddingBottom": 0.0, 75 | "text": "Bottom", 76 | "textColor": "#8a000000", 77 | "textSize": 14.0 78 | } 79 | ] 80 | } 81 | ] 82 | } 83 | } -------------------------------------------------------------------------------- /app/layoutSnapshots/e2_nested_layout_only_specified views.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 3, 3 | "features": { 4 | "children": [ 5 | { 6 | "children": [ 7 | { 8 | "left": 298.0, 9 | "top": 0.0, 10 | "right": 301.0, 11 | "bottom": 41.0, 12 | "type": "android.widget.TextView", 13 | "enabled": true, 14 | "clickable": false, 15 | "id": "com.redapparat.demo:id/text_top", 16 | "visibility": "VISIBLE", 17 | "background": "null", 18 | "paddingStart": 0.0, 19 | "paddingTop": 0.0, 20 | "paddingEnd": 0.0, 21 | "paddingBottom": 0.0, 22 | "text": "Top", 23 | "textColor": "#8a000000", 24 | "textSize": 14.0 25 | } 26 | ] 27 | }, 28 | { 29 | "children": [ 30 | { 31 | "left": 297.0, 32 | "top": 0.0, 33 | "right": 303.0, 34 | "bottom": 41.0, 35 | "type": "android.widget.TextView", 36 | "enabled": true, 37 | "clickable": false, 38 | "id": "com.redapparat.demo:id/text_bottom", 39 | "visibility": "VISIBLE", 40 | "background": "null", 41 | "paddingStart": 0.0, 42 | "paddingTop": 0.0, 43 | "paddingEnd": 0.0, 44 | "paddingBottom": 0.0, 45 | "text": "Bottom", 46 | "textColor": "#8a000000", 47 | "textSize": 14.0 48 | } 49 | ] 50 | } 51 | ] 52 | } 53 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/e1_flat_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 12 |