diff --git a/app/src/main/java/org/libre/agosto/p2play/MainActivity.kt b/app/src/main/java/org/libre/agosto/p2play/MainActivity.kt index 70d9f3c..97a823f 100644 --- a/app/src/main/java/org/libre/agosto/p2play/MainActivity.kt +++ b/app/src/main/java/org/libre/agosto/p2play/MainActivity.kt @@ -111,6 +111,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte (viewAdapter as VideosAdapter).clearData() recyclerView.scrollToPosition(0) } + (viewAdapter as VideosAdapter).addData(videos) }catch (err: Exception){ err.printStackTrace() @@ -281,8 +282,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte // lastItem.isChecked = false // } lastItem = item - - + pagination = 0 // item.isChecked = true when (item.itemId) { @@ -350,7 +350,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte private fun loadMore(){ swipeContainer.isRefreshing = true - this.pagination += 30 + this.pagination += ManagerSingleton.videos_count when(section){ "local" -> this.getLocalVideos() diff --git a/app/src/main/java/org/libre/agosto/p2play/adapters/VideosAdapter.kt b/app/src/main/java/org/libre/agosto/p2play/adapters/VideosAdapter.kt index 29bfbb4..4a5624c 100644 --- a/app/src/main/java/org/libre/agosto/p2play/adapters/VideosAdapter.kt +++ b/app/src/main/java/org/libre/agosto/p2play/adapters/VideosAdapter.kt @@ -100,7 +100,7 @@ class VideosAdapter(private val myDataset: ArrayList) : } fun addData(newItems: ArrayList){ - val lastPos = myDataset.size - 1 + val lastPos = myDataset.size myDataset.addAll(newItems) notifyItemRangeInserted(lastPos, newItems.size) } diff --git a/build.gradle b/build.gradle index 0d5a2ba..0d1d608 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.3.0' + classpath 'com.android.tools.build:gradle:3.3.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong