Skip to content

Commit

Permalink
Merge pull request #101 from joelkanyi/migrate-to-cmp-resources
Browse files Browse the repository at this point in the history
use new cmp resources
  • Loading branch information
joelkanyi authored Apr 30, 2024
2 parents c71e771 + 2e25c41 commit a7096c8
Show file tree
Hide file tree
Showing 56 changed files with 200 additions and 277 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build

on:
push:
branches: [ develop ]
branches: [ develop, main ]
pull_request:
branches: [ main, develop ]

Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build & Publish Release APK

on:
push:
tags:
- '*'

jobs:
Gradle:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v2

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: gradle

- name: Make gradle executable
run: chmod +x ./gradlew

- name: Build Release APK
run: ./gradlew assembleRelease

- name: Releasing using Hub
uses: kyze8439690/action-release-releaseapk@master
env:
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
APP_FOLDER: android
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ FocusBloom is a Kotlin Multiplatform app that helps users enhance their producti
![](https://img.shields.io/badge/Android-black.svg?style=for-the-badge&logo=android) | ![](https://img.shields.io/badge/iOS-black.svg?style=for-the-badge&logo=apple) | ![](https://img.shields.io/badge/Desktop-black.svg?style=for-the-badge&logo=windows) | ![](https://img.shields.io/badge/Web-black.svg?style=for-the-badge&logo=google-chrome)
:----: | :----: | :----: | :----:
✅ | ✅ | ✅ | Planned
<a href='https://play.google.com/store/apps/details?id=com.joelkanyi.focusbloom.android'><img alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png' height='80px'/></a>

## Screenshots
### Android
Expand All @@ -27,6 +26,18 @@ FocusBloom is a Kotlin Multiplatform app that helps users enhance their producti
## Architecture
The app is shared between Android, iOS and Desktop. The shared code is written in Kotlin and the UI is built with Compose Multiplatform. Shared code, written in Kotlin, is compiled to JVM bytecode for Android and Desktop with Kotlin/JVM and to native binaries for iOS with Kotlin/Native.
### Modules

```mermaid
%%{
init: {
'theme': 'neutral'
}
}%%
graph LR
:desktop --> :shared
:android --> :shared
```
- shared:
- contains all the shared code between the platforms
- android:
Expand Down Expand Up @@ -65,20 +76,6 @@ To run the application on iPhone device/simulator:
- Open `ios/iosApp.xcworkspace` in Xcode and run standard configuration
- Or use [Kotlin Multiplatform Mobile plugin](https://plugins.jetbrains.com/plugin/14936-kotlin-multiplatform-mobile) for Android Studio

### Module Graph

```mermaid
%%{
init: {
'theme': 'neutral'
}
}%%
graph LR
:desktop --> :shared
:android --> :shared
```

## License
```xml
Copyright 2023 JoelKanyi
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

androidDriver = "2.0.2"
kotlin = "1.9.23"
compose = "1.6.2"
compose = "1.6.10-dev1608"
koinCore = "3.5.6"
koinAndroid = "3.5.3"
gradle = "8.3.2"
Expand Down
14 changes: 2 additions & 12 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ plugins {
android {
namespace = "com.joelkanyi.focusbloom.shared"
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
sourceSets["main"].res.srcDirs("src/commonMain/resources")
sourceSets["main"].resources.srcDirs("src/commonMain/resources")
// sourceSets["main"].res.srcDirs("src/androidMain/res")
// sourceSets["main"].resources.srcDirs("src/commonMain/resources")
compileSdk = 34
defaultConfig {
minSdk = 21
Expand Down Expand Up @@ -97,7 +97,6 @@ kotlin {
implementation(compose.material)
implementation(compose.materialIconsExtended)

@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
implementation(compose.components.resources)

implementation(libs.voyager.navigator)
Expand Down Expand Up @@ -167,13 +166,4 @@ sqldelight {
packageName.set("com.joelkanyi.focusbloom.database")
}
}
}


tasks.withType<AndroidLintAnalysisTask>{
dependsOn("copyFontsToAndroidAssets")
}

tasks.withType<LintModelWriterTask>{
dependsOn("copyFontsToAndroidAssets")
}

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,44 @@
*/
package com.joelkanyi.focusbloom.core.domain.model

data class TaskType(
import focusbloom.shared.generated.resources.Res
import focusbloom.shared.generated.resources.other
import focusbloom.shared.generated.resources.personal
import focusbloom.shared.generated.resources.study
import focusbloom.shared.generated.resources.work
import org.jetbrains.compose.resources.DrawableResource
import org.jetbrains.compose.resources.ExperimentalResourceApi

data class TaskType @OptIn(ExperimentalResourceApi::class) constructor(
val name: String,
val icon: String,
val icon: DrawableResource,
val color: Long,
) {
override fun toString(): String {
return name
}
}

@OptIn(ExperimentalResourceApi::class)
val taskTypes = listOf(
TaskType(
name = "Work",
icon = "work.xml",
icon = Res.drawable.work,
color = 0xFF3375fd,
),
TaskType(
name = "Study",
icon = "study.xml",
icon = Res.drawable.study,
color = 0xFFff686d,
),
TaskType(
name = "Personal",
icon = "personal.xml",
icon = Res.drawable.personal,
color = 0xFF24c469,
),
TaskType(
name = "Other",
icon = "other.xml",
icon = Res.drawable.other,
color = 0xFF734efe,
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ import com.joelkanyi.focusbloom.feature.calendar.CalendarScreen
import com.joelkanyi.focusbloom.feature.home.HomeScreen
import com.joelkanyi.focusbloom.feature.settings.SettingsScreen
import com.joelkanyi.focusbloom.feature.statistics.StatisticsScreen
import org.jetbrains.compose.resources.DrawableResource
import focusbloom.shared.generated.resources.Res
import focusbloom.shared.generated.resources.add_outlined
import focusbloom.shared.generated.resources.calendar_outlined
import focusbloom.shared.generated.resources.home_outlined
import focusbloom.shared.generated.resources.settings_outlined
import focusbloom.shared.generated.resources.statistics_outlined
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.painterResource

Expand All @@ -35,7 +40,7 @@ internal sealed class BloomTab {
@Composable
get() {
val title = "Home"
val icon = painterResource(DrawableResource("home_outlined.xml"))
val icon = painterResource(Res.drawable.home_outlined)

return remember {
TabOptions(
Expand All @@ -58,7 +63,7 @@ internal sealed class BloomTab {
@Composable
get() {
val title = "Calendar"
val icon = painterResource(DrawableResource("calendar_outlined.xml"))
val icon = painterResource(Res.drawable.calendar_outlined)

return remember {
TabOptions(
Expand All @@ -81,7 +86,7 @@ internal sealed class BloomTab {
@Composable
get() {
val title = "Statistics"
val icon = painterResource(DrawableResource("statistics_outlined.xml"))
val icon = painterResource(Res.drawable.statistics_outlined)

return remember {
TabOptions(
Expand All @@ -104,7 +109,7 @@ internal sealed class BloomTab {
@Composable
get() {
val title = "Settings"
val icon = painterResource(DrawableResource("settings_outlined.xml"))
val icon = painterResource(Res.drawable.settings_outlined)

return remember {
TabOptions(
Expand All @@ -129,7 +134,7 @@ internal sealed class BloomTab {
@Composable
get() {
val title = "Add Task"
val icon = painterResource(DrawableResource("add_outlined.xml"))
val icon = painterResource(Res.drawable.add_outlined)

return remember {
TabOptions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material.icons.filled.PlayArrow
import androidx.compose.material3.Card
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
Expand All @@ -55,11 +54,12 @@ import com.joelkanyi.focusbloom.core.utils.calculateEndTime
import com.joelkanyi.focusbloom.core.utils.durationInMinutes
import com.joelkanyi.focusbloom.core.utils.prettyFormat
import com.joelkanyi.focusbloom.core.utils.prettyTimeDifference
import org.jetbrains.compose.resources.DrawableResource
import focusbloom.shared.generated.resources.Res
import focusbloom.shared.generated.resources.ic_complete
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.painterResource

@OptIn(ExperimentalMaterial3Api::class, ExperimentalResourceApi::class)
@OptIn(ExperimentalResourceApi::class)
@Composable
fun TaskCard(
task: Task,
Expand Down Expand Up @@ -188,7 +188,7 @@ fun TaskCard(
modifier = Modifier
.size(48.dp),
painter = painterResource(
DrawableResource("ic_complete.xml")),
Res.drawable.ic_complete),
contentDescription = "Task Options",
)
} else {
Expand Down
Loading

0 comments on commit a7096c8

Please sign in to comment.