├── lib ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ ├── strings.xml │ │ │ │ └── attrs.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── mosect │ │ │ └── ashadow │ │ │ ├── UnsupportedKeyException.java │ │ │ ├── ShadowFactory.java │ │ │ ├── RoundShadowFactory.java │ │ │ ├── Shadow.java │ │ │ ├── UnsupportedRoundShadow.java │ │ │ ├── ShadowManager.java │ │ │ ├── ShadowHelper.java │ │ │ ├── ShadowRelativeLayout.java │ │ │ ├── ShadowLinearLayout.java │ │ │ ├── RoundShadow.java │ │ │ └── ShadowLayout.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── mosect │ │ │ └── ashadow │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── mosect │ │ └── ashadow │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── example ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.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 │ │ │ ├── xml │ │ │ │ └── backup_descriptor.xml │ │ │ ├── drawable │ │ │ │ ├── item_bg.xml │ │ │ │ ├── shape_bg.xml │ │ │ │ └── ic_launcher_background.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── layout │ │ │ │ ├── activity_main.xml │ │ │ │ ├── item_main.xml │ │ │ │ ├── activity_shadowrelativelayout.xml │ │ │ │ ├── activity_shadowlinerlayout.xml │ │ │ │ └── activity_shadowlayout.xml │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── mosect │ │ │ │ └── ashadow │ │ │ │ └── example │ │ │ │ ├── ShadowLayoutActivity.java │ │ │ │ ├── ShadowLinearLayoutActivity.java │ │ │ │ ├── ShadowRelativeLayoutActivity.java │ │ │ │ ├── GridSpacingItemDecoration.java │ │ │ │ ├── ShadowItemDecoration.java │ │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── mosect │ │ │ └── ashadow │ │ │ └── example │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── mosect │ │ └── ashadow │ │ └── example │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── img ├── 01.jpg ├── 02.jpg └── 03.jpg ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── gradlew └── README.md /lib/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':lib', ':example' 2 | -------------------------------------------------------------------------------- /img/01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mosect/AShadow2/HEAD/img/01.jpg -------------------------------------------------------------------------------- /img/02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mosect/AShadow2/HEAD/img/02.jpg -------------------------------------------------------------------------------- /img/03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mosect/AShadow2/HEAD/img/03.jpg -------------------------------------------------------------------------------- /lib/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | lib 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mosect/AShadow2/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AShadow2 3 | 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | .idea 5 | .DS_Store 6 | /build 7 | /captures 8 | .externalNativeBuild 9 | -------------------------------------------------------------------------------- /example/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mosect/AShadow2/HEAD/example/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mosect/AShadow2/HEAD/example/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /lib/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mosect/AShadow2/HEAD/example/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mosect/AShadow2/HEAD/example/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mosect/AShadow2/HEAD/example/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mosect/AShadow2/HEAD/example/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mosect/AShadow2/HEAD/example/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mosect/AShadow2/HEAD/example/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mosect/AShadow2/HEAD/example/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mosect/AShadow2/HEAD/example/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/src/main/res/xml/backup_descriptor.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Apr 02 14:20:15 CST 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip 7 | -------------------------------------------------------------------------------- /example/src/main/res/drawable/item_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /example/src/main/res/drawable/shape_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 12 | -------------------------------------------------------------------------------- /lib/src/test/java/com/mosect/ashadow/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.mosect.ashadow; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /example/src/test/java/com/mosect/ashadow/example/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.mosect.ashadow.example; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /example/src/main/java/com/mosect/ashadow/example/ShadowLayoutActivity.java: -------------------------------------------------------------------------------- 1 | package com.mosect.ashadow.example; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.app.AppCompatActivity; 6 | 7 | public class ShadowLayoutActivity extends AppCompatActivity { 8 | @Override 9 | protected void onCreate(@Nullable Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | setContentView(R.layout.activity_shadowlayout); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/src/main/java/com/mosect/ashadow/example/ShadowLinearLayoutActivity.java: -------------------------------------------------------------------------------- 1 | package com.mosect.ashadow.example; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.app.AppCompatActivity; 6 | 7 | public class ShadowLinearLayoutActivity extends AppCompatActivity { 8 | 9 | @Override 10 | protected void onCreate(@Nullable Bundle savedInstanceState) { 11 | super.onCreate(savedInstanceState); 12 | setContentView(R.layout.activity_shadowlinerlayout); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /example/src/main/java/com/mosect/ashadow/example/ShadowRelativeLayoutActivity.java: -------------------------------------------------------------------------------- 1 | package com.mosect.ashadow.example; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.app.AppCompatActivity; 6 | 7 | public class ShadowRelativeLayoutActivity extends AppCompatActivity { 8 | 9 | @Override 10 | protected void onCreate(@Nullable Bundle savedInstanceState) { 11 | super.onCreate(savedInstanceState); 12 | setContentView(R.layout.activity_shadowrelativelayout); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /lib/src/main/java/com/mosect/ashadow/UnsupportedKeyException.java: -------------------------------------------------------------------------------- 1 | package com.mosect.ashadow; 2 | 3 | public class UnsupportedKeyException extends RuntimeException { 4 | 5 | public UnsupportedKeyException() { 6 | } 7 | 8 | public UnsupportedKeyException(String message) { 9 | super(message); 10 | } 11 | 12 | public UnsupportedKeyException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | 16 | public UnsupportedKeyException(Throwable cause) { 17 | super(cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | 15 | -------------------------------------------------------------------------------- /lib/src/main/java/com/mosect/ashadow/ShadowFactory.java: -------------------------------------------------------------------------------- 1 | package com.mosect.ashadow; 2 | 3 | /** 4 | * 阴影工厂 5 | */ 6 | public interface ShadowFactory { 7 | 8 | /** 9 | * 判断是否支持此阴影key 10 | * 11 | * @param key 阴影key 12 | * @return true,支持此阴影key 13 | */ 14 | boolean supportKey(Object key); 15 | 16 | /** 17 | * 复制阴影key 18 | * 19 | * @param key 阴影key 20 | * @return key的备份 21 | * @throws UnsupportedKeyException 不支持的阴影key 22 | */ 23 | Object copyKey(Object key) throws UnsupportedKeyException; 24 | 25 | /** 26 | * 创建阴影 27 | * 28 | * @param key 阴影key 29 | * @return 阴影 30 | * @throws UnsupportedKeyException 不支持的阴影key 31 | */ 32 | Shadow create(Object key) throws UnsupportedKeyException; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /example/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /lib/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /lib/src/androidTest/java/com/mosect/ashadow/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.mosect.ashadow; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.mosect.ashadow.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /example/src/androidTest/java/com/mosect/ashadow/example/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.mosect.ashadow.example; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.mosect.ashadow.example", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/src/main/java/com/mosect/ashadow/RoundShadowFactory.java: -------------------------------------------------------------------------------- 1 | package com.mosect.ashadow; 2 | 3 | /** 4 | * 圆角矩形阴影工厂 5 | */ 6 | public class RoundShadowFactory implements ShadowFactory { 7 | 8 | @Override 9 | public boolean supportKey(Object key) { 10 | return key instanceof RoundShadow.Key; 11 | } 12 | 13 | @Override 14 | public Object copyKey(Object key) throws UnsupportedKeyException { 15 | if (!supportKey(key)) { 16 | throw new UnsupportedKeyException("Key:" + key); 17 | } 18 | return ((RoundShadow.Key) key).clone(); 19 | } 20 | 21 | @Override 22 | public Shadow create(Object key) throws UnsupportedKeyException { 23 | if (!supportKey(key)) { 24 | throw new UnsupportedKeyException("Key:" + key); 25 | } 26 | if (key instanceof UnsupportedRoundShadow.Key) { 27 | return new UnsupportedRoundShadow((UnsupportedRoundShadow.Key) key); 28 | } 29 | return new RoundShadow((RoundShadow.Key) key); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /example/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | 6 | 7 | 8 | defaultConfig { 9 | applicationId "com.mosect.ashadow.example" 10 | minSdkVersion 19 11 | targetSdkVersion 28 12 | versionCode 1 13 | versionName "1.0" 14 | 15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 16 | 17 | } 18 | 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | 26 | } 27 | 28 | dependencies { 29 | implementation fileTree(dir: 'libs', include: ['*.jar']) 30 | 31 | implementation 'com.android.support:appcompat-v7:28.0.0' 32 | implementation 'com.android.support:recyclerview-v7:28.0.0' 33 | testImplementation 'junit:junit:4.12' 34 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 35 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 36 | implementation project(':lib') 37 | implementation 'com.github.Mosect:ViewUtils:1.0.8' 38 | } 39 | -------------------------------------------------------------------------------- /example/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 |