<commit_before>package fr.o80.sample.lib.core.ui

import android.content.Context
import android.support.design.widget.NavigationView
import android.util.AttributeSet
import android.view.Menu
import android.view.MenuItem

import java.lang.ref.WeakReference

import javax.inject.Inject

import fr.o80.sample.lib.core.Feature
import fr.o80.sample.lib.core.LibApplication
import fr.o80.sample.lib.core.LibConfiguration

/**
 * @author <NAME>
 */
class LibNavigationView
@JvmOverloads
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)
    : NavigationView(context, attrs, defStyleAttr) {

    @Inject
    lateinit var configuration: LibConfiguration

    private var listener: WeakReference<Listener>? = null

    init {
        (context.applicationContext as LibApplication).component().inject(this)

        addFeature(0, configuration.home)
        configuration.features
                .withIndex()
                .forEach { (id, feature) ->
                    addFeature(id + 1, feature)
                }
    }

    private fun addFeature(id: Int, feature: Feature) {
        menu
                .add(Menu.NONE, id, Menu.NONE, feature.title)
                .setIcon(feature.icon)
                .setEnabled(true)
                .setOnMenuItemClickListener {
                    val l = listener?.get()
                    if (l != null) {
                        l.onFeatureClicked(feature)
                        true
                    } else
                        false
                }
                .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS)
    }

    fun setListener(listener: Listener) {
        this.listener = WeakReference(listener)
    }

    interface Listener {
        fun onFeatureClicked(feature: Feature)
    }

}
<commit_msg>Use SHOW_AS_ACTION_IF_ROOM instead of _ALWAYS<commit_after>package fr.o80.sample.lib.core.ui

import android.content.Context
import android.support.design.widget.NavigationView
import android.util.AttributeSet
import android.view.Menu
import android.view.MenuItem

import java.lang.ref.WeakReference

import javax.inject.Inject

import fr.o80.sample.lib.core.Feature
import fr.o80.sample.lib.core.LibApplication
import fr.o80.sample.lib.core.LibConfiguration

/**
 * @author <NAME>
 */
class LibNavigationView
@JvmOverloads
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)
    : NavigationView(context, attrs, defStyleAttr) {

    @Inject
    lateinit var configuration: LibConfiguration

    private var listener: WeakReference<Listener>? = null

    init {
        (context.applicationContext as LibApplication).component().inject(this)

        addFeature(0, configuration.home)
        configuration.features
                .withIndex()
                .forEach { (id, feature) ->
                    addFeature(id + 1, feature)
                }
    }

    private fun addFeature(id: Int, feature: Feature) {
        menu
                .add(Menu.NONE, id, Menu.NONE, feature.title)
                .setIcon(feature.icon)
                .setEnabled(true)
                .setOnMenuItemClickListener {
                    val l = listener?.get()
                    if (l != null) {
                        l.onFeatureClicked(feature)
                        true
                    } else
                        false
                }
                .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM)
    }

    fun setListener(listener: Listener) {
        this.listener = WeakReference(listener)
    }

    interface Listener {
        fun onFeatureClicked(feature: Feature)
    }

}

{'fraction_non_alphanumeric': 0.0898814447201544, 'fraction_numerical': 0.006065618968844775, 'mean_word_length': 2.0513036164844407, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '4043807', 'n_tokens_mistral': 1017, 'n_tokens_neox': 960, 'n_words': 198}