From 62599fffd13d0678ed4939dc4537d5497900e439 Mon Sep 17 00:00:00 2001 From: Hossein Date: Sun, 23 Jun 2019 20:11:15 +0430 Subject: [PATCH 1/2] Added support for android X --- build.gradle | 4 +- example/build.gradle | 55 +++++++++---------- .../example/MainActivity.java | 10 ++-- .../example/adapters/CountriesAdapter.java | 2 +- .../adapters/ExampleFragmentsAdapter.java | 6 +- .../customview/CustomHandleBehavior.java | 4 +- .../CustomScrollerViewProvider.java | 2 +- .../example/fragments/ExampleFragment.java | 12 ++-- .../example/fragments/HorizontalFragment.java | 8 +-- example/src/main/res/layout/activity_main.xml | 4 +- .../src/main/res/layout/fragment_default.xml | 2 +- .../main/res/layout/fragment_horizontal.xml | 2 +- .../src/main/res/layout/fragment_styled.xml | 2 +- fastscroll/build.gradle | 10 ++-- .../recyclerviewfastscroll/FastScroller.java | 6 +- .../RecyclerViewScrollListener.java | 4 +- .../recyclerviewfastscroll/Utils.java | 2 - .../DefaultScrollerViewProvider.java | 2 +- .../viewprovider/ScrollerViewProvider.java | 2 +- .../VisibilityAnimationManager.java | 2 +- gradle.properties | 4 +- gradle/wrapper/gradle-wrapper.properties | 4 +- 22 files changed, 74 insertions(+), 75 deletions(-) diff --git a/build.gradle b/build.gradle index 4b93e89..83f3353 100644 --- a/build.gradle +++ b/build.gradle @@ -6,9 +6,10 @@ buildscript { maven { url "https://plugins.gradle.org/m2/" } + google() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.0-beta1' + classpath 'com.android.tools.build:gradle:3.4.1' classpath "com.github.dcendents:android-maven-gradle-plugin:1.4.1" classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2' } @@ -17,6 +18,7 @@ buildscript { allprojects { repositories { jcenter() + google() } } diff --git a/example/build.gradle b/example/build.gradle index ac469d5..133ae82 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -1,48 +1,47 @@ apply plugin: 'com.android.application' android { - compileSdkVersion rootProject.compileSdkVersion - buildToolsVersion rootProject.buildToolsVersion + compileSdkVersion 29 - signingConfigs { - - def pathToProperties = "keyz/signing.properties" - if (!(file(pathToProperties)).exists()) { - throw new GradleException("You have to specify a valid signing properties file.") - } - Properties props = new Properties() - props.load(new FileInputStream(file(pathToProperties))) - - release { - keyAlias props['keyAlias'] - keyPassword props['keyPassword'] - storePassword props['storePassword'] - storeFile file('keyz/keystore.jks') - } - - } +// signingConfigs { +// +// def pathToProperties = "keyz/signing.properties" +// if (!(file(pathToProperties)).exists()) { +// throw new GradleException("You have to specify a valid signing properties file.") +// } +// Properties props = new Properties() +// props.load(new FileInputStream(file(pathToProperties))) +// +// release { +// keyAlias props['keyAlias'] +// keyPassword props['keyPassword'] +// storePassword props['storePassword'] +// storeFile file('keyz/keystore.jks') +// } +// +// } defaultConfig { applicationId "com.futuremind.recyclerviewfastscroll.example" - minSdkVersion rootProject.minSdkVersion - targetSdkVersion rootProject.targetSdkVersion + minSdkVersion 14 + targetSdkVersion 29 versionCode rootProject.versionCode versionName rootProject.versionName } buildTypes { release { minifyEnabled false - signingConfig signingConfigs.release +// signingConfig signingConfigs.release proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile project(':fastscroll') - compile 'com.android.support:appcompat-v7:23.4.0' - compile 'com.android.support:recyclerview-v7:23.4.0' - compile 'com.android.support:design:23.4.0' - compile 'com.android.support:support-v4:23.4.0' + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation project(':fastscroll') + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'androidx.recyclerview:recyclerview:1.0.0' + implementation 'com.google.android.material:material:1.0.0' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' } diff --git a/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/MainActivity.java b/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/MainActivity.java index ad50182..2b14e07 100644 --- a/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/MainActivity.java +++ b/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/MainActivity.java @@ -1,9 +1,9 @@ package com.futuremind.recyclerviewfastscroll.example; import android.os.Bundle; -import android.support.design.widget.TabLayout; -import android.support.v4.view.ViewPager; -import android.support.v7.app.AppCompatActivity; +import com.google.android.material.tabs.TabLayout; +import androidx.viewpager.widget.ViewPager; +import androidx.appcompat.app.AppCompatActivity; import com.futuremind.recyclerviewfastscroll.example.adapters.ExampleFragmentsAdapter; @@ -14,8 +14,8 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); - ViewPager pager = (ViewPager) findViewById(R.id.pager); - TabLayout tabs = (TabLayout) findViewById(R.id.tab_layout); + ViewPager pager = findViewById(R.id.pager); + TabLayout tabs = findViewById(R.id.tab_layout); pager.setAdapter(new ExampleFragmentsAdapter(this, getSupportFragmentManager())); tabs.setupWithViewPager(pager); diff --git a/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/adapters/CountriesAdapter.java b/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/adapters/CountriesAdapter.java index d7317d3..8ef7f8c 100644 --- a/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/adapters/CountriesAdapter.java +++ b/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/adapters/CountriesAdapter.java @@ -1,7 +1,7 @@ package com.futuremind.recyclerviewfastscroll.example.adapters; import android.content.Context; -import android.support.v7.widget.RecyclerView; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/adapters/ExampleFragmentsAdapter.java b/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/adapters/ExampleFragmentsAdapter.java index b98a079..a91de85 100644 --- a/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/adapters/ExampleFragmentsAdapter.java +++ b/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/adapters/ExampleFragmentsAdapter.java @@ -1,9 +1,9 @@ package com.futuremind.recyclerviewfastscroll.example.adapters; import android.content.Context; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentStatePagerAdapter; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentStatePagerAdapter; import com.futuremind.recyclerviewfastscroll.example.R; import com.futuremind.recyclerviewfastscroll.example.fragments.CustomViewFragment; diff --git a/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/customview/CustomHandleBehavior.java b/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/customview/CustomHandleBehavior.java index bb772a1..040f61b 100644 --- a/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/customview/CustomHandleBehavior.java +++ b/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/customview/CustomHandleBehavior.java @@ -2,8 +2,8 @@ import android.animation.AnimatorInflater; import android.animation.AnimatorSet; -import android.support.annotation.AnimatorRes; -import android.support.annotation.Nullable; +import androidx.annotation.AnimatorRes; +import androidx.annotation.Nullable; import android.view.View; import com.futuremind.recyclerviewfastscroll.viewprovider.ViewBehavior; diff --git a/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/customview/CustomScrollerViewProvider.java b/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/customview/CustomScrollerViewProvider.java index 71fc9e5..4ec2977 100644 --- a/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/customview/CustomScrollerViewProvider.java +++ b/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/customview/CustomScrollerViewProvider.java @@ -2,7 +2,7 @@ import android.graphics.drawable.ShapeDrawable; import android.graphics.drawable.shapes.OvalShape; -import android.support.v4.content.ContextCompat; +import androidx.core.content.ContextCompat; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; diff --git a/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/fragments/ExampleFragment.java b/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/fragments/ExampleFragment.java index 206868c..4e97162 100644 --- a/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/fragments/ExampleFragment.java +++ b/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/fragments/ExampleFragment.java @@ -1,10 +1,10 @@ package com.futuremind.recyclerviewfastscroll.example.fragments; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -23,8 +23,8 @@ public abstract class ExampleFragment extends Fragment { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View layout = LayoutInflater.from(getActivity()).inflate(getLayoutId(), container, false); - RecyclerView recyclerView = (RecyclerView) layout.findViewById(R.id.recyclerview); - fastScroller = (FastScroller) layout.findViewById(R.id.fastscroll); + RecyclerView recyclerView = layout.findViewById(R.id.recyclerview); + fastScroller = layout.findViewById(R.id.fastscroll); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); CountriesAdapter adapter = new CountriesAdapter(getActivity()); diff --git a/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/fragments/HorizontalFragment.java b/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/fragments/HorizontalFragment.java index e85625a..28ac3aa 100644 --- a/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/fragments/HorizontalFragment.java +++ b/example/src/main/java/com/futuremind/recyclerviewfastscroll/example/fragments/HorizontalFragment.java @@ -1,10 +1,10 @@ package com.futuremind.recyclerviewfastscroll.example.fragments; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/example/src/main/res/layout/activity_main.xml b/example/src/main/res/layout/activity_main.xml index a6553fd..22ca9e0 100644 --- a/example/src/main/res/layout/activity_main.xml +++ b/example/src/main/res/layout/activity_main.xml @@ -6,14 +6,14 @@ android:orientation="vertical" tools:context=".MainActivity"> - - diff --git a/example/src/main/res/layout/fragment_default.xml b/example/src/main/res/layout/fragment_default.xml index fe101c9..8574241 100644 --- a/example/src/main/res/layout/fragment_default.xml +++ b/example/src/main/res/layout/fragment_default.xml @@ -2,7 +2,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - - Date: Sun, 23 Jun 2019 20:17:01 +0430 Subject: [PATCH 2/2] ready to merge --- example/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/build.gradle b/example/build.gradle index 133ae82..67bfd71 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -23,8 +23,8 @@ android { defaultConfig { applicationId "com.futuremind.recyclerviewfastscroll.example" - minSdkVersion 14 - targetSdkVersion 29 + minSdkVersion rootProject.minSdkVersion + targetSdkVersion rootProject.targetSdkVersion versionCode rootProject.versionCode versionName rootProject.versionName }