aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorClyhtsuriva <aimeric@adjutor.xyz>2021-02-17 22:57:15 +0100
committerClyhtsuriva <aimeric@adjutor.xyz>2021-02-17 22:57:15 +0100
commitc1d5a3e8fb8b3f8ac28d1e7818b5b33c0ab41b49 (patch)
tree8881509b7068b40a064866dff5fe8e27f0c0115c /app
parent7e0e688d4bc59bddfd5e9e69b0da57607c1e56ed (diff)
Recycler view now working in a fragment.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/xyz/adjutor/aniki/TopMangaPage.kt21
-rw-r--r--app/src/main/res/layout/item_layout.xml2
-rw-r--r--app/src/main/res/values/strings.xml1
3 files changed, 14 insertions, 10 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
diff --git a/app/src/main/res/layout/item_layout.xml b/app/src/main/res/layout/item_layout.xml
index af4b9b0..8500bc7 100644
--- a/app/src/main/res/layout/item_layout.xml
+++ b/app/src/main/res/layout/item_layout.xml
@@ -39,7 +39,7 @@
app:layout_constraintBottom_toBottomOf="parent"
android:text="@string/rv_title"
android:textColor="@color/strong_pink"
- android:textSize="30sp"/>
+ android:textSize="20sp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 41bd064..d69fb60 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -31,6 +31,7 @@
<item>Ana Satsujin</item>
<item>Samurai Deeper Kyou</item>
<item>Sebsei, Ore ni Kamawazu Itte Kudasai!!</item>
+ <item>Mondaiji-tachi ga Isekai Kara Kuru Sou Desu yo</item>
</string-array>
<string name="manga1_name">Dragon Ball</string>