Imports cleaning. Libraries update.

This commit is contained in:
Amine 2018-10-12 20:51:36 +02:00
parent 06b88c783d
commit 6090590f24
14 changed files with 57 additions and 111 deletions

View File

@ -94,13 +94,13 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Android Support // Android Support
implementation 'androidx.appcompat:appcompat:1.0.0' implementation "androidx.appcompat:appcompat:$android_version"
implementation 'com.google.android.material:material:1.0.0' implementation "com.google.android.material:material:$android_version"
implementation 'androidx.recyclerview:recyclerview:1.0.0' implementation "androidx.recyclerview:recyclerview:$android_version"
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation "androidx.legacy:legacy-support-v4:$android_version"
implementation 'androidx.vectordrawable:vectordrawable:1.0.0' implementation "androidx.vectordrawable:vectordrawable:$android_version"
implementation 'androidx.browser:browser:1.0.0' implementation "androidx.browser:browser:$android_version"
implementation 'androidx.cardview:cardview:1.0.0' implementation "androidx.cardview:cardview:$android_version"
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
//multidex //multidex
@ -110,7 +110,7 @@ dependencies {
implementation 'agency.tango.android:material-intro-screen:0.0.5' implementation 'agency.tango.android:material-intro-screen:0.0.5'
// About // About
implementation('com.mikepenz:aboutlibraries:6.0.0@aar') { implementation('com.mikepenz:aboutlibraries:6.2.0@aar') {
transitive = true transitive = true
} }
@ -121,8 +121,8 @@ dependencies {
implementation 'com.burgstaller:okhttp-digest:1.12' implementation 'com.burgstaller:okhttp-digest:1.12'
// Material-ish things // Material-ish things
implementation 'com.ashokvarma.android:bottom-navigation-bar:2.0.3' implementation 'com.ashokvarma.android:bottom-navigation-bar:2.0.5'
implementation 'com.github.jd-alexander:LikeButton:0.2.1' implementation 'com.github.jd-alexander:LikeButton:0.2.3'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
// glide // glide
@ -130,10 +130,10 @@ dependencies {
implementation 'com.github.bumptech.glide:okhttp3-integration:4.1.1' implementation 'com.github.bumptech.glide:okhttp3-integration:4.1.1'
// Asking politely users to rate the app // Asking politely users to rate the app
implementation 'com.github.stkent:amplify:2.1.0' implementation 'com.github.stkent:amplify:2.2.0'
// Drawer // Drawer
implementation 'co.zsmb:materialdrawer-kt:1.3.7' implementation 'co.zsmb:materialdrawer-kt:2.0.1'
implementation 'com.anupcowkur:reservoir:3.1.0' implementation 'com.anupcowkur:reservoir:3.1.0'
// Themes // Themes
@ -142,7 +142,7 @@ dependencies {
implementation 'com.github.rubensousa:floatingtoolbar:1.5.1' implementation 'com.github.rubensousa:floatingtoolbar:1.5.1'
// Pager // Pager
implementation 'me.relex:circleindicator:1.2.2@aar' implementation 'me.relex:circleindicator:2.0.0@aar'
implementation 'androidx.core:core-ktx:1.0.0' implementation 'androidx.core:core-ktx:1.0.0'

View File

@ -114,10 +114,10 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
private lateinit var appColors: AppColors private lateinit var appColors: AppColors
private var offset: Int = 0 private var offset: Int = 0
private var firstVisible: Int = 0 private var firstVisible: Int = 0
private lateinit var recyclerViewScrollListener: androidx.recyclerview.widget.RecyclerView.OnScrollListener private lateinit var recyclerViewScrollListener: RecyclerView.OnScrollListener
private lateinit var settings: SharedPreferences private lateinit var settings: SharedPreferences
private var recyclerAdapter: androidx.recyclerview.widget.RecyclerView.Adapter<*>? = null private var recyclerAdapter: RecyclerView.Adapter<*>? = null
private var badgeNew: Int = -1 private var badgeNew: Int = -1
private var badgeAll: Int = -1 private var badgeAll: Int = -1
@ -209,8 +209,8 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT
) { ) {
override fun getSwipeDirs( override fun getSwipeDirs(
recyclerView: androidx.recyclerview.widget.RecyclerView, recyclerView: RecyclerView,
viewHolder: androidx.recyclerview.widget.RecyclerView.ViewHolder viewHolder: RecyclerView.ViewHolder
): Int = ): Int =
if (elementsShown != UNREAD_SHOWN) { if (elementsShown != UNREAD_SHOWN) {
0 0
@ -222,12 +222,12 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
} }
override fun onMove( override fun onMove(
recyclerView: androidx.recyclerview.widget.RecyclerView, recyclerView: RecyclerView,
viewHolder: androidx.recyclerview.widget.RecyclerView.ViewHolder, viewHolder: RecyclerView.ViewHolder,
target: androidx.recyclerview.widget.RecyclerView.ViewHolder target: RecyclerView.ViewHolder
): Boolean = false ): Boolean = false
override fun onSwiped(viewHolder: androidx.recyclerview.widget.RecyclerView.ViewHolder, swipeDir: Int) { override fun onSwiped(viewHolder: RecyclerView.ViewHolder, swipeDir: Int) {
val position = viewHolder.adapterPosition val position = viewHolder.adapterPosition
val i = items.elementAtOrNull(position) val i = items.elementAtOrNull(position)
@ -729,43 +729,43 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
private fun reloadLayoutManager() { private fun reloadLayoutManager() {
val currentManager = recyclerView.layoutManager val currentManager = recyclerView.layoutManager
val layoutManager: androidx.recyclerview.widget.RecyclerView.LayoutManager val layoutManager: RecyclerView.LayoutManager
// This will only update the layout manager if settings changed // This will only update the layout manager if settings changed
when (currentManager) { when (currentManager) {
is androidx.recyclerview.widget.StaggeredGridLayoutManager -> is StaggeredGridLayoutManager ->
if (!shouldBeCardView) { if (!shouldBeCardView) {
layoutManager = androidx.recyclerview.widget.GridLayoutManager( layoutManager = GridLayoutManager(
this, this,
calculateNoOfColumns() calculateNoOfColumns()
) )
recyclerView.layoutManager = layoutManager recyclerView.layoutManager = layoutManager
} }
is androidx.recyclerview.widget.GridLayoutManager -> is GridLayoutManager ->
if (shouldBeCardView) { if (shouldBeCardView) {
layoutManager = androidx.recyclerview.widget.StaggeredGridLayoutManager( layoutManager = StaggeredGridLayoutManager(
calculateNoOfColumns(), calculateNoOfColumns(),
androidx.recyclerview.widget.StaggeredGridLayoutManager.VERTICAL StaggeredGridLayoutManager.VERTICAL
) )
layoutManager.gapStrategy = layoutManager.gapStrategy =
androidx.recyclerview.widget.StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS
recyclerView.layoutManager = layoutManager recyclerView.layoutManager = layoutManager
} }
else -> else ->
if (currentManager == null) { if (currentManager == null) {
if (!shouldBeCardView) { if (!shouldBeCardView) {
layoutManager = androidx.recyclerview.widget.GridLayoutManager( layoutManager = GridLayoutManager(
this, this,
calculateNoOfColumns() calculateNoOfColumns()
) )
recyclerView.layoutManager = layoutManager recyclerView.layoutManager = layoutManager
} else { } else {
layoutManager = androidx.recyclerview.widget.StaggeredGridLayoutManager( layoutManager = StaggeredGridLayoutManager(
calculateNoOfColumns(), calculateNoOfColumns(),
androidx.recyclerview.widget.StaggeredGridLayoutManager.VERTICAL StaggeredGridLayoutManager.VERTICAL
) )
layoutManager.gapStrategy = layoutManager.gapStrategy =
androidx.recyclerview.widget.StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS
recyclerView.layoutManager = layoutManager recyclerView.layoutManager = layoutManager
} }
} else { } else {
@ -781,13 +781,13 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
val layoutManager = recyclerView.adapter val layoutManager = recyclerView.adapter
when (layoutManager) { when (layoutManager) {
is androidx.recyclerview.widget.StaggeredGridLayoutManager -> is StaggeredGridLayoutManager ->
if (layoutManager.findFirstCompletelyVisibleItemPositions(null)[0] == 0) { if (layoutManager.findFirstCompletelyVisibleItemPositions(null)[0] == 0) {
getElementsAccordingToTab() getElementsAccordingToTab()
} else { } else {
layoutManager.scrollToPositionWithOffset(0, 0) layoutManager.scrollToPositionWithOffset(0, 0)
} }
is androidx.recyclerview.widget.GridLayoutManager -> is GridLayoutManager ->
if (layoutManager.findFirstCompletelyVisibleItemPosition() == 0) { if (layoutManager.findFirstCompletelyVisibleItemPosition() == 0) {
getElementsAccordingToTab() getElementsAccordingToTab()
} else { } else {
@ -811,15 +811,15 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
} }
private fun handleInfiniteScroll() { private fun handleInfiniteScroll() {
recyclerViewScrollListener = object : androidx.recyclerview.widget.RecyclerView.OnScrollListener() { recyclerViewScrollListener = object : RecyclerView.OnScrollListener() {
override fun onScrolled(localRecycler: androidx.recyclerview.widget.RecyclerView, dx: Int, dy: Int) { override fun onScrolled(localRecycler: RecyclerView, dx: Int, dy: Int) {
if (localRecycler != null && dy > 0) { if (localRecycler != null && dy > 0) {
val manager = recyclerView.layoutManager val manager = recyclerView.layoutManager
val lastVisibleItem: Int = when (manager) { val lastVisibleItem: Int = when (manager) {
is androidx.recyclerview.widget.StaggeredGridLayoutManager -> manager.findLastCompletelyVisibleItemPositions( is StaggeredGridLayoutManager -> manager.findLastCompletelyVisibleItemPositions(
null null
).last() ).last()
is androidx.recyclerview.widget.GridLayoutManager -> manager.findLastCompletelyVisibleItemPosition() is GridLayoutManager -> manager.findLastCompletelyVisibleItemPosition()
else -> 0 else -> 0
} }
@ -970,9 +970,9 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
if (appendResults) { if (appendResults) {
val oldManager = recyclerView.layoutManager val oldManager = recyclerView.layoutManager
firstVisible = when (oldManager) { firstVisible = when (oldManager) {
is androidx.recyclerview.widget.StaggeredGridLayoutManager -> is StaggeredGridLayoutManager ->
oldManager.findFirstCompletelyVisibleItemPositions(null).last() oldManager.findFirstCompletelyVisibleItemPositions(null).last()
is androidx.recyclerview.widget.GridLayoutManager -> is GridLayoutManager ->
oldManager.findFirstCompletelyVisibleItemPosition() oldManager.findFirstCompletelyVisibleItemPosition()
else -> 0 else -> 0
} }
@ -1013,9 +1013,9 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
} }
recyclerView.addItemDecoration( recyclerView.addItemDecoration(
androidx.recyclerview.widget.DividerItemDecoration( DividerItemDecoration(
this@HomeActivity, this@HomeActivity,
androidx.recyclerview.widget.DividerItemDecoration.VERTICAL DividerItemDecoration.VERTICAL
) )
) )
} }

View File

@ -104,7 +104,7 @@ class ReaderActivity : AppCompatActivity() {
(indicator as CircleIndicator).setViewPager(pager) (indicator as CircleIndicator).setViewPager(pager)
pager.addOnPageChangeListener( pager.addOnPageChangeListener(
object : androidx.viewpager.widget.ViewPager.SimpleOnPageChangeListener() { object : ViewPager.SimpleOnPageChangeListener() {
override fun onPageSelected(position: Int) { override fun onPageSelected(position: Int) {
@ -170,8 +170,8 @@ class ReaderActivity : AppCompatActivity() {
oldInstanceState!!.clear() oldInstanceState!!.clear()
} }
private inner class ScreenSlidePagerAdapter(fm: androidx.fragment.app.FragmentManager, val appColors: AppColors) : private inner class ScreenSlidePagerAdapter(fm: FragmentManager, val appColors: AppColors) :
androidx.fragment.app.FragmentStatePagerAdapter(fm) { FragmentStatePagerAdapter(fm) {
override fun getCount(): Int { override fun getCount(): Int {

View File

@ -51,7 +51,7 @@ class SourcesActivity : AppCompatActivity() {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
val mLayoutManager = androidx.recyclerview.widget.LinearLayoutManager(this) val mLayoutManager = LinearLayoutManager(this)
val prefs = PreferenceManager.getDefaultSharedPreferences(this) val prefs = PreferenceManager.getDefaultSharedPreferences(this)

View File

@ -53,7 +53,7 @@ class ItemCardAdapter(
c.resources.getDimension(R.dimen.card_image_max_height).toInt() c.resources.getDimension(R.dimen.card_image_max_height).toInt()
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val v = LayoutInflater.from(c).inflate(R.layout.card_item, parent, false) as androidx.cardview.widget.CardView val v = LayoutInflater.from(c).inflate(R.layout.card_item, parent, false) as CardView
return ViewHolder(v) return ViewHolder(v)
} }
@ -102,7 +102,7 @@ class ItemCardAdapter(
return items.size return items.size
} }
inner class ViewHolder(val mView: androidx.cardview.widget.CardView) : androidx.recyclerview.widget.RecyclerView.ViewHolder(mView) { inner class ViewHolder(val mView: CardView) : RecyclerView.ViewHolder(mView) {
init { init {
mView.setCardBackgroundColor(appColors.cardBackgroundColor) mView.setCardBackgroundColor(appColors.cardBackgroundColor)
handleClickListeners() handleClickListeners()

View File

@ -123,7 +123,7 @@ class ItemListAdapter(
override fun getItemCount(): Int = items.size override fun getItemCount(): Int = items.size
inner class ViewHolder(val mView: ConstraintLayout) : androidx.recyclerview.widget.RecyclerView.ViewHolder(mView) { inner class ViewHolder(val mView: ConstraintLayout) : RecyclerView.ViewHolder(mView) {
init { init {
handleClickListeners() handleClickListeners()

View File

@ -18,7 +18,7 @@ import retrofit2.Call
import retrofit2.Callback import retrofit2.Callback
import retrofit2.Response import retrofit2.Response
abstract class ItemsAdapter<VH : androidx.recyclerview.widget.RecyclerView.ViewHolder?> : androidx.recyclerview.widget.RecyclerView.Adapter<VH>() { abstract class ItemsAdapter<VH : RecyclerView.ViewHolder?> : RecyclerView.Adapter<VH>() {
abstract var items: ArrayList<Item> abstract var items: ArrayList<Item>
abstract val api: SelfossApi abstract val api: SelfossApi
abstract val debugReadingItems: Boolean abstract val debugReadingItems: Boolean

View File

@ -25,7 +25,7 @@ class SourcesListAdapter(
private val app: Activity, private val app: Activity,
private val items: ArrayList<Sources>, private val items: ArrayList<Sources>,
private val api: SelfossApi private val api: SelfossApi
) : androidx.recyclerview.widget.RecyclerView.Adapter<SourcesListAdapter.ViewHolder>() { ) : RecyclerView.Adapter<SourcesListAdapter.ViewHolder>() {
private val c: Context = app.baseContext private val c: Context = app.baseContext
private val generator: ColorGenerator = ColorGenerator.MATERIAL private val generator: ColorGenerator = ColorGenerator.MATERIAL
@ -59,7 +59,7 @@ class SourcesListAdapter(
override fun getItemCount(): Int = items.size override fun getItemCount(): Int = items.size
inner class ViewHolder(internal val mView: ConstraintLayout) : androidx.recyclerview.widget.RecyclerView.ViewHolder(mView) { inner class ViewHolder(internal val mView: ConstraintLayout) : RecyclerView.ViewHolder(mView) {
init { init {
handleClickListeners() handleClickListeners()

View File

@ -45,7 +45,7 @@ import retrofit2.Response
import java.net.MalformedURLException import java.net.MalformedURLException
import java.net.URL import java.net.URL
class ArticleFragment : androidx.fragment.app.Fragment() { class ArticleFragment : Fragment() {
private lateinit var pageNumber: Number private lateinit var pageNumber: Number
private var fontSize: Int = 14 private var fontSize: Int = 14
private lateinit var allItems: ArrayList<Item> private lateinit var allItems: ArrayList<Item>

View File

@ -3,7 +3,7 @@ package apps.amine.bou.readerforselfoss.transformers
import androidx.viewpager.widget.ViewPager import androidx.viewpager.widget.ViewPager
import android.view.View import android.view.View
class DepthPageTransformer : androidx.viewpager.widget.ViewPager.PageTransformer { class DepthPageTransformer : ViewPager.PageTransformer {
override fun transformPage(view: View, position: Float) { override fun transformPage(view: View, position: Float) {
val pageWidth = view.width val pageWidth = view.width

View File

@ -1,54 +0,0 @@
package apps.amine.bou.readerforselfoss.utils
import android.content.Context
import androidx.coordinatorlayout.widget.CoordinatorLayout
import com.google.android.material.floatingactionbutton.FloatingActionButton
import android.util.AttributeSet
import android.view.View
class ScrollAwareFABBehavior(
context: Context,
attrs: AttributeSet
) : androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior<FloatingActionButton>() {
override fun onStartNestedScroll(
coordinatorLayout: androidx.coordinatorlayout.widget.CoordinatorLayout,
child: FloatingActionButton,
directTargetChild: View,
target: View,
nestedScrollAxes: Int
): Boolean {
return true
}
override fun onNestedScroll(
coordinatorLayout: androidx.coordinatorlayout.widget.CoordinatorLayout,
child: FloatingActionButton,
target: View,
dxConsumed: Int,
dyConsumed: Int,
dxUnconsumed: Int,
dyUnconsumed: Int
) {
super.onNestedScroll(
coordinatorLayout,
child,
target,
dxConsumed,
dyConsumed,
dxUnconsumed,
dyUnconsumed
)
if (dyConsumed > 0 && child.visibility == View.VISIBLE) {
child.hide(object : FloatingActionButton.OnVisibilityChangedListener() {
override fun onHidden(fab: FloatingActionButton?) {
super.onHidden(fab)
fab!!.visibility = View.INVISIBLE
}
})
} else if (dyConsumed < 0 && child.visibility != View.VISIBLE) {
child.show()
}
}
}

View File

@ -8,7 +8,7 @@ import android.widget.TextView
import apps.amine.bou.readerforselfoss.R import apps.amine.bou.readerforselfoss.R
open class CustomBaseViewHolder(var view: View) : androidx.recyclerview.widget.RecyclerView.ViewHolder(view) { open class CustomBaseViewHolder(var view: View) : RecyclerView.ViewHolder(view) {
var icon: ImageView = view.findViewById(R.id.material_drawer_icon) var icon: ImageView = view.findViewById(R.id.material_drawer_icon)
var name: TextView = view.findViewById(R.id.material_drawer_name) var name: TextView = view.findViewById(R.id.material_drawer_name)
var description: TextView = view.findViewById(R.id.material_drawer_description) var description: TextView = view.findViewById(R.id.material_drawer_description)

View File

@ -15,7 +15,7 @@ import com.mikepenz.materialdrawer.util.DrawerImageLoader
import com.mikepenz.materialdrawer.util.DrawerUIUtils import com.mikepenz.materialdrawer.util.DrawerUIUtils
import com.mikepenz.materialize.util.UIUtils import com.mikepenz.materialize.util.UIUtils
abstract class CustomUrlBasePrimaryDrawerItem<T, VH : androidx.recyclerview.widget.RecyclerView.ViewHolder> : abstract class CustomUrlBasePrimaryDrawerItem<T, VH : RecyclerView.ViewHolder> :
BaseDrawerItem<T, VH>() { BaseDrawerItem<T, VH>() {
fun withIcon(url: String): T { fun withIcon(url: String): T {
this.icon = ImageHolder(url) this.icon = ImageHolder(url)

View File

@ -3,7 +3,7 @@
buildscript { buildscript {
ext { ext {
kotlin_version = '1.2.51' kotlin_version = '1.2.51'
android_version = '28.0.0' android_version = '1.0.0'
} }
repositories { repositories {
jcenter() jcenter()