aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/xyz/adjutor
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/xyz/adjutor')
-rw-r--r--app/src/main/java/xyz/adjutor/aniki/TopMangaPage.kt21
1 files changed, 12 insertions, 9 deletions
diff --git a/app/src/main/java/xyz/adjutor/aniki/TopMangaPage.kt b/app/src/main/java/xyz/adjutor/aniki/TopMangaPage.kt
index 17d124e..ac585c7 100644
--- a/app/src/main/java/xyz/adjutor/aniki/TopMangaPage.kt
+++ b/app/src/main/java/xyz/adjutor/aniki/TopMangaPage.kt
@@ -1,13 +1,13 @@
package xyz.adjutor.aniki
import android.os.Bundle
-import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
-import androidx.appcompat.app.AppCompatActivity
+import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
+import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
class TopMangaPage : Fragment() {
@@ -17,7 +17,16 @@ class TopMangaPage : Fragment() {
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
- return inflater.inflate(R.layout.top_manga_page, container, false)
+ val view = inflater.inflate(R.layout.top_manga_page, container, false)
+
+ // Retrieves data from mangasource
+ val mangaList = MangaSource(view.context).getMangaList()
+
+ val recyclerView: RecyclerView = view.findViewById(R.id.recycler_view)
+ recyclerView.setHasFixedSize(true)
+ recyclerView.layoutManager = LinearLayoutManager(view.context)
+ recyclerView.adapter = MangaAdapter(mangaList)
+ return view
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@@ -27,11 +36,5 @@ class TopMangaPage : Fragment() {
findNavController().navigate(R.id.action_TopMangaPage_to_HomePage)
}
- // Retrieves data from mangasource
- val mangaList = MangaSource(requireActivity().applicationContext).getMangaList()
-
- val recyclerView: RecyclerView = view.findViewById(R.id.recycler_view)
- recyclerView.adapter = MangaAdapter(mangaList)
-
}
} \ No newline at end of file