PostVortex
1.0.0
โครงการ Postvortex เป็นแอปพลิเคชั่น Android ที่แสดงให้เห็นถึงการใช้ RecyclerView ภายใน Fragment โครงการมุ่งเน้นไปที่การสร้างรายการแบบไดนามิกของโพสต์แนวเกมรวมถึงเนื้อหาที่เกี่ยวข้องกับเกมยอดนิยมเช่น League of Legends, Batman: Arkham Series และ Marvel's Spider-Man แอพได้รับการออกแบบให้เรียบง่ายและเป็นโมดูลาร์ทำให้ง่ายต่อการอัปเดตและขยาย
RecyclerView กับ LinearLayoutManager เพื่อแสดงรายการของรายการRecyclerView โดยใช้อะแดปเตอร์ที่กำหนดเองตัวอย่าง:
data class Post ( val title : String , val description : String , val imageUrl : String )Fragment เพื่อจัดการส่วนประกอบ UI และเหตุการณ์วงจรชีวิตตัวอย่าง:
class ListFragment : Fragment () {
override fun onCreate ( savedInstanceState : Bundle ? ) {
super .onCreate(savedInstanceState)
retainInstance = true
}
override fun onCreateView (
inflater : LayoutInflater ,
container : ViewGroup ? ,
savedInstanceState : Bundle ?
): View ? = inflater.inflate( R .layout.fragment_main, container, false )
}RecyclerView เพื่อแสดงรายการโพสต์แนวเกมตัวอย่าง:
list_recycler_view. apply {
layoutManager = LinearLayoutManager (activity)
adapter = ListAdapter (postList)
}ตัวอย่าง:
private val postList = listOf (
Post (
" League of Legends - Unleashing the Power of the Nexus. " ,
" Join your team and destroy the enemy Nexus in this epic battle of wits and reflexes. Every decision counts in the world of Runeterra. " ,
" https://www.mobafire.com/images/guide/9.16/lol-nexus-destruction.jpg "
),
// More posts...
)ตัวอย่าง:
Post (
" The Dark Knight Rises Again. " ,
" Gotham's silent protector is back. Dive into the shadows with Batman as he faces off against his rogues' gallery in yet another thrilling adventure. " ,
" https://www.rockpapershotgun.com/images/2021/01/batman-arkham-asylum.jpg "
)git clone https://github.com/Pirate-Emperor/PostVortex.git แอปพลิเคชันแสดงรายการโพสต์ที่เกี่ยวข้องกับการเล่นเกมใน RecyclerView แต่ละรายการมีชื่อเรื่องคำอธิบายและรูปภาพ เนื้อหาถูกสร้างขึ้นแบบไดนามิกตามรูปแบบข้อมูลที่มีให้ในรหัส