This commit is contained in:
Austin Huang 2021-07-07 17:28:05 -04:00
parent 40907a8bc1
commit 7d1dca07c1
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
2 changed files with 3 additions and 3 deletions

View File

@ -139,7 +139,7 @@ public final class DirectItemsAdapter extends RecyclerView.Adapter<RecyclerView.
return new HeaderViewHolder(LayoutDmHeaderBinding.inflate(layoutInflater, parent, false));
}
final LayoutDmBaseBinding baseBinding = LayoutDmBaseBinding.inflate(layoutInflater, parent, false);
final DirectItemType directItemType = DirectItemType.Companion.getId(type);
final DirectItemType directItemType = DirectItemType.Companion.getTypeFromId(type);
final DirectItemViewHolder itemViewHolder = getItemViewHolder(layoutInflater, baseBinding, directItemType);
itemViewHolder.setLongClickListener(longClickListener);
return itemViewHolder;

View File

@ -64,8 +64,8 @@ enum class DirectItemType(val id: Int) : Serializable {
private val map: MutableMap<Int, DirectItemType> = mutableMapOf()
@JvmStatic
fun getId(id: Int): DirectItemType? {
return map[id]
fun getTypeFromId(id: Int): DirectItemType {
return map[id] ?: UNKNOWN
}
fun getName(directItemType: DirectItemType): String? {