diff --git a/.idea/misc.xml b/.idea/misc.xml index 74aef28..755b432 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,11 +1,12 @@ + diff --git a/.idea/modules.xml b/.idea/modules.xml index a9373bf..2bd8fbd 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,15 +2,10 @@ - - - - - \ No newline at end of file diff --git a/README.md b/README.md index 1fab2c9..b153420 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ### 1.添加XTabLayout依赖库 #### 在app目录下的build.gradle的dependencies中添加如下引用: - compile 'com.androidkun:XTabLayout:1.1.5' + compile 'com.github.791180116:XTabLayout:1.1.6' ### 2.在布局文件中设置XTabLayout属性 diff --git a/app/build.gradle b/app/build.gradle index d869912..3c0720d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,12 +20,12 @@ android { } dependencies { - compile fileTree(include: ['*.jar'], dir: 'libs') - androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + implementation fileTree(include: ['*.jar'], dir: 'libs') + androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) /* compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:design:23.4.0+'*/ - testCompile 'junit:junit:4.12' - compile project(':xtablayoutlibrary') + testImplementation 'junit:junit:4.12' + implementation project(':xtablayoutlibrary') } diff --git a/build.gradle b/build.gradle index b43e389..caf1d60 100644 --- a/build.gradle +++ b/build.gradle @@ -2,11 +2,17 @@ buildscript { repositories { + maven{ url 'http://maven.oschina.net/content/groups/public/'} + maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } + maven { url 'https://maven.aliyun.com/repository/releases' } + maven { url 'https://maven.aliyun.com/repository/public/' } + google() + mavenCentral() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.2.3' - classpath 'com.novoda:bintray-release:0.3.4' + classpath 'com.android.tools.build:gradle:3.5.2' + classpath 'com.novoda:bintray-release:0.9.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } @@ -14,7 +20,15 @@ buildscript { allprojects { repositories { + maven{ url 'http://maven.oschina.net/content/groups/public/'} + maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } + maven { url 'https://maven.aliyun.com/repository/releases' } + maven { url 'https://maven.aliyun.com/repository/public/' } + maven { url 'https://maven.aliyun.com/repository/spring/' } + google() + mavenCentral() jcenter() + maven {url 'https://jitpack.io/'} } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 04e285f..191736c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Dec 28 10:00:20 PST 2015 +#Wed Dec 30 10:52:57 CST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip diff --git a/xtablayoutlibrary/build.gradle b/xtablayoutlibrary/build.gradle index ea8c31e..5903419 100644 --- a/xtablayoutlibrary/build.gradle +++ b/xtablayoutlibrary/build.gradle @@ -26,20 +26,20 @@ android { } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + api fileTree(dir: 'libs', include: ['*.jar']) + androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) - compile 'com.android.support:appcompat-v7:23.4.0' - compile 'com.android.support:design:23.4.0+' - testCompile 'junit:junit:4.12' + api 'com.android.support:appcompat-v7:23.4.0' + api 'com.android.support:design:23.4.0+' + testImplementation 'junit:junit:4.12' } publish { userOrg = 'androidkun' groupId = 'com.androidkun' artifactId = 'XTabLayout' - publishVersion = '1.1.5' + publishVersion = '1.1.6' desc = 'Added support to modify text size and indicator width based on the original TabLayout.' website = 'https://github.com/AndroidKun/XTabLayout' } diff --git a/xtablayoutlibrary/src/main/java/com/androidkun/xtablayout/XTabLayout.java b/xtablayoutlibrary/src/main/java/com/androidkun/xtablayout/XTabLayout.java index d65b979..1d8069a 100644 --- a/xtablayoutlibrary/src/main/java/com/androidkun/xtablayout/XTabLayout.java +++ b/xtablayoutlibrary/src/main/java/com/androidkun/xtablayout/XTabLayout.java @@ -186,8 +186,8 @@ public interface OnTabSelectedListener { private boolean xTabTextSelectedBold; private float mTabTextMultiLineSize; - private final int xTabBackgroundColor; - private final int xTabSelectedBackgroundColor; + private final Drawable xTabBackgroundColor; + private final Drawable xTabSelectedBackgroundColor; private int mTabMaxWidth = Integer.MAX_VALUE; private final int mRequestedTabMinWidth; @@ -305,8 +305,8 @@ public XTabLayout(Context context, AttributeSet attrs, int defStyleAttr) { INVALID_WIDTH); mRequestedTabMaxWidth = a.getDimensionPixelSize(R.styleable.XTabLayout_xTabMaxWidth, INVALID_WIDTH); - xTabBackgroundColor = a.getColor(R.styleable.XTabLayout_xTabBackgroundColor, 0); - xTabSelectedBackgroundColor = a.getColor(R.styleable.XTabLayout_xTabSelectedBackgroundColor, 0); + xTabBackgroundColor = a.getDrawable(R.styleable.XTabLayout_xTabBackgroundColor); + xTabSelectedBackgroundColor = a.getDrawable(R.styleable.XTabLayout_xTabSelectedBackgroundColor); mContentInsetStart = a.getDimensionPixelSize(R.styleable.XTabLayout_xTabContentStart, 0); mMode = a.getInt(R.styleable.XTabLayout_xTabMode, MODE_FIXED); @@ -1488,13 +1488,14 @@ public boolean performClick() { } } + @TargetApi(Build.VERSION_CODES.JELLY_BEAN) @Override public void setSelected(boolean selected) { final boolean changed = (isSelected() != selected); super.setSelected(selected); if (!selected) { - if (xTabBackgroundColor != 0) { - setBackgroundColor(xTabBackgroundColor); + if (xTabBackgroundColor != null) { + setBackground(xTabBackgroundColor); } mTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize); if (xTabTextBold) { @@ -1504,8 +1505,8 @@ public void setSelected(boolean selected) { } } if (changed && selected) { - if (xTabSelectedBackgroundColor != 0) { - setBackgroundColor(xTabSelectedBackgroundColor); + if (xTabSelectedBackgroundColor != null) { + setBackground(xTabSelectedBackgroundColor); } sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);