File tree Expand file tree Collapse file tree
app/src/main/java/com/seok/gfd Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package com.seok.gfd.adapter
33import android.view.LayoutInflater
44import android.view.View
55import android.view.ViewGroup
6+ import android.widget.EditText
67import androidx.fragment.app.FragmentActivity
78import androidx.lifecycle.ViewModelProviders
89import androidx.recyclerview.widget.RecyclerView
@@ -11,8 +12,9 @@ import com.seok.gfd.room.entity.SearchGithubId
1112import com.seok.gfd.viewmodel.GithubIdViewModel
1213import kotlinx.android.synthetic.main.item_search_github_id.view.*
1314
14- class SearchGithubIdAdapter (list : ArrayList <SearchGithubId >) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
15+ class SearchGithubIdAdapter (list : ArrayList <SearchGithubId >, edtText : EditText ) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
1516 private val githubIds: ArrayList <SearchGithubId > = list
17+ private val searchEditText = edtText
1618 private lateinit var githubIdsViewModel: GithubIdViewModel
1719
1820 inner class SearchGithubIdViewHolder (itemView : View ) : RecyclerView.ViewHolder(itemView){
@@ -24,6 +26,9 @@ class SearchGithubIdAdapter(list: ArrayList<SearchGithubId>) : RecyclerView.Adap
2426 notifyItemRemoved(this .adapterPosition)
2527 notifyDataSetChanged()
2628 }
29+ itemView.item_search_card_view.setOnClickListener {
30+ searchEditText.setText(searchGithubId.gidName)
31+ }
2732 }
2833 }
2934
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ package com.seok.gfd.views
33import android.os.Bundle
44import android.text.Editable
55import android.text.TextWatcher
6- import android.view.View.OnFocusChangeListener
76import android.view.WindowManager
87import android.view.animation.AnimationUtils
98import androidx.appcompat.app.AppCompatActivity
@@ -16,7 +15,6 @@ import com.seok.gfd.R
1615import com.seok.gfd.adapter.SearchGithubIdAdapter
1716import com.seok.gfd.room.entity.SearchGithubId
1817import com.seok.gfd.viewmodel.GithubIdViewModel
19- import kotlinx.android.synthetic.main.activity_guest_main.*
2018import kotlinx.android.synthetic.main.activity_search.*
2119
2220
@@ -65,7 +63,7 @@ class SearchActivity : AppCompatActivity() {
6563
6664 private fun init () {
6765 githubIds = ArrayList ()
68- searchGithubIdAdapter = SearchGithubIdAdapter (githubIds)
66+ searchGithubIdAdapter = SearchGithubIdAdapter (githubIds, search_edt_id )
6967 gridLayoutManager = GridLayoutManager (this , 1 )
7068 search_recycler_view.layoutManager = gridLayoutManager
7169 search_recycler_view.adapter = searchGithubIdAdapter
You can’t perform that action at this time.
0 commit comments