Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions sample/android-app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.composeCompiler)
}

android {
namespace = "dev.androidbroadcast.featured.sample.app"
compileSdk =
libs.versions.android.compileSdk
.get()
.toInt()

defaultConfig {
applicationId = "dev.androidbroadcast.featured.sample"
minSdk =
libs.versions.android.minSdk
.get()
.toInt()
targetSdk =
libs.versions.android.targetSdk
.get()
.toInt()
versionCode = 1
versionName = "1.0.0"
}

buildFeatures {
compose = true
}

buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
)
}
}
}

dependencies {
implementation(project(":sample"))
implementation(project(":featured-debug-ui"))
implementation(project(":featured-platform"))
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.appcompat)
}
16 changes: 16 additions & 0 deletions sample/android-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="Featured Sample"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<activity
android:name="dev.androidbroadcast.featured.sample.MainActivity"
android:exported="true"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package dev.androidbroadcast.featured.sample

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.BackHandler
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import dev.androidbroadcast.featured.ConfigValues
import dev.androidbroadcast.featured.SampleApp
import dev.androidbroadcast.featured.debugui.FeatureFlagsDebugScreen
import dev.androidbroadcast.featured.platform.defaultLocalProvider

class MainActivity : ComponentActivity() {
// ConfigValues is held at Activity scope for this sample.
// In production, move to Application or a DI singleton to avoid
// recreating (and re-opening) the DataStore file on every rotation.
private val configValues by lazy {
ConfigValues(localProvider = defaultLocalProvider(applicationContext))
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
var showDebug by rememberSaveable { mutableStateOf(false) }

if (showDebug) {
BackHandler { showDebug = false }
FeatureFlagsDebugScreen(configValues = configValues)
} else {
SampleApp(
configValues = configValues,
onOpenDebugUi = { showDebug = true },
)
}
}
}
}
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ plugins {

include(":featured-gradle-plugin")
include(":sample")
include(":sample:android-app")
include(":core")
include(":featured-compose")
include(":featured-registry")
Expand Down
Loading