Skip to content

Commit 5338804

Browse files
Refactor all (#33)
* fix(deps): update all dependencies | datasource | package | from | to | | ---------- | ----------------------------------------- | ------ | ------ | | maven | androidx.fragment:fragment-ktx | 1.5.2 | 1.5.3 | | maven | androidx.core:core-ktx | 1.8.0 | 1.9.0 | | maven | androidx.appcompat:appcompat | 1.5.0 | 1.5.1 | | maven | com.android.tools.build:gradle | 7.2.2 | 7.3.0 | | maven | org.jetbrains.kotlin:kotlin-stdlib-jdk8 | 1.7.10 | 1.7.20 | | maven | org.jetbrains.kotlin:kotlin-gradle-plugin | 1.7.10 | 1.7.20 | * refactor: all * ktlint * ci * chore: bump * chore: bump Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
1 parent ebc803c commit 5338804

File tree

28 files changed

+557
-259
lines changed

28 files changed

+557
-259
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
[*]
3+
indent_size=2
4+
end_of_line=lf
5+
charset=utf-8
6+
trim_trailing_whitespace=true
7+
insert_final_newline=true
8+
[*.{kt, kts}]
9+
ij_kotlin_imports_layout=*
10+
ktlint_disabled_rules=filename,no-wildcard-imports
11+
[*.xml]
12+
indent_size=4

.github/workflows/build.yml

Lines changed: 36 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,36 @@
1-
name: Build CI
2-
3-
on:
4-
push:
5-
branches: [ master ]
6-
paths-ignore: [ '**.md', '**.MD' ]
7-
8-
pull_request:
9-
branches: [ master ]
10-
paths-ignore: [ '**.md', '**.MD' ]
11-
12-
jobs:
13-
build:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/checkout@v3
17-
18-
- name: Set up JDK
19-
uses: actions/setup-java@v3
20-
with:
21-
distribution: 'zulu'
22-
java-version: '11'
23-
24-
- name: Make gradlew executable
25-
run: chmod +x ./gradlew
26-
27-
# - name: Spotless check
28-
# uses: gradle/gradle-build-action@v2
29-
# with:
30-
# arguments: spotlessCheck
31-
32-
- name: Build debug APK
33-
uses: gradle/gradle-build-action@v2
34-
with:
35-
arguments: assembleDebug --warning-mode all --stacktrace
36-
37-
- name: Upload APK
38-
uses: actions/upload-artifact@v3
39-
with:
40-
name: app-debug
41-
path: app/build/outputs/apk/debug/app-debug.apk
1+
name: Build CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
paths-ignore: [ '**.md', '**.MD' ]
7+
8+
pull_request:
9+
branches: [ master ]
10+
paths-ignore: [ '**.md', '**.MD' ]
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Set up JDK
19+
uses: actions/setup-java@v3
20+
with:
21+
distribution: 'zulu'
22+
java-version: '11'
23+
24+
- name: Make gradlew executable
25+
run: chmod +x ./gradlew
26+
27+
- name: Build debug APK
28+
uses: gradle/gradle-build-action@v2
29+
with:
30+
arguments: assembleDebug --warning-mode all --stacktrace
31+
32+
- name: Upload APK
33+
uses: actions/upload-artifact@v3
34+
with:
35+
name: app-debug
36+
path: app/build/outputs/apk/debug/app-debug.apk

.github/workflows/ktlint.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Ktlint CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
paths-ignore: [ '**.md', '**.MD' ]
7+
8+
pull_request:
9+
branches: [ master ]
10+
paths-ignore: [ '**.md', '**.MD' ]
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Set up JDK
19+
uses: actions/setup-java@v3
20+
with:
21+
distribution: 'zulu'
22+
java-version: '11'
23+
24+
- name: Make gradlew executable
25+
run: chmod +x ./gradlew
26+
27+
- name: Check code style
28+
uses: gradle/gradle-build-action@v2
29+
with:
30+
arguments: lintKotlin --warning-mode all --stacktrace
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
name: Remove old artifacts
2-
3-
on:
4-
# push:
5-
# branches: [ master ]
6-
7-
schedule:
8-
# Runs at 01:00 UTC on the 1, 8, 15, 22 and 29th of every month.
9-
- cron: '0 1 */7 * *'
10-
11-
jobs:
12-
remove-old-artifacts:
13-
runs-on: ubuntu-latest
14-
timeout-minutes: 10
15-
16-
steps:
17-
- name: Remove old artifacts
18-
uses: c-hive/gha-remove-artifacts@v1
19-
with:
20-
age: '1 month'
21-
skip-tags: true
22-
skip-recent: 5
1+
name: Remove old artifacts
2+
3+
on:
4+
# push:
5+
# branches: [ master ]
6+
7+
schedule:
8+
# Runs at 01:00 UTC on the 1, 8, 15, 22 and 29th of every month.
9+
- cron: '0 1 */7 * *'
10+
11+
jobs:
12+
remove-old-artifacts:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 10
15+
16+
steps:
17+
- name: Remove old artifacts
18+
uses: c-hive/gha-remove-artifacts@v1
19+
with:
20+
age: '7 days'
21+
skip-tags: true
22+
skip-recent: 5

.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.name

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/Project.xml

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/codeStyleConfig.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jarRepositories.xml

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Using StateFlow as LiveData
55
[![Build CI](https://github.com/Kotlin-Android-Open-Source/StateFlow-demo/actions/workflows/build.yml/badge.svg)](https://github.com/Kotlin-Android-Open-Source/StateFlow-demo/actions/workflows/build.yml)
66
[![Validate Gradle Wrapper](https://github.com/Kotlin-Android-Open-Source/StateFlow-demo/actions/workflows/gradle-wrapper-validation.yml/badge.svg)](https://github.com/Kotlin-Android-Open-Source/StateFlow-demo/actions/workflows/gradle-wrapper-validation.yml)
77
[![API](https://img.shields.io/badge/API-23%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=23)
8-
[![Kotlin](https://img.shields.io/badge/kotlin-1.6.10-orange.svg?logo=kotlin)](http://kotlinlang.org)
8+
[![Kotlin](https://img.shields.io/badge/kotlin-1.7.20-orange.svg?logo=kotlin)](http://kotlinlang.org)
99
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FKotlin-Android-Open-Source%2FStateFlow-demo&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com)
1010
[![License: MIT](https://img.shields.io/badge/License-MIT-purple.svg)](https://opensource.org/licenses/MIT)
1111

app/build.gradle

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1-
apply plugin: 'com.android.application'
2-
apply plugin: 'kotlin-android'
3-
apply plugin: 'kotlin-android-extensions'
1+
plugins {
2+
alias(libs.plugins.android.application)
3+
alias(libs.plugins.kotlin.android)
4+
}
45

56
android {
6-
compileSdkVersion 32
7-
buildToolsVersion "32.0.0"
7+
compileSdkVersion 33
8+
buildToolsVersion "33.0.0"
9+
namespace "com.hoc081098.stateflowsample"
810

911
defaultConfig {
1012
applicationId "com.hoc081098.stateflowsample"
1113
minSdkVersion 23
12-
targetSdkVersion 32
13-
versionCode 1
14-
versionName "1.0"
14+
targetSdkVersion 33
15+
16+
final MAJOR = 1
17+
final MINOR = 0
18+
final PATCH = 0
19+
versionCode MAJOR * 10_000 + MINOR * 100 + PATCH
20+
versionName "$MAJOR.$MINOR.$PATCH"
1521

1622
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1723
}
@@ -35,26 +41,28 @@ android {
3541

3642
dependencies {
3743
implementation fileTree(dir: 'libs', include: ['*.jar'])
38-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
44+
implementation libs.kotlin.stdlib
3945

40-
implementation 'androidx.appcompat:appcompat:1.5.0'
41-
implementation 'androidx.core:core-ktx:1.8.0'
42-
implementation 'com.google.android.material:material:1.6.1'
43-
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
46+
implementation libs.androidx.appcompat
47+
implementation libs.androidx.core.ktx
48+
implementation libs.android.material
49+
implementation libs.androidx.constraintlayout
4450

4551
// viewModels
46-
implementation "androidx.fragment:fragment-ktx:1.5.2"
52+
implementation libs.androidx.fragment
4753

4854
testImplementation 'junit:junit:4.13.2'
4955
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
5056
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
5157

5258
// coroutines
53-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'
54-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
59+
implementation libs.kotlinx.coroutines.core
60+
implementation libs.kotlinx.coroutines.android
61+
62+
implementation libs.hoc081098.flowext
5563

5664
// viewModelScope
57-
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
65+
implementation libs.androidx.lifecycle.viewmodel.ktx
5866
// lifecycleScope
59-
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
67+
implementation libs.androidx.lifecycle.runtime.ktx
6068
}

app/src/androidTest/java/com/hoc081098/stateflowsample/ExampleInstrumentedTest.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package com.hoc081098.stateflowsample
22

3-
import androidx.test.platform.app.InstrumentationRegistry
43
import androidx.test.ext.junit.runners.AndroidJUnit4
5-
4+
import androidx.test.platform.app.InstrumentationRegistry
5+
import org.junit.Assert.*
66
import org.junit.Test
77
import org.junit.runner.RunWith
88

9-
import org.junit.Assert.*
10-
119
/**
1210
* Instrumented test, which will execute on an Android device.
1311
*

0 commit comments

Comments
 (0)