From fb162624823e4b24ad4340afd2b7683fff540394 Mon Sep 17 00:00:00 2001 From: lizk Date: Mon, 22 Nov 2021 17:10:10 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8Dandroidx=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FlycoTabLayout_Lib/build.gradle | 2 +- .../java/com/flyco/tablayout/CommonTabLayout.java | 5 +++-- .../java/com/flyco/tablayout/SegmentTabLayout.java | 5 +++-- .../java/com/flyco/tablayout/SlidingTabLayout.java | 13 +++++++------ .../tablayout/utils/FragmentChangeManager.java | 7 ++++--- .../tablayoutsamples/ui/CommonTabActivity.java | 11 ++++++----- .../tablayoutsamples/ui/SegmentTabActivity.java | 11 ++++++----- .../tablayoutsamples/ui/SimpleCardFragment.java | 3 ++- .../tablayoutsamples/ui/SimpleHomeActivity.java | 3 ++- .../tablayoutsamples/ui/SlidingTabActivity.java | 11 ++++++----- gradle.properties | 4 +++- 11 files changed, 43 insertions(+), 32 deletions(-) diff --git a/FlycoTabLayout_Lib/build.gradle b/FlycoTabLayout_Lib/build.gradle index 55064a83..bbd7d235 100644 --- a/FlycoTabLayout_Lib/build.gradle +++ b/FlycoTabLayout_Lib/build.gradle @@ -34,7 +34,7 @@ afterEvaluate { from components.release groupId = 'com.github.lizhongkan' artifactId = 'FlycoTableLayout' - version = '2.1.4' + version = '2.1.5' } } } diff --git a/FlycoTabLayout_Lib/src/main/java/com/flyco/tablayout/CommonTabLayout.java b/FlycoTabLayout_Lib/src/main/java/com/flyco/tablayout/CommonTabLayout.java index df4dc23d..317c2e17 100644 --- a/FlycoTabLayout_Lib/src/main/java/com/flyco/tablayout/CommonTabLayout.java +++ b/FlycoTabLayout_Lib/src/main/java/com/flyco/tablayout/CommonTabLayout.java @@ -13,8 +13,6 @@ import android.graphics.drawable.GradientDrawable; import android.os.Bundle; import android.os.Parcelable; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentActivity; import android.util.AttributeSet; import android.util.SparseArray; import android.util.TypedValue; @@ -35,6 +33,9 @@ import java.util.ArrayList; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; + /** 没有继承HorizontalScrollView不能滑动,对于ViewPager无依赖 */ public class CommonTabLayout extends FrameLayout implements ValueAnimator.AnimatorUpdateListener { private Context mContext; diff --git a/FlycoTabLayout_Lib/src/main/java/com/flyco/tablayout/SegmentTabLayout.java b/FlycoTabLayout_Lib/src/main/java/com/flyco/tablayout/SegmentTabLayout.java index e9df2953..da93f3e1 100644 --- a/FlycoTabLayout_Lib/src/main/java/com/flyco/tablayout/SegmentTabLayout.java +++ b/FlycoTabLayout_Lib/src/main/java/com/flyco/tablayout/SegmentTabLayout.java @@ -11,8 +11,6 @@ import android.graphics.drawable.GradientDrawable; import android.os.Bundle; import android.os.Parcelable; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentActivity; import android.util.AttributeSet; import android.util.SparseArray; import android.util.TypedValue; @@ -30,6 +28,9 @@ import java.util.ArrayList; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; + public class SegmentTabLayout extends FrameLayout implements ValueAnimator.AnimatorUpdateListener { private Context mContext; private String[] mTitles; 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..c2b18d82 100644 --- a/FlycoTabLayout_Lib/src/main/java/com/flyco/tablayout/SlidingTabLayout.java +++ b/FlycoTabLayout_Lib/src/main/java/com/flyco/tablayout/SlidingTabLayout.java @@ -10,12 +10,6 @@ import android.graphics.drawable.GradientDrawable; import android.os.Bundle; import android.os.Parcelable; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentActivity; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentPagerAdapter; -import android.support.v4.view.PagerAdapter; -import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.util.SparseArray; import android.util.TypedValue; @@ -33,6 +27,13 @@ import java.util.ArrayList; import java.util.Collections; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentPagerAdapter; +import androidx.viewpager.widget.PagerAdapter; +import androidx.viewpager.widget.ViewPager; + /** 滑动TabLayout,对于ViewPager的依赖性强 */ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager.OnPageChangeListener { private Context mContext; diff --git a/FlycoTabLayout_Lib/src/main/java/com/flyco/tablayout/utils/FragmentChangeManager.java b/FlycoTabLayout_Lib/src/main/java/com/flyco/tablayout/utils/FragmentChangeManager.java index dcba1688..3706aec9 100644 --- a/FlycoTabLayout_Lib/src/main/java/com/flyco/tablayout/utils/FragmentChangeManager.java +++ b/FlycoTabLayout_Lib/src/main/java/com/flyco/tablayout/utils/FragmentChangeManager.java @@ -1,11 +1,12 @@ package com.flyco.tablayout.utils; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentTransaction; import java.util.ArrayList; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; + public class FragmentChangeManager { private FragmentManager mFragmentManager; private int mContainerViewId; diff --git a/app/src/main/java/com/flyco/tablayoutsamples/ui/CommonTabActivity.java b/app/src/main/java/com/flyco/tablayoutsamples/ui/CommonTabActivity.java index b898c2ce..a72bcdfa 100644 --- a/app/src/main/java/com/flyco/tablayoutsamples/ui/CommonTabActivity.java +++ b/app/src/main/java/com/flyco/tablayoutsamples/ui/CommonTabActivity.java @@ -3,11 +3,6 @@ import android.content.Context; import android.graphics.Color; 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 android.view.View; import com.flyco.tablayout.CommonTabLayout; @@ -22,6 +17,12 @@ import java.util.ArrayList; import java.util.Random; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentPagerAdapter; +import androidx.viewpager.widget.ViewPager; + public class CommonTabActivity extends AppCompatActivity { private Context mContext = this; private ArrayList mFragments = new ArrayList<>(); diff --git a/app/src/main/java/com/flyco/tablayoutsamples/ui/SegmentTabActivity.java b/app/src/main/java/com/flyco/tablayoutsamples/ui/SegmentTabActivity.java index 9ac154cc..2b1802be 100644 --- a/app/src/main/java/com/flyco/tablayoutsamples/ui/SegmentTabActivity.java +++ b/app/src/main/java/com/flyco/tablayoutsamples/ui/SegmentTabActivity.java @@ -2,11 +2,6 @@ import android.graphics.Color; 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 android.view.View; import com.flyco.tablayout.SegmentTabLayout; @@ -17,6 +12,12 @@ import java.util.ArrayList; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentPagerAdapter; +import androidx.viewpager.widget.ViewPager; + public class SegmentTabActivity extends AppCompatActivity { private ArrayList mFragments = new ArrayList<>(); private ArrayList mFragments2 = new ArrayList<>(); diff --git a/app/src/main/java/com/flyco/tablayoutsamples/ui/SimpleCardFragment.java b/app/src/main/java/com/flyco/tablayoutsamples/ui/SimpleCardFragment.java index c4aeed2b..54075b22 100644 --- a/app/src/main/java/com/flyco/tablayoutsamples/ui/SimpleCardFragment.java +++ b/app/src/main/java/com/flyco/tablayoutsamples/ui/SimpleCardFragment.java @@ -2,7 +2,6 @@ import android.annotation.SuppressLint; import android.os.Bundle; -import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -10,6 +9,8 @@ import com.flyco.tablayoutsamples.R; +import androidx.fragment.app.Fragment; + @SuppressLint("ValidFragment") public class SimpleCardFragment extends Fragment { private String mTitle; diff --git a/app/src/main/java/com/flyco/tablayoutsamples/ui/SimpleHomeActivity.java b/app/src/main/java/com/flyco/tablayoutsamples/ui/SimpleHomeActivity.java index 087c3e7a..fc5b6a72 100644 --- a/app/src/main/java/com/flyco/tablayoutsamples/ui/SimpleHomeActivity.java +++ b/app/src/main/java/com/flyco/tablayoutsamples/ui/SimpleHomeActivity.java @@ -4,13 +4,14 @@ import android.content.Intent; import android.graphics.Color; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import com.flyco.tablayoutsamples.adapter.SimpleHomeAdapter; +import androidx.appcompat.app.AppCompatActivity; + public class SimpleHomeActivity extends AppCompatActivity { private Context mContext = this; private final String[] mItems = {"SlidingTabLayout", "CommonTabLayout", "SegmentTabLayout"}; diff --git a/app/src/main/java/com/flyco/tablayoutsamples/ui/SlidingTabActivity.java b/app/src/main/java/com/flyco/tablayoutsamples/ui/SlidingTabActivity.java index 290c9b03..82fd03f0 100644 --- a/app/src/main/java/com/flyco/tablayoutsamples/ui/SlidingTabActivity.java +++ b/app/src/main/java/com/flyco/tablayoutsamples/ui/SlidingTabActivity.java @@ -3,11 +3,6 @@ import android.content.Context; import android.graphics.Color; 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 android.view.View; import android.widget.Toast; @@ -19,6 +14,12 @@ import java.util.ArrayList; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentPagerAdapter; +import androidx.viewpager.widget.ViewPager; + public class SlidingTabActivity extends AppCompatActivity implements OnTabSelectListener { private Context mContext = this; private ArrayList mFragments = new ArrayList<>(); diff --git a/gradle.properties b/gradle.properties index 1d3591c8..59d5aab6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,4 +15,6 @@ # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true \ No newline at end of file +# org.gradle.parallel=true +android.useAndroidX=true +android.enableJetifier=true \ No newline at end of file