<commit_before>package jp.toastkid.yobidashi.calendar

import android.content.Context
import android.content.Intent
import android.databinding.DataBindingUtil
import android.os.Bundle
import android.support.v7.widget.Toolbar
import jp.toastkid.yobidashi.BaseActivity
import jp.toastkid.yobidashi.R
import jp.toastkid.yobidashi.analytics.LogSender
import jp.toastkid.yobidashi.databinding.ActivityDateDetailBinding
import jp.toastkid.yobidashi.libs.intent.IntentFactory
import jp.toastkid.yobidashi.search.SearchAction
import java.util.*

/**
 * Displaying date detail activity.
 *
 * @author toastkidjp
 */
class DateDetailActivity : BaseActivity() {

    /**
     * Data-Binding object.
     */
    private lateinit var binding: ActivityDateDetailBinding

    /**
     * Analytics logger wrapper.
     */
    private var logSender: LogSender? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        overridePendingTransition(0, 0)
        setContentView(LAYOUT_ID)
        binding = DataBindingUtil.setContentView<ActivityDateDetailBinding>(this, LAYOUT_ID)

        logSender = LogSender(this)

        if (binding.toolbar != null) {
            initToolbar(binding.toolbar as Toolbar)
        }

        initButtons()

        binding.background.setOnClickListener { finish() }
    }

    /**
     * Set onClick listeners.
     */
    private fun initButtons() {
        val month = intent.getIntExtra(KEY_MONTH, 0)
        val dayOfMonth = intent.getIntExtra(KEY_DAY_OF_MONTH, 1)
        val dateTitle = DateTitleFactory.makeDateTitle(this, month, dayOfMonth)
        val bundle = Bundle().apply { putString("daily", dateTitle) }

        binding.openArticle.setOnClickListener {
            logSender?.send("cal_wkp", bundle)
            CalendarArticleLinker(this, month, dayOfMonth).invoke()
            finish()
        }
        binding.addSchedule.setOnClickListener {
            logSender?.send("cal_schdl", bundle)
            val eventStartMs = GregorianCalendar(
                    intent.getIntExtra(KEY_YEAR, 2017), month, dayOfMonth).timeInMillis<commit_msg>refactor #283 Simplify initToolbar() function calling in DateDetailActivity.<commit_after>package jp.toastkid.yobidashi.calendar

import android.content.Context
import android.content.Intent
import android.databinding.DataBindingUtil
import android.os.Bundle
import jp.toastkid.yobidashi.BaseActivity
import jp.toastkid.yobidashi.R
import jp.toastkid.yobidashi.analytics.LogSender
import jp.toastkid.yobidashi.databinding.ActivityDateDetailBinding
import jp.toastkid.yobidashi.libs.intent.IntentFactory
import jp.toastkid.yobidashi.search.SearchAction
import java.util.*

/**
 * Displaying date detail activity.
 *
 * @author toastkidjp
 */
class DateDetailActivity : BaseActivity() {

    /**
     * Data-Binding object.
     */
    private lateinit var binding: ActivityDateDetailBinding

    /**
     * Analytics logger wrapper.
     */
    private var logSender: LogSender? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        overridePendingTransition(0, 0)
        setContentView(LAYOUT_ID)
        binding = DataBindingUtil.setContentView<ActivityDateDetailBinding>(this, LAYOUT_ID)

        logSender = LogSender(this)

        initToolbar(binding.toolbar)

        initButtons()

        binding.background.setOnClickListener { finish() }
    }

    /**
     * Set onClick listeners.
     */
    private fun initButtons() {
        val month = intent.getIntExtra(KEY_MONTH, 0)
        val dayOfMonth = intent.getIntExtra(KEY_DAY_OF_MONTH, 1)
        val dateTitle = DateTitleFactory.makeDateTitle(this, month, dayOfMonth)
        val bundle = Bundle().apply { putString("daily", dateTitle) }

        binding.openArticle.setOnClickListener {
            logSender?.send("cal_wkp", bundle)
            CalendarArticleLinker(this, month, dayOfMonth).invoke()
            finish()
        }
        binding.addSchedule.setOnClickListener {
            logSender?.send("cal_schdl", bundle)
            val eventStartMs = GregorianCalendar(
                    intent.getIntExtra(KEY_YEAR, 2017), month, dayOfMonth).timeInMillis
{'fraction_non_alphanumeric': 0.0909735349716446, 'fraction_numerical': 0.004725897920604915, 'mean_word_length': 3.1910891089108913, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1089774', 'n_tokens_mistral': 1267, 'n_tokens_neox': 1193, 'n_words': 225}