Skip to content

Commit 15d2c3d

Browse files
update robolectric
1 parent 201a90c commit 15d2c3d

File tree

67 files changed

+255
-162
lines changed

Some content is hidden

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

67 files changed

+255
-162
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: 'Setup Java and Gradle'
2+
description: 'Composite action to set up Java and Gradle for Android builds.'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Set up JDK
7+
uses: actions/setup-java@v4
8+
with:
9+
distribution: zulu
10+
java-version: 21
11+
- name: Set up Gradle
12+
uses: gradle/actions/setup-gradle@v4
13+

.github/workflows/android-ci.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: "Android CI"
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '**/*.md'
7+
- '.github/workflows/android-test-ci.yml'
8+
- '.github/workflows/codeql-analysis.yml'
9+
- '.github/workflows/stale.yml'
10+
pull_request:
11+
paths-ignore:
12+
- '**/*.md'
13+
- '.github/workflows/android-test-ci.yml'
14+
- '.github/workflows/codeql-analysis.yml'
15+
- '.github/workflows/stale.yml'
16+
workflow_dispatch: {}
17+
18+
jobs:
19+
ktlint:
20+
runs-on: ubuntu-22.04
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: ./.github/actions/common-setup
24+
- name: ktlint check
25+
run: bash ./gradlew ktlintCheck --stacktrace
26+
- name: Upload ktlint report
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: ktlint-report
30+
path: app/build/reports/ktlint
31+
32+
lint:
33+
runs-on: ubuntu-22.04
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: ./.github/actions/common-setup
37+
- name: lint
38+
run: bash ./gradlew lintDebug --stacktrace
39+
- name: Upload lint report
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: lint-report
43+
path: app/build/reports/lint-results*.*
44+
45+
test:
46+
runs-on: ubuntu-22.04
47+
steps:
48+
- uses: actions/checkout@v4
49+
- uses: ./.github/actions/common-setup
50+
- name: unit tests
51+
run: bash ./gradlew testDebugUnitTest --stacktrace
52+
- name: Upload test results
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: test-results
56+
path: app/build/reports/tests
57+
58+
coverage:
59+
runs-on: ubuntu-22.04
60+
needs: test
61+
steps:
62+
- uses: actions/checkout@v4
63+
- uses: ./.github/actions/common-setup
64+
- name: coverage
65+
run: bash ./gradlew jacocoTestCoverageVerification --stacktrace
66+
- name: Upload JaCoCo report
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: jacoco-report
70+
path: app/build/reports/jacoco
71+
- name: upload coverage to Codecov
72+
uses: codecov/codecov-action@v4
73+
with:
74+
token: ${{ secrets.CODECOV_TOKEN }}
75+
file: ./app/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml
76+
77+
build-apk:
78+
runs-on: ubuntu-22.04
79+
needs: [ktlint, lint, test, coverage]
80+
steps:
81+
- uses: actions/checkout@v4
82+
- uses: ./.github/actions/common-setup
83+
- name: build apk
84+
run: bash ./gradlew assembleDebug --stacktrace
85+
- name: artifact apk
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: artifact-apk
89+
path: app/build/outputs/apk/debug
90+
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Android Instrumentation Tests
2+
on:
3+
push:
4+
branches:
5+
- release
6+
paths-ignore:
7+
- '**/*.md'
8+
- '.github/workflows/android-ci.yml'
9+
- '.github/workflows/codeql-analysis.yml'
10+
- '.github/workflows/stale.yml'
11+
workflow_dispatch: {}
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-22.04
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: ./.github/actions/common-setup
19+
- name: Build APKs
20+
run: ./gradlew assembleDebug assembleAndroidTest
21+
- name: Upload APKs
22+
uses: actions/upload-artifact@v4
23+
with:
24+
name: apks
25+
path: |
26+
app/build/outputs/apk/debug/app-debug.apk
27+
app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk
28+
29+
test:
30+
runs-on: ubuntu-22.04
31+
needs: build
32+
steps:
33+
- uses: actions/checkout@v4
34+
- name: Download APKs
35+
uses: actions/download-artifact@v4
36+
with:
37+
name: apks
38+
- name: Run tests
39+
uses: emulator-wtf/run-tests@v0
40+
with:
41+
api-token: ${{ secrets.EW_API_TOKEN }}
42+
app: app-debug.apk
43+
test: app-debug-androidTest.apk
44+
outputs-dir: build/test-results
45+
- name: Upload test results
46+
uses: actions/upload-artifact@v4
47+
with:
48+
path: |
49+
build/test-results
50+
app/build/reports/androidTests
51+
- name: Publish test results
52+
uses: mikepenz/action-junit-report@v5
53+
if: always()
54+
with:
55+
report_paths: 'build/test-results/**/*.xml'

.github/workflows/android_ci.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

.github/workflows/android_test_ci.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

app/build.gradle

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ plugins {
2121
id "kotlin-android"
2222
id "kotlin-allopen"
2323
id "jacoco"
24-
id "org.jlleitschuh.gradle.ktlint" version "13.0.0"
24+
id "org.jlleitschuh.gradle.ktlint" version "13.1.0"
2525
}
2626

