Compare commits

...

8 Commits

Author SHA1 Message Date
10ffb6c6a0 Test gh-actions 2023-03-22 04:46:41 -05:00
dependabot[bot]
856a0726f7 Bump logback-classic from 1.4.4 to 1.4.5
Bumps [logback-classic](https://github.com/qos-ch/logback) from 1.4.4 to 1.4.5.
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.4.4...v_1.4.5)

---
updated-dependencies:
- dependency-name: ch.qos.logback:logback-classic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-01 09:43:07 +01:00
dependabot[bot]
df97b1fd4f Bump espressoVersion from 3.4.0 to 3.5.0
Bumps `espressoVersion` from 3.4.0 to 3.5.0.

Updates `espresso-contrib` from 3.4.0 to 3.5.0

Updates `espresso-core` from 3.4.0 to 3.5.0

---
updated-dependencies:
- dependency-name: androidx.test.espresso:espresso-contrib
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: androidx.test.espresso:espresso-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-01 09:42:46 +01:00
dc678e59df GH Actions: Set job timeout 2022-12-23 10:31:30 -06:00
dependabot[bot]
d95084500f Bump daggerVersion from 2.43.2 to 2.44.2 (#1582)
Bumps `daggerVersion` from 2.43.2 to 2.44.2.

Updates `dagger` from 2.43.2 to 2.44.2
- [Release notes](https://github.com/google/dagger/releases)
- [Changelog](https://github.com/google/dagger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/dagger/compare/dagger-2.43.2...dagger-2.44.2)

Updates `dagger-compiler` from 2.43.2 to 2.44.2
- [Release notes](https://github.com/google/dagger/releases)
- [Changelog](https://github.com/google/dagger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/dagger/compare/dagger-2.43.2...dagger-2.44.2)

---
updated-dependencies:
- dependency-name: com.google.dagger:dagger
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: com.google.dagger:dagger-compiler
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-20 04:10:18 -06:00
6f7215b46f Update dependencies 2022-12-19 08:57:30 -06:00
Jakub Kalinowski
c423d2b3ca Issue 1574: Fixed the almost invisible watch hands in snooze activity (#1592)
* Setting the current theme correctly

* Ktlint correction
2022-12-18 04:25:06 -06:00
Jakub Kalinowski
758fc56277 Issue 1576: Solving problems with habitbull import (#1591)
* Recomputing the habit after import, corrected order of magnitude

* Corrected HabitBullCSV3 test and added a new one
2022-12-18 04:05:14 -06:00
10 changed files with 51 additions and 21 deletions

View File

@@ -9,6 +9,7 @@ on:
jobs: jobs:
Test: Test:
runs-on: self-hosted runs-on: self-hosted
timeout-minutes: 30
steps: steps:
- name: Check out source code - name: Check out source code
uses: actions/checkout@v1 uses: actions/checkout@v1

View File

@@ -1,6 +1,6 @@
plugins { plugins {
val kotlinVersion = "1.7.21" val kotlinVersion = "1.7.21"
id("com.android.application") version ("7.3.0-rc01") apply (false) id("com.android.application") version ("7.3.1") apply (false)
id("org.jetbrains.kotlin.android") version kotlinVersion apply (false) id("org.jetbrains.kotlin.android") version kotlinVersion apply (false)
id("org.jetbrains.kotlin.kapt") version kotlinVersion apply (false) id("org.jetbrains.kotlin.kapt") version kotlinVersion apply (false)
id("org.jetbrains.kotlin.android.extensions") version kotlinVersion apply (false) id("org.jetbrains.kotlin.android.extensions") version kotlinVersion apply (false)

View File

@@ -162,6 +162,7 @@ android_boot() {
# shellcheck disable=SC2016 # shellcheck disable=SC2016
android_test() { android_test() {
return 1
API=$1 API=$1
AVDNAME=${AVD_PREFIX}${API} AVDNAME=${AVD_PREFIX}${API}

View File

@@ -80,11 +80,11 @@ android {
} }
dependencies { dependencies {
val daggerVersion = "2.43.2" val daggerVersion = "2.44.2"
val kotlinVersion = "1.7.21" val kotlinVersion = "1.7.21"
val kxCoroutinesVersion = "1.6.4" val kxCoroutinesVersion = "1.6.4"
val ktorVersion = "1.6.8" val ktorVersion = "1.6.8"
val espressoVersion = "3.4.0" val espressoVersion = "3.5.0"
androidTestImplementation("androidx.test.espresso:espresso-contrib:$espressoVersion") androidTestImplementation("androidx.test.espresso:espresso-contrib:$espressoVersion")
androidTestImplementation("androidx.test.espresso:espresso-core:$espressoVersion") androidTestImplementation("androidx.test.espresso:espresso-core:$espressoVersion")
@@ -92,10 +92,10 @@ dependencies {
androidTestImplementation("com.linkedin.dexmaker:dexmaker-mockito:2.28.3") androidTestImplementation("com.linkedin.dexmaker:dexmaker-mockito:2.28.3")
androidTestImplementation("io.ktor:ktor-client-mock:$ktorVersion") androidTestImplementation("io.ktor:ktor-client-mock:$ktorVersion")
androidTestImplementation("io.ktor:ktor-jackson:$ktorVersion") androidTestImplementation("io.ktor:ktor-jackson:$ktorVersion")
androidTestImplementation("androidx.annotation:annotation:1.4.0") androidTestImplementation("androidx.annotation:annotation:1.5.0")
androidTestImplementation("androidx.test.ext:junit:1.1.3") androidTestImplementation("androidx.test.ext:junit:1.1.4")
androidTestImplementation("androidx.test.uiautomator:uiautomator:2.2.0") androidTestImplementation("androidx.test.uiautomator:uiautomator:2.2.0")
androidTestImplementation("androidx.test:rules:1.4.0") androidTestImplementation("androidx.test:rules:1.5.0")
androidTestImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0") androidTestImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
compileOnly("javax.annotation:jsr250-api:1.0") compileOnly("javax.annotation:jsr250-api:1.0")
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.2.2") coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.2.2")
@@ -113,7 +113,7 @@ dependencies {
implementation("androidx.appcompat:appcompat:1.5.1") implementation("androidx.appcompat:appcompat:1.5.1")
implementation("androidx.legacy:legacy-preference-v14:1.0.0") implementation("androidx.legacy:legacy-preference-v14:1.0.0")
implementation("androidx.legacy:legacy-support-v4:1.0.0") implementation("androidx.legacy:legacy-support-v4:1.0.0")
implementation("com.google.android.material:material:1.6.1") implementation("com.google.android.material:material:1.7.0")
implementation("com.opencsv:opencsv:5.7.1") implementation("com.opencsv:opencsv:5.7.1")
implementation(project(":uhabits-core")) implementation(project(":uhabits-core"))
kapt("com.google.dagger:dagger-compiler:$daggerVersion") kapt("com.google.dagger:dagger-compiler:$daggerVersion")

View File

@@ -33,7 +33,8 @@ import org.isoron.uhabits.HabitsApplication
import org.isoron.uhabits.R import org.isoron.uhabits.R
import org.isoron.uhabits.activities.AndroidThemeSwitcher import org.isoron.uhabits.activities.AndroidThemeSwitcher
import org.isoron.uhabits.core.models.Habit import org.isoron.uhabits.core.models.Habit
import org.isoron.uhabits.core.ui.ThemeSwitcher.Companion.THEME_LIGHT import org.isoron.uhabits.core.ui.views.DarkTheme
import org.isoron.uhabits.core.ui.views.LightTheme
import org.isoron.uhabits.receivers.ReminderController import org.isoron.uhabits.receivers.ReminderController
import org.isoron.uhabits.utils.SystemUtils import org.isoron.uhabits.utils.SystemUtils
import java.util.Calendar import java.util.Calendar
@@ -51,11 +52,8 @@ class SnoozeDelayPickerActivity : FragmentActivity(), OnItemClickListener {
val app = applicationContext as HabitsApplication val app = applicationContext as HabitsApplication
val appComponent = app.component val appComponent = app.component
val themeSwitcher = AndroidThemeSwitcher(this, appComponent.preferences) val themeSwitcher = AndroidThemeSwitcher(this, appComponent.preferences)
if (themeSwitcher.getSystemTheme() == THEME_LIGHT) { themeSwitcher.setTheme()
setTheme(R.style.BaseDialog)
} else {
setTheme(R.style.BaseDialogDark)
}
val data = intent.data val data = intent.data
if (data == null) { if (data == null) {
finish() finish()
@@ -75,6 +73,16 @@ class SnoozeDelayPickerActivity : FragmentActivity(), OnItemClickListener {
SystemUtils.unlockScreen(this) SystemUtils.unlockScreen(this)
} }
private fun AndroidThemeSwitcher.setTheme() {
if (this.isNightMode) {
setTheme(R.style.BaseDialogDark)
this.currentTheme = DarkTheme()
} else {
setTheme(R.style.BaseDialog)
this.currentTheme = LightTheme()
}
}
private fun showTimePicker() { private fun showTimePicker() {
val calendar = Calendar.getInstance() val calendar = Calendar.getInstance()
val dialog = TimePickerDialog.newInstance( val dialog = TimePickerDialog.newInstance(

View File

@@ -0,0 +1,3 @@
HabitName,HabitDescription,HabitCategory,CalendarDate,Value,CommentText
Caffeine,,Coffee Consumption,2022-11-21,80,
Caffeine,,Coffee Consumption,2022-11-22,80,
1 HabitName HabitDescription HabitCategory CalendarDate Value CommentText
2 Caffeine Coffee Consumption 2022-11-21 80
3 Caffeine Coffee Consumption 2022-11-22 80

View File

@@ -43,11 +43,11 @@ kotlin {
val jvmMain by getting { val jvmMain by getting {
dependencies { dependencies {
implementation(kotlin("stdlib-jdk8")) implementation(kotlin("stdlib-jdk8"))
compileOnly("com.google.dagger:dagger:2.43.2") compileOnly("com.google.dagger:dagger:2.44.2")
implementation("com.google.guava:guava:31.1-android") implementation("com.google.guava:guava:31.1-android")
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.7.10") implementation("org.jetbrains.kotlin:kotlin-stdlib:1.7.21")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4")
implementation("androidx.annotation:annotation:1.4.0") implementation("androidx.annotation:annotation:1.5.0")
implementation("com.google.code.findbugs:jsr305:3.0.2") implementation("com.google.code.findbugs:jsr305:3.0.2")
implementation("com.opencsv:opencsv:5.7.1") implementation("com.opencsv:opencsv:5.7.1")
implementation("commons-codec:commons-codec:1.15") implementation("commons-codec:commons-codec:1.15")
@@ -59,7 +59,7 @@ kotlin {
dependencies { dependencies {
implementation(kotlin("test")) implementation(kotlin("test"))
implementation(kotlin("test-junit")) implementation(kotlin("test-junit"))
implementation("org.xerial:sqlite-jdbc:3.39.3.0") implementation("org.xerial:sqlite-jdbc:3.40.0.0")
implementation("org.hamcrest:hamcrest:2.2") implementation("org.hamcrest:hamcrest:2.2")
implementation("org.apache.commons:commons-io:1.3.2") implementation("org.apache.commons:commons-io:1.3.2")
implementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0") implementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")

View File

@@ -86,10 +86,12 @@ class HabitBullCSVImporter
logger.info("Found a value of $value, considering this habit as numerical.") logger.info("Found a value of $value, considering this habit as numerical.")
h.type = HabitType.NUMERICAL h.type = HabitType.NUMERICAL
} }
h.originalEntries.add(Entry(timestamp, value, notes)) h.originalEntries.add(Entry(timestamp, value * 1000, notes))
} }
} }
} }
map.forEach { (_, habit) -> habit.recompute() }
} }
private fun parseTimestamp(rawValue: String): Timestamp { private fun parseTimestamp(rawValue: String): Timestamp {

View File

@@ -85,8 +85,8 @@ class ImportTest : BaseUnitTest() {
assertThat(habit.type, equalTo(HabitType.NUMERICAL)) assertThat(habit.type, equalTo(HabitType.NUMERICAL))
assertThat(habit.description, equalTo("")) assertThat(habit.description, equalTo(""))
assertThat(habit.frequency, equalTo(Frequency.DAILY)) assertThat(habit.frequency, equalTo(Frequency.DAILY))
assertThat(getValue(habit, 2021, 9, 1), equalTo(30)) assertThat(getValue(habit, 2021, 9, 1), equalTo(30000))
assertThat(getValue(habit, 2022, 1, 8), equalTo(100)) assertThat(getValue(habit, 2022, 1, 8), equalTo(100000))
val habit2 = habitList.getByPosition(1) val habit2 = habitList.getByPosition(1)
assertThat(habit2.name, equalTo("run")) assertThat(habit2.name, equalTo("run"))
@@ -98,6 +98,21 @@ class ImportTest : BaseUnitTest() {
assertTrue(isChecked(habit2, 2022, 1, 19)) assertTrue(isChecked(habit2, 2022, 1, 19))
} }
@Test
@Throws(IOException::class)
fun testHabitBullCSV4() {
importFromFile("habitbull4.csv")
assertThat(habitList.size(), equalTo(1))
val habit = habitList.getByPosition(0)
assertThat(habit.name, equalTo("Caffeine"))
assertThat(habit.type, equalTo(HabitType.NUMERICAL))
assertThat(habit.description, equalTo(""))
assertThat(habit.frequency, equalTo(Frequency.DAILY))
assertThat(getValue(habit, 2022, 11, 21), equalTo(80000))
assertThat(getValue(habit, 2022, 11, 22), equalTo(80000))
}
@Test @Test
@Throws(IOException::class) @Throws(IOException::class)
fun testLoopDB() { fun testLoopDB() {

View File

@@ -35,7 +35,7 @@ application {
dependencies { dependencies {
val ktorVersion = "1.6.8" val ktorVersion = "1.6.8"
val kotlinVersion = "1.7.21" val kotlinVersion = "1.7.21"
val logbackVersion = "1.4.4" val logbackVersion = "1.4.5"
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion") implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion")
implementation("io.ktor:ktor-server-netty:$ktorVersion") implementation("io.ktor:ktor-server-netty:$ktorVersion")
implementation("ch.qos.logback:logback-classic:$logbackVersion") implementation("ch.qos.logback:logback-classic:$logbackVersion")