diff --git a/build.gradle b/build.gradle index e6fda31..1c9648f 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'com.android.tools.build:gradle:3.2.1' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0" // NOTE: Do not place your application dependencies here; they belong @@ -26,11 +26,12 @@ task clean(type: Delete) { } ext { - buildToolsVersion = '27.0.3' - targetSdkVersion = 27 - compileSdkVersion = 27 + buildToolsVersion = '28.0.3' + targetSdkVersion = 28 + compileSdkVersion = 28 minSdkVersion = 15 - supportVersion = '27.1.1' - constraintVersion = '1.0.2' + + androidxtVersion = '1.0.0' + constraintVersion = '1.1.3' } diff --git a/gradle.properties b/gradle.properties index 6cbe7a6..fd39ba9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,6 +10,8 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx10248m -XX:MaxPermSize=256m +android.enableJetifier=true +android.useAndroidX=true org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index def655a..fdc1254 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Nov 06 23:10:43 CST 2017 +#Wed Oct 17 13:05:39 CST 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip diff --git a/magicasakura/build.gradle b/magicasakura/build.gradle index 3358432..ae60032 100644 --- a/magicasakura/build.gradle +++ b/magicasakura/build.gradle @@ -97,7 +97,7 @@ bintray { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation "com.android.support:design:${rootProject.ext.supportVersion}" - implementation "com.android.support.constraint:constraint-layout:${rootProject.ext.constraintVersion}" + implementation "com.google.android.material:material:${rootProject.ext.androidxtVersion}" + implementation "androidx.constraintlayout:constraintlayout:${rootProject.ext.constraintVersion}" } diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/drawables/FilterableStateListDrawable.java b/magicasakura/src/main/java/com/bilibili/magicasakura/drawables/FilterableStateListDrawable.java index ce9c34c..6539284 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/drawables/FilterableStateListDrawable.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/drawables/FilterableStateListDrawable.java @@ -19,10 +19,10 @@ import android.graphics.ColorFilter; import android.graphics.drawable.Drawable; import android.graphics.drawable.StateListDrawable; -import android.support.annotation.RestrictTo; +import androidx.annotation.RestrictTo; import android.util.SparseArray; -import static android.support.annotation.RestrictTo.Scope.LIBRARY; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; /** * This is an extension to {@link android.graphics.drawable.StateListDrawable} that workaround a bug not allowing diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/utils/ColorStateListUtils.java b/magicasakura/src/main/java/com/bilibili/magicasakura/utils/ColorStateListUtils.java index 192066c..ad270f6 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/utils/ColorStateListUtils.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/utils/ColorStateListUtils.java @@ -21,8 +21,8 @@ import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.graphics.Color; -import android.support.annotation.RestrictTo; -import android.support.v4.graphics.ColorUtils; +import androidx.annotation.RestrictTo; +import androidx.core.graphics.ColorUtils; import android.util.AttributeSet; import android.util.StateSet; import android.util.TypedValue; @@ -34,7 +34,7 @@ import java.io.IOException; import java.util.LinkedList; -import static android.support.annotation.RestrictTo.Scope.LIBRARY; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; /** * @author xyczero617@gmail.com diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/utils/DrawableUtils.java b/magicasakura/src/main/java/com/bilibili/magicasakura/utils/DrawableUtils.java index fc2ad6c..f79552d 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/utils/DrawableUtils.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/utils/DrawableUtils.java @@ -28,7 +28,7 @@ import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.annotation.RestrictTo; +import androidx.annotation.RestrictTo; import android.util.AttributeSet; import android.util.StateSet; import android.util.TypedValue; @@ -41,7 +41,7 @@ import java.io.IOException; -import static android.support.annotation.RestrictTo.Scope.LIBRARY; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; /** * @author xyczero617@gmail.com diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/utils/GradientDrawableInflateImpl.java b/magicasakura/src/main/java/com/bilibili/magicasakura/utils/GradientDrawableInflateImpl.java index 57ef073..7e64a7f 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/utils/GradientDrawableInflateImpl.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/utils/GradientDrawableInflateImpl.java @@ -23,7 +23,7 @@ import android.graphics.drawable.Drawable; import android.graphics.drawable.GradientDrawable; import android.os.Build; -import android.support.v4.graphics.ColorUtils; +import androidx.core.graphics.ColorUtils; import android.util.AttributeSet; import android.util.Log; import android.util.TypedValue; diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/utils/InputConnectionImpl.java b/magicasakura/src/main/java/com/bilibili/magicasakura/utils/InputConnectionImpl.java index b9a3fda..f6850d5 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/utils/InputConnectionImpl.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/utils/InputConnectionImpl.java @@ -1,10 +1,10 @@ package com.bilibili.magicasakura.utils; -import android.support.annotation.RestrictTo; +import androidx.annotation.RestrictTo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputConnectionWrapper; -import static android.support.annotation.RestrictTo.Scope.LIBRARY; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; /** * just used for fix
java.lang.IndexOutOfBoundsExceptionwhile diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/utils/ThemeUtils.java b/magicasakura/src/main/java/com/bilibili/magicasakura/utils/ThemeUtils.java index 54ef9dc..aed47b4 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/utils/ThemeUtils.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/utils/ThemeUtils.java @@ -33,15 +33,15 @@ import android.graphics.drawable.NinePatchDrawable; import android.graphics.drawable.StateListDrawable; import android.os.Build; -import android.support.annotation.AttrRes; -import android.support.annotation.ColorInt; -import android.support.annotation.ColorRes; -import android.support.annotation.DrawableRes; -import android.support.annotation.StyleRes; -import android.support.v4.graphics.ColorUtils; -import android.support.v4.graphics.drawable.DrawableCompat; -import android.support.v7.view.ContextThemeWrapper; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.AttrRes; +import androidx.annotation.ColorInt; +import androidx.annotation.ColorRes; +import androidx.annotation.DrawableRes; +import androidx.annotation.StyleRes; +import androidx.core.graphics.ColorUtils; +import androidx.core.graphics.drawable.DrawableCompat; +import androidx.appcompat.view.ContextThemeWrapper; +import androidx.recyclerview.widget.RecyclerView; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.StateSet; @@ -269,10 +269,10 @@ public static boolean containsNinePatch(Drawable drawable) { @SuppressLint("RestrictedApi") public static Drawable getWrapperDrawable(Drawable drawable) { - if (drawable instanceof android.support.v4.graphics.drawable.WrappedDrawable) { - return ((android.support.v4.graphics.drawable.WrappedDrawable) drawable).getWrappedDrawable(); - } else if (drawable instanceof android.support.v7.graphics.drawable.DrawableWrapper) { - return ((android.support.v7.graphics.drawable.DrawableWrapper) drawable).getWrappedDrawable(); + if (drawable instanceof androidx.core.graphics.drawable.WrappedDrawable) { + return ((androidx.core.graphics.drawable.WrappedDrawable) drawable).getWrappedDrawable(); + } else if (drawable instanceof androidx.appcompat.graphics.drawable.DrawableWrapper) { + return ((androidx.appcompat.graphics.drawable.DrawableWrapper) drawable).getWrappedDrawable(); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && drawable instanceof android.graphics.drawable.DrawableWrapper) { return ((android.graphics.drawable.DrawableWrapper) drawable).getDrawable(); } diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/utils/TintInfo.java b/magicasakura/src/main/java/com/bilibili/magicasakura/utils/TintInfo.java index 507ce5a..69645e0 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/utils/TintInfo.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/utils/TintInfo.java @@ -18,11 +18,11 @@ import android.content.res.ColorStateList; import android.graphics.PorterDuff; -import android.support.annotation.RestrictTo; +import androidx.annotation.RestrictTo; import java.util.LinkedList; -import static android.support.annotation.RestrictTo.Scope.LIBRARY; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; /** * @author xyczero617@gmail.com diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/utils/TintManager.java b/magicasakura/src/main/java/com/bilibili/magicasakura/utils/TintManager.java index d295c0e..83c14fa 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/utils/TintManager.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/utils/TintManager.java @@ -23,13 +23,13 @@ import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.annotation.ColorRes; -import android.support.annotation.DrawableRes; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.RestrictTo; -import android.support.v4.util.LruCache; -import android.support.v7.view.ContextThemeWrapper; +import androidx.annotation.ColorRes; +import androidx.annotation.DrawableRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.RestrictTo; +import androidx.collection.LruCache; +import androidx.appcompat.view.ContextThemeWrapper; import android.util.Log; import android.util.SparseArray; import android.view.View; @@ -40,7 +40,7 @@ import java.util.Map; import java.util.WeakHashMap; -import static android.support.annotation.RestrictTo.Scope.LIBRARY; +import static androidx.annotation.RestrictTo.Scope.LIBRARY; /** * @author xyczero617@gmail.com diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/utils/VectorDrawableInflateImpl.java b/magicasakura/src/main/java/com/bilibili/magicasakura/utils/VectorDrawableInflateImpl.java index eeefba9..207b00b 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/utils/VectorDrawableInflateImpl.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/utils/VectorDrawableInflateImpl.java @@ -8,10 +8,9 @@ import android.content.res.ColorStateList; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; -import android.support.graphics.drawable.VectorDrawableCompat; -import android.support.v4.graphics.drawable.DrawableCompat; +import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat; +import androidx.core.graphics.drawable.DrawableCompat; import android.util.AttributeSet; -import android.util.Log; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatBackgroundHelper.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatBackgroundHelper.java index b1339bb..1ffdcc1 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatBackgroundHelper.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatBackgroundHelper.java @@ -20,8 +20,8 @@ import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.v4.content.ContextCompat; -import android.support.v4.graphics.drawable.DrawableCompat; +import androidx.core.content.ContextCompat; +import androidx.core.graphics.drawable.DrawableCompat; import android.util.AttributeSet; import android.view.View; diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatCompoundButtonHelper.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatCompoundButtonHelper.java index 2f73943..a6c4801 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatCompoundButtonHelper.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatCompoundButtonHelper.java @@ -20,9 +20,9 @@ import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.v4.content.ContextCompat; -import android.support.v4.graphics.drawable.DrawableCompat; -import android.support.v4.widget.CompoundButtonCompat; +import androidx.core.content.ContextCompat; +import androidx.core.graphics.drawable.DrawableCompat; +import androidx.core.widget.CompoundButtonCompat; import android.util.AttributeSet; import android.widget.CompoundButton; diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatCompoundDrawableHelper.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatCompoundDrawableHelper.java index c6be484..7933855 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatCompoundDrawableHelper.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatCompoundDrawableHelper.java @@ -20,8 +20,8 @@ import android.content.res.TypedArray; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; -import android.support.v4.content.ContextCompat; -import android.support.v4.graphics.drawable.DrawableCompat; +import androidx.core.content.ContextCompat; +import androidx.core.graphics.drawable.DrawableCompat; import android.util.AttributeSet; import android.widget.TextView; diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatForegroundHelper.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatForegroundHelper.java index 77989f2..9a91624 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatForegroundHelper.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatForegroundHelper.java @@ -20,8 +20,8 @@ import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.v4.content.ContextCompat; -import android.support.v4.graphics.drawable.DrawableCompat; +import androidx.core.content.ContextCompat; +import androidx.core.graphics.drawable.DrawableCompat; import android.util.AttributeSet; import android.view.View; import android.widget.FrameLayout; diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatImageHelper.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatImageHelper.java index 017d467..9064c39 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatImageHelper.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatImageHelper.java @@ -19,8 +19,8 @@ import android.content.res.TypedArray; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; -import android.support.v4.content.ContextCompat; -import android.support.v4.graphics.drawable.DrawableCompat; +import androidx.core.content.ContextCompat; +import androidx.core.graphics.drawable.DrawableCompat; import android.util.AttributeSet; import android.widget.ImageView; @@ -168,12 +168,14 @@ private void resetTintResource(int resId/*background resource id*/) { @Override public void tint() { - if (mImageTintResId == 0 || !setSupportImageTint(mImageTintResId)) { - Drawable drawable = mTintManager.getDrawable(mImageResId); - if (drawable == null) { - drawable = mImageResId == 0 ? null : ContextCompat.getDrawable(mView.getContext(), mImageResId); + if (mImageResId != 0) { + if (mImageTintResId == 0 || !setSupportImageTint(mImageTintResId)) { + Drawable drawable = mTintManager.getDrawable(mImageResId); + if (drawable == null) { + drawable = mImageResId == 0 ? null : ContextCompat.getDrawable(mView.getContext(), mImageResId); + } + setImageDrawable(drawable); } - setImageDrawable(drawable); } } diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatProgressBarHelper.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatProgressBarHelper.java index 7b89901..ce2a5b7 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatProgressBarHelper.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatProgressBarHelper.java @@ -19,7 +19,7 @@ import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.util.AttributeSet; import com.bilibili.magicasakura.R; @@ -128,6 +128,11 @@ private Drawable getTintTarget(int layerId, boolean shouldFallback) { return layer; } + public void setIndeterminateTintResId(int indeterminateTintResId) { + this.mIndeterminateTintResId = indeterminateTintResId; + setSupportIndeterminateTint(indeterminateTintResId); + } + @Override public void tint() { if (mProgressTintResId != 0) { diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatSwitchHelper.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatSwitchHelper.java index bcf9f5c..442209c 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatSwitchHelper.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatSwitchHelper.java @@ -4,10 +4,10 @@ import android.content.res.TypedArray; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; -import android.support.annotation.NonNull; -import android.support.v4.content.ContextCompat; -import android.support.v4.graphics.drawable.DrawableCompat; -import android.support.v7.widget.SwitchCompat; +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; +import androidx.core.graphics.drawable.DrawableCompat; +import androidx.appcompat.widget.SwitchCompat; import android.util.AttributeSet; import com.bilibili.magicasakura.utils.DrawableUtils; diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatTextHelper.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatTextHelper.java index 3fdf009..ae46b12 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatTextHelper.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/AppCompatTextHelper.java @@ -18,7 +18,7 @@ import android.content.res.ColorStateList; import android.content.res.TypedArray; -import android.support.annotation.ColorRes; +import androidx.annotation.ColorRes; import android.util.AttributeSet; import android.widget.TextView; diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintAppBarLayout.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintAppBarLayout.java index 511ed76..d7e0a89 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintAppBarLayout.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintAppBarLayout.java @@ -19,7 +19,7 @@ import android.content.Context; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; -import android.support.design.widget.AppBarLayout; +import com.google.android.material.appbar.AppBarLayout; import android.util.AttributeSet; import com.bilibili.magicasakura.utils.TintManager; diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintButton.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintButton.java index a5f7e75..a9af181 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintButton.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintButton.java @@ -23,7 +23,7 @@ import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.annotation.ColorRes; +import androidx.annotation.ColorRes; import android.util.AttributeSet; import android.widget.Button; diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintCheckBox.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintCheckBox.java index 406c0e6..1538a22 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintCheckBox.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintCheckBox.java @@ -24,10 +24,10 @@ import android.graphics.drawable.AnimatedStateListDrawable; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.annotation.ColorRes; -import android.support.annotation.DrawableRes; -import android.support.annotation.Nullable; -import android.support.v4.widget.CompoundButtonCompat; +import androidx.annotation.ColorRes; +import androidx.annotation.DrawableRes; +import androidx.annotation.Nullable; +import androidx.core.widget.CompoundButtonCompat; import android.util.AttributeSet; import android.widget.CheckBox; diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintCheckedTextView.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintCheckedTextView.java index 25d4ad0..53ecac3 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintCheckedTextView.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintCheckedTextView.java @@ -22,8 +22,8 @@ import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.annotation.DrawableRes; -import android.support.v4.graphics.drawable.DrawableCompat; +import androidx.annotation.DrawableRes; +import androidx.core.graphics.drawable.DrawableCompat; import android.util.AttributeSet; import android.widget.CheckedTextView; diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintConstraintLayout.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintConstraintLayout.java index fed823e..bd38275 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintConstraintLayout.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintConstraintLayout.java @@ -3,7 +3,7 @@ import android.content.Context; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; -import android.support.constraint.ConstraintLayout; +import androidx.constraintlayout.widget.ConstraintLayout; import android.util.AttributeSet; import com.bilibili.magicasakura.utils.TintManager; diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintEditText.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintEditText.java index 5c4baca..86fc1bf 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintEditText.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintEditText.java @@ -23,7 +23,7 @@ import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.annotation.ColorRes; +import androidx.annotation.ColorRes; import android.util.AttributeSet; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintProgressBar.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintProgressBar.java index 15543a9..6f46cf0 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintProgressBar.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintProgressBar.java @@ -48,6 +48,10 @@ public TintProgressBar(Context context, AttributeSet attrs, int defStyleAttr) { mProgressBarHelper.loadFromAttribute(attrs, defStyleAttr); } + public void setIndeterminateTintResId(int indeterminateTintResId) { + mProgressBarHelper.setIndeterminateTintResId(indeterminateTintResId); + } + @Override public void tint() { if (mProgressBarHelper != null) { diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintProgressDialog.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintProgressDialog.java index 6223230..7850b9d 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintProgressDialog.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintProgressDialog.java @@ -21,7 +21,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.Message; -import android.support.v7.app.AlertDialog; +import androidx.appcompat.app.AlertDialog; import android.text.Spannable; import android.text.SpannableString; import android.text.style.StyleSpan; diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintRadioButton.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintRadioButton.java index c80816f..fc8bd54 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintRadioButton.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintRadioButton.java @@ -24,10 +24,10 @@ import android.graphics.drawable.AnimatedStateListDrawable; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.annotation.ColorRes; -import android.support.annotation.DrawableRes; -import android.support.annotation.Nullable; -import android.support.v4.widget.CompoundButtonCompat; +import androidx.annotation.ColorRes; +import androidx.annotation.DrawableRes; +import androidx.annotation.Nullable; +import androidx.core.widget.CompoundButtonCompat; import android.util.AttributeSet; import android.widget.RadioButton; diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintSwitchCompat.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintSwitchCompat.java index b34272e..d3e9efc 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintSwitchCompat.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintSwitchCompat.java @@ -7,11 +7,11 @@ import android.graphics.drawable.AnimatedStateListDrawable; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.annotation.ColorRes; -import android.support.annotation.DrawableRes; -import android.support.annotation.Nullable; -import android.support.v4.widget.CompoundButtonCompat; -import android.support.v7.widget.SwitchCompat; +import androidx.annotation.ColorRes; +import androidx.annotation.DrawableRes; +import androidx.annotation.Nullable; +import androidx.core.widget.CompoundButtonCompat; +import androidx.appcompat.widget.SwitchCompat; import android.util.AttributeSet; import com.bilibili.magicasakura.R; @@ -38,7 +38,7 @@ public TintSwitchCompat(Context context) { } public TintSwitchCompat(Context context, AttributeSet attrs) { - this(context, attrs, android.support.v7.appcompat.R.attr.switchStyle); + this(context, attrs, androidx.appcompat.R.attr.switchStyle); } public TintSwitchCompat(Context context, AttributeSet attrs, int defStyleAttr) { diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintTextView.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintTextView.java index 9a7c824..715ff33 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintTextView.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintTextView.java @@ -23,7 +23,7 @@ import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.annotation.ColorRes; +import androidx.annotation.ColorRes; import android.util.AttributeSet; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; diff --git a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintToolbar.java b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintToolbar.java index de00dd3..8dc501d 100644 --- a/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintToolbar.java +++ b/magicasakura/src/main/java/com/bilibili/magicasakura/widgets/TintToolbar.java @@ -19,7 +19,7 @@ import android.content.Context; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; -import android.support.v7.widget.Toolbar; +import androidx.appcompat.widget.Toolbar; import android.util.AttributeSet; import com.bilibili.magicasakura.R; diff --git a/sample/build.gradle b/sample/build.gradle index 5773cdb..8ea494b 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -25,6 +25,6 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(':magicasakura') - implementation "com.android.support:design:${rootProject.ext.supportVersion}" - implementation "com.android.support:preference-v7:${rootProject.ext.supportVersion}" + implementation "com.google.android.material:material:${rootProject.ext.androidxtVersion}" + implementation "androidx.preference:preference:${rootProject.ext.androidxtVersion}" } diff --git a/sample/src/main/java/com/bilibili/magicasakurademo/MainActivity.java b/sample/src/main/java/com/bilibili/magicasakurademo/MainActivity.java index e40d237..51204e3 100644 --- a/sample/src/main/java/com/bilibili/magicasakurademo/MainActivity.java +++ b/sample/src/main/java/com/bilibili/magicasakurademo/MainActivity.java @@ -21,13 +21,13 @@ import android.graphics.Rect; import android.os.Build; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.util.SparseArrayCompat; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.SwitchCompat; -import android.support.v7.widget.Toolbar; +import androidx.annotation.Nullable; +import androidx.collection.SparseArrayCompat; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.appcompat.widget.SwitchCompat; +import androidx.appcompat.widget.Toolbar; import android.text.Editable; import android.text.TextWatcher; import android.view.KeyEvent; diff --git a/sample/src/main/java/com/bilibili/magicasakurademo/MyApplication.java b/sample/src/main/java/com/bilibili/magicasakurademo/MyApplication.java index 25aa0d6..b223290 100644 --- a/sample/src/main/java/com/bilibili/magicasakurademo/MyApplication.java +++ b/sample/src/main/java/com/bilibili/magicasakurademo/MyApplication.java @@ -18,8 +18,8 @@ import android.app.Application; import android.content.Context; -import android.support.annotation.ColorInt; -import android.support.annotation.ColorRes; +import androidx.annotation.ColorInt; +import androidx.annotation.ColorRes; import com.bilibili.magicasakurademo.utils.ThemeHelper; import com.bilibili.magicasakura.utils.ThemeUtils; diff --git a/sample/src/main/java/com/bilibili/magicasakurademo/dialog/CardPickerDialog.java b/sample/src/main/java/com/bilibili/magicasakurademo/dialog/CardPickerDialog.java index a4d4417..9f9682c 100644 --- a/sample/src/main/java/com/bilibili/magicasakurademo/dialog/CardPickerDialog.java +++ b/sample/src/main/java/com/bilibili/magicasakurademo/dialog/CardPickerDialog.java @@ -17,8 +17,8 @@ package com.bilibili.magicasakurademo.dialog; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.DialogFragment; +import androidx.annotation.Nullable; +import androidx.fragment.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/sample/src/main/java/com/bilibili/magicasakurademo/dialog/ProgressCheckDialog.java b/sample/src/main/java/com/bilibili/magicasakurademo/dialog/ProgressCheckDialog.java index 962096a..8149026 100644 --- a/sample/src/main/java/com/bilibili/magicasakurademo/dialog/ProgressCheckDialog.java +++ b/sample/src/main/java/com/bilibili/magicasakurademo/dialog/ProgressCheckDialog.java @@ -17,8 +17,8 @@ package com.bilibili.magicasakurademo.dialog; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.DialogFragment; +import androidx.annotation.Nullable; +import androidx.fragment.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/sample/src/main/java/com/bilibili/magicasakurademo/dialog/ProgressStyleDialog.java b/sample/src/main/java/com/bilibili/magicasakurademo/dialog/ProgressStyleDialog.java index 4b28f48..1c66b93 100644 --- a/sample/src/main/java/com/bilibili/magicasakurademo/dialog/ProgressStyleDialog.java +++ b/sample/src/main/java/com/bilibili/magicasakurademo/dialog/ProgressStyleDialog.java @@ -17,8 +17,8 @@ package com.bilibili.magicasakurademo.dialog; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.DialogFragment; +import androidx.annotation.Nullable; +import androidx.fragment.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/sample/src/main/java/com/bilibili/magicasakurademo/utils/SnackAnimationUtil.java b/sample/src/main/java/com/bilibili/magicasakurademo/utils/SnackAnimationUtil.java index 5da7999..f7b2086 100644 --- a/sample/src/main/java/com/bilibili/magicasakurademo/utils/SnackAnimationUtil.java +++ b/sample/src/main/java/com/bilibili/magicasakurademo/utils/SnackAnimationUtil.java @@ -17,7 +17,7 @@ package com.bilibili.magicasakurademo.utils; import android.content.Context; -import android.support.annotation.AnimRes; +import androidx.annotation.AnimRes; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml index 3a5f742..a885c35 100644 --- a/sample/src/main/res/layout/activity_main.xml +++ b/sample/src/main/res/layout/activity_main.xml @@ -40,7 +40,7 @@ -