Newer
Older
OverlayMultiCounter / app / src / main / kotlin / jackall / overlaymulticounter / activity / MainActivity.kt
MatsumotoKeiju on 9 Nov 2017 901 bytes [add] remove counter row
package jackall.overlaymulticounter.activity

import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import jackall.overlaymulticounter.R
import jackall.overlaymulticounter.db.CounterRealmHelper
import jackall.overlaymulticounter.service.MainService
import jackall.overlaymulticounter.vo.Counter

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        if (CounterRealmHelper().getNextId() == 0) {
            CounterRealmHelper().insert(
                    Counter(CounterRealmHelper().getNextId(),
                            "Counter0",
                            0)
            )
        }

        // TODO: RuntimePermissionの処理
        startService(Intent(this, MainService::class.java))
    }
}