From e9caa81d3dc06c9f79819192684ba33f61aa2f0e Mon Sep 17 00:00:00 2001 From: Sira Lam Date: Fri, 22 Sep 2017 12:38:39 +0800 Subject: [PATCH 1/2] Changed to support library 26 and added functionality of extra width when indicator width equals title width. --- FlycoTabLayout_Lib/build.gradle | 10 +++++----- .../java/com/flyco/tablayout/SlidingTabLayout.java | 6 ++++-- FlycoTabLayout_Lib/src/main/res/values/attrs.xml | 2 ++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/FlycoTabLayout_Lib/build.gradle b/FlycoTabLayout_Lib/build.gradle index 166f8c62..0b260e9d 100644 --- a/FlycoTabLayout_Lib/build.gradle +++ b/FlycoTabLayout_Lib/build.gradle @@ -5,13 +5,13 @@ apply plugin: 'com.android.library' // 这个version是区分library版本的,因此当我们需要更新library时记得修改这个version version = "2.1.2" android { - compileSdkVersion 25 - buildToolsVersion "25.0.1" + compileSdkVersion 26 + buildToolsVersion "26.0.1" defaultConfig { minSdkVersion 11 - targetSdkVersion 25 - versionCode 212 + targetSdkVersion 26 + versionCode 213 versionName version } buildTypes { @@ -24,7 +24,7 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:support-v4:25.1.0' + compile 'com.android.support:support-v4:26.1.0' } //def siteUrl = 'https://github.com/H07000223' // 项目的主页 diff --git a/FlycoTabLayout_Lib/src/main/java/com/flyco/tablayout/SlidingTabLayout.java b/FlycoTabLayout_Lib/src/main/java/com/flyco/tablayout/SlidingTabLayout.java index 9ab7e5ed..a5e6eb0a 100644 --- a/FlycoTabLayout_Lib/src/main/java/com/flyco/tablayout/SlidingTabLayout.java +++ b/FlycoTabLayout_Lib/src/main/java/com/flyco/tablayout/SlidingTabLayout.java @@ -72,6 +72,7 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager. private float mIndicatorMarginBottom; private int mIndicatorGravity; private boolean mIndicatorWidthEqualTitle; + private float mIndicatorWidthEqualTitleExtra; /** underline */ private int mUnderlineColor; @@ -146,6 +147,7 @@ private void obtainAttributes(Context context, AttributeSet attrs) { mIndicatorMarginBottom = ta.getDimension(R.styleable.SlidingTabLayout_tl_indicator_margin_bottom, dp2px(mIndicatorStyle == STYLE_BLOCK ? 7 : 0)); mIndicatorGravity = ta.getInt(R.styleable.SlidingTabLayout_tl_indicator_gravity, Gravity.BOTTOM); mIndicatorWidthEqualTitle = ta.getBoolean(R.styleable.SlidingTabLayout_tl_indicator_width_equal_title, false); + mIndicatorWidthEqualTitleExtraWidth = ta.getDimension(R.styleable.SlidingTabLayout_tl_indicator_width_equal_title_extra_width, dp2px(0)); mUnderlineColor = ta.getColor(R.styleable.SlidingTabLayout_tl_underline_color, Color.parseColor("#ffffff")); mUnderlineHeight = ta.getDimension(R.styleable.SlidingTabLayout_tl_underline_height, dp2px(0)); @@ -413,8 +415,8 @@ private void calcIndicatorRect() { mIndicatorRect.right = (int) right; //for mIndicatorWidthEqualTitle if (mIndicatorStyle == STYLE_NORMAL && mIndicatorWidthEqualTitle) { - mIndicatorRect.left = (int) (left + margin - 1); - mIndicatorRect.right = (int) (right - margin - 1); + mIndicatorRect.left = (int) ((left + margin - 1) - mIndicatorWidthEqualTitleExtraWidth); + mIndicatorRect.right = (int) ((right - margin - 1) + mIndicatorWidthEqualTitleExtraWidth); } mTabRect.left = (int) left; diff --git a/FlycoTabLayout_Lib/src/main/res/values/attrs.xml b/FlycoTabLayout_Lib/src/main/res/values/attrs.xml index b0afdbee..0021866f 100644 --- a/FlycoTabLayout_Lib/src/main/res/values/attrs.xml +++ b/FlycoTabLayout_Lib/src/main/res/values/attrs.xml @@ -27,6 +27,7 @@ + @@ -90,6 +91,7 @@ + From 66027651c5bce393b28d8d873e6ae8773b23e750 Mon Sep 17 00:00:00 2001 From: Sira Lam Date: Fri, 22 Sep 2017 12:40:46 +0800 Subject: [PATCH 2/2] Mofidied app version --- FlycoTabLayout_Lib/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FlycoTabLayout_Lib/build.gradle b/FlycoTabLayout_Lib/build.gradle index 0b260e9d..c216929d 100644 --- a/FlycoTabLayout_Lib/build.gradle +++ b/FlycoTabLayout_Lib/build.gradle @@ -3,7 +3,7 @@ apply plugin: 'com.android.library' //apply plugin: 'com.jfrog.bintray' // 这个version是区分library版本的,因此当我们需要更新library时记得修改这个version -version = "2.1.2" +version = "2.1.3" android { compileSdkVersion 26 buildToolsVersion "26.0.1"