diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index f6a83779..00000000 --- a/app/build.gradle +++ /dev/null @@ -1,129 +0,0 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' - -android { - - defaultConfig { - applicationId "de.rwth_aachen.phyphox" - minSdkVersion 21 - targetSdkVersion 35 - compileSdk 35 - - versionName "1.2.0" - // format WXXYYZZ, where WW is major, XX is minor, YY is patch, and ZZ is build - versionCode 1020009 //1.02.00-09 - - def locales = ['en', 'cs', 'de', 'el', 'es', 'fr', 'hi', 'it', 'ja', 'ka', 'nl', 'pl', 'pt', 'ru', 'sr', 'b+sr+Latn', 'tr', 'vi', 'zh-rCN', 'zh-rTW'] - buildConfigField "String[]", "LOCALE_ARRAY", "new String[]{\""+locales.join("\",\"")+"\"}" - resourceConfigurations += ['en', 'cs', 'de', 'el', 'es', 'fr', 'hi', 'it', 'ja', 'ka', 'nl', 'pl', 'pt', 'ru', 'sr', 'b+sr+Latn', 'tr', 'vi', 'zh-rCN', 'zh-rTW'] - - vectorDrawables { - useSupportLibrary = true - } - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - - multiDexEnabled true - - vectorDrawables.useSupportLibrary = true - } - - buildTypes { - release { - lintOptions { - disable 'MissingTranslation' - } - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - - externalNativeBuild { - cmake { - path 'src/main/cpp/CMakeLists.txt' - } - } - - flavorDimensions = ["permissions"] - productFlavors { - screenshot { - dimension "permissions" - minSdkVersion 18 - } - regular { - dimension "permissions" - } - } - - compileOptions { - encoding = 'UTF-8' - sourceCompatibility JavaVersion.VERSION_21 - targetCompatibility JavaVersion.VERSION_21 - } - - namespace 'de.rwth_aachen.phyphox' - testNamespace 'de.rwth_aachen.phyphoxTest' - - bundle { - language { - enableSplit = false - } - } - - buildFeatures { - buildConfig true - } - - ndkVersion '28.0.13004108' -} - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - - implementation 'androidx.multidex:multidex:2.0.1' - - - implementation 'com.google.android.material:material:1.12.0' - implementation 'androidx.annotation:annotation:1.9.1' - implementation 'androidx.appcompat:appcompat:1.7.1' - implementation 'androidx.appcompat:appcompat-resources:1.7.1' - implementation 'androidx.preference:preference:1.2.1' - implementation 'androidx.core:core:1.16.0' - implementation 'androidx.fragment:fragment:1.8.8' - implementation 'androidx.fragment:fragment-ktx:1.8.8' - - implementation 'androidx.viewpager:viewpager:1.1.0' - implementation 'org.apache.commons:commons-io:1.3.2' - - //https://github.com/journeyapps/zxing-android-embedded/blob/master/CHANGES.md - implementation 'com.journeyapps:zxing-android-embedded:3.5.0' - - implementation ('org.apache.poi:poi:3.13') - - implementation 'net.freeutils:jlhttp:3.1' - - //https://bigbadaboom.github.io/androidsvg/release_notes.html - implementation 'com.caverock:androidsvg:1.4' - - implementation 'androidx.recyclerview:recyclerview-selection:1.2.0' - testImplementation 'junit:junit:4.13.2' - - //Automated screenshot generation - androidTestScreenshotImplementation 'junit:junit:4.13.2' - androidTestScreenshotImplementation 'tools.fastlane:screengrab:2.1.1' - androidTestScreenshotImplementation 'androidx.test:rules:1.6.1' - androidTestScreenshotImplementation 'androidx.test.ext:junit:1.2.1' - androidTestScreenshotImplementation 'androidx.test.espresso:espresso-core:3.6.1' - - testImplementation "com.google.truth:truth:1.0.1" - - implementation "com.github.hannesa2:paho.mqtt.android:4.4" - - def camerax_version = "1.4.2" - implementation "androidx.camera:camera-core:${camerax_version}" - implementation "androidx.camera:camera-camera2:${camerax_version}" - implementation "androidx.camera:camera-lifecycle:${camerax_version}" - implementation "androidx.camera:camera-view:${camerax_version}" - - implementation 'androidx.recyclerview:recyclerview:1.4.0' - -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 00000000..c67e8a19 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,138 @@ +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.ksp) + alias(libs.plugins.hilt.android) +} + +android { + namespace = "de.rwth_aachen.phyphox" + testNamespace = "de.rwth_aachen.phyphoxTest" + compileSdk = libs.versions.compileSdk.get().toInt() + + defaultConfig { + applicationId = "de.rwth_aachen.phyphox" + minSdk = libs.versions.minSdk.get().toInt() + targetSdk = libs.versions.targetSdk.get().toInt() + + versionName = "1.2.0" + // format WXXYYZZ, where WW is major, XX is minor, YY is patch, and ZZ is build + versionCode = 1020009 //1.02.00-09 + + val locales = listOf( + "en", + "cs", + "de", + "el", + "es", + "fr", + "hi", + "it", + "ja", + "ka", + "nl", + "pl", + "pt", + "ru", + "sr", + "b+sr+Latn", + "tr", + "vi", + "zh-rCN", + "zh-rTW" + ) + buildConfigField( + "String[]", + "LOCALE_ARRAY", + "new String[]{\"" + locales.joinToString("\",\"") + "\"}" + ) + resourceConfigurations.addAll(locales) + + vectorDrawables { + useSupportLibrary = true + } + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + + multiDexEnabled = true + } + + buildTypes { + getByName("release") { + lint { + disable.add("MissingTranslation") + } + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") + } + } + + externalNativeBuild { + cmake { + path = file("src/main/cpp/CMakeLists.txt") + } + } + + flavorDimensions.add("permissions") + productFlavors { + create("screenshot") { + dimension = "permissions" + } + create("regular") { + dimension = "permissions" + } + } + + compileOptions { + encoding = "UTF-8" + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 + } + + bundle { + language { + enableSplit = false + } + } + + buildFeatures { + buildConfig = true + } + + ndkVersion = "28.0.13004108" +} + +dependencies { + implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) + implementation(libs.androidx.multidex) + implementation(libs.google.material) + implementation(libs.androidx.annotation) + implementation(libs.androidx.appcompat) + implementation(libs.androidx.appcompat.resources) + implementation(libs.androidx.preference) + implementation(libs.androidx.core) + implementation(libs.androidx.fragment) + implementation(libs.androidx.fragment.ktx) + implementation(libs.androidx.viewpager) + implementation(libs.androidx.recyclerview.selection) + implementation(libs.androidx.recyclerview) + implementation(libs.bundles.camerax)// CameraX Bundle + implementation(libs.commons.io) + implementation(libs.zxing.android.embedded)//https://github.com/journeyapps/zxing-android-embedded/blob/master/CHANGES.md + implementation(libs.apache.poi) + implementation(libs.jlhttp) + implementation(libs.caverock.androidsvg)//https://bigbadaboom.github.io/androidsvg/release_notes.html + implementation(libs.paho.mqtt.android) + + //hilt + implementation(libs.hilt.android) + ksp(libs.hilt.android.compiler) + + add("androidTestScreenshotImplementation", libs.junit) + add("androidTestScreenshotImplementation", libs.fastlane.screengrab) + add("androidTestScreenshotImplementation", libs.androidx.test.rules) + add("androidTestScreenshotImplementation", libs.androidx.test.ext.junit) + add("androidTestScreenshotImplementation", libs.androidx.test.espresso.core) + + testImplementation(libs.junit) + testImplementation(libs.google.truth) +} diff --git a/app/src/main/java/de/rwth_aachen/phyphox/App.java b/app/src/main/java/de/rwth_aachen/phyphox/App.java deleted file mode 100644 index 5d8230b7..00000000 --- a/app/src/main/java/de/rwth_aachen/phyphox/App.java +++ /dev/null @@ -1,11 +0,0 @@ -package de.rwth_aachen.phyphox; - -import android.app.Application; - -import androidx.multidex.MultiDexApplication; - -//This extension to application is only used to store measured data in memory as this may easily exceed the amount of data allowed on the transaction stack - -public class App extends MultiDexApplication { - public PhyphoxExperiment experiment = null; -} diff --git a/app/src/main/java/de/rwth_aachen/phyphox/App.kt b/app/src/main/java/de/rwth_aachen/phyphox/App.kt new file mode 100644 index 00000000..b16162f1 --- /dev/null +++ b/app/src/main/java/de/rwth_aachen/phyphox/App.kt @@ -0,0 +1,13 @@ +package de.rwth_aachen.phyphox + +import androidx.multidex.MultiDexApplication +import dagger.hilt.android.HiltAndroidApp + +//This extension to application is only used to store measured data in memory as this may easily exceed the amount of data allowed on the transaction stack +@HiltAndroidApp +class App : MultiDexApplication() { + + //Need to get rid off of this ASAP + @JvmField + var experiment: PhyphoxExperiment? = null +} diff --git a/app/src/main/java/de/rwth_aachen/phyphox/SettingsActivity/SettingsActivity.java b/app/src/main/java/de/rwth_aachen/phyphox/SettingsActivity/SettingsActivity.java index 4e74c56a..d9cd7fa6 100644 --- a/app/src/main/java/de/rwth_aachen/phyphox/SettingsActivity/SettingsActivity.java +++ b/app/src/main/java/de/rwth_aachen/phyphox/SettingsActivity/SettingsActivity.java @@ -12,11 +12,12 @@ import android.view.ViewGroup; +import dagger.hilt.android.AndroidEntryPoint; import de.rwth_aachen.phyphox.Helper.Helper; import de.rwth_aachen.phyphox.Helper.WindowInsetHelper; import de.rwth_aachen.phyphox.R; - +@AndroidEntryPoint public class SettingsActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { diff --git a/app/src/main/java/de/rwth_aachen/phyphox/di/AppModule.kt b/app/src/main/java/de/rwth_aachen/phyphox/di/AppModule.kt new file mode 100644 index 00000000..bda88bd7 --- /dev/null +++ b/app/src/main/java/de/rwth_aachen/phyphox/di/AppModule.kt @@ -0,0 +1,10 @@ +package de.rwth_aachen.phyphox.di + +import dagger.Module +import dagger.hilt.InstallIn +import dagger.hilt.components.SingletonComponent + +@Module(includes = []) +@InstallIn(SingletonComponent::class) +abstract class AppModule {} + diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 8379515b..00000000 --- a/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - repositories { - google() - mavenCentral() - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.21" - classpath 'com.android.tools.build:gradle:8.10.1' - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} - -allprojects { - repositories { - google() - mavenCentral() - maven { url 'https://jitpack.io' } - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..58f44467 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,7 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.hilt.android) apply false + alias(libs.plugins.ksp) apply false +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..2a8fbd68 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,81 @@ +[versions] +# SDK Versions +compileSdk = "35" +minSdk = "21" +targetSdk = "35" + +# Plugin Versions +androidGradlePlugin = "8.13.2" +kotlin = "2.2.21" +ksp = "2.2.10-2.0.2" + +# Dependency Versions +multidex = "2.0.1" +material = "1.12.0" +annotation = "1.9.1" +appcompat = "1.7.1" +preference = "1.2.1" +core = "1.16.0" +fragment = "1.8.9" +viewpager = "1.1.0" +commonsIo = "1.3.2" +zxing = "3.5.0" +poi = "3.13" +jlhttp = "3.1" +androidsvg = "1.4" +recyclerview = "1.4.0" +recyclerviewSelection = "1.2.0" +junit = "4.13.2" +screengrab = "2.1.1" +testRules = "1.6.1" +testExtJunit = "1.3.0" +espresso = "3.6.1" +truth = "1.0.1" +pahoMqtt = "4.4" +camerax = "1.4.2" +hilt-android = "2.57.2" + +[libraries] +androidx-multidex = { group = "androidx.multidex", name = "multidex", version.ref = "multidex" } +google-material = { group = "com.google.android.material", name = "material", version.ref = "material" } +androidx-annotation = { group = "androidx.annotation", name = "annotation", version.ref = "annotation" } +androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } +androidx-appcompat-resources = { group = "androidx.appcompat", name = "appcompat-resources", version.ref = "appcompat" } +androidx-preference = { group = "androidx.preference", name = "preference", version.ref = "preference" } +androidx-core = { group = "androidx.core", name = "core", version.ref = "core" } +androidx-fragment = { group = "androidx.fragment", name = "fragment", version.ref = "fragment" } +androidx-fragment-ktx = { group = "androidx.fragment", name = "fragment-ktx", version.ref = "fragment" } +androidx-viewpager = { group = "androidx.viewpager", name = "viewpager", version.ref = "viewpager" } +commons-io = { group = "org.apache.commons", name = "commons-io", version.ref = "commonsIo" } +zxing-android-embedded = { group = "com.journeyapps", name = "zxing-android-embedded", version.ref = "zxing" } +apache-poi = { group = "org.apache.poi", name = "poi", version.ref = "poi" } +jlhttp = { group = "net.freeutils", name = "jlhttp", version.ref = "jlhttp" } +caverock-androidsvg = { group = "com.caverock", name = "androidsvg", version.ref = "androidsvg" } +androidx-recyclerview = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "recyclerview" } +androidx-recyclerview-selection = { group = "androidx.recyclerview", name = "recyclerview-selection", version.ref = "recyclerviewSelection" } +junit = { group = "junit", name = "junit", version.ref = "junit" } +fastlane-screengrab = { group = "tools.fastlane", name = "screengrab", version.ref = "screengrab" } +androidx-test-rules = { group = "androidx.test", name = "rules", version.ref = "testRules" } +androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "testExtJunit" } +androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso" } +google-truth = { group = "com.google.truth", name = "truth", version.ref = "truth" } +paho-mqtt-android = { group = "com.github.hannesa2", name = "paho.mqtt.android", version.ref = "pahoMqtt" } + +# CameraX +androidx-camera-core = { group = "androidx.camera", name = "camera-core", version.ref = "camerax" } +androidx-camera-camera2 = { group = "androidx.camera", name = "camera-camera2", version.ref = "camerax" } +androidx-camera-lifecycle = { group = "androidx.camera", name = "camera-lifecycle", version.ref = "camerax" } +androidx-camera-view = { group = "androidx.camera", name = "camera-view", version.ref = "camerax" } + +#hilt-android +hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt-android" } +hilt-android-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt-android" } + +[plugins] +android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +hilt-android = { id = "com.google.dagger.hilt.android", version.ref = "hilt-android" } +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } + +[bundles] +camerax = ["androidx-camera-core", "androidx-camera-camera2", "androidx-camera-lifecycle", "androidx-camera-view"] diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 84810408..8823a0e4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Tue Jun 03 08:52:22 CEST 2025 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index e7b4def4..00000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':app' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..92d8dcb8 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,34 @@ +pluginManagement { + repositories { + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + maven { url = uri("https://jitpack.io") } + } +} + +buildCache { + local { + isEnabled = true + } +} + +rootProject.name = "phyphox" +include(":app")