Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

Commit

Permalink
Test Update
Browse files Browse the repository at this point in the history
  • Loading branch information
CreativeCodeCat committed Nov 21, 2024
1 parent 0868d8d commit 5af4c34
Show file tree
Hide file tree
Showing 5 changed files with 216 additions and 119 deletions.
116 changes: 58 additions & 58 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -81,67 +81,67 @@ android {
}

dependencies {
val androidxTestKotlin = "1.7.5"
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
implementation("androidx.core:core-ktx:1.15.0")
implementation("androidx.appcompat:appcompat:1.7.0")
implementation("androidx.recyclerview:recyclerview:1.3.2")
// Core libraries
implementation(libs.core.ktx)
implementation(libs.appcompat)
implementation(libs.recyclerview)

// Android lifecycle
implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7")
// Android Lifecycle
implementation(libs.lifecycle.extensions)
implementation(libs.lifecycle.viewmodel.ktx)

// Navigation
implementation("androidx.navigation:navigation-fragment-ktx:2.8.3")
implementation(libs.navigation.fragment.ktx)
implementation(libs.navigation.ui.ktx)

// Work Manager
implementation("androidx.work:work-runtime-ktx:2.10.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.constraintlayout:constraintlayout-compose:1.1.0")

// Text similarity
implementation("org.apache.commons:commons-text:1.12.0")
implementation("com.google.code.gson:gson:2.11.0")

// JETPACK
// Integration with activities
//noinspection GradleDependency
implementation("androidx.activity:activity-compose:1.9.1")
// Compose Material Design
implementation("androidx.compose.material:material:$androidxTestKotlin")
implementation("com.github.SmartToolFactory:Compose-Colorful-Sliders:1.2.0")
// Animations
implementation("androidx.compose.animation:animation:$androidxTestKotlin")
implementation("androidx.navigation:navigation-ui-ktx:2.8.4")

// AndroidX
implementation("androidx.compose.ui:ui:$androidxTestKotlin")
implementation("androidx.compose.ui:ui-tooling:$androidxTestKotlin")
implementation("androidx.compose.foundation:foundation:$androidxTestKotlin")
implementation("androidx.biometric:biometric-ktx:1.4.0-alpha02")

//color picker
implementation("net.mm2d.color-chooser:color-chooser:0.7.3")

val acraVersion = "5.11.3"
implementation("ch.acra:acra-core:$acraVersion")
implementation("ch.acra:acra-dialog:$acraVersion")
implementation("ch.acra:acra-mail:$acraVersion")

val androidxTestEspresso = "3.6.1"
androidTestImplementation("androidx.test.espresso:espresso-core:$androidxTestEspresso")
androidTestImplementation("androidx.test.espresso:espresso-contrib:$androidxTestEspresso")
implementation("androidx.test.espresso:espresso-idling-resource:$androidxTestEspresso")
implementation("androidx.test.espresso:espresso-idling-resource:$androidxTestEspresso")

// Test rules and transitive dependencies:
androidTestImplementation("androidx.compose.ui:ui-test-junit4:$androidxTestKotlin")
// Needed for createComposeRule, but not createAndroidComposeRule:
debugImplementation("androidx.compose.ui:ui-test-manifest:$androidxTestKotlin")
androidTestImplementation("androidx.navigation:navigation-testing:2.8.4")
debugImplementation("androidx.fragment:fragment-testing:1.8.5")
implementation("androidx.test:core-ktx:1.6.1")
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
androidTestImplementation("androidx.test:runner:1.6.2")
androidTestImplementation("androidx.test:rules:1.6.1")
implementation(libs.work.runtime.ktx)

// UI Components
implementation(libs.constraintlayout)
implementation(libs.constraintlayout.compose)
implementation(libs.activity.compose)

// Jetpack Compose
implementation(libs.compose.material) // Compose Material Design
implementation(libs.compose.animation) // Animations
implementation(libs.compose.ui) // Core UI library
implementation(libs.compose.foundation) // Foundation library
implementation(libs.compose.ui.tooling) // UI tooling for previews

// Text similarity and JSON handling
implementation(libs.commons.text)
implementation(libs.gson)

// Color picker and sliders
implementation(libs.color.chooser) // Simple color picker
implementation(libs.compose.colorful.sliders) // Compose colorful sliders

// Biometric support
implementation(libs.biometric.ktx)

// ACRA for crash reporting
implementation(libs.acra.core)
implementation(libs.acra.dialog)
implementation(libs.acra.mail)

// AndroidX Test - Espresso
androidTestImplementation(libs.espresso.core)
androidTestImplementation(libs.espresso.contrib)
implementation(libs.espresso.idling.resource) // Idling resources for Espresso tests

// Test rules and other testing dependencies
androidTestImplementation(libs.test.runner)
androidTestImplementation(libs.test.rules)
implementation(libs.test.core.ktx) // Test core utilities

// Jetpack Compose Testing
androidTestImplementation(libs.ui.test.junit4) // For createComposeRule
debugImplementation(libs.ui.test.manifest) // Debug-only dependencies for Compose testing

// Fragment testing
debugImplementation(libs.fragment.testing)

// Navigation testing
androidTestImplementation(libs.navigation.testing)
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object Constants {
const val CLOCK_DATE_SIZE_MIN = 20
const val CLOCK_DATE_SIZE_MAX = 150

const val BATTERY_SIZE_MIN = 20
const val BATTERY_SIZE_MIN = 10
const val BATTERY_SIZE_MAX = 150

const val TEXT_MARGIN_MIN = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class Prefs(val context: Context) {
editor.putFloat(key, value.toFloat())
}
}

is MutableSet<*> -> {
val list = value.filterIsInstance<String>().toSet()
editor.putStringSet(key, list)
Expand Down Expand Up @@ -541,9 +542,9 @@ class Prefs(val context: Context) {
var batterySize: Int
get() {
return try {
prefs.getInt(BATTERY_SIZE_TEXT, 18)
prefs.getInt(BATTERY_SIZE_TEXT, 14)
} catch (_: Exception) {
18
14
}
}
set(value) = prefs.edit().putInt(BATTERY_SIZE_TEXT, value).apply()
Expand Down
132 changes: 74 additions & 58 deletions app/src/main/res/layout/fragment_home.xml
Original file line number Diff line number Diff line change
@@ -1,73 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:orientation="vertical"
tools:context=".ui.HomeFragment">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:orientation="vertical"
tools:context=".ui.HomeFragment">

<FrameLayout
android:id="@+id/touchArea"
android:layout_marginTop="50dp"
android:layout_marginBottom="50dp"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
android:layout_marginTop="50dp"
android:layout_marginBottom="50dp" />

<!-- Clock and calendar-->
<LinearLayout
android:id="@+id/dateTimeLayout"
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/mainView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="56dp"
android:layout_marginEnd="24dp"
android:orientation="vertical"
tools:visibility="visible">

<TextClock
android:id="@+id/clock"
style="@style/TextDefault"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/time_size"
tools:text="02:34" />

<TextClock
android:id="@+id/date"
style="@style/TextDefault"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="2dp"
android:textSize="@dimen/date_size"
tools:text="Thu, 30 Dec" />
android:layout_height="match_parent"
android:layout_marginHorizontal="20dp"
android:layout_marginVertical="32dp"
android:orientation="vertical">

<LinearLayout
android:id="@+id/batteryLayout"
android:layout_width="wrap_content"
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:visibility="visible">
android:layout_marginTop="16dp"
android:orientation="vertical">

<TextView
android:id="@+id/batteryIcon"
style="@style/TextDefault"
<LinearLayout
android:id="@+id/batteryLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingVertical="2dp"
android:textSize="@dimen/date_size"
android:visibility="gone" />
android:layout_gravity="end"
android:orientation="horizontal"
tools:visibility="visible">

<TextView
android:id="@+id/batteryText"
style="@style/TextDefault"
android:layout_width="wrap_content"
<TextView
android:id="@+id/batteryIcon"
style="@style/TextDefault"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingVertical="2dp"
android:textSize="@dimen/date_size"
android:visibility="gone" />

<TextView
android:id="@+id/batteryText"
style="@style/TextDefault"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingVertical="2dp"
android:textSize="@dimen/date_size" />
</LinearLayout>

<!-- Clock and calendar-->
<LinearLayout
android:id="@+id/dateTimeLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="2dp"
android:textSize="@dimen/date_size" />
</LinearLayout>
</LinearLayout>
android:layout_marginVertical="2dp"
android:orientation="vertical"
tools:visibility="visible">

<TextClock
android:id="@+id/clock"
style="@style/TextDefault"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/time_size"
tools:text="02:34" />

<TextClock
android:id="@+id/date"
style="@style/TextDefault"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="2dp"
android:textSize="@dimen/date_size"
tools:text="Thu, 30 Dec" />
</LinearLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>


<!-- Home apps-->
<LinearLayout
Expand All @@ -77,8 +93,8 @@
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingHorizontal="20dp"
android:paddingBottom="80dp"
android:paddingTop="112dp" />
android:paddingTop="112dp"
android:paddingBottom="80dp" />

<TextView
android:id="@+id/homeScreenPager"
Expand Down
80 changes: 80 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# gradle/libs.versions.toml

[versions]
# AndroidX
core-ktx = "1.15.0"
appcompat = "1.7.0"
recyclerview = "1.3.2"
lifecycle-extensions = "2.2.0"
lifecycle-viewmodel-ktx = "2.8.7"
navigation-fragment-ktx = "2.8.4"
navigation-ui-ktx = "2.8.4"
constraintlayout = "2.2.0"
constraintlayout-compose = "1.1.0"
work-runtime-ktx = "2.10.0"
biometric-ktx = "1.4.0-alpha02"
activity-compose = "1.9.3"

# Compose Material
compose-material = "1.7.5"
compose-animation = "1.7.5"
compose-ui = "1.7.5"
compose-foundation = "1.7.5"
compose-ui-tooling = "1.7.5"

# Libraries
commons-text = "1.12.0"
gson = "2.11.0"
color-chooser = "0.7.3"
compose-colorful-sliders = "1.2.0"

# ACRA
acra = "5.11.3"

# Android Test
espresso = "3.6.1"
test-runner = "1.6.2"
test-rules = "1.6.1"
test-core-ktx = "1.6.1"

# Debug/Test
fragment-testing = "1.8.5"
ui-test-junit4 = "1.7.5"
ui-test-manifest = "1.7.5"
navigation-testing = "2.8.4"

[libraries]
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "core-ktx" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
recyclerview = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "recyclerview" }
lifecycle-extensions = { group = "androidx.lifecycle", name = "lifecycle-extensions", version.ref = "lifecycle-extensions" }
lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycle-viewmodel-ktx" }
navigation-fragment-ktx = { group = "androidx.navigation", name = "navigation-fragment-ktx", version.ref = "navigation-fragment-ktx" }
navigation-ui-ktx = { group = "androidx.navigation", name = "navigation-ui-ktx", version.ref = "navigation-ui-ktx" }
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
constraintlayout-compose = { group = "androidx.constraintlayout", name = "constraintlayout-compose", version.ref = "constraintlayout-compose" }
work-runtime-ktx = { group = "androidx.work", name = "work-runtime-ktx", version.ref = "work-runtime-ktx" }
biometric-ktx = { group = "androidx.biometric", name = "biometric-ktx", version.ref = "biometric-ktx" }
activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activity-compose" }
compose-material = { group = "androidx.compose.material", name = "material", version.ref = "compose-material" }
compose-animation = { group = "androidx.compose.animation", name = "animation", version.ref = "compose-animation" }
compose-ui = { group = "androidx.compose.ui", name = "ui", version.ref = "compose-ui" }
compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling", version.ref = "compose-ui-tooling" }
compose-foundation = { group = "androidx.compose.foundation", name = "foundation", version.ref = "compose-foundation" }
commons-text = { group = "org.apache.commons", name = "commons-text", version.ref = "commons-text" }
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
color-chooser = { group = "net.mm2d.color-chooser", name = "color-chooser", version.ref = "color-chooser" }
compose-colorful-sliders = { group = "com.github.SmartToolFactory", name = "Compose-Colorful-Sliders", version.ref = "compose-colorful-sliders" }
acra-core = { group = "ch.acra", name = "acra-core", version.ref = "acra" }
acra-dialog = { group = "ch.acra", name = "acra-dialog", version.ref = "acra" }
acra-mail = { group = "ch.acra", name = "acra-mail", version.ref = "acra" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso" }
espresso-contrib = { group = "androidx.test.espresso", name = "espresso-contrib", version.ref = "espresso" }
espresso-idling-resource = { group = "androidx.test.espresso", name = "espresso-idling-resource", version.ref = "espresso" }
test-runner = { group = "androidx.test", name = "runner", version.ref = "test-runner" }
test-rules = { group = "androidx.test", name = "rules", version.ref = "test-rules" }
test-core-ktx = { group = "androidx.test", name = "core-ktx", version.ref = "test-core-ktx" }
fragment-testing = { group = "androidx.fragment", name = "fragment-testing", version.ref = "fragment-testing" }
ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4", version.ref = "ui-test-junit4" }
ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest", version.ref = "ui-test-manifest" }
navigation-testing = { group = "androidx.navigation", name = "navigation-testing", version.ref = "navigation-testing" }

0 comments on commit 5af4c34

Please sign in to comment.