-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(android): display container information on marker click (#216)
Refs: closes #17, closes #20 ## Summary Add an info window that displays the container information of the clicked marker. Also add a button to give the user directions to that marker.
- Loading branch information
1 parent
2db8c7e
commit 1aa3f04
Showing
11 changed files
with
340 additions
and
10 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
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
53 changes: 53 additions & 0 deletions
53
android/app/src/main/java/com/ecomap/ecomap/map/ContainerCategoriesRecyclerViewAdapter.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,53 @@ | ||
package com.ecomap.ecomap.map | ||
|
||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.ImageView | ||
import android.widget.TextView | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.ecomap.ecomap.R | ||
|
||
/** | ||
* Represents the structure of an item in the container category recycler view. | ||
* @param iconResourceID Category icon resource ID. | ||
* @param category Category description. | ||
*/ | ||
data class ContainerCategoryRecyclerViewData( | ||
val iconResourceID: Int, | ||
val category: String, | ||
) | ||
|
||
/** | ||
* Recycler view adapter for the container categories. | ||
*/ | ||
class ContainerCategoriesRecyclerViewAdapter(private val dataSet: Array<ContainerCategoryRecyclerViewData>) : | ||
RecyclerView.Adapter<ContainerCategoriesRecyclerViewAdapter.ViewHolder>() { | ||
|
||
/** | ||
* Defines the views in the adapter. | ||
*/ | ||
class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { | ||
val imageView: ImageView = view.findViewById(R.id.image_view_icon) | ||
val textView: TextView = view.findViewById(R.id.text_view_category) | ||
} | ||
|
||
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): ViewHolder { | ||
// Create a new view, which defines the UI of the list item. | ||
val view = LayoutInflater.from(viewGroup.context) | ||
.inflate(R.layout.frame_layout_container_categories, viewGroup, false) | ||
|
||
return ViewHolder(view) | ||
} | ||
|
||
override fun onBindViewHolder(viewHolder: ViewHolder, position: Int) { | ||
val data = dataSet[position] | ||
|
||
viewHolder.imageView.setImageResource(data.iconResourceID) | ||
viewHolder.textView.text = data.category | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return dataSet.size | ||
} | ||
} |
23 changes: 17 additions & 6 deletions
23
android/app/src/main/java/com/ecomap/ecomap/map/ContainerMarker.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
Oops, something went wrong.