Repository: h6ah4i/android-materialshadowninepatch Branch: master Commit: eb527faf693a Files: 389 Total size: 258.6 KB Directory structure: gitextract_5tr75mf2/ ├── .gitignore ├── LICENSE ├── NOTICE ├── README.md ├── RELEASE-NOTES.md ├── build.gradle ├── common/ │ ├── android-maven-publish.gradle │ ├── android-set-common-properties.gradle │ └── android-signing-utils.gradle ├── example/ │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src/ │ ├── androidTest/ │ │ └── java/ │ │ └── com/ │ │ └── h6ah4i/ │ │ └── android/ │ │ └── example/ │ │ └── materialshadowninepatch/ │ │ └── ApplicationTest.java │ └── main/ │ ├── AndroidManifest.xml │ ├── java/ │ │ └── com/ │ │ └── h6ah4i/ │ │ └── android/ │ │ └── example/ │ │ └── materialshadowninepatch/ │ │ ├── MainActivity.java │ │ ├── ProgrammaticallyAddDemoActivity.java │ │ ├── ProgrammaticallyAddDemoFragment.java │ │ ├── ShadowStylesDemoActivity.java │ │ ├── ShadowStylesDemoFragment.java │ │ ├── XYPositionDemoActivity.java │ │ ├── XYPositionDemoFragment.java │ │ ├── ZPositionAnimationDemoActivity.java │ │ ├── ZPositionAnimationDemoFragment.java │ │ ├── ZPositionDemoActivity.java │ │ └── ZPositionDemoFragment.java │ └── res/ │ ├── layout/ │ │ ├── activity_demo_screen.xml │ │ ├── activity_main.xml │ │ ├── compat_shadow_items.xml │ │ ├── debug_layout.xml │ │ ├── fragment_programmatically_add_demo.xml │ │ ├── fragment_shadow_styles_demo.xml │ │ ├── fragment_xy_position_demo.xml │ │ ├── fragment_z_position_animation_demo.xml │ │ ├── fragment_z_position_demo.xml │ │ └── native_shadow_items.xml │ ├── values/ │ │ ├── dimens.xml │ │ ├── strings.xml │ │ ├── styles.xml │ │ └── values.xml │ ├── values-v21/ │ │ └── values.xml │ └── values-w820dp/ │ └── dimens.xml ├── gradle/ │ └── wrapper/ │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── gradlew ├── gradlew.bat ├── library/ │ ├── .gitignore │ ├── build.gradle │ ├── library-data.properties │ ├── proguard-rules.pro │ └── src/ │ ├── androidTest/ │ │ └── java/ │ │ └── com/ │ │ └── h6ah4i/ │ │ └── android/ │ │ └── materialshadowninepatch/ │ │ └── ApplicationTest.java │ └── main/ │ ├── AndroidManifest.xml │ ├── java/ │ │ └── com/ │ │ └── h6ah4i/ │ │ └── android/ │ │ └── materialshadowninepatch/ │ │ ├── MaterialShadowContainerView.java │ │ └── MaterialShadowContainerViewProperties.java │ └── res/ │ ├── drawable-hdpi/ │ │ ├── ms9_ambient_shadow_z1.xml │ │ ├── ms9_ambient_shadow_z10.xml │ │ ├── ms9_ambient_shadow_z11.xml │ │ ├── ms9_ambient_shadow_z12.xml │ │ ├── ms9_ambient_shadow_z13.xml │ │ ├── ms9_ambient_shadow_z14.xml │ │ ├── ms9_ambient_shadow_z15.xml │ │ ├── ms9_ambient_shadow_z16.xml │ │ ├── ms9_ambient_shadow_z17.xml │ │ ├── ms9_ambient_shadow_z18.xml │ │ ├── ms9_ambient_shadow_z2.xml │ │ ├── ms9_ambient_shadow_z3.xml │ │ ├── ms9_ambient_shadow_z4.xml │ │ ├── ms9_ambient_shadow_z5.xml │ │ ├── ms9_ambient_shadow_z6.xml │ │ ├── ms9_ambient_shadow_z7.xml │ │ ├── ms9_ambient_shadow_z8.xml │ │ ├── ms9_ambient_shadow_z9.xml │ │ ├── ms9_composite_shadow_z1.xml │ │ ├── ms9_composite_shadow_z2.xml │ │ ├── ms9_composite_shadow_z3.xml │ │ ├── ms9_composite_shadow_z4.xml │ │ ├── ms9_composite_shadow_z5.xml │ │ ├── ms9_composite_shadow_z6.xml │ │ ├── ms9_composite_shadow_z7.xml │ │ ├── ms9_composite_shadow_z8.xml │ │ ├── ms9_composite_shadow_z9.xml │ │ ├── ms9_spot_shadow_z1.xml │ │ ├── ms9_spot_shadow_z10.xml │ │ ├── ms9_spot_shadow_z11.xml │ │ ├── ms9_spot_shadow_z12.xml │ │ ├── ms9_spot_shadow_z13.xml │ │ ├── ms9_spot_shadow_z14.xml │ │ ├── ms9_spot_shadow_z15.xml │ │ ├── ms9_spot_shadow_z16.xml │ │ ├── ms9_spot_shadow_z17.xml │ │ ├── ms9_spot_shadow_z18.xml │ │ ├── ms9_spot_shadow_z2.xml │ │ ├── ms9_spot_shadow_z3.xml │ │ ├── ms9_spot_shadow_z4.xml │ │ ├── ms9_spot_shadow_z5.xml │ │ ├── ms9_spot_shadow_z6.xml │ │ ├── ms9_spot_shadow_z7.xml │ │ ├── ms9_spot_shadow_z8.xml │ │ └── ms9_spot_shadow_z9.xml │ ├── drawable-ldpi/ │ │ ├── ms9_ambient_shadow_z1.xml │ │ ├── ms9_ambient_shadow_z10.xml │ │ ├── ms9_ambient_shadow_z11.xml │ │ ├── ms9_ambient_shadow_z12.xml │ │ ├── ms9_ambient_shadow_z13.xml │ │ ├── ms9_ambient_shadow_z14.xml │ │ ├── ms9_ambient_shadow_z15.xml │ │ ├── ms9_ambient_shadow_z16.xml │ │ ├── ms9_ambient_shadow_z17.xml │ │ ├── ms9_ambient_shadow_z18.xml │ │ ├── ms9_ambient_shadow_z2.xml │ │ ├── ms9_ambient_shadow_z3.xml │ │ ├── ms9_ambient_shadow_z4.xml │ │ ├── ms9_ambient_shadow_z5.xml │ │ ├── ms9_ambient_shadow_z6.xml │ │ ├── ms9_ambient_shadow_z7.xml │ │ ├── ms9_ambient_shadow_z8.xml │ │ ├── ms9_ambient_shadow_z9.xml │ │ ├── ms9_composite_shadow_z1.xml │ │ ├── ms9_composite_shadow_z2.xml │ │ ├── ms9_composite_shadow_z3.xml │ │ ├── ms9_composite_shadow_z4.xml │ │ ├── ms9_composite_shadow_z5.xml │ │ ├── ms9_composite_shadow_z6.xml │ │ ├── ms9_composite_shadow_z7.xml │ │ ├── ms9_composite_shadow_z8.xml │ │ ├── ms9_composite_shadow_z9.xml │ │ ├── ms9_spot_shadow_z1.xml │ │ ├── ms9_spot_shadow_z10.xml │ │ ├── ms9_spot_shadow_z11.xml │ │ ├── ms9_spot_shadow_z12.xml │ │ ├── ms9_spot_shadow_z13.xml │ │ ├── ms9_spot_shadow_z14.xml │ │ ├── ms9_spot_shadow_z15.xml │ │ ├── ms9_spot_shadow_z16.xml │ │ ├── ms9_spot_shadow_z17.xml │ │ ├── ms9_spot_shadow_z18.xml │ │ ├── ms9_spot_shadow_z2.xml │ │ ├── ms9_spot_shadow_z3.xml │ │ ├── ms9_spot_shadow_z4.xml │ │ ├── ms9_spot_shadow_z5.xml │ │ ├── ms9_spot_shadow_z6.xml │ │ ├── ms9_spot_shadow_z7.xml │ │ ├── ms9_spot_shadow_z8.xml │ │ └── ms9_spot_shadow_z9.xml │ ├── drawable-mdpi/ │ │ ├── ms9_ambient_shadow_z1.xml │ │ ├── ms9_ambient_shadow_z10.xml │ │ ├── ms9_ambient_shadow_z11.xml │ │ ├── ms9_ambient_shadow_z12.xml │ │ ├── ms9_ambient_shadow_z13.xml │ │ ├── ms9_ambient_shadow_z14.xml │ │ ├── ms9_ambient_shadow_z15.xml │ │ ├── ms9_ambient_shadow_z16.xml │ │ ├── ms9_ambient_shadow_z17.xml │ │ ├── ms9_ambient_shadow_z18.xml │ │ ├── ms9_ambient_shadow_z2.xml │ │ ├── ms9_ambient_shadow_z3.xml │ │ ├── ms9_ambient_shadow_z4.xml │ │ ├── ms9_ambient_shadow_z5.xml │ │ ├── ms9_ambient_shadow_z6.xml │ │ ├── ms9_ambient_shadow_z7.xml │ │ ├── ms9_ambient_shadow_z8.xml │ │ ├── ms9_ambient_shadow_z9.xml │ │ ├── ms9_composite_shadow_z1.xml │ │ ├── ms9_composite_shadow_z2.xml │ │ ├── ms9_composite_shadow_z3.xml │ │ ├── ms9_composite_shadow_z4.xml │ │ ├── ms9_composite_shadow_z5.xml │ │ ├── ms9_composite_shadow_z6.xml │ │ ├── ms9_composite_shadow_z7.xml │ │ ├── ms9_composite_shadow_z8.xml │ │ ├── ms9_composite_shadow_z9.xml │ │ ├── ms9_spot_shadow_z1.xml │ │ ├── ms9_spot_shadow_z10.xml │ │ ├── ms9_spot_shadow_z11.xml │ │ ├── ms9_spot_shadow_z12.xml │ │ ├── ms9_spot_shadow_z13.xml │ │ ├── ms9_spot_shadow_z14.xml │ │ ├── ms9_spot_shadow_z15.xml │ │ ├── ms9_spot_shadow_z16.xml │ │ ├── ms9_spot_shadow_z17.xml │ │ ├── ms9_spot_shadow_z18.xml │ │ ├── ms9_spot_shadow_z2.xml │ │ ├── ms9_spot_shadow_z3.xml │ │ ├── ms9_spot_shadow_z4.xml │ │ ├── ms9_spot_shadow_z5.xml │ │ ├── ms9_spot_shadow_z6.xml │ │ ├── ms9_spot_shadow_z7.xml │ │ ├── ms9_spot_shadow_z8.xml │ │ └── ms9_spot_shadow_z9.xml │ ├── drawable-tvdpi/ │ │ ├── ms9_ambient_shadow_z1.xml │ │ ├── ms9_ambient_shadow_z10.xml │ │ ├── ms9_ambient_shadow_z11.xml │ │ ├── ms9_ambient_shadow_z12.xml │ │ ├── ms9_ambient_shadow_z13.xml │ │ ├── ms9_ambient_shadow_z14.xml │ │ ├── ms9_ambient_shadow_z15.xml │ │ ├── ms9_ambient_shadow_z16.xml │ │ ├── ms9_ambient_shadow_z17.xml │ │ ├── ms9_ambient_shadow_z18.xml │ │ ├── ms9_ambient_shadow_z2.xml │ │ ├── ms9_ambient_shadow_z3.xml │ │ ├── ms9_ambient_shadow_z4.xml │ │ ├── ms9_ambient_shadow_z5.xml │ │ ├── ms9_ambient_shadow_z6.xml │ │ ├── ms9_ambient_shadow_z7.xml │ │ ├── ms9_ambient_shadow_z8.xml │ │ ├── ms9_ambient_shadow_z9.xml │ │ ├── ms9_composite_shadow_z1.xml │ │ ├── ms9_composite_shadow_z2.xml │ │ ├── ms9_composite_shadow_z3.xml │ │ ├── ms9_composite_shadow_z4.xml │ │ ├── ms9_composite_shadow_z5.xml │ │ ├── ms9_composite_shadow_z6.xml │ │ ├── ms9_composite_shadow_z7.xml │ │ ├── ms9_composite_shadow_z8.xml │ │ ├── ms9_composite_shadow_z9.xml │ │ ├── ms9_spot_shadow_z1.xml │ │ ├── ms9_spot_shadow_z10.xml │ │ ├── ms9_spot_shadow_z11.xml │ │ ├── ms9_spot_shadow_z12.xml │ │ ├── ms9_spot_shadow_z13.xml │ │ ├── ms9_spot_shadow_z14.xml │ │ ├── ms9_spot_shadow_z15.xml │ │ ├── ms9_spot_shadow_z16.xml │ │ ├── ms9_spot_shadow_z17.xml │ │ ├── ms9_spot_shadow_z18.xml │ │ ├── ms9_spot_shadow_z2.xml │ │ ├── ms9_spot_shadow_z3.xml │ │ ├── ms9_spot_shadow_z4.xml │ │ ├── ms9_spot_shadow_z5.xml │ │ ├── ms9_spot_shadow_z6.xml │ │ ├── ms9_spot_shadow_z7.xml │ │ ├── ms9_spot_shadow_z8.xml │ │ └── ms9_spot_shadow_z9.xml │ ├── drawable-xhdpi/ │ │ ├── ms9_ambient_shadow_z1.xml │ │ ├── ms9_ambient_shadow_z10.xml │ │ ├── ms9_ambient_shadow_z11.xml │ │ ├── ms9_ambient_shadow_z12.xml │ │ ├── ms9_ambient_shadow_z13.xml │ │ ├── ms9_ambient_shadow_z14.xml │ │ ├── ms9_ambient_shadow_z15.xml │ │ ├── ms9_ambient_shadow_z16.xml │ │ ├── ms9_ambient_shadow_z17.xml │ │ ├── ms9_ambient_shadow_z18.xml │ │ ├── ms9_ambient_shadow_z2.xml │ │ ├── ms9_ambient_shadow_z3.xml │ │ ├── ms9_ambient_shadow_z4.xml │ │ ├── ms9_ambient_shadow_z5.xml │ │ ├── ms9_ambient_shadow_z6.xml │ │ ├── ms9_ambient_shadow_z7.xml │ │ ├── ms9_ambient_shadow_z8.xml │ │ ├── ms9_ambient_shadow_z9.xml │ │ ├── ms9_composite_shadow_z1.xml │ │ ├── ms9_composite_shadow_z2.xml │ │ ├── ms9_composite_shadow_z3.xml │ │ ├── ms9_composite_shadow_z4.xml │ │ ├── ms9_composite_shadow_z5.xml │ │ ├── ms9_composite_shadow_z6.xml │ │ ├── ms9_composite_shadow_z7.xml │ │ ├── ms9_composite_shadow_z8.xml │ │ ├── ms9_composite_shadow_z9.xml │ │ ├── ms9_spot_shadow_z1.xml │ │ ├── ms9_spot_shadow_z10.xml │ │ ├── ms9_spot_shadow_z11.xml │ │ ├── ms9_spot_shadow_z12.xml │ │ ├── ms9_spot_shadow_z13.xml │ │ ├── ms9_spot_shadow_z14.xml │ │ ├── ms9_spot_shadow_z15.xml │ │ ├── ms9_spot_shadow_z16.xml │ │ ├── ms9_spot_shadow_z17.xml │ │ ├── ms9_spot_shadow_z18.xml │ │ ├── ms9_spot_shadow_z2.xml │ │ ├── ms9_spot_shadow_z3.xml │ │ ├── ms9_spot_shadow_z4.xml │ │ ├── ms9_spot_shadow_z5.xml │ │ ├── ms9_spot_shadow_z6.xml │ │ ├── ms9_spot_shadow_z7.xml │ │ ├── ms9_spot_shadow_z8.xml │ │ └── ms9_spot_shadow_z9.xml │ ├── drawable-xxhdpi/ │ │ ├── ms9_ambient_shadow_z1.xml │ │ ├── ms9_ambient_shadow_z10.xml │ │ ├── ms9_ambient_shadow_z11.xml │ │ ├── ms9_ambient_shadow_z12.xml │ │ ├── ms9_ambient_shadow_z13.xml │ │ ├── ms9_ambient_shadow_z14.xml │ │ ├── ms9_ambient_shadow_z15.xml │ │ ├── ms9_ambient_shadow_z16.xml │ │ ├── ms9_ambient_shadow_z17.xml │ │ ├── ms9_ambient_shadow_z18.xml │ │ ├── ms9_ambient_shadow_z2.xml │ │ ├── ms9_ambient_shadow_z3.xml │ │ ├── ms9_ambient_shadow_z4.xml │ │ ├── ms9_ambient_shadow_z5.xml │ │ ├── ms9_ambient_shadow_z6.xml │ │ ├── ms9_ambient_shadow_z7.xml │ │ ├── ms9_ambient_shadow_z8.xml │ │ ├── ms9_ambient_shadow_z9.xml │ │ ├── ms9_composite_shadow_z1.xml │ │ ├── ms9_composite_shadow_z2.xml │ │ ├── ms9_composite_shadow_z3.xml │ │ ├── ms9_composite_shadow_z4.xml │ │ ├── ms9_composite_shadow_z5.xml │ │ ├── ms9_composite_shadow_z6.xml │ │ ├── ms9_composite_shadow_z7.xml │ │ ├── ms9_composite_shadow_z8.xml │ │ ├── ms9_composite_shadow_z9.xml │ │ ├── ms9_spot_shadow_z1.xml │ │ ├── ms9_spot_shadow_z10.xml │ │ ├── ms9_spot_shadow_z11.xml │ │ ├── ms9_spot_shadow_z12.xml │ │ ├── ms9_spot_shadow_z13.xml │ │ ├── ms9_spot_shadow_z14.xml │ │ ├── ms9_spot_shadow_z15.xml │ │ ├── ms9_spot_shadow_z16.xml │ │ ├── ms9_spot_shadow_z17.xml │ │ ├── ms9_spot_shadow_z18.xml │ │ ├── ms9_spot_shadow_z2.xml │ │ ├── ms9_spot_shadow_z3.xml │ │ ├── ms9_spot_shadow_z4.xml │ │ ├── ms9_spot_shadow_z5.xml │ │ ├── ms9_spot_shadow_z6.xml │ │ ├── ms9_spot_shadow_z7.xml │ │ ├── ms9_spot_shadow_z8.xml │ │ └── ms9_spot_shadow_z9.xml │ ├── drawable-xxxhdpi/ │ │ ├── ms9_ambient_shadow_z1.xml │ │ ├── ms9_ambient_shadow_z10.xml │ │ ├── ms9_ambient_shadow_z11.xml │ │ ├── ms9_ambient_shadow_z12.xml │ │ ├── ms9_ambient_shadow_z13.xml │ │ ├── ms9_ambient_shadow_z14.xml │ │ ├── ms9_ambient_shadow_z15.xml │ │ ├── ms9_ambient_shadow_z16.xml │ │ ├── ms9_ambient_shadow_z17.xml │ │ ├── ms9_ambient_shadow_z18.xml │ │ ├── ms9_ambient_shadow_z2.xml │ │ ├── ms9_ambient_shadow_z3.xml │ │ ├── ms9_ambient_shadow_z4.xml │ │ ├── ms9_ambient_shadow_z5.xml │ │ ├── ms9_ambient_shadow_z6.xml │ │ ├── ms9_ambient_shadow_z7.xml │ │ ├── ms9_ambient_shadow_z8.xml │ │ ├── ms9_ambient_shadow_z9.xml │ │ ├── ms9_composite_shadow_z1.xml │ │ ├── ms9_composite_shadow_z2.xml │ │ ├── ms9_composite_shadow_z3.xml │ │ ├── ms9_composite_shadow_z4.xml │ │ ├── ms9_composite_shadow_z5.xml │ │ ├── ms9_composite_shadow_z6.xml │ │ ├── ms9_composite_shadow_z7.xml │ │ ├── ms9_composite_shadow_z8.xml │ │ ├── ms9_composite_shadow_z9.xml │ │ ├── ms9_spot_shadow_z1.xml │ │ ├── ms9_spot_shadow_z10.xml │ │ ├── ms9_spot_shadow_z11.xml │ │ ├── ms9_spot_shadow_z12.xml │ │ ├── ms9_spot_shadow_z13.xml │ │ ├── ms9_spot_shadow_z14.xml │ │ ├── ms9_spot_shadow_z15.xml │ │ ├── ms9_spot_shadow_z16.xml │ │ ├── ms9_spot_shadow_z17.xml │ │ ├── ms9_spot_shadow_z18.xml │ │ ├── ms9_spot_shadow_z2.xml │ │ ├── ms9_spot_shadow_z3.xml │ │ ├── ms9_spot_shadow_z4.xml │ │ ├── ms9_spot_shadow_z5.xml │ │ ├── ms9_spot_shadow_z6.xml │ │ ├── ms9_spot_shadow_z7.xml │ │ ├── ms9_spot_shadow_z8.xml │ │ └── ms9_spot_shadow_z9.xml │ └── values/ │ ├── arrays.xml │ ├── attrs.xml │ └── styles.xml ├── resource/ │ ├── .gitignore │ ├── README │ ├── batch_inkscape_export.sh │ ├── crop_ninepatch_valid_area.sh │ ├── gen_alias_xml.py │ ├── inkscape_export_obj.sh │ ├── phase1_batch_inkscape_export.sh │ ├── phase2_batch_crop_ninepatch_valid_area.sh │ ├── phase3_batch_shrink_png_file.sh │ ├── phase4_batch_gen_alias_xml.sh │ ├── process_all.sh │ └── shrink_png_file.sh ├── settings.gradle └── signing/ ├── .gitignore ├── README ├── example-signing.properties.template └── library-maven-publish-signing.properties.template ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ /.gradle /.idea /build /repository /local.properties *.iml .DS_Store *~ ================================================ FILE: LICENSE ================================================ Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS ================================================ FILE: NOTICE ================================================ ====================================================================== This library ("Material Shadow 9-Patch") ---------------------------------------------------------------------- Copyright (C) 2015 Haruki Hasegawa Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: README.md ================================================ Material Shadow 9-Patch =============== This library provides 9-patch based drop shadow for view elements. Works on API level 14 or later. [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Material%20Shadow%209--Patch-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1562) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.h6ah4i.android.materialshadowninepatch/materialshadowninepatch/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.h6ah4i.android.widget.verticalseekbar/verticalseekbar) --- Example on Android 4.0 Example on Android 5.0 --- Target platforms --- - API level 14 or later Latest version --- - Version 1.0.0 (September 25, 2018) Getting started --- This library is published on Maven Central. Just add these lines to `build.gradle`. ```groovy dependencies { compile 'com.h6ah4i.android.materialshadowninepatch:materialshadowninepatch:1.0.0' } ``` Usage --- ### Layout XML ```xml ``` ### Java code ```java MaterialShadowContainerView shadowView = (MaterialShadowContainerView) findViewById(R.id.shadow_item_container); float density = getResources().getDisplayMetrics().density; shadowView.setShadowTranslationZ(density * 2.0f); // 2.0 dp shadowView.setShadowElevation(density * 4.0f); // 4.0 dp ``` Advanced Usages --- ```xml ... ``` | Property name | Default | Description | |----------------------------------|---------------------------------------|-------------------------------------------------------------------------| | `ms9_shadowTranslationZ` | `0dp` | Compatibility version of `android:translationZ` | | `ms9_shadowElevation` | `0dp` | Compatibility version of `android:elevation` | | `ms9_forceUseCompatShadow` | `false` | Enforces to use compatibility shadow on Lollipop or later | | `ms9_affectsDisplayedPosition` | `true` | Specify whether the shadow position is affected by the target view's position (emulates Lollipop's behavior) | | `app:ms9_useAmbientShadow` | `true` | Specify whether to use ambient shadow | | `app:ms9_useSpotShadow` | `true` | Specify whether to use spot shadow | | `ms9_spotShadowDrawablesList` | `@array/ms9_spot_shadow_drawables` | Specify *Spot shadow (Key shadow)* 9-patch resources | | `ms9_ambientShadowDrawablesList` | `@array/ms9_ambient_shadow_drawables` | Specify *Ambient shadow* 9-patch resources | | Style name | | |------------------------------------------------------|----------------------------------------------------------------------------| | `ms9_DefaultShadowStyle([ Z6 or Z9 orZ18 ])` | Default style (uses spot & ambient shadow, position affects) | | `ms9_DefaultShadowStyle([ Z6 or Z9 or Z18 ])CompatOnly` | Default style with `ms9_forceUseCompatShadow="true"` | | `ms9_NoDisplayedPositionAffectShadowStyle([ Z6 or Z9 or Z18 ])` | No displayed position affects style | | `ms9_NoDisplayedPositionAffectShadowStyle([ Z6 or Z9 or Z18 ])CompatOnly` | No displayed position affects style with `ms9_forceUseCompatShadow="true"` | | `ms9_CompositeShadowStyle([ Z6 or Z9 ])` | Pre-composite shadow style (**less overdraws**) | | `ms9_CompositeShadowStyle([ Z6 or Z9 ])CompatOnly` | Pre-composite shadow style with `ms9_forceUseCompatShadow="true"` | *NOTE: You can specify `Z[6|9|18]` suffix for style names. This limits the deepest limit of shadow nine patch resources and it makes resource shrinking (`shrinkResources true`) work more effectively!* License --- This library is licensed under the [Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). See [`LICENSE`](LICENSE) for full of the license text. Copyright (C) 2015 Haruki Hasegawa Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: RELEASE-NOTES.md ================================================ ## 1.0.0 - Migrate to AndroidX - Change min API level to v14 ## 0.6.5 - Shrunk PNG image files - Add tools:shrinkMode="strict" to all drawable resources ## 0.6.4 - Added four-parameter constructor to MaterialShadowContainerView - Add a new demo: "Programmatically add demo" ## 0.6.3 - Added new styles in order to make resource shrinking work more aggressively ## 0.6.2 - Added pre-composite nine patch resources - Introduced `MaterialShadowContainerView` styles ## 0.6.1 - Fixed BadParcelableException issue (#5) - Added `ms9_useAmbientShadow` property - Added `ms9_useSpotShadow` property ## 0.6.0 - Added "ms9_" prefix for all attributes - Added "ms9_forceUseCompatShadow" property - Added `MaterialShadowContainerViewProperties` class - Made `MaterialShadowContainerView` saves its state - Improved demo app ## 0.5.0 - Initial release ================================================ FILE: build.gradle ================================================ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() google() } dependencies { classpath 'com.android.tools.build:gradle:3.2.0-rc03' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() google() } } ================================================ FILE: common/android-maven-publish.gradle ================================================ /* * Copyright (C) 2015 Haruki Hasegawa * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ apply plugin: 'maven' apply plugin: 'signing' // Declare these properties in project's extension // - ext.mavenPublishDestDir = [path to destination directory] // - ext.mavenPublishDataFile = [path to data properties file] // - ext.mavenPublishSigningSetting = [path to signing info properties file] (optional) def repoDir = project.mavenPublishDestDir def dataProps = new Properties() dataProps.load(project.file(project.mavenPublishDataFile).newDataInputStream()) task cleanDocsOutDir(type: Delete) { delete project.docsDir } task androidJavadocs(type: Javadoc) { source = android.sourceSets.main.java.srcDirs classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) excludes += '**/BuildConfig.java' excludes += '**/R.java' options.encoding "utf-8" } task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { classifier = 'javadoc' from androidJavadocs.destinationDir } task androidSourcesJar(type: Jar) { classifier = 'sources' from android.sourceSets.main.java.srcDirs } afterEvaluate { androidJavadocs.classpath += project.android.libraryVariants.toList().first().javaCompile.classpath } signing { // load 'keyId', 'password' and 'secretKeyRingFile' def propsFile = project.file(project.mavenPublishSigningSetting) if (propsFile.exists()) { def props = new Properties() props.load(propsFile.newDataInputStream()) if (props.keyId != null && props.password != null && props.secretKeyRingFile != null) { project.ext.keyId = props.keyId project.ext.password = props.password project.ext.secretKeyRingFile = props.secretKeyRingFile } } required { gradle.taskGraph.hasTask("uploadArchives") } sign configurations.archives } uploadArchives { repositories.mavenDeployer { beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } repository(url: "file://${repoDir}") pom.groupId = dataProps.POM_GROUP_ID pom.artifactId = dataProps.POM_ARTIFACT_ID pom.version = dataProps.VERSION_NAME pom.project { licenses { license { name dataProps.POM_APACHE_V2_LICENCE_NAME url dataProps.POM_APACHE_V2_LICENCE_URL distribution dataProps.POM_APACHE_V2_LICENCE_DIST } } scm { url dataProps.POM_SCM_URL connection dataProps.POM_SCM_CONNECTION developerConnection dataProps.POM_SCM_DEVELOPER_CONNECTION } developers { developer { id dataProps.POM_DEVELOPER_ID name dataProps.POM_DEVELOPER_NAME } } } } } artifacts { archives androidSourcesJar archives androidJavadocsJar } ================================================ FILE: common/android-set-common-properties.gradle ================================================ /* * Copyright (C) 2015 Haruki Hasegawa * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ android { compileSdkVersion 28 buildToolsVersion '28.0.2' compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } } ================================================ FILE: common/android-signing-utils.gradle ================================================ /* * Copyright (C) 2015 Haruki Hasegawa * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ def loadSigningConfigFromPropertiesFile(project, signingConfig, propFileName) { def props = new Properties() def propFile = project.file(propFileName) if (!propFile.exists()) { return false } props.load(propFile.newDataInputStream()) if ((props.storeFile != null) && (props.storePassword != null) && (props.keyAlias != null) && (props.keyPassword != null)) { signingConfig.storeFile = project.file(props.storeFile) signingConfig.storePassword = props.storePassword signingConfig.keyAlias = props.keyAlias signingConfig.keyPassword = props.keyPassword return true } else { return false } } // Export methods by turning them into closures ext { loadSigningConfigFromPropertiesFile = this.&loadSigningConfigFromPropertiesFile } ================================================ FILE: example/.gitignore ================================================ /build ================================================ FILE: example/build.gradle ================================================ /* * Copyright (C) 2015 Haruki Hasegawa * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ apply plugin: 'com.android.application' // Common configurations apply from: '../common/android-set-common-properties.gradle' apply from: '../common/android-signing-utils.gradle' android { compileSdkVersion 28 buildToolsVersion "28.0.2" defaultConfig { applicationId "com.h6ah4i.android.example.materialshadowninepatch" minSdkVersion 14 targetSdkVersion 28 versionCode 7 versionName "1.0.0" } signingConfigs { release } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } // load signing config from external properties file if (loadSigningConfigFromPropertiesFile( project, android.signingConfigs.release, '../signing/example-signing.properties')) { android.buildTypes.release.signingConfig android.signingConfigs.release } dependencies { implementation 'androidx.appcompat:appcompat:1.0.0' implementation project(':library') } ================================================ FILE: example/proguard-rules.pro ================================================ # Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified # in /home/hasegawa/Applications/android/sdk/tools/proguard/proguard-android.txt # You can edit the include path and order by changing the proguardFiles # directive in build.gradle. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html # Add any project specific keep options here: # If your project uses WebView with JS, uncomment the following # and specify the fully qualified class name to the JavaScript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} ================================================ FILE: example/src/androidTest/java/com/h6ah4i/android/example/materialshadowninepatch/ApplicationTest.java ================================================ /* * Copyright (C) 2015 Haruki Hasegawa * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.h6ah4i.android.example.materialshadowninepatch; import android.app.Application; import android.test.ApplicationTestCase; /** * Testing Fundamentals */ public class ApplicationTest extends ApplicationTestCase { public ApplicationTest() { super(Application.class); } } ================================================ FILE: example/src/main/AndroidManifest.xml ================================================ ================================================ FILE: example/src/main/java/com/h6ah4i/android/example/materialshadowninepatch/MainActivity.java ================================================ /* * Copyright (C) 2015 Haruki Hasegawa * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.h6ah4i.android.example.materialshadowninepatch; import android.app.Activity; import android.content.Intent; import android.os.Build; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import android.view.View; public class MainActivity extends AppCompatActivity implements View.OnClickListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.button_z_position_demo).setOnClickListener(this); findViewById(R.id.button_xy_position_demo).setOnClickListener(this); findViewById(R.id.button_z_position_animation_demo).setOnClickListener(this); findViewById(R.id.button_shadow_styles_demo).setOnClickListener(this); findViewById(R.id.button_programmatically_add_demo).setOnClickListener(this); /** {@link android.util.Property} is only available on API level 14 or later */ findViewById(R.id.button_z_position_animation_demo).setEnabled( Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.button_z_position_demo: launchActivity(ZPositionDemoActivity.class); break; case R.id.button_xy_position_demo: launchActivity(XYPositionDemoActivity.class); break; case R.id.button_z_position_animation_demo: launchActivity(ZPositionAnimationDemoActivity.class); break; case R.id.button_shadow_styles_demo: launchActivity(ShadowStylesDemoActivity.class); break; case R.id.button_programmatically_add_demo: launchActivity(ProgrammaticallyAddDemoActivity.class); break; default: break; } } private void launchActivity(Class activityClass) { Intent intent = new Intent(this, activityClass); startActivity(intent); } } ================================================ FILE: example/src/main/java/com/h6ah4i/android/example/materialshadowninepatch/ProgrammaticallyAddDemoActivity.java ================================================ package com.h6ah4i.android.example.materialshadowninepatch; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; /** * Created by hasegawa on 9/13/15. */ public class ProgrammaticallyAddDemoActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_demo_screen); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new ProgrammaticallyAddDemoFragment()) .commit(); } } } ================================================ FILE: example/src/main/java/com/h6ah4i/android/example/materialshadowninepatch/ProgrammaticallyAddDemoFragment.java ================================================ /* * Copyright (C) 2015 Haruki Hasegawa * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.h6ah4i.android.example.materialshadowninepatch; import android.content.Context; import android.graphics.Color; import android.os.Bundle; import androidx.fragment.app.Fragment; import androidx.core.view.ViewCompat; import androidx.appcompat.widget.AppCompatTextView; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.LinearLayout; import com.h6ah4i.android.materialshadowninepatch.MaterialShadowContainerView; public class ProgrammaticallyAddDemoFragment extends Fragment implements View.OnClickListener, CheckBox.OnCheckedChangeListener { private CheckBox mCheckBoxForceUseCompatMode; private LinearLayout mItemsContainer; private Button mAddButton; private Button mClearButton; public ProgrammaticallyAddDemoFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.fragment_programmatically_add_demo, container, false); mCheckBoxForceUseCompatMode = rootView.findViewById(R.id.checkbox_force_use_compat_mode); mItemsContainer = rootView.findViewById(R.id.items_container); mAddButton = rootView.findViewById(R.id.button_add); mClearButton = rootView.findViewById(R.id.button_clear); mCheckBoxForceUseCompatMode.setOnCheckedChangeListener(this); mAddButton.setOnClickListener(this); mClearButton.setOnClickListener(this); return rootView; } @Override public void onClick(View v) { switch (v.getId()) { case R.id.button_add: addItem(); break; case R.id.button_clear: clearItems(); break; } } @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { switch (buttonView.getId()) { case R.id.checkbox_force_use_compat_mode: setForceCompatMode(isChecked); break; } } private void addItem() { LinearLayout parent = mItemsContainer; Context context = parent.getContext(); float density = context.getResources().getDisplayMetrics().density; AppCompatTextView itemView = new AppCompatTextView(context); // Need to specify type of the shadow. Specify one of the following to the fourth parameter. // // - R.style.ms9_DefaultShadowStyle[Z6|Z9|Z18] // - R.style.ms9_DefaultShadowStyle[Z6|Z9|Z18]CompatOnly // - R.style.ms9_NoDisplayedPositionAffectShadowStyle[Z6|Z9|Z18] // - R.style.ms9_NoDisplayedPositionAffectShadowStyle[Z6|Z9|Z18]CompatOnly // - R.style.ms9_CompositeShadowStyle[Z6|Z9|Z18] // - R.style.ms9_CompositeShadowStyle[Z6|Z9|Z18]CompatOnly MaterialShadowContainerView shadowView = new MaterialShadowContainerView( context, null, 0, R.style.ms9_DefaultShadowStyle); // Setup the itemView { MaterialShadowContainerView.LayoutParams layoutParams = new MaterialShadowContainerView.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, (int) (density * 56)); // Need to set background color and margins itemView.setBackgroundColor(Color.WHITE); layoutParams.setMargins( (int) (8 * density), (int) (8 * density), (int) (8 * density), (int) (8 * density)); itemView.setLayoutParams(layoutParams); itemView.setText("Item " + (parent.getChildCount() + 1)); itemView.setGravity(Gravity.CENTER); } // Setup the shadowView { LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); shadowView.setLayoutParams(layoutParams); shadowView.setShadowElevation(density * 4); shadowView.setForceUseCompatShadow(mCheckBoxForceUseCompatMode.isChecked()); } // Add views shadowView.addView(itemView); parent.addView(shadowView); } private void clearItems() { mItemsContainer.removeAllViews(); } public void setForceCompatMode(boolean forceCompatMode) { int n = mItemsContainer.getChildCount(); for (int i = 0; i < n; i++) { MaterialShadowContainerView v = (MaterialShadowContainerView) mItemsContainer.getChildAt(i); v.setForceUseCompatShadow(forceCompatMode); } } } ================================================ FILE: example/src/main/java/com/h6ah4i/android/example/materialshadowninepatch/ShadowStylesDemoActivity.java ================================================ /* * Copyright (C) 2015 Haruki Hasegawa * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.h6ah4i.android.example.materialshadowninepatch; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; public class ShadowStylesDemoActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_demo_screen); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new ShadowStylesDemoFragment()) .commit(); } } } ================================================ FILE: example/src/main/java/com/h6ah4i/android/example/materialshadowninepatch/ShadowStylesDemoFragment.java ================================================ /* * Copyright (C) 2015 Haruki Hasegawa * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.h6ah4i.android.example.materialshadowninepatch; import android.os.Bundle; import androidx.fragment.app.Fragment; import androidx.core.view.ViewCompat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class ShadowStylesDemoFragment extends Fragment { public ShadowStylesDemoFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_shadow_styles_demo, container, false); } } ================================================ FILE: example/src/main/java/com/h6ah4i/android/example/materialshadowninepatch/XYPositionDemoActivity.java ================================================ /* * Copyright (C) 2015 Haruki Hasegawa * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.h6ah4i.android.example.materialshadowninepatch; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; public class XYPositionDemoActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_demo_screen); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new XYPositionDemoFragment()) .commit(); } } } ================================================ FILE: example/src/main/java/com/h6ah4i/android/example/materialshadowninepatch/XYPositionDemoFragment.java ================================================ /* * Copyright (C) 2015 Haruki Hasegawa * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.h6ah4i.android.example.materialshadowninepatch; import android.os.Bundle; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.SeekBar; import com.h6ah4i.android.materialshadowninepatch.MaterialShadowContainerView; public class XYPositionDemoFragment extends Fragment implements View.OnClickListener, CheckBox.OnCheckedChangeListener, SeekBar.OnSeekBarChangeListener { private static final int SEEKBAR_MAX = 1000; private static final float MAX_Z_TRANSLATION = 9; private static final int[] mCompatShadowItemIds = new int[]{ R.id.compat_shadow_item_top_left, R.id.compat_shadow_item_top_center, R.id.compat_shadow_item_top_right, R.id.compat_shadow_item_center_left, R.id.compat_shadow_item_center_center, R.id.compat_shadow_item_center_right, R.id.compat_shadow_item_bottom_left, R.id.compat_shadow_item_bottom_center, R.id.compat_shadow_item_bottom_right, }; private static final int[] mCompatShadowItemContainerIds = new int[]{ R.id.compat_shadow_item_container_top_left, R.id.compat_shadow_item_container_top_center, R.id.compat_shadow_item_container_top_right, R.id.compat_shadow_item_container_center_left, R.id.compat_shadow_item_container_center_center, R.id.compat_shadow_item_container_center_right, R.id.compat_shadow_item_container_bottom_left, R.id.compat_shadow_item_container_bottom_center, R.id.compat_shadow_item_container_bottom_right, }; private View[] mCompatShadowItems; private MaterialShadowContainerView[] mCompatShadowItemContainers; private SeekBar mSeekBarTranslationZ; private CheckBox mCheckBoxForceUseCompatMode; private CheckBox mCheckBoxEnableDisplayedPositionAffection; private float mDisplayDensity; public XYPositionDemoFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.fragment_xy_position_demo, container, false); mDisplayDensity = getResources().getDisplayMetrics().density; mSeekBarTranslationZ = rootView.findViewById(R.id.seekbar_translation_z); mSeekBarTranslationZ.setOnSeekBarChangeListener(this); mSeekBarTranslationZ.setMax(SEEKBAR_MAX); mCheckBoxForceUseCompatMode = rootView.findViewById(R.id.checkbox_force_use_compat_mode); mCheckBoxForceUseCompatMode.setOnCheckedChangeListener(this); mCheckBoxEnableDisplayedPositionAffection = rootView.findViewById(R.id.checkbox_displayed_position_affection); mCheckBoxEnableDisplayedPositionAffection.setOnCheckedChangeListener(this); mCompatShadowItems = new View[mCompatShadowItemIds.length]; for (int i = 0; i < mCompatShadowItemIds.length; i++) { mCompatShadowItems[i] = rootView.findViewById(mCompatShadowItemIds[i]); } mCompatShadowItemContainers = new MaterialShadowContainerView[mCompatShadowItemContainerIds.length]; for (int i = 0; i < mCompatShadowItemContainerIds.length; i++) { mCompatShadowItemContainers[i] = rootView.findViewById(mCompatShadowItemContainerIds[i]); } if (savedInstanceState == null) { mCheckBoxForceUseCompatMode.setChecked(true); mCheckBoxEnableDisplayedPositionAffection.setChecked(true); mSeekBarTranslationZ.setProgress(500); setForceCompatMode(mCheckBoxForceUseCompatMode.isChecked()); setDisplayedPositionAffection(mCheckBoxEnableDisplayedPositionAffection.isChecked()); setItemsTranslationZ(progressToTranslationZAmount(mSeekBarTranslationZ.getProgress())); } return rootView; } @Override public void onClick(View v) { } @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { switch (buttonView.getId()) { case R.id.checkbox_force_use_compat_mode: setForceCompatMode(isChecked); break; case R.id.checkbox_displayed_position_affection: setDisplayedPositionAffection(isChecked); break; } } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { switch (seekBar.getId()) { case R.id.seekbar_translation_z: if (fromUser) { setItemsTranslationZ(progressToTranslationZAmount(progress)); } break; } } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } private float progressToTranslationZAmount(int progress) { return MAX_Z_TRANSLATION * mDisplayDensity * progress / SEEKBAR_MAX; } public void setItemsTranslationZ(float amount) { for (MaterialShadowContainerView v : mCompatShadowItemContainers) { v.setShadowTranslationZ(amount); } } public void setForceCompatMode(boolean forceCompatMode) { for (MaterialShadowContainerView v : mCompatShadowItemContainers) { v.setForceUseCompatShadow(forceCompatMode); } } public void setDisplayedPositionAffection(boolean enabled) { for (MaterialShadowContainerView v : mCompatShadowItemContainers) { v.setDisplayedPositionAffectionEnabled(enabled); } } } ================================================ FILE: example/src/main/java/com/h6ah4i/android/example/materialshadowninepatch/ZPositionAnimationDemoActivity.java ================================================ /* * Copyright (C) 2015 Haruki Hasegawa * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.h6ah4i.android.example.materialshadowninepatch; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; public class ZPositionAnimationDemoActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_demo_screen); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new ZPositionAnimationDemoFragment()) .commit(); } } } ================================================ FILE: example/src/main/java/com/h6ah4i/android/example/materialshadowninepatch/ZPositionAnimationDemoFragment.java ================================================ /* * Copyright (C) 2015 Haruki Hasegawa * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.h6ah4i.android.example.materialshadowninepatch; import android.animation.ObjectAnimator; import android.annotation.TargetApi; import android.os.Build; import android.os.Bundle; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.animation.CycleInterpolator; import android.widget.CheckBox; import android.widget.CompoundButton; import com.h6ah4i.android.materialshadowninepatch.MaterialShadowContainerView; import com.h6ah4i.android.materialshadowninepatch.MaterialShadowContainerViewProperties; @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public class ZPositionAnimationDemoFragment extends Fragment implements View.OnClickListener, CheckBox.OnCheckedChangeListener { private float mDisplayDensity; private View mCompatShadowItem; private MaterialShadowContainerView mCompatShadowItemContainer; private CheckBox mCheckBoxForceUseCompatMode; public ZPositionAnimationDemoFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.fragment_z_position_animation_demo, container, false); mDisplayDensity = getResources().getDisplayMetrics().density; mCompatShadowItem = rootView.findViewById(R.id.compat_shadow_item); mCompatShadowItem.setOnClickListener(this); mCompatShadowItemContainer = rootView.findViewById(R.id.compat_shadow_item_container); mCheckBoxForceUseCompatMode = rootView.findViewById(R.id.checkbox_force_use_compat_mode); mCheckBoxForceUseCompatMode.setOnCheckedChangeListener(this); return rootView; } @Override public void onClick(View v) { if (v == mCompatShadowItem) { ObjectAnimator animator = ObjectAnimator.ofFloat( mCompatShadowItemContainer, MaterialShadowContainerViewProperties.SHADOW_TRANSLATION_Z, mDisplayDensity * 0.0f, mDisplayDensity * 8.0f); animator.setDuration(500); animator.setInterpolator(new CycleInterpolator(0.5f)); animator.start(); } } @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { switch (buttonView.getId()) { case R.id.checkbox_force_use_compat_mode: setForceCompatMode(isChecked); break; } } public void setForceCompatMode(boolean forceCompatMode) { mCompatShadowItemContainer.setForceUseCompatShadow(forceCompatMode); } } ================================================ FILE: example/src/main/java/com/h6ah4i/android/example/materialshadowninepatch/ZPositionDemoActivity.java ================================================ /* * Copyright (C) 2015 Haruki Hasegawa * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.h6ah4i.android.example.materialshadowninepatch; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; public class ZPositionDemoActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_demo_screen); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new ZPositionDemoFragment()) .commit(); } } } ================================================ FILE: example/src/main/java/com/h6ah4i/android/example/materialshadowninepatch/ZPositionDemoFragment.java ================================================ /* * Copyright (C) 2015 Haruki Hasegawa * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.h6ah4i.android.example.materialshadowninepatch; import android.os.Bundle; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.core.view.ViewCompat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.SeekBar; import com.h6ah4i.android.materialshadowninepatch.MaterialShadowContainerView; public class ZPositionDemoFragment extends Fragment implements View.OnClickListener, CheckBox.OnCheckedChangeListener, SeekBar.OnSeekBarChangeListener { private static final int SEEKBAR_MAX = 1000; private static final float MAX_TRANSLATION_Z = 9; private static final int[] mNativeShadowItemIds = new int[]{ R.id.native_shadow_item_z0, R.id.native_shadow_item_z1, R.id.native_shadow_item_z2, R.id.native_shadow_item_z3, R.id.native_shadow_item_z4, R.id.native_shadow_item_z5, R.id.native_shadow_item_z6, R.id.native_shadow_item_z7, R.id.native_shadow_item_z8, R.id.native_shadow_item_z9, }; private static final int[] mCompatShadowItemIds = new int[]{ R.id.compat_shadow_item_z0, R.id.compat_shadow_item_z1, R.id.compat_shadow_item_z2, R.id.compat_shadow_item_z3, R.id.compat_shadow_item_z4, R.id.compat_shadow_item_z5, R.id.compat_shadow_item_z6, R.id.compat_shadow_item_z7, R.id.compat_shadow_item_z8, R.id.compat_shadow_item_z9, }; private static final int[] mCompatShadowItemContainerIds = new int[]{ R.id.compat_shadow_item_container_z0, R.id.compat_shadow_item_container_z1, R.id.compat_shadow_item_container_z2, R.id.compat_shadow_item_container_z3, R.id.compat_shadow_item_container_z4, R.id.compat_shadow_item_container_z5, R.id.compat_shadow_item_container_z6, R.id.compat_shadow_item_container_z7, R.id.compat_shadow_item_container_z8, R.id.compat_shadow_item_container_z9, }; private View[] mNativeShadowItems; private View[] mCompatShadowItems; private MaterialShadowContainerView[] mCompatShadowItemContainers; private SeekBar mSeekBarElevation; private CheckBox mCheckBoxForceUseCompatMode; private float mDisplayDensity; public ZPositionDemoFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.fragment_z_position_demo, container, false); mDisplayDensity = getResources().getDisplayMetrics().density; mSeekBarElevation = rootView.findViewById(R.id.seekbar_translation_z); mSeekBarElevation.setOnSeekBarChangeListener(this); mSeekBarElevation.setMax(SEEKBAR_MAX); mCheckBoxForceUseCompatMode = rootView.findViewById(R.id.checkbox_force_use_compat_mode); mCheckBoxForceUseCompatMode.setOnCheckedChangeListener(this); mNativeShadowItems = new View[mNativeShadowItemIds.length]; for (int i = 0; i < mNativeShadowItemIds.length; i++) { mNativeShadowItems[i] = rootView.findViewById(mNativeShadowItemIds[i]); } mCompatShadowItems = new View[mCompatShadowItemIds.length]; for (int i = 0; i < mCompatShadowItemIds.length; i++) { mCompatShadowItems[i] = rootView.findViewById(mCompatShadowItemIds[i]); } mCompatShadowItemContainers = new MaterialShadowContainerView[mCompatShadowItemContainerIds.length]; for (int i = 0; i < mCompatShadowItemContainerIds.length; i++) { mCompatShadowItemContainers[i] = rootView.findViewById(mCompatShadowItemContainerIds[i]); } return rootView; } @Override public void onClick(View v) { } @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { switch (buttonView.getId()) { case R.id.checkbox_force_use_compat_mode: setForceCompatMode(isChecked); break; } } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { switch (seekBar.getId()) { case R.id.seekbar_translation_z: if (fromUser) { setItemsTranslationZ(progressToTranslationZAmount(progress)); } break; } } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } private float progressToTranslationZAmount(int progress) { return MAX_TRANSLATION_Z * mDisplayDensity * progress / SEEKBAR_MAX; } public void setItemsTranslationZ(float amount) { for (View v : mNativeShadowItems) { ViewCompat.setTranslationZ(v, amount); } for (MaterialShadowContainerView v : mCompatShadowItemContainers) { v.setShadowTranslationZ(amount); } } public void setForceCompatMode(boolean forceCompatMode) { for (MaterialShadowContainerView v : mCompatShadowItemContainers) { v.setForceUseCompatShadow(forceCompatMode); } } } ================================================ FILE: example/src/main/res/layout/activity_demo_screen.xml ================================================ ================================================ FILE: example/src/main/res/layout/activity_main.xml ================================================