Filter emoji where "visible_in_picker" is set to false. (#907)

Addresses #770
This commit is contained in:
Levi Bard 2018-11-04 10:51:31 +01:00 committed by Konrad Pozniak
parent 6960d725a3
commit b483a0bf25
3 changed files with 9 additions and 3 deletions

View file

@ -125,7 +125,6 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

View file

@ -23,7 +23,12 @@ import com.keylesspalace.tusky.R
import com.keylesspalace.tusky.entity.Emoji
import com.squareup.picasso.Picasso
class EmojiAdapter(private val emojiList: List<Emoji>, private val onEmojiSelectedListener: OnEmojiSelectedListener) : RecyclerView.Adapter<EmojiAdapter.EmojiHolder>() {
class EmojiAdapter(emojiList: List<Emoji>, private val onEmojiSelectedListener: OnEmojiSelectedListener) : RecyclerView.Adapter<EmojiAdapter.EmojiHolder>() {
private val emojiList : List<Emoji>
init {
this.emojiList = emojiList.filter { emoji -> emoji.visibleInPicker == null || emoji.visibleInPicker }
}
override fun getItemCount(): Int {
return emojiList.size

View file

@ -16,10 +16,12 @@
package com.keylesspalace.tusky.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
@Parcelize
data class Emoji(
val shortcode: String,
val url: String
val url: String,
@SerializedName("visible_in_picker") val visibleInPicker: Boolean?
) : Parcelable