Skip to content

Commit 73710e1

Browse files
fix #512
1 parent f187ec7 commit 73710e1

8 files changed

Lines changed: 33 additions & 35 deletions

File tree

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ dependencies {
3434
implementation 'com.google.android.material:material:1.12.0'
3535
implementation 'androidx.annotation:annotation:1.9.1'
3636
implementation 'androidx.appcompat:appcompat:1.7.0'
37-
implementation 'androidx.collection:collection-ktx:1.4.5'
37+
implementation 'androidx.collection:collection-ktx:1.5.0'
3838
implementation 'androidx.core:core-ktx:1.15.0'
3939
implementation 'androidx.core:core-splashscreen:1.0.1'
4040
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
@@ -47,7 +47,7 @@ dependencies {
4747
testImplementation 'androidx.test.ext:junit:1.2.1'
4848
testImplementation 'com.googlecode.junit-toolbox:junit-toolbox:2.4'
4949
testImplementation 'junit:junit:4.13.2'
50-
testImplementation 'org.mockito:mockito-core:5.16.0'
50+
testImplementation 'org.mockito:mockito-core:5.16.1'
5151
testImplementation 'org.mockito.kotlin:mockito-kotlin:5.4.0'
5252
testImplementation 'org.robolectric:robolectric:4.14.1'
5353
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"

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-
#Sat Mar 08 09:09:08 EST 2025
3-
version_build=5
2+
#Fri Mar 21 16:09:58 EDT 2025
3+
version_build=6
44
version_major=3
55
version_minor=1
66
version_patch=4

app/src/main/kotlin/com/vrem/wifianalyzer/settings/ThemeStyle.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717
*/
1818
package com.vrem.wifianalyzer.settings
1919

20+
import android.graphics.Color
21+
import androidx.annotation.ColorInt
2022
import androidx.annotation.StyleRes
2123
import com.vrem.wifianalyzer.R
2224

23-
enum class ThemeStyle(@param:StyleRes val theme: Int, @param:StyleRes val themeNoActionBar: Int) {
24-
DARK(R.style.ThemeDark, R.style.ThemeDarkNoActionBar),
25-
LIGHT(R.style.ThemeLight, R.style.ThemeLightNoActionBar),
26-
SYSTEM(R.style.ThemeSystem, R.style.ThemeSystemNoActionBar);
27-
}
25+
enum class ThemeStyle(@param:StyleRes val theme: Int, @param:StyleRes val themeNoActionBar: Int, @param:ColorInt val colorGraphText: Int) {
26+
DARK(R.style.ThemeDark, R.style.ThemeDarkNoActionBar, Color.WHITE),
27+
LIGHT(R.style.ThemeLight, R.style.ThemeLightNoActionBar, Color.BLACK),
28+
SYSTEM(R.style.ThemeSystem, R.style.ThemeSystemNoActionBar, Color.GRAY);
29+
}

app/src/main/kotlin/com/vrem/wifianalyzer/wifi/graphutils/GraphViewBuilder.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,11 @@ internal fun Viewport.initialize(maximumY: Int): Viewport {
4444
}
4545

4646
internal fun GridLabelRenderer.colors(themeStyle: ThemeStyle): GridLabelRenderer {
47-
val color = if (ThemeStyle.DARK == themeStyle) Color.WHITE else Color.BLACK
4847
this.gridColor = Color.GRAY
49-
this.verticalLabelsColor = color
50-
this.verticalAxisTitleColor = color
51-
this.horizontalLabelsColor = color
52-
this.horizontalAxisTitleColor = color
48+
this.verticalLabelsColor = themeStyle.colorGraphText
49+
this.verticalAxisTitleColor = themeStyle.colorGraphText
50+
this.horizontalLabelsColor = themeStyle.colorGraphText
51+
this.horizontalAxisTitleColor = themeStyle.colorGraphText
5352
return this
5453
}
5554

app/src/main/kotlin/com/vrem/wifianalyzer/wifi/graphutils/GraphViewWrapper.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818
package com.vrem.wifianalyzer.wifi.graphutils
1919

20-
import android.graphics.Color
2120
import com.jjoe64.graphview.GraphView
2221
import com.jjoe64.graphview.LegendRenderer
2322
import com.jjoe64.graphview.series.BaseSeries
@@ -113,7 +112,7 @@ class GraphViewWrapper(
113112
legendRenderer.resetStyles()
114113
legendRenderer.width = 0
115114
legendRenderer.textSize = graphView.titleTextSize
116-
legendRenderer.textColor = if (ThemeStyle.DARK == themeStyle) Color.WHITE else Color.BLACK
115+
legendRenderer.textColor = themeStyle.colorGraphText
117116
graphLegend.display(legendRenderer)
118117
}
119118

app/src/test/kotlin/com/vrem/wifianalyzer/settings/ThemeStyleTest.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818
package com.vrem.wifianalyzer.settings
1919

20+
import android.graphics.Color
2021
import com.vrem.wifianalyzer.R
2122
import org.assertj.core.api.Assertions.assertThat
2223
import org.junit.Test
@@ -41,4 +42,11 @@ class ThemeStyleTest {
4142
assertThat(ThemeStyle.SYSTEM.themeNoActionBar).isEqualTo(R.style.ThemeSystemNoActionBar)
4243
}
4344

45+
@Test
46+
fun colorGraphText() {
47+
assertThat(ThemeStyle.DARK.colorGraphText).isEqualTo(Color.WHITE)
48+
assertThat(ThemeStyle.LIGHT.colorGraphText).isEqualTo(Color.BLACK)
49+
assertThat(ThemeStyle.SYSTEM.colorGraphText).isEqualTo(Color.GRAY)
50+
}
51+
4452
}

app/src/test/kotlin/com/vrem/wifianalyzer/wifi/graphutils/GraphViewBuilderTest.kt

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -173,27 +173,17 @@ class GraphViewBuilderTest {
173173
}
174174

175175
@Test
176-
fun gridLabelRenderColorsDarkTheme() {
177-
// execute
178-
gridLabelRenderer.colors(ThemeStyle.DARK)
179-
// validate
180-
verify(gridLabelRenderer).gridColor = Color.GRAY
181-
verify(gridLabelRenderer).verticalLabelsColor = Color.WHITE
182-
verify(gridLabelRenderer).verticalAxisTitleColor = Color.WHITE
183-
verify(gridLabelRenderer).horizontalLabelsColor = Color.WHITE
184-
verify(gridLabelRenderer).horizontalAxisTitleColor = Color.WHITE
185-
}
186-
187-
@Test
188-
fun gridLabelRenderColorsLightTheme() {
176+
fun gridLabelRenderColors() {
177+
// setup
178+
val themeStyle = ThemeStyle.LIGHT
189179
// execute
190-
gridLabelRenderer.colors(ThemeStyle.LIGHT)
180+
gridLabelRenderer.colors(themeStyle)
191181
// validate
192182
verify(gridLabelRenderer).gridColor = Color.GRAY
193-
verify(gridLabelRenderer).verticalLabelsColor = Color.BLACK
194-
verify(gridLabelRenderer).verticalAxisTitleColor = Color.BLACK
195-
verify(gridLabelRenderer).horizontalLabelsColor = Color.BLACK
196-
verify(gridLabelRenderer).horizontalAxisTitleColor = Color.BLACK
183+
verify(gridLabelRenderer).verticalLabelsColor = themeStyle.colorGraphText
184+
verify(gridLabelRenderer).verticalAxisTitleColor = themeStyle.colorGraphText
185+
verify(gridLabelRenderer).horizontalLabelsColor = themeStyle.colorGraphText
186+
verify(gridLabelRenderer).horizontalAxisTitleColor = themeStyle.colorGraphText
197187
}
198188

199189
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
buildscript {
2222
ext {
23-
kotlin_version = '2.1.10'
23+
kotlin_version = '2.1.20'
2424
}
2525
repositories {
2626
google()

0 commit comments

Comments
 (0)