diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 09a4488..5f5daa5 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -5,12 +5,12 @@ plugins { android { namespace = "io.github.sky130.kndroidx.demo" - compileSdk = 33 + compileSdk = 34 defaultConfig { applicationId = "io.github.sky130.kndroidx.demo" minSdk = 21 - targetSdk = 33 + targetSdk = 34 versionCode = 1 versionName = "1.0" diff --git a/app/src/androidTest/java/io/github/sky130/kndroidx/ExampleInstrumentedTest.kt b/app/src/androidTest/java/io/github/sky130/kndroidx/ExampleInstrumentedTest.kt deleted file mode 100644 index fee3be2..0000000 --- a/app/src/androidTest/java/io/github/sky130/kndroidx/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,24 +0,0 @@ -package io.github.sky130.kndroidx - -import androidx.test.platform.app.InstrumentationRegistry -import androidx.test.ext.junit.runners.AndroidJUnit4 - -import org.junit.Test -import org.junit.runner.RunWith - -import org.junit.Assert.* - -/** - * Instrumented test, which will execute on an Android device. - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -@RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { - @Test - fun useAppContext() { - // Context of the app under test. - val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("io.github.sky130.kndroidx", appContext.packageName) - } -} \ No newline at end of file diff --git a/app/src/test/java/io/github/sky130/kndroidx/ExampleUnitTest.kt b/app/src/test/java/io/github/sky130/kndroidx/ExampleUnitTest.kt deleted file mode 100644 index 71f2269..0000000 --- a/app/src/test/java/io/github/sky130/kndroidx/ExampleUnitTest.kt +++ /dev/null @@ -1,17 +0,0 @@ -package io.github.sky130.kndroidx - -import org.junit.Test - -import org.junit.Assert.* - -/** - * Example local unit test, which will execute on the development machine (host). - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -class ExampleUnitTest { - @Test - fun addition_isCorrect() { - assertEquals(4, 2 + 2) - } -} \ No newline at end of file diff --git a/core/src/main/java/kndroidx/extension/LogExtraFun.kt b/core/src/main/java/kndroidx/extension/LogExtraFun.kt index 44238e3..3f92a32 100644 --- a/core/src/main/java/kndroidx/extension/LogExtraFun.kt +++ b/core/src/main/java/kndroidx/extension/LogExtraFun.kt @@ -12,7 +12,7 @@ val Any.log: LogObject fun Any.log(tag: String = TAG) = LogObject.getObj(tag, this.toString()) fun isDebug(): Boolean { - return context!!.applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE != 0 + return context.applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE != 0 } class LogObject private constructor(private val tag: String, private val msg: String) { diff --git a/kndroidx/src/androidTest/java/io/github/sky130/kndroidx/ExampleInstrumentedTest.kt b/kndroidx/src/androidTest/java/io/github/sky130/kndroidx/ExampleInstrumentedTest.kt deleted file mode 100644 index fee3be2..0000000 --- a/kndroidx/src/androidTest/java/io/github/sky130/kndroidx/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,24 +0,0 @@ -package io.github.sky130.kndroidx - -import androidx.test.platform.app.InstrumentationRegistry -import androidx.test.ext.junit.runners.AndroidJUnit4 - -import org.junit.Test -import org.junit.runner.RunWith - -import org.junit.Assert.* - -/** - * Instrumented test, which will execute on an Android device. - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -@RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { - @Test - fun useAppContext() { - // Context of the app under test. - val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("io.github.sky130.kndroidx", appContext.packageName) - } -} \ No newline at end of file diff --git a/kndroidx/src/main/java/kndroidx/extension/IntentExtraFun.kt b/kndroidx/src/main/java/kndroidx/extension/IntentExtraFun.kt deleted file mode 100644 index d51926f..0000000 --- a/kndroidx/src/main/java/kndroidx/extension/IntentExtraFun.kt +++ /dev/null @@ -1,51 +0,0 @@ -package kndroidx.extension - -import android.app.Activity -import android.app.Application -import android.app.Service -import android.content.ComponentName -import android.content.Context -import android.content.Intent -import android.content.ServiceConnection -import android.os.IBinder -import kndroidx.application.ApplicationX - -inline fun Context.startIntent(block: Intent.() -> Unit) : Intent { - val intent = Intent() - intent.block() - startActivity(intent) - return intent -} - -inline fun Context.start() { - val intent = Intent(this, T::class.java) - startActivity(intent) -} - -inline fun Context.start(block: Intent.() -> Unit) { - val intent = Intent(this, T::class.java) - intent.block() - startActivity(intent) -} - -inline fun start( - flags: Int = Application.BIND_AUTO_CREATE, - context: Context = ApplicationX.application, - crossinline onServiceConnected: (ComponentName, IBinder) -> Unit = { _, _ -> }, - crossinline onServiceDisconnected: (ComponentName) -> Unit = { _ -> }, - intent: Intent.() -> Unit = {}, -) : Intent { - val service = Intent(context, T::class.java) - val serviceConnection = object : ServiceConnection { - override fun onServiceConnected(name: ComponentName, binder: IBinder) { - onServiceConnected(name, binder) - } - - override fun onServiceDisconnected(name: ComponentName) { - onServiceDisconnected(name) - } - } - service.intent() - context.bindService(service, serviceConnection, flags) - return service -} \ No newline at end of file diff --git a/kndroidx/src/main/res/values/colors.xml b/kndroidx/src/main/res/values/colors.xml deleted file mode 100644 index f8c6127..0000000 --- a/kndroidx/src/main/res/values/colors.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - #FFBB86FC - #FF6200EE - #FF3700B3 - #FF03DAC5 - #FF018786 - #FF000000 - #FFFFFFFF - \ No newline at end of file diff --git a/kndroidx/src/main/res/values/strings.xml b/kndroidx/src/main/res/values/strings.xml deleted file mode 100644 index c137e5b..0000000 --- a/kndroidx/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - KndroidX - \ No newline at end of file diff --git a/kndroidx/src/main/res/values/themes.xml b/kndroidx/src/main/res/values/themes.xml deleted file mode 100644 index d9b1744..0000000 --- a/kndroidx/src/main/res/values/themes.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - \ No newline at end of file diff --git a/kndroidx/src/test/java/io/github/sky130/kndroidx/ExampleUnitTest.kt b/kndroidx/src/test/java/io/github/sky130/kndroidx/ExampleUnitTest.kt deleted file mode 100644 index 71f2269..0000000 --- a/kndroidx/src/test/java/io/github/sky130/kndroidx/ExampleUnitTest.kt +++ /dev/null @@ -1,17 +0,0 @@ -package io.github.sky130.kndroidx - -import org.junit.Test - -import org.junit.Assert.* - -/** - * Example local unit test, which will execute on the development machine (host). - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -class ExampleUnitTest { - @Test - fun addition_isCorrect() { - assertEquals(4, 2 + 2) - } -} \ No newline at end of file