<commit_before>package info.ccook.groundhog.weather

import android.Manifest
import android.arch.lifecycle.*
import android.os.Bundle
import info.ccook.groundhog.BaseActivity
import info.ccook.groundhog.R
import kotlinx.android.synthetic.main.activity_main.*
import pub.devrel.easypermissions.EasyPermissions
import javax.inject.Inject

class WeatherActivity : BaseActivity(), LifecycleRegistryOwner {

    private val lifecycleRegistry = LifecycleRegistry(this)

    @Inject
    lateinit var viewModelFactory: ViewModelProvider.Factory

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val weatherViewModel = ViewModelProviders.of(this, viewModelFactory)
                .get(WeatherViewModel::class.java)

        if (hasFineLocationPermission()) {
            weatherViewModel.getCurrentWeather().observe(this, Observer { weather ->
                locationName.text = weather?.locationName
                currentTemp.text = weather?.currentTemp
                high.text = weather?.high
                low.text = weather?.low
                humidity.text = weather?.humidityPercentage
                windSpeed.text = weather?.windSpeed
                windDirection.text = weather?.windDirection
            })
        } else {
            requestFineLocationPermission()
        }
    }

    override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>,
                                            grantResults: IntArray) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults)
        EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this)
    }

    override fun getLifecycle(): LifecycleRegistry = lifecycleRegistry

    private fun hasFineLocationPermission() = EasyPermissions
            .hasPermissions(this, Manifest.permission.ACCESS_FINE_LOCATION)

    private fun requestFineLocationPermission() {
        EasyPermissions.requestPermissions(this, getString(R.string.gps_request_message), 100,
                Manifest.permission.ACCESS_FINE_LOCATION)
    }
}<commit_msg>Update string res reference with correct name<commit_after>package info.ccook.groundhog.weather

import android.Manifest
import android.arch.lifecycle.*
import android.os.Bundle
import info.ccook.groundhog.BaseActivity
import info.ccook.groundhog.R
import kotlinx.android.synthetic.main.activity_main.*
import pub.devrel.easypermissions.EasyPermissions
import javax.inject.Inject

class WeatherActivity : BaseActivity(), LifecycleRegistryOwner {

    private val lifecycleRegistry = LifecycleRegistry(this)

    @Inject
    lateinit var viewModelFactory: ViewModelProvider.Factory

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val weatherViewModel = ViewModelProviders.of(this, viewModelFactory)
                .get(WeatherViewModel::class.java)

        if (hasFineLocationPermission()) {
            weatherViewModel.getCurrentWeather().observe(this, Observer { weather ->
                locationName.text = weather?.locationName
                currentTemp.text = weather?.currentTemp
                high.text = weather?.high
                low.text = weather?.low
                humidity.text = weather?.humidityPercentage
                windSpeed.text = weather?.windSpeed
                windDirection.text = weather?.windDirection
            })
        } else {
            requestFineLocationPermission()
        }
    }

    override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>,
                                            grantResults: IntArray) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults)
        EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this)
    }

    override fun getLifecycle(): LifecycleRegistry = lifecycleRegistry

    private fun hasFineLocationPermission() = EasyPermissions
            .hasPermissions(this, Manifest.permission.ACCESS_FINE_LOCATION)

    private fun requestFineLocationPermission() {
        EasyPermissions.requestPermissions(this, getString(R.string.gpsRequestMessage), 100,
                Manifest.permission.ACCESS_FINE_LOCATION)
    }
}
{'fraction_non_alphanumeric': 0.075591985428051, 'fraction_numerical': 0.001366120218579235, 'mean_word_length': 3.019213174748399, 'pattern_counts': {'":': 0, '<': 5, '<?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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2652909', 'n_tokens_mistral': 1113, 'n_tokens_neox': 1051, 'n_words': 198}