mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 11:07:10 +00:00
refactor(android): move sample app under examples/sample-app/
Rename the gradle sample project from :sdk-android-sample to :sample-app so the isolated example for users lives beside its spec in examples/.
This commit is contained in:
1 parent
f57634809e
commit
c12a3e242f
5 files changed
+2
-2
No files matched your search
@@ -0,0 +1,36 @@
|
||||
plugins {
|
||||
id("com.android.application") version "8.11.0"
|
||||
kotlin("android") version "2.1.21"
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "dev.uatu.sample"
|
||||
compileSdk = 35
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "dev.uatu.sample"
|
||||
minSdk = 24
|
||||
targetSdk = 35
|
||||
versionCode = 1
|
||||
versionName = findProperty("uatu.version") as String? ?: "0.0.0-dev"
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
isDebuggable = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":sdk-android"))
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<application
|
||||
android:name=".SampleApplication"
|
||||
android:label="Uatu Sample"
|
||||
android:allowBackup="false">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,48 @@
|
||||
package dev.uatu.sample
|
||||
|
||||
import android.app.Activity
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
import android.widget.Button
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
|
||||
class MainActivity : Activity() {
|
||||
companion object {
|
||||
@Volatile var clickCount: Int = 0
|
||||
}
|
||||
|
||||
private lateinit var label: TextView
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
val layout = LinearLayout(this).apply {
|
||||
orientation = LinearLayout.VERTICAL
|
||||
gravity = Gravity.CENTER
|
||||
setBackgroundColor(Color.parseColor("#FAFAFA"))
|
||||
setPadding(64, 96, 64, 64)
|
||||
}
|
||||
|
||||
label = TextView(this).apply {
|
||||
text = "Clicks: 0"
|
||||
textSize = 28f
|
||||
setTextColor(Color.BLACK)
|
||||
gravity = Gravity.CENTER
|
||||
}
|
||||
layout.addView(label)
|
||||
|
||||
val button = Button(this).apply {
|
||||
text = "Click me"
|
||||
textSize = 18f
|
||||
setOnClickListener {
|
||||
clickCount++
|
||||
label.text = "Clicks: $clickCount"
|
||||
}
|
||||
}
|
||||
layout.addView(button)
|
||||
|
||||
setContentView(layout)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package dev.uatu.sample
|
||||
|
||||
import android.app.Application
|
||||
import dev.uatu.sdk.Uatu
|
||||
|
||||
class SampleApplication : Application() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
Uatu.start(this)
|
||||
Uatu.extract("app_state") { "running" }
|
||||
Uatu.extract("click_count") { MainActivity.clickCount }
|
||||
Uatu.extract("uptime_millis") { System.currentTimeMillis() - startedAt }
|
||||
}
|
||||
|
||||
private val startedAt: Long = System.currentTimeMillis()
|
||||
}
|
||||
Reference in new issue
Block a user