diff --git a/app/.gitignore b/app/.gitignore deleted file mode 100644 index 6ae6c730..00000000 --- a/app/.gitignore +++ /dev/null @@ -1,123 +0,0 @@ - -# Created by https://www.toptal.com/developers/gitignore/api/androidstudio -# Edit at https://www.toptal.com/developers/gitignore?templates=androidstudio - -### AndroidStudio ### -# Covers files to be ignored for android development using Android Studio. - -# Built application files -*.apk -*.ap_ -*.aab - -# Files for the ART/Dalvik VM -*.dex - -# Java class files -*.class - -# Generated files -bin/ -gen/ -out/ - -# Gradle files -.gradle -.gradle/ -build/ - -# Signing files -.signing/ - -# Local configuration file (sdk path, etc) -local.properties - -# Proguard folder generated by Eclipse -proguard/ - -# Log Files -*.log - -# Android Studio -/*/build/ -/*/local.properties -/*/out -/*/*/build -/*/*/production -captures/ -.navigation/ -*.ipr -*~ -*.swp - -# Keystore files -*.jks -*.keystore - -# Google Services (e.g. APIs or Firebase) -# google-services.json - -# Android Patch -gen-external-apklibs - -# External native build folder generated in Android Studio 2.2 and later -.externalNativeBuild - -# NDK -obj/ - -# IntelliJ IDEA -*.iml -*.iws -/out/ - -# User-specific configurations -.idea/ - -# OS-specific files -.DS_Store -.DS_Store? -._* -.Spotlight-V100 -.Trashes -ehthumbs.db -Thumbs.db - -# Legacy Eclipse project files -.classpath -.project -.cproject -.settings/ - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.war -*.ear - -# virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml) -hs_err_pid* - -## Plugin-specific files: - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Mongo Explorer plugin -.idea/mongoSettings.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -### AndroidStudio Patch ### - -!/gradle/wrapper/gradle-wrapper.jar - -# End of https://www.toptal.com/developers/gitignore/api/androidstudio diff --git a/app/build.gradle b/app/build.gradle index 7380ed50..0f88e4f5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,15 +1,17 @@ plugins { id 'com.android.application' id 'kotlin-android' + id 'kotlin-kapt' + id 'dagger.hilt.android.plugin' } android { - compileSdk 31 + compileSdk android_api_version defaultConfig { applicationId "no.nordicsemi.android.nrftoolbox" - minSdk 21 - targetSdk 31 + minSdk android_min_api_version + targetSdk android_api_version versionCode 1 versionName "1.0" @@ -38,21 +40,32 @@ android { } composeOptions { kotlinCompilerExtensionVersion compose_version - kotlinCompilerVersion '1.5.21' + kotlinCompilerVersion kotlin_version } - packagingOptions { - resources { - excludes += '/META-INF/{AL2.0,LGPL2.1}' - } + hilt { + enableExperimentalClasspathAggregation = true } } dependencies { + //Hilt requires to implement every module in the main app module + //https://github.com/google/dagger/issues/2123 + implementation project(":feature_csc") + implementation project(":lib_broadcast") + implementation project(":lib_events") + implementation project(":lib_theme") + implementation project(":lib_scanner") + + implementation libs.nordic.ble.common + + implementation libs.bundles.hilt + kapt libs.bundles.hiltkapt implementation libs.bundles.compose implementation libs.androidx.core implementation libs.material - implementation libs.lifecycle + implementation libs.lifecycle.activity + implementation libs.compose.lifecycle implementation libs.compose.activity testImplementation libs.test.junit @@ -60,4 +73,4 @@ dependencies { androidTestImplementation libs.android.test.espresso androidTestImplementation libs.android.test.compose.ui debugImplementation libs.android.test.compose.tooling -} \ No newline at end of file +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro deleted file mode 100644 index 481bb434..00000000 --- a/app/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0a69ceaf..774fd620 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -3,6 +3,7 @@ package="no.nordicsemi.android.nrftoolbox"> Unit) { + Button( + modifier = Modifier.fillMaxWidth(), + onClick = { onClick() }, + colors = ButtonDefaults.buttonColors(backgroundColor = Color.Transparent) + ) { + Image( + painter = painterResource(iconId), + contentDescription = stringResource(id = nameId), + contentScale = ContentScale.Crop, + modifier = Modifier + .size(64.dp) + .clip(CircleShape) + .background(Color.White) + ) + Row( + modifier = Modifier + .padding(16.dp) + .fillMaxWidth(), + horizontalArrangement = Arrangement.Center + ) { + Text( + text = stringResource(id = nameId), + modifier = Modifier.padding(16.dp), + ) + } + } +} + +@Preview(showBackground = true) +@Composable +fun DefaultPreview() { + HomeView(rememberNavController()) +} diff --git a/app/src/main/java/no/nordicsemi/android/nrftoolbox/MainActivity.kt b/app/src/main/java/no/nordicsemi/android/nrftoolbox/MainActivity.kt index 651ffcb9..de07cd82 100644 --- a/app/src/main/java/no/nordicsemi/android/nrftoolbox/MainActivity.kt +++ b/app/src/main/java/no/nordicsemi/android/nrftoolbox/MainActivity.kt @@ -5,34 +5,21 @@ import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.material.MaterialTheme import androidx.compose.material.Surface -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.tooling.preview.Preview -import no.nordicsemi.android.nrftoolbox.ui.theme.TestTheme +import dagger.hilt.android.AndroidEntryPoint +import no.nordicsemi.android.theme.TestTheme +@AndroidEntryPoint class MainActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + setContent { TestTheme { - // A surface container using the 'background' color from the theme Surface(color = MaterialTheme.colors.background) { - Greeting("Android") + HomeScreen() } } } } } - -@Composable -fun Greeting(name: String) { - Text(text = "Hello $name!") -} - -@Preview(showBackground = true) -@Composable -fun DefaultPreview() { - TestTheme { - Greeting("Android") - } -} \ No newline at end of file diff --git a/app/src/main/java/no/nordicsemi/android/nrftoolbox/NrfToolboxApplication.kt b/app/src/main/java/no/nordicsemi/android/nrftoolbox/NrfToolboxApplication.kt new file mode 100644 index 00000000..c7090164 --- /dev/null +++ b/app/src/main/java/no/nordicsemi/android/nrftoolbox/NrfToolboxApplication.kt @@ -0,0 +1,8 @@ +package no.nordicsemi.android.nrftoolbox + +import android.app.Application +import dagger.hilt.android.HiltAndroidApp + +@HiltAndroidApp +class NrfToolboxApplication : Application() { +} \ No newline at end of file diff --git a/app/src/main/java/no/nordicsemi/android/nrftoolbox/ui/theme/Color.kt b/app/src/main/java/no/nordicsemi/android/nrftoolbox/ui/theme/Color.kt deleted file mode 100644 index 5fa89076..00000000 --- a/app/src/main/java/no/nordicsemi/android/nrftoolbox/ui/theme/Color.kt +++ /dev/null @@ -1,8 +0,0 @@ -package no.nordicsemi.android.nrftoolbox.ui.theme - -import androidx.compose.ui.graphics.Color - -val Purple200 = Color(0xFFBB86FC) -val Purple500 = Color(0xFF6200EE) -val Purple700 = Color(0xFF3700B3) -val Teal200 = Color(0xFF03DAC5) \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_csc.xml b/app/src/main/res/drawable/ic_csc.xml new file mode 100644 index 00000000..97283930 --- /dev/null +++ b/app/src/main/res/drawable/ic_csc.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index dd8a87e2..140e38df 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -2,13 +2,13 @@