11package com.seok.gfd.views
22
33import android.os.Bundle
4- import android.widget.ArrayAdapter
54import androidx.appcompat.app.AppCompatActivity
5+ import androidx.recyclerview.widget.LinearLayoutManager
66import com.seok.gfd.R
7+ import com.seok.gfd.adapter.CustomAdapter
78import kotlinx.android.synthetic.main.activity_guest_main.*
89import java.util.*
910
1011class GuestMain : AppCompatActivity () {
11- private val arrayList = ArrayList <String >(listOf (" First Element" , " Second Element" , " Third Element" , " Fourth Element" , " Fifth Element" ))
12+ private val personNames = ArrayList (listOf (" Person 1" , " Person 2" , " Person 3" , " Person 4" , " Person 5" , " Person 6" , " Person 7" , " Person 8" , " Person 9" , " Person 10" , " Person 11" , " Person 12" , " Person 13" , " Person 14" ))
13+ private val personImages = ArrayList (listOf (R .drawable.btn_bottom_help, R .drawable.icon_location, R .drawable.btn_bottom_home, R .drawable.btn_bottom_rank, R .drawable.gfd_app_logo, R .drawable.gfd_launcher, R .drawable.gfd_logo_background, R .drawable.gfd_logo_foreground, R .drawable.github_login_users_background, R .drawable.guest_login_background, R .drawable.ic_launcher_background, R .drawable.icon_bio, R .drawable.rounding_trans_background, R .drawable.rounding_background))
1214
1315 override fun onCreate (savedInstanceState : Bundle ? ) {
1416 super .onCreate(savedInstanceState)
1517 setContentView(R .layout.activity_guest_main)
1618
17- val adapter = ArrayAdapter (this , R .layout.simple_list_item_1, arrayList)
18- listView.adapter = adapter
19+ val linearLayoutManager = LinearLayoutManager (applicationContext)
20+ recyclerView.layoutManager = linearLayoutManager
21+ val customAdapter = CustomAdapter (personNames, personImages, this )
22+ recyclerView.adapter = customAdapter
1923
2024 simpleSwipeRefreshLayout.setOnRefreshListener {
2125 simpleSwipeRefreshLayout.isRefreshing = false
@@ -24,9 +28,10 @@ class GuestMain : AppCompatActivity() {
2428 }
2529
2630 private fun shuffleItems (){
27- arrayList.shuffle(Random (System .currentTimeMillis()))
28- val adapter = ArrayAdapter (this , R .layout.simple_list_item_1, arrayList)
29- listView.adapter = adapter
31+ personNames.shuffle(Random (System .currentTimeMillis()))
32+ personImages.shuffle(Random (System .currentTimeMillis()))
33+ val customAdapter = CustomAdapter (personNames, personImages, this )
34+ recyclerView.adapter = customAdapter
3035 }
3136
3237}
0 commit comments