2727
apply {
@@ -36,25 +36,25 @@ dependencies {
3636
implementation 'androidx.annotation:annotation:1.9.1'
3737
implementation 'androidx.appcompat:appcompat:1.7.1'
3838
implementation 'androidx.collection:collection-ktx:1.5.0'
39-
implementation 'androidx.core:core-ktx:1.16.0'
39+
implementation 'androidx.core:core-ktx:1.17.0'
4040
implementation 'androidx.core:core-splashscreen:1.0.1'
4141
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
42-
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.9.2'
43-
implementation 'androidx.media:media:1.7.0'
42+
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.9.3'
43+
implementation 'androidx.media:media:1.7.1'
4444
implementation 'androidx.preference:preference-ktx:1.2.1'
4545
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
4646
implementation 'com.jjoe64:graphview:4.2.2'
4747
// Unit Test Dependencies
4848
testImplementation 'androidx.test.ext:junit:1.3.0'
4949
testImplementation 'com.googlecode.junit-toolbox:junit-toolbox:2.4'
5050
testImplementation 'junit:junit:4.13.2'
51-
testImplementation 'org.mockito:mockito-core:5.18.0'
51+
testImplementation 'org.mockito:mockito-core:5.19.0'
5252
testImplementation 'org.mockito.kotlin:mockito-kotlin:6.0.0'
53-
testImplementation 'org.robolectric:robolectric:4.15.1'
53+
testImplementation 'org.robolectric:robolectric:4.16'
5454
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
5555
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
5656
testImplementation 'org.slf4j:slf4j-simple:2.0.17'
57-
testImplementation 'org.assertj:assertj-core:3.27.3'
57+
testImplementation 'org.assertj:assertj-core:3.27.4'
5858
// Android Test Dependencies
5959
androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0'
6060
androidTestImplementation 'androidx.test.ext:junit-ktx:1.3.0'
@@ -63,7 +63,8 @@ dependencies {
6363

6464
android {
6565
namespace = 'com.vrem.wifianalyzer'
66-
compileSdk = 35
66+
compileSdk = 36
67+
buildToolsVersion '36.0.0'
6768

6869
sourceSets.each {
6970
it.java.srcDirs += "src/$it.name/kotlin"
@@ -72,7 +73,7 @@ android {
7273
defaultConfig {
7374
applicationId = "com.vrem.wifianalyzer"
7475
minSdkVersion 24
75-
targetSdkVersion 35
76+
targetSdkVersion 36
7677
versionCode
7778
versionName
7879
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

app/build.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Build Properties
2-
#Mon Aug 04 12:26:03 EDT 2025
3-
version_build=28
2+
#Fri Aug 29 17:20:31 EDT 2025
3+
version_build=29
44
version_major=3
55
version_minor=2
66
version_patch=1

app/src/main/kotlin/com/vrem/util/LocaleUtils.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ private object SyncAvoid {
5151
).toList()
5252
}
5353

54-
val BULGARIAN: Locale = Locale("bg")
55-
val GREEK: Locale = Locale("el")
56-
val POLISH: Locale = Locale("pl")
57-
val PORTUGUESE_PORTUGAL: Locale = Locale("pt", "PT")
58-
val PORTUGUESE_BRAZIL: Locale = Locale("pt", "BR")
59-
val SPANISH: Locale = Locale("es")
60-
val RUSSIAN: Locale = Locale("ru")
61-
val TURKISH: Locale = Locale("tr")
62-
val UKRAINIAN: Locale = Locale("uk")
54+
val BULGARIAN: Locale = Locale.forLanguageTag("bg")
55+
val GREEK: Locale = Locale.forLanguageTag("el")
56+
val POLISH: Locale = Locale.forLanguageTag("pl")
57+
val PORTUGUESE_PORTUGAL: Locale = Locale.forLanguageTag("pt-PT")
58+
val PORTUGUESE_BRAZIL: Locale = Locale.forLanguageTag("pt-BR")
59+
val SPANISH: Locale = Locale.forLanguageTag("es")
60+
val RUSSIAN: Locale = Locale.forLanguageTag("ru")
61+
val TURKISH: Locale = Locale.forLanguageTag("tr")
62+
val UKRAINIAN: Locale = Locale.forLanguageTag("uk")
6363

6464
private const val SEPARATOR: String = "_"
6565

@@ -88,8 +88,8 @@ fun toLanguageTag(locale: Locale): String = locale.language + SEPARATOR + locale
8888
private fun fromLanguageTag(languageTag: String): Locale {
8989
val codes: Array<String> = languageTag.split(SEPARATOR).toTypedArray()
9090
return when (codes.size) {
91-
1 -> Locale(codes[0])
92-
2 -> Locale(codes[0], codes[1].toCapitalize(Locale.getDefault()))
91+
1 -> Locale.forLanguageTag(codes[0])
92+
2 -> Locale.forLanguageTag("${codes[0]}-${codes[1].toCapitalize(Locale.getDefault())}")
9393
else -> SyncAvoid.defaultLocale
9494
}
9595
}

app/src/main/kotlin/com/vrem/wifianalyzer/wifi/model/WiFiSignal.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package com.vrem.wifianalyzer.wifi.model
2020
import android.content.Context
2121
import com.vrem.wifianalyzer.wifi.band.WiFiBand
2222
import com.vrem.wifianalyzer.wifi.band.WiFiChannel
23+
import java.util.Locale
2324

2425
data class WiFiSignalExtra(
2526
val is80211mc: Boolean = false,
@@ -65,7 +66,7 @@ data class WiFiSignal(
6566

6667
val strength: Strength get() = Strength.calculate(level)
6768

68-
val distance: String get() = String.format("~%.1fm", calculateDistance(primaryFrequency, level))
69+
val distance: String get() = String.format(Locale.getDefault(), "~%.1fm", calculateDistance(primaryFrequency, level))
6970

7071
fun inRange(frequency: Int): Boolean = frequency in wiFiChannelStart.frequency..wiFiChannelEnd.frequency
7172

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
2+
<!-- Minimal content for AttributeSet testing -->
3+
</PreferenceScreen>
4+

0 commit comments

Comments
 (0)