Newer
Older
OverlayMultiCounter / app / src / main / kotlin / jackall / overlaymulticounter / activity / MainActivity.kt
MatsumotoKeiju on 9 Nov 2017 909 bytes [add] Overlay Counter
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(),
                            "カウンター1",
                            0)
            )
        }

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