Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup recyclerview and adapter for tags
- Loading branch information
1 parent
1ea4409
commit d1e45ce
Showing
6 changed files
with
80 additions
and
5 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
41 changes: 41 additions & 0 deletions
41
app/src/main/java/com/taskail/mixion/post/TagChipsAdapter.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,41 @@ | ||
package com.taskail.mixion.post | ||
|
||
import android.support.v7.widget.RecyclerView | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.taskail.mixion.R | ||
import com.taskail.mixion.post.TagChipsAdapter.TagsViewHolder | ||
import kotlinx.android.synthetic.main.layout_chip_tags.view.* | ||
|
||
/** | ||
*Created by ed on 2/16/18. | ||
*/ | ||
|
||
class TagChipsAdapter : RecyclerView.Adapter<TagsViewHolder>() { | ||
|
||
var tags = mutableListOf("Tag") | ||
|
||
class TagsViewHolder(itemView: View): RecyclerView.ViewHolder(itemView){ | ||
|
||
fun setTag(tag: String){ | ||
itemView.chip_tag.text = tag | ||
} | ||
} | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): TagsViewHolder { | ||
val itemView = LayoutInflater.from(parent?.context) | ||
.inflate(R.layout.layout_chip_tags, | ||
parent, false) | ||
|
||
return TagsViewHolder(itemView) | ||
} | ||
|
||
override fun onBindViewHolder(holder: TagsViewHolder?, position: Int) { | ||
holder?.setTag(tags[position]) | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return tags.size | ||
} | ||
} |
File renamed without changes.
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,4 @@ | ||
<vector android:height="12dp" android:viewportHeight="24.0" | ||
android:viewportWidth="24.0" android:width="12dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillColor="#FFF" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM17,13h-4v4h-2v-4L7,13v-2h4L11,7h2v4h4v2z"/> | ||
</vector> |
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