-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement horizontal RecyclerView to display saved places
- Loading branch information
1 parent
9d4a8e2
commit 8f9c13d
Showing
8 changed files
with
116 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,4 @@ package campus.tech.kakao.map.model | |
|
||
data class SavePlace ( | ||
val savePlace: String, | ||
val time: String | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
app/src/main/java/campus/tech/kakao/map/view/SavePlaceAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package campus.tech.kakao.map.view | ||
|
||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.TextView | ||
import androidx.recyclerview.widget.RecyclerView | ||
import campus.tech.kakao.map.R | ||
import campus.tech.kakao.map.model.SavePlace | ||
|
||
class SavePlaceAdapter( | ||
private val savePlaces: List<SavePlace> | ||
) : RecyclerView.Adapter<SavePlaceAdapter.SavePlaceViewHolder>() { | ||
class SavePlaceViewHolder( | ||
itemView: View, | ||
) : RecyclerView.ViewHolder(itemView) { | ||
private val savePlaceTextView: TextView = itemView.findViewById(R.id.savePlace) | ||
|
||
fun bind(savePlace: SavePlace) { | ||
savePlaceTextView.text = savePlace.savePlace | ||
} | ||
} | ||
|
||
override fun onCreateViewHolder( | ||
parent: ViewGroup, | ||
viewType: Int | ||
): SavePlaceViewHolder { | ||
val view = LayoutInflater.from(parent.context).inflate(R.layout.saveplace_item, parent, false) | ||
return SavePlaceViewHolder(view) | ||
} | ||
|
||
override fun onBindViewHolder(holder: SavePlaceViewHolder, position: Int) { | ||
val savePlace = savePlaces[position] | ||
holder.bind(savePlace) | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return savePlaces.size | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters