Skip to content

Commit fc45aea

Browse files
committed
feat: add theme toggle button
1 parent 0fba091 commit fc45aea

File tree

86 files changed

+1081
-724
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1081
-724
lines changed

.editorconfig

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
1-
# https://pinterest.github.io/ktlint/latest/rules/standard
2-
31
root = true
42

5-
[*.{kt, kts}]
6-
ktlint_code_style = ktlint_official
7-
indent_size = 4
8-
indent_style = space
9-
ij_kotlin_allow_trailing_comma = false
10-
ij_kotlin_allow_trailing_comma_on_call_site = false
11-
12-
# enabled, disabled
13-
ktlint_standard = enabled
14-
ktlint_experimental = disabled
15-
ktlint_custom-rule-set = disabled
16-
17-
max_line_length = off
18-
insert_final_newline = false
19-
20-
# ktlint_standard_multiline-expression-wrapping = disabled
21-
# ktlint_standard_import-ordering = disabled
22-
# ktlint_standard_trailing-comma-on-declaration-site = disabled
3+
[*.{kt,kts}]
4+
ij_kotlin_allow_trailing_comma = true
5+
ij_kotlin_allow_trailing_comma_on_call_site = true
6+
ktlint_function_naming_ignore_when_annotated_with = Composable, Test

.github/workflows/Build.yaml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ jobs:
1717

1818
steps:
1919
- name: Checkout
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
2121

2222
- name: Validate Gradle Wrapper
23-
uses: gradle/wrapper-validation-action@v1
23+
uses: gradle/wrapper-validation-action@v3
2424

2525
- name: Copy CI gradle.properties
2626
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
2727

2828
- name: Set up JDK 17
29-
uses: actions/setup-java@v3
29+
uses: actions/setup-java@v4
3030
with:
3131
distribution: 'zulu'
3232
java-version: 17
@@ -46,29 +46,14 @@ jobs:
4646
key: gradle-${{ hashFiles('checksum.txt') }}
4747

4848
- name: Setup Gradle
49-
uses: gradle/gradle-build-action@v2
49+
uses: gradle/gradle-build-action@v3
5050

51-
- name: Check spotless
51+
- name: Check Spotless
5252
run: ./gradlew spotlessCheck --init-script gradle/init.gradle.kts --no-configuration-cache --stacktrace
5353

54-
- name: Check lint
55-
run: ./gradlew lintDebug --stacktrace
56-
57-
# - name: Build all build type and flavor permutations
58-
# run: ./gradlew assemble --stacktrace
59-
60-
# - name: Run local tests
61-
# run: ./gradlew testDebug testProdDebug --stacktrace
62-
63-
# - name: Upload build outputs (APKs)
64-
# uses: actions/upload-artifact@v3
65-
# with:
66-
# name: build-outputs
67-
# path: app/build/outputs
68-
6954
- name: Upload build reports
7055
if: always()
7156
uses: actions/upload-artifact@v3
7257
with:
7358
name: build-reports
74-
path: app/build/reports
59+
path: app/build/reports

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<p align="center">
44
<a href='https://developer.android.com'><img src='http://img.shields.io/badge/platform-android-green.svg'/></a>
55
<a href="https://kotlinlang.org/docs/whatsnew1920.html"><img src = "https://shields.io/badge/kotlin-1.9.23-blue" /></a>
6-
<a href="https://developer.android.com/jetpack/compose/bom"><img src = "https://img.shields.io/badge/jetpack%20compose-2024.04.00-brightgreen" /></a>
6+
<a href="https://developer.android.com/jetpack/compose/bom"><img src = "https://img.shields.io/badge/jetpack%20compose-2024.05.00-brightgreen" /></a>
77
<a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/license-Apache%202.0-blue.svg"/></a>
88
</p>
99

