<commit_before>package com.sjn.stamp.utils

import android.content.res.Configuration
import android.graphics.drawable.Drawable
import android.support.v4.media.MediaMetadataCompat
import android.support.v7.app.ActionBarDrawerToggle
import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.Toolbar
import android.view.MenuItem
import android.view.View
import com.mikepenz.materialdrawer.AccountHeader
import com.mikepenz.materialdrawer.AccountHeaderBuilder
import com.mikepenz.materialdrawer.DrawerBuilder
import com.mikepenz.materialdrawer.model.BaseDrawerItem
import com.mikepenz.materialdrawer.model.ProfileDrawerItem
import com.mikepenz.materialdrawer.model.interfaces.Nameable
import com.sjn.stamp.R
import com.sjn.stamp.ui.DrawerMenu
import java.util.*

object DrawerHelper {

    class Drawer(private val activity: AppCompatActivity, toolbar: Toolbar, private val listener: Listener) {
        interface Listener {
            fun changeFragmentByDrawer(menu: Long)
        }

        private val accountHeader: AccountHeader = AccountHeaderBuilder().apply {
            withSelectionListEnabledForSingleProfile(false)
            withActivity(activity)
            withHeaderBackground(Drawable.createFromStream(activity.assets.open(String.format("drawer/mb-bg-fb-%0${2}d.jpg", Random().nextInt(30) + 1)), null))
        }.build()
        private val drawer = DrawerBuilder().apply {
            withActivity(activity)
            withAccountHeader(accountHeader)
            withToolbar(toolbar)
            withFullscreen(true)
            inflateMenu(R.menu.drawer)
            withSelectedItem(currentMenuId)
            withOnDrawerNavigationListener {
                //this method is only called if the Arrow icon is shown. The hamburger is automatically managed by the MaterialDrawer
                //if the back arrow is shown. close the activity
                activity.onBackPressed()
                //return true if we have consumed the event
                true
            }
            withOnDrawerItemClickListener { _, _, drawerItem -><commit_msg>String.format bug fix<commit_after>package com.sjn.stamp.utils

import android.content.res.Configuration
import android.graphics.drawable.Drawable
import android.support.v4.media.MediaMetadataCompat
import android.support.v7.app.ActionBarDrawerToggle
import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.Toolbar
import android.view.MenuItem
import android.view.View
import com.mikepenz.materialdrawer.AccountHeader
import com.mikepenz.materialdrawer.AccountHeaderBuilder
import com.mikepenz.materialdrawer.DrawerBuilder
import com.mikepenz.materialdrawer.model.BaseDrawerItem
import com.mikepenz.materialdrawer.model.ProfileDrawerItem
import com.mikepenz.materialdrawer.model.interfaces.Nameable
import com.sjn.stamp.R
import com.sjn.stamp.ui.DrawerMenu
import java.util.*

object DrawerHelper {

    class Drawer(private val activity: AppCompatActivity, toolbar: Toolbar, private val listener: Listener) {
        interface Listener {
            fun changeFragmentByDrawer(menu: Long)
        }

        private val accountHeader: AccountHeader = AccountHeaderBuilder().apply {
            withSelectionListEnabledForSingleProfile(false)
            withActivity(activity)
            withHeaderBackground(Drawable.createFromStream(activity.assets.open(String.format(Locale.US, "drawer/mb-bg-fb-%0${2}d.jpg", Random().nextInt(30) + 1)), null))
        }.build()
        private val drawer = DrawerBuilder().apply {
            withActivity(activity)
            withAccountHeader(accountHeader)
            withToolbar(toolbar)
            withFullscreen(true)
            inflateMenu(R.menu.drawer)
            withSelectedItem(currentMenuId)
            withOnDrawerNavigationListener {
                //this method is only called if the Arrow icon is shown. The hamburger is automatically managed by the MaterialDrawer
                //if the back arrow is shown. close the activity
                activity.onBackPressed()
                //return true if we have consumed the event
                true
            }
            withOnDrawerItemClickListener { _, _, drawerItem ->
{'fraction_non_alphanumeric': 0.07663107947805457, 'fraction_numerical': 0.004270462633451958, 'mean_word_length': 3.190854870775348, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2647367', 'n_tokens_mistral': 1134, 'n_tokens_neox': 1109, 'n_words': 237}