diff --git a/README.md b/README.md
index 15653cb..26bf13a 100644
--- a/README.md
+++ b/README.md
@@ -39,5 +39,29 @@ dependencies {
```
+
+### 混淆
+若使用support库,则需要保证support库中的代码不被混淆,请在proguard-rules.pro中添加如下配置:
+```proguard
+# 保留support下的所有类及内部类
+-keep class android.support.**{*;}
+-dontwarn android.support.v4.**
+# 保留继承support库的类
+-keep public class * extends android.support.v4.**
+-keep public class * extends android.support.v7.**
+-keep public class * extends android.support.annotation.**
+```
+
+若已迁移到androidx,则需要添加如下配置:
+```proguard
+-keep class com.google.android.material.** {*;}
+-keep class androidx.** {*;}
+-keep public class * extends androidx.**
+-keep interface androidx.** {*;}
+-dontwarn com.google.android.material.**
+-dontnote com.google.android.material.**
+-dontwarn androidx.**
+```
+
## 参考
https://blog.csdn.net/vite_s/article/details/78901767
diff --git a/appbarlayoutbehavior/build.gradle b/appbarlayoutbehavior/build.gradle
index 1d0a34c..a8aebb0 100644
--- a/appbarlayoutbehavior/build.gradle
+++ b/appbarlayoutbehavior/build.gradle
@@ -4,16 +4,16 @@ apply plugin: 'com.github.dcendents.android-maven'
group='com.github.yuruiyin'
android {
- compileSdkVersion 27
+ compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
- minSdkVersion 15
- targetSdkVersion 27
- buildToolsVersion '27.0.3'
+ minSdkVersion rootProject.ext.minSdkVersion
+ buildToolsVersion rootProject.ext.buildToolsVersion
+ targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@@ -29,9 +29,9 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation 'com.android.support:appcompat-v7:27.1.1'
- implementation 'com.android.support:design:27.1.1'
+ implementation 'androidx.appcompat:appcompat:1.0.2'
+ implementation 'com.google.android.material:material:1.0.0'
testImplementation 'junit:junit:4.12'
- androidTestImplementation 'com.android.support.test:runner:1.0.2'
- androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
+ androidTestImplementation 'androidx.test:runner:1.2.0'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
diff --git a/appbarlayoutbehavior/src/androidTest/java/com/yuruiyin/appbarlayoutbehavior/ExampleInstrumentedTest.java b/appbarlayoutbehavior/src/androidTest/java/com/yuruiyin/appbarlayoutbehavior/ExampleInstrumentedTest.java
index 9852f91..9512e02 100644
--- a/appbarlayoutbehavior/src/androidTest/java/com/yuruiyin/appbarlayoutbehavior/ExampleInstrumentedTest.java
+++ b/appbarlayoutbehavior/src/androidTest/java/com/yuruiyin/appbarlayoutbehavior/ExampleInstrumentedTest.java
@@ -1,8 +1,8 @@
package com.yuruiyin.appbarlayoutbehavior;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/appbarlayoutbehavior/src/main/java/com/yuruiyin/appbarlayoutbehavior/AppBarLayoutBehavior.java b/appbarlayoutbehavior/src/main/java/com/yuruiyin/appbarlayoutbehavior/AppBarLayoutBehavior.java
index f7605a3..8316f04 100644
--- a/appbarlayoutbehavior/src/main/java/com/yuruiyin/appbarlayoutbehavior/AppBarLayoutBehavior.java
+++ b/appbarlayoutbehavior/src/main/java/com/yuruiyin/appbarlayoutbehavior/AppBarLayoutBehavior.java
@@ -1,8 +1,8 @@
package com.yuruiyin.appbarlayoutbehavior;
import android.content.Context;
-import android.support.design.widget.AppBarLayout;
-import android.support.design.widget.CoordinatorLayout;
+import com.google.android.material.appbar.AppBarLayout;
+import androidx.coordinatorlayout.widget.CoordinatorLayout;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
diff --git a/build.gradle b/build.gradle
index 960a85d..28d34d1 100644
--- a/build.gradle
+++ b/build.gradle
@@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.1.4'
+ classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
@@ -38,14 +38,14 @@ ext {
androidSupportVersion = "28.0.0"
}
-subprojects {
- project.configurations.all {
- resolutionStrategy.eachDependency { details ->
- if (details.requested.group == 'com.android.support'
- && !details.requested.name.contains('multidex') ) {
- details.useVersion androidSupportVersion
- }
- }
- }
-}
+//subprojects {
+// project.configurations.all {
+// resolutionStrategy.eachDependency { details ->
+// if (details.requested.group == 'com.android.support'
+// && !details.requested.name.contains('multidex') ) {
+// details.useVersion androidSupportVersion
+// }
+// }
+// }
+//}
diff --git a/gradle.properties b/gradle.properties
index 743d692..8de5058 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -6,6 +6,8 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
+android.enableJetifier=true
+android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 38f3922..eda709a 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Fri Jul 13 17:23:18 CST 2018
+#Mon Jun 10 23:58:55 CST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
diff --git a/sample/android.keystore b/sample/android.keystore
new file mode 100644
index 0000000..6cc7d0b
Binary files /dev/null and b/sample/android.keystore differ
diff --git a/sample/build.gradle b/sample/build.gradle
index aec0738..4f2a758 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -9,12 +9,40 @@ android {
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 3
versionName "1.0.2"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
+
+ signingConfigs {
+ debug {
+ storeFile file('android.keystore')
+ storePassword "123456"
+ keyAlias "AppbarLayoutBehavior"
+ keyPassword "123456"
+ v1SigningEnabled true
+ v2SigningEnabled true
+ }
+
+ release {
+ storeFile file('android.keystore')
+ storePassword "123456"
+ keyAlias "AppbarLayoutBehavior"
+ keyPassword "123456"
+ v1SigningEnabled true
+ v2SigningEnabled true
+ }
+ }
+
buildTypes {
+ debug {
+ signingConfig signingConfigs.debug
+ ext.enableCrashlytics = false
+ }
release {
- minifyEnabled false
+ shrinkResources true
+ zipAlignEnabled true
+ minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ signingConfig signingConfigs.release
}
}
@@ -26,17 +54,17 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation "com.android.support:appcompat-v7:$androidSupportVersion"
- implementation "com.android.support:design:$androidSupportVersion"
- implementation 'com.android.support.constraint:constraint-layout:1.1.3'
+ implementation 'androidx.appcompat:appcompat:1.0.2'
+ implementation 'com.google.android.material:material:1.0.0'
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
- androidTestImplementation 'com.android.support.test:runner:1.0.2'
- androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
+ androidTestImplementation 'androidx.test:runner:1.2.0'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.github.hackware1993:MagicIndicator:1.5.0'
- implementation 'com.jakewharton:butterknife:8.8.1'
- annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
+ implementation 'com.jakewharton:butterknife:10.1.0'
+ annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
implementation project(':appbarlayoutbehavior')
diff --git a/sample/proguard-rules.pro b/sample/proguard-rules.pro
index f1b4245..19585c4 100644
--- a/sample/proguard-rules.pro
+++ b/sample/proguard-rules.pro
@@ -19,3 +19,20 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
+
+# 保留support下的所有类及内部类
+-keep class android.support.**{*;}
+-dontwarn android.support.v4.**
+# 保留继承support库的类
+-keep public class * extends android.support.v4.**
+-keep public class * extends android.support.v7.**
+-keep public class * extends android.support.annotation.**
+
+# 若使用androidx
+-keep class com.google.android.material.** {*;}
+-keep class androidx.** {*;}
+-keep public class * extends androidx.**
+-keep interface androidx.** {*;}
+-dontwarn com.google.android.material.**
+-dontnote com.google.android.material.**
+-dontwarn androidx.**
diff --git a/sample/src/androidTest/java/com/yuruiyin/sample/ExampleInstrumentedTest.java b/sample/src/androidTest/java/com/yuruiyin/sample/ExampleInstrumentedTest.java
index c361008..f7ad4c7 100644
--- a/sample/src/androidTest/java/com/yuruiyin/sample/ExampleInstrumentedTest.java
+++ b/sample/src/androidTest/java/com/yuruiyin/sample/ExampleInstrumentedTest.java
@@ -1,8 +1,8 @@
package com.yuruiyin.sample;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/sample/src/main/java/com/yuruiyin/sample/MainActivity.java b/sample/src/main/java/com/yuruiyin/sample/MainActivity.java
index 5f6d56c..5429ef2 100644
--- a/sample/src/main/java/com/yuruiyin/sample/MainActivity.java
+++ b/sample/src/main/java/com/yuruiyin/sample/MainActivity.java
@@ -1,11 +1,11 @@
package com.yuruiyin.sample;
import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentPagerAdapter;
-import android.support.v4.view.ViewPager;
-import android.support.v7.app.AppCompatActivity;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentPagerAdapter;
+import androidx.viewpager.widget.ViewPager;
+import androidx.appcompat.app.AppCompatActivity;
import com.yuruiyin.sample.adapter.CustomIndicatorAdapter;
diff --git a/sample/src/main/java/com/yuruiyin/sample/MyListFragment.java b/sample/src/main/java/com/yuruiyin/sample/MyListFragment.java
index 96cdcdc..0421e17 100644
--- a/sample/src/main/java/com/yuruiyin/sample/MyListFragment.java
+++ b/sample/src/main/java/com/yuruiyin/sample/MyListFragment.java
@@ -1,11 +1,11 @@
package com.yuruiyin.sample;
import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
diff --git a/sample/src/main/java/com/yuruiyin/sample/adapter/CustomIndicatorAdapter.java b/sample/src/main/java/com/yuruiyin/sample/adapter/CustomIndicatorAdapter.java
index da3e021..7f37b35 100644
--- a/sample/src/main/java/com/yuruiyin/sample/adapter/CustomIndicatorAdapter.java
+++ b/sample/src/main/java/com/yuruiyin/sample/adapter/CustomIndicatorAdapter.java
@@ -2,7 +2,7 @@
import android.content.Context;
import android.graphics.Color;
-import android.support.v4.view.ViewPager;
+import androidx.viewpager.widget.ViewPager;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
diff --git a/sample/src/main/java/com/yuruiyin/sample/adapter/RecyclerViewAdapter.java b/sample/src/main/java/com/yuruiyin/sample/adapter/RecyclerViewAdapter.java
index 00760d6..85d14c7 100644
--- a/sample/src/main/java/com/yuruiyin/sample/adapter/RecyclerViewAdapter.java
+++ b/sample/src/main/java/com/yuruiyin/sample/adapter/RecyclerViewAdapter.java
@@ -1,8 +1,8 @@
package com.yuruiyin.sample.adapter;
import android.content.Context;
-import android.support.annotation.NonNull;
-import android.support.v7.widget.RecyclerView;
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
diff --git a/sample/src/main/java/com/yuruiyin/sample/divider/ItemSmallDecoration.java b/sample/src/main/java/com/yuruiyin/sample/divider/ItemSmallDecoration.java
index a6915df..59e677d 100644
--- a/sample/src/main/java/com/yuruiyin/sample/divider/ItemSmallDecoration.java
+++ b/sample/src/main/java/com/yuruiyin/sample/divider/ItemSmallDecoration.java
@@ -4,8 +4,8 @@
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
-import android.support.v4.content.ContextCompat;
-import android.support.v7.widget.RecyclerView;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import com.yuruiyin.sample.R;
diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml
index 60c38b3..bf708dd 100644
--- a/sample/src/main/res/layout/activity_main.xml
+++ b/sample/src/main/res/layout/activity_main.xml
@@ -1,5 +1,5 @@
-
-
-
-
+
-
+
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/sample/src/main/res/layout/fragment_list.xml b/sample/src/main/res/layout/fragment_list.xml
index 1fd9f34..03c87de 100644
--- a/sample/src/main/res/layout/fragment_list.xml
+++ b/sample/src/main/res/layout/fragment_list.xml
@@ -1,5 +1,5 @@
-