<commit_before>package net.kivitro.kittycat.view.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.TextView
import net.kivitro.kittycat.R
import net.kivitro.kittycat.model.Category
import timber.log.Timber

/**
 * Created by Max on 10.04.2016.
 */
class CategoryAdapter() : BaseAdapter() {
    private var categories: MutableList<Category> = arrayListOf()

    override fun getCount(): Int {
        return categories.size
    }

    override fun getItem(position: Int): Category {
        return categories[position]
    }

    override fun getItemId(position: Int): Long {
        return 0
    }

    override fun getDropDownView(position: Int, convertView: View?, parent: ViewGroup): View? {
        val v: View = convertView ?: LayoutInflater.from(parent.context).inflate(R.layout.item_spinner_item, parent, false)
        val text = v.findViewById(android.R.id.text1) as TextView
        text.text = getItem(position).name
        return v
    }

    override fun getView(position: Int, convertView: View?, parent: ViewGroup): View? {
        val v: View = convertView ?: LayoutInflater.from(parent.context).inflate(R.layout.item_spinner, parent, false)
        val text = v.findViewById(android.R.id.text1) as TextView
        text.text = getItem(position).name
        return v
    }

    fun addItems(categories: List<Category>) {
        Timber.d("addItems %f", categories.size)
        this.categories.clear()
        this.categories.add(Category.ALL)
        this.categories.addAll(categories)
        notifyDataSetChanged()
    }

}<commit_msg>fix spinner blocking bug<commit_after>package net.kivitro.kittycat.view.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.TextView
import net.kivitro.kittycat.R
import net.kivitro.kittycat.model.Category
import timber.log.Timber

/**
 * Created by Max on 10.04.2016.
 */
class CategoryAdapter() : BaseAdapter() {
    private var categories: MutableList<Category> = arrayListOf()

    override fun getCount(): Int {
        return categories.size
    }

    override fun getItem(position: Int): Category {
        return categories[position]
    }

    override fun getItemId(position: Int): Long {
        return 0
    }

    override fun getDropDownView(position: Int, convertView: View?, parent: ViewGroup): View? {
        val v: View = convertView ?: LayoutInflater.from(parent.context).inflate(R.layout.item_spinner_item, parent, false)
        val text = v.findViewById(android.R.id.text1) as TextView
        text.text = getItem(position).name
        return v
    }

    override fun getView(position: Int, convertView: View?, parent: ViewGroup): View? {
        val v: View = convertView ?: LayoutInflater.from(parent.context).inflate(R.layout.item_spinner, parent, false)
        val text = v.findViewById(android.R.id.text1) as TextView
        text.text = getItem(position).name
        return v
    }

    fun addItems(categories: List<Category>) {
        Timber.d("addItems %d", categories.size)
        this.categories.clear()
        this.categories.add(Category.ALL)
        this.categories.addAll(categories)
        notifyDataSetChanged()
    }

}
{'fraction_non_alphanumeric': 0.10561056105610561, 'fraction_numerical': 0.006600660066006601, 'mean_word_length': 3.2743589743589743, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4628689', 'n_tokens_mistral': 1013, 'n_tokens_neox': 963, 'n_words': 225}