@@ -34,8 +34,11 @@
3434
- [Retrofit2](https://github.com/square/retrofit)
3535
- [Coil-Compose](https://coil-kt.github.io/coil/compose)
3636
- [Timber](https://github.com/JakeWharton/timber)
37+
- [Haze](https://github.com/chrisbanes/haze)
38+
- [sharedElement](https://developer.android.com/guide/fragments/animate#shared)
3739

3840
## Multi Module
41+
3942
```
4043
├── app
4144
├── core

app/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ android {
3131
isMinifyEnabled = true
3232
proguardFiles(
3333
getDefaultProguardFile("proguard-android-optimize.txt"),
34-
"proguard-rules.pro"
34+
"proguard-rules.pro",
3535
)
3636
signingConfig = signingConfigs.getByName("debug")
3737
}
@@ -48,4 +48,5 @@ dependencies {
4848
implementation(libs.androidx.startup)
4949
implementation(libs.androidx.compose.material3)
5050
implementation(libs.timber)
51+
implementation(libs.coil.kt)
5152
}

app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
<application
88
android:name=".BrBaApplication"
9+
android:allowBackup="false"
910
android:enableOnBackInvokedCallback="true"
1011
android:hardwareAccelerated="true"
1112
android:icon="@mipmap/ic_launcher"
@@ -22,6 +23,10 @@
2223
<meta-data
2324
android:name="io.github.shinhyo.brba.initializer.TimberInitializer"
2425
android:value="androidx.startup" />
26+
27+
<meta-data
28+
android:name="io.github.shinhyo.brba.initializer.CoilInitializer"
29+
android:value="androidx.startup" />
2530
</provider>
2631

2732
</application>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright 2024 shinhyo
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.github.shinhyo.brba.initializer
17+
18+
import android.content.Context
19+
import androidx.startup.Initializer
20+
import coil.Coil
21+
import coil.ImageLoader
22+
import coil.disk.DiskCache
23+
import coil.memory.MemoryCache
24+
25+
class CoilInitializer : Initializer<Unit> {
26+
27+
override fun create(context: Context) {
28+
Coil.setImageLoader(
29+
ImageLoader.Builder(context)
30+
.memoryCache {
31+
MemoryCache.Builder(context)
32+
.maxSizePercent(0.25)
33+
.build()
34+
}
35+
.crossfade(true)
36+
// .logger(if (BuildConfig.DEBUG) DebugLogger() else null)
37+
.respectCacheHeaders(false)
38+
.diskCache {
39+
DiskCache.Builder()
40+
.directory(context.cacheDir.resolve("image_cache"))
41+
.maxSizePercent(0.10)
42+
.build()
43+
}
44+
.build(),
45+
)
46+
}
47+
48+
override fun dependencies(): MutableList<Class<out Initializer<*>>> = mutableListOf()
49+
}

app/src/main/res/values/colors.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<resources>
3-
</resources>
2+
<resources></resources>

build-logic/convention/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,4 @@ dependencies {
2222
compileOnly(libs.android.tools.common)
2323
compileOnly(libs.kotlin.gradlePlugin)
2424
compileOnly(libs.ksp.gradlePlugin)
25-
compileOnly(libs.ktlint.gradlePlugin)
26-
}
25+
}

build-logic/convention/src/main/kotlin/brba.android.application.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import com.android.build.api.dsl.ApplicationExtension
22
import io.github.shinhyo.brba.buildlogic.configureAndroidCompose
33
import io.github.shinhyo.brba.buildlogic.configureHiltAndroid
44
import io.github.shinhyo.brba.buildlogic.configureKotlinAndroid
5-
import io.github.shinhyo.brba.buildlogic.configureKtlintAndroid
65
import io.github.shinhyo.brba.buildlogic.findVersion
76

87
with(pluginManager) {
@@ -16,4 +15,3 @@ extensions.configure<ApplicationExtension> {
1615
configureKotlinAndroid()
1716
configureAndroidCompose()
1817
configureHiltAndroid()
19-
configureKtlintAndroid()

build-logic/convention/src/main/kotlin/brba.android.feature.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ androidExtension.apply {
1515

1616
add("implementation", findLibrary("coil.kt.compose"))
1717

18-
add("implementation", findLibrary("androidx.constraintlayout.compose"))
1918
add("implementation", findLibrary("androidx.compose.material3"))
2019
add("implementation", findLibrary("androidx.compose.material.iconsExtended"))
20+
add("implementation", findLibrary("androidx.compose.animation"))
2121
add("implementation", findLibrary("haze"))
2222

2323
add("implementation", findLibrary("androidx.navigation.compose"))

0 commit comments

Comments
 (0)