Skip to content

Commit

Permalink
Merge pull request #52 from Jacob3075/WTA-39/add-more-items-to-home-page
Browse files Browse the repository at this point in the history
Added logic and UI for current streak
  • Loading branch information
Jacob3075 authored Nov 5, 2022
2 parents 3cf2828 + fa563ac commit f521091
Show file tree
Hide file tree
Showing 46 changed files with 2,132 additions and 451 deletions.
1 change: 0 additions & 1 deletion .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions .idea/deploymentTargetDropDown.xml

This file was deleted.

23 changes: 23 additions & 0 deletions .idea/runConfigurations/Home_Unit_Tests.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 6 additions & 9 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
plugins {
id("wakatimeapp.android.application")
id("androidx.navigation.safeargs.kotlin")
}

android {
namespace = "com.jacob.wakatimeapp"
}

dependencies {
Expand All @@ -14,7 +17,7 @@ dependencies {

implementation("androidx.core:core-splashscreen:1.0.0")

implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.0")

// Core Testing
testImplementation("junit:junit:4.13.2")
Expand All @@ -25,7 +28,7 @@ dependencies {
androidTestImplementation("androidx.test:runner:1.4.0")
androidTestImplementation("androidx.arch.core:core-testing:2.1.0")
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.2.1")
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.3.0")
androidTestImplementation("androidx.test.espresso:espresso-intents:3.4.0")

androidTestImplementation("com.google.dagger:hilt-android-testing:2.42")
Expand All @@ -34,10 +37,4 @@ dependencies {
androidTestImplementation("com.google.truth:truth:1.1.3")
androidTestImplementation("com.squareup.okhttp3:mockwebserver:4.9.3")
androidTestImplementation("io.mockk:mockk-android:1.12.4")

debugImplementation("androidx.compose.ui:ui-tooling:1.2.1")
debugImplementation("androidx.compose.ui:ui-test-manifest:1.2.1")
}
android {
namespace = "com.jacob.wakatimeapp"
}
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.3.0")
classpath("com.android.tools.build:gradle:8.0.0-alpha07")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10")
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.5.2")
classpath("com.google.dagger:hilt-android-gradle-plugin:2.42")
classpath("de.mannodermaus.gradle.plugins:android-junit5:1.8.2.1")
}
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ buildscript {
}

dependencies {
implementation("com.android.tools.build:gradle:7.3.0")
implementation("com.android.tools.build:gradle:8.0.0-alpha07")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10")

implementation("org.jetbrains.kotlin:kotlin-serialization:1.7.10")
implementation("org.jetbrains.kotlin:kotlin-serialization:1.7.20")
implementation("com.google.devtools.ksp:symbol-processing-api:1.7.10-1.0.6")
implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.22.0-RC1")

Expand Down
22 changes: 14 additions & 8 deletions buildSrc/src/main/kotlin/wakatimeapp.android.application.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ android {
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions { jvmTarget = "11" }
kotlinOptions {
jvmTarget = "11"
freeCompilerArgs = freeCompilerArgs + "-Xcontext-receivers"
}

buildFeatures { compose = true }
composeOptions { kotlinCompilerExtensionVersion = "1.3.1" }
Expand All @@ -60,22 +63,24 @@ dependencies {
implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.appcompat:appcompat:1.5.1")
implementation("androidx.legacy:legacy-support-v4:1.0.0")
implementation("com.google.android.material:material:1.7.0")

implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")

// Compose
implementation("androidx.compose.ui:ui:1.2.1")
implementation("com.google.android.material:material:1.7.0-rc01")
implementation("androidx.compose.material3:material3:1.0.0-rc01")
implementation("androidx.compose.ui:ui-tooling-preview:1.2.1")
implementation("androidx.activity:activity-compose:1.6.0")
implementation(platform("androidx.compose:compose-bom:2022.10.00"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.material3:material3")
implementation("androidx.activity:activity-compose:1.6.1")

implementation("androidx.compose.ui:ui-tooling-preview")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")

// Navigation
implementation("io.github.raamcosta.compose-destinations:core:1.6.19-beta")
ksp("io.github.raamcosta.compose-destinations:ksp:1.6.19-beta")

implementation("androidx.hilt:hilt-navigation-fragment:1.0.0")

// Hilt
implementation("com.google.dagger:hilt-android:2.43.1")
kapt("com.google.dagger:hilt-android-compiler:2.43.1")
Expand All @@ -84,6 +89,7 @@ dependencies {
implementation("com.jakewharton.timber:timber:5.0.1")

implementation("io.arrow-kt:arrow-core:1.0.1")

}

kapt {
Expand Down
33 changes: 25 additions & 8 deletions buildSrc/src/main/kotlin/wakatimeapp.android.feature.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ android {
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions { jvmTarget = "11" }
kotlinOptions {
jvmTarget = "11"
freeCompilerArgs = freeCompilerArgs + "-Xcontext-receivers"
}

buildFeatures { compose = true }
composeOptions { kotlinCompilerExtensionVersion = "1.3.1" }
Expand All @@ -50,18 +53,22 @@ dependencies {
implementation(project(":core:common"))

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.0")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")

implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.appcompat:appcompat:1.5.1")
implementation("com.google.android.material:material:1.7.0-rc01")
implementation("com.google.android.material:material:1.7.0")

// Compose
implementation("androidx.compose.ui:ui:1.2.1")
implementation("androidx.compose.material3:material3:1.0.0-rc01")
implementation("androidx.compose.ui:ui-tooling-preview:1.2.1")
implementation("androidx.activity:activity-compose:1.6.0")
implementation(platform("androidx.compose:compose-bom:2022.10.00"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.material3:material3")
implementation("androidx.activity:activity-compose:1.6.1")

implementation("androidx.compose.ui:ui-tooling-preview")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")

// Hilt
implementation("com.google.dagger:hilt-android:2.43.1")
Expand All @@ -79,13 +86,23 @@ dependencies {

// Base testing dependencies
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2")

// Coroutines & Flows
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4")
testImplementation("app.cash.turbine:turbine:0.12.0")

// Mocks
testImplementation("io.mockk:mockk:1.13.2")

// Assertions
testImplementation("io.kotest:kotest-assertions-core:5.5.0")
testImplementation("io.kotest.extensions:kotest-assertions-arrow:1.2.5")

androidTestImplementation("androidx.test.ext:junit:1.1.3")

testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2")
debugImplementation("androidx.compose.ui:ui-tooling:1.3.0")
debugImplementation("androidx.compose.ui:ui-test-manifest:1.3.0")
}

kapt {
Expand Down
7 changes: 5 additions & 2 deletions buildSrc/src/main/kotlin/wakatimeapp.android.library.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ android {
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions { jvmTarget = "11" }
kotlinOptions {
jvmTarget = "11"
freeCompilerArgs = freeCompilerArgs + "-Xcontext-receivers"
}
}

dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.0")

implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")

Expand Down
7 changes: 4 additions & 3 deletions core/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ plugins {
id("wakatimeapp.android.library")
}

android {
namespace = "com.jacob.wakatimeapp.core.common"
}

dependencies {
implementation(project(":core:models"))

Expand All @@ -25,6 +29,3 @@ dependencies {
implementation("com.squareup.okhttp3:okhttp")
implementation("com.squareup.okhttp3:logging-interceptor")
}
android {
namespace = "com.jacob.wakatimeapp.core.common"
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
package com.jacob.wakatimeapp.core.common // ktlint-disable filename
package com.jacob.wakatimeapp.core.common

import java.time.format.TextStyle.SHORT
import java.util.Locale
import kotlinx.datetime.Instant
import kotlinx.datetime.LocalDate
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toLocalDateTime

fun Instant.toDate(timeZone: TimeZone = TimeZone.currentSystemDefault()) =
toLocalDateTime(timeZone).date

fun LocalDate.getDisplayNameForDay(): String =
dayOfWeek.getDisplayName(SHORT, Locale.getDefault())
5 changes: 3 additions & 2 deletions core/models/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ plugins {
id("wakatimeapp.android.library")
}

dependencies {
}
android {
namespace = "com.jacob.wakatimeapp.core.models"
}

dependencies {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.jacob.wakatimeapp.core.models

data class Stats(
val totalTime: Time,
val dailyStats: List<DailyStats>,
val range: StatsRange,
)
13 changes: 9 additions & 4 deletions core/ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@ dependencies {

implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.appcompat:appcompat:1.5.1")
implementation("com.google.android.material:material:1.7.0-rc01")
implementation("androidx.compose.material3:material3:1.0.0-rc01")
implementation("com.google.android.material:material:1.7.0")
implementation("androidx.compose.material3:material3:1.0.0")

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4")

// Compose
implementation("androidx.compose.ui:ui:1.2.1")
implementation("androidx.compose.ui:ui-tooling-preview:1.2.1")
implementation(platform("androidx.compose:compose-bom:2022.10.00"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.material3:material3")

implementation("androidx.compose.ui:ui-tooling-preview")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")

implementation("com.airbnb.android:lottie-compose:5.0.3")

Expand Down
31 changes: 31 additions & 0 deletions core/ui/src/main/java/com/jacob/wakatimeapp/core/ui/WtaPreviews.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.jacob.wakatimeapp.core.ui

import android.content.res.Configuration
import androidx.compose.ui.tooling.preview.Preview

@Preview(
name = "Light Mode",
uiMode = Configuration.UI_MODE_NIGHT_NO or Configuration.UI_MODE_TYPE_NORMAL,
group = "component"
)
@Preview(
name = "Dark Mode",
showBackground = true,
uiMode = Configuration.UI_MODE_NIGHT_YES or Configuration.UI_MODE_TYPE_NORMAL,
group = "component"
)
@Preview(
name = "Full Device Light ",
showBackground = true,
uiMode = Configuration.UI_MODE_NIGHT_NO or Configuration.UI_MODE_TYPE_NORMAL,
showSystemUi = true,
group = "full"
)
@Preview(
name = "Full Device Dark ",
showBackground = true,
uiMode = Configuration.UI_MODE_NIGHT_YES or Configuration.UI_MODE_TYPE_NORMAL,
showSystemUi = true,
group = "full"
)
annotation class WtaPreviews
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.jacob.wakatimeapp.core.ui.modifiers

import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.layout
import androidx.compose.ui.text.TextStyle

/**
* Removes excess padding from the top and bottom of the text.
*
* [Source](https://issuetracker.google.com/issues/171394808#comment38)
*/
fun Modifier.removeFontPadding(
textStyle: TextStyle,
) = layout { measurable, constraints ->
val placeable = measurable.measure(constraints)
val heightWithoutPadding =
placeable.height - placeable.height.mod(textStyle.lineHeight.roundToPx())
layout(placeable.width, heightWithoutPadding) {
placeable.placeRelative(0, 0)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ data class Gradient(
val opacity: Int = 100,
val onStartColor: Color = startColor,
val onEndColor: Color = endColor,
)
) {
val colorList get() = listOf(startColor, endColor)
}

@Immutable
data class Gradients(
Expand Down
Loading

0 comments on commit f521091

Please sign in to comment.