Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update support lib to androidx #66

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
}

2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions magicasakura/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 [email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -41,7 +41,7 @@

import java.io.IOException;

import static android.support.annotation.RestrictTo.Scope.LIBRARY;
import static androidx.annotation.RestrictTo.Scope.LIBRARY;

/**
* @author [email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <pre>java.lang.IndexOutOfBoundsException</pre> while
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 [email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading