Skip to content

Commit d76c8a3

Browse files
apply consistent formatting style
1 parent d25ef24 commit d76c8a3

File tree

264 files changed

+3575
-2256
lines changed

Some content is hidden

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

264 files changed

+3575
-2256
lines changed

.editorconfig

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Coding Conventions style guide
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 4
7+
tab_width = 4
8+
continuation_indent_size = 4
9+
insert_final_newline = true
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
max_line_length = 120
13+
end_of_line = lf
14+
15+
[*.{kt,kts}]
16+
indent_size = 4
17+
continuation_indent_size = 4
18+
insert_final_newline = true
19+
max_line_length = 120
20+
21+
[*.java]
22+
indent_size = 4
23+
continuation_indent_size = 4
24+
max_line_length = 120
25+
26+
[*.gradle]
27+
indent_size = 4
28+
29+
[*.xml]
30+
indent_size = 4
31+
32+
[*.md]
33+
indent_size = 2
34+
trim_trailing_whitespace = false
35+
insert_final_newline = true
36+
charset = utf-8
37+
38+
[*.properties]
39+
charset = utf-8
40+
end_of_line = lf
41+
insert_final_newline = true
42+
trim_trailing_whitespace = true
43+
44+
[*.json]
45+
indent_size = 2
46+
insert_final_newline = true
47+
charset = utf-8
48+
49+
[*.{yml,yaml}]
50+
indent_size = 2
51+
insert_final_newline = true
52+
charset = utf-8

.github/workflows/android_ci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,22 @@ jobs:
77
steps:
88
- name: checkout repository
99
uses: actions/checkout@v4
10+
- name: Cache Gradle packages
11+
uses: actions/cache@v4
12+
with:
13+
path: |
14+
~/.gradle/caches
15+
~/.gradle/wrapper
16+
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
17+
restore-keys: |
18+
gradle-${{ runner.os }}-
1019
- name: set up JDK 21
1120
uses: actions/setup-java@v4
1221
with:
1322
distribution: 'zulu'
1423
java-version: '21'
24+
- name: ktlint check
25+
run: bash ./gradlew ktlintCheck --stacktrace
1526
- name: lint
1627
run: bash ./gradlew lintDebug --stacktrace
1728
- name: unit tests

README.md

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This is the official repository of WiFiAnalyzer.
3030
* Analyze Wi-Fi networks to rate channels
3131
* HT/VHT Detection - 40/80/160/320 MHz (Requires hardware/software support)
3232
* 2.4 GHz, 5 GHz and 6 GHz Wi-Fi bands (Requires hardware/software support)
33-
* Access Point view complete or compact
33+
* Access Point view: complete or compact
3434
* Estimated Distance to the Access Points
3535
* Export access points details
3636
* Dark, Light and System theme available
@@ -59,7 +59,7 @@ The complete guide to using WiFiAnalyzer can be found in the [User Manual](USER_
5959
* [Android Wi-Fi scanning throttling](https://github.com/VREMSoftwareDevelopment/WiFiAnalyzer/wiki/Android-WiFi-scanning-throttling)
6060
* [Location Service Permission Requirements](https://github.com/VREMSoftwareDevelopment/WiFiAnalyzer/wiki/Location-Service-Permission-Requirements)
6161
* [WiFiAnalyzer on secondary user accounts](https://github.com/VREMSoftwareDevelopment/WiFiAnalyzer/wiki/WiFi-Analyzer-on-secondary-user-accounts)
62-
* [How channel graph displays 20/40/80/160/320 MHz channel width?](https://github.com/VREMSoftwareDevelopment/WiFiAnalyzer/issues/64)
62+
* [How does the channel graph display...](https://github.com/VREMSoftwareDevelopment/WiFiAnalyzer/issues/64)
6363
* [How to use SSID filter?](https://github.com/VREMSoftwareDevelopment/WiFiAnalyzer/issues/125)
6464
* [WiFiAnalyzer equivalent on iOS](https://github.com/VREMSoftwareDevelopment/WiFiAnalyzer/issues/69)
6565

@@ -68,7 +68,6 @@ The complete guide to using WiFiAnalyzer can be found in the [User Manual](USER_
6868
* Bug reports can be submitted [here](https://github.com/VREMSoftwareDevelopment/WiFiAnalyzer/issues).
6969
* To learn how to submit a bug [click here](https://github.com/VREMSoftwareDevelopment/WiFiAnalyzer/wiki/Feedback).
7070
* [Discussions](https://github.com/VREMSoftwareDevelopment/WiFiAnalyzer/discussions)
71-
* If you do not have GitHub account, please use [google groups](https://groups.google.com/forum/#!forum/wifi-analyzer-open-source) to discuss application features.
7271

7372
## License
7473

@@ -90,9 +89,9 @@ WiFiAnalyzer is licensed under the GNU General Public License v3.0 (GPLv3).
9089
## Privacy policy
9190

9291
* WiFiAnalyzer does not collect any personal/device information.
93-
* WiFiAnalyzer is designed to use as few permissions as possible. It asks for just enough to perform the analysis.
94-
* Plus, it is all open source so nothing is hidden!
95-
* Most notably, this application does not require access to internet, so you can be sure it does not send any personal/device information to any other source and it does not receive any information from other sources.
92+
* WiFiAnalyzer is designed to use as few permissions as possible. It asks for just enough to perform the analysis.
93+
* Plus, it is all open source so nothing is hidden!
94+
* Most notably, this application does not require access to the internet, so you can be sure it does not send any personal/device information to any other source and it does not receive any information from other sources.
9695

9796
## WiFiAnalyzer Build
9897

@@ -116,28 +115,53 @@ WiFiAnalyzer is licensed under the GNU General Public License v3.0 (GPLv3).
116115
## Contribute
117116

118117
* Want to contribute? Check out our [CONTRIBUTING.md](CONTRIBUTING.md) to see how you can help.
119-
* We want to express our gratitude to all [people](https://github.com/VREMSoftwareDevelopment/WiFiAnalyzer/graphs/contributors) for their contributions, such as: patches, bug solving, updates and etc.
120-
* If you would like to contribute financially to the project please feel free to send any amount through paypal.
118+
* We want to express our gratitude to all [contributors](https://github.com/VREMSoftwareDevelopment/WiFiAnalyzer/graphs/contributors) for their contributions, such as patches, bug fixes, updates, and more.
119+
* If you would like to contribute financially to the project, please feel free to send any amount through PayPal.
121120
* [![](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=62PA6HJ3BZL3E)
122-
* Thanks to every one who already donated so far!
121+
* Thanks to everyone who has already donated!
123122

124-
### Build project
123+
## Build project
125124

126125
1. Install Android Studio
127-
2. Import project into Android Studio
128-
* In Welcome to Android Studio Screen select Import project ...
126+
2. Import the project into Android Studio
127+
* In the Welcome to Android Studio screen, select "Import project ..."
129128
* Select the root directory of the WiFiAnalyzer repository and click "OK".
130129
* WiFiAnalyzer will build automatically.
131130

132-
### Running lint, unit tests and jacoco coverage report
131+
## Running various Gradle commands
133132

134-
```
135-
./gradlew lintDebug jacocoTestCoverageVerification
136-
```
133+
### Check Kotlin code style
134+
`./gradlew ktlintCheck`
137135

138-
- lint report: `app/build/reports/lint-results.html`
139-
- unit test report: `app/build/reports/tests/testDebugUnitTest/index.html`
140-
- code coverage report: `app/build/reports/jacoco/jacocoTestReport/html/index.html`
136+
### Apply Kotlin code style
137+
`./gradlew ktlintFormat`
138+
139+
### Run lint analysis
140+
`./gradlew lintDebug`
141+
142+
This command generates the following report:
143+
- Lint report: `app/build/reports/lint-results.html`
144+
145+
### Run unit tests with coverage
146+
`./gradlew testDebugUnitTest`
147+
148+
This command generates the following report:
149+
- Unit test report: `app/build/reports/tests/testDebugUnitTest/index.html`
150+
151+
### Run unit tests with coverage
152+
`./gradlew jacocoTestCoverageVerification`
153+
154+
This command generates the following report:
155+
- Code coverage report: `app/build/reports/jacoco/jacocoTestReport/html/index.html`
156+
157+
## Continuous Integration
158+
159+
This project uses GitHub Actions for CI/CD. On every push and pull request, the following checks are performed automatically:
160+
- Code style check with ktlint
161+
- Lint analysis
162+
- Unit tests with coverage (uploaded to Codecov)
163+
- APK build (debug)
164+
- Artifacts (reports and APK) are available for download in the workflow run
141165

142166
## Translation
143167

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ plugins {
2121
id "kotlin-android"
2222
id "kotlin-allopen"
2323
id "jacoco"
24+
id "org.jlleitschuh.gradle.ktlint" version "13.0.0"
2425
}
2526

2627
apply {

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 Jul 26 09:17:15 EDT 2025
3-
version_build=23
2+
#Mon Jul 28 09:54:51 EDT 2025
3+
version_build=24
44
version_major=3
55
version_minor=2
66
version_patch=1

app/src/androidTest/kotlin/com/vrem/wifianalyzer/InstrumentedTestUtils.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ import org.hamcrest.TypeSafeMatcher
2929
private const val SLEEP_1_SECOND = 1000
3030
private const val SLEEP_3_SECONDS = 3000
3131

32-
internal class ChildAtPosition(val parentMatcher: Matcher<View>, val position: Int) : TypeSafeMatcher<View>() {
32+
internal class ChildAtPosition(
33+
val parentMatcher: Matcher<View>,
34+
val position: Int,
35+
) : TypeSafeMatcher<View>() {
3336
override fun describeTo(description: Description) {
3437
description.appendText("Child at position $position in parent ")
3538
parentMatcher.describeTo(description)
@@ -41,22 +44,19 @@ internal class ChildAtPosition(val parentMatcher: Matcher<View>, val position: I
4144
}
4245
}
4346

44-
internal fun withToolbarTitle(expectedTitle: CharSequence): Matcher<View> {
45-
return object : BoundedMatcher<View, Toolbar>(Toolbar::class.java) {
47+
internal fun withToolbarTitle(expectedTitle: CharSequence): Matcher<View> =
48+
object : BoundedMatcher<View, Toolbar>(Toolbar::class.java) {
4649
override fun describeTo(description: Description) {
4750
description.appendText("with toolbar title: $expectedTitle")
4851
}
4952

50-
override fun matchesSafely(toolbar: Toolbar): Boolean =
51-
toolbar.title == expectedTitle
53+
override fun matchesSafely(toolbar: Toolbar): Boolean = toolbar.title == expectedTitle
5254
}
53-
}
5455

5556
internal fun pressBackButton() = pressBack()
5657

5758
internal fun pauseShort() = pause(SLEEP_1_SECOND)
5859

5960
internal fun pauseLong() = pause(SLEEP_3_SECONDS)
6061

61-
private fun pause(sleepTime: Int) =
62-
runCatching { Thread.sleep(sleepTime.toLong()) }.getOrElse{ it.printStackTrace() }
62+
private fun pause(sleepTime: Int) = runCatching { Thread.sleep(sleepTime.toLong()) }.getOrElse { it.printStackTrace() }

app/src/androidTest/kotlin/com/vrem/wifianalyzer/MainInstrumentedTest.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ import org.junit.runner.RunWith
2929
@LargeTest
3030
@RunWith(AndroidJUnit4::class)
3131
class MainInstrumentedTest {
32-
3332
@get:Rule
3433
val activityTestRule: ActivityScenarioRule<MainActivity> = activityScenarioRule()
3534

3635
@get:Rule
37-
val grantPermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
38-
android.Manifest.permission.ACCESS_COARSE_LOCATION,
39-
android.Manifest.permission.ACCESS_FINE_LOCATION,
40-
android.Manifest.permission.ACCESS_WIFI_STATE,
41-
android.Manifest.permission.CHANGE_WIFI_STATE
42-
)
36+
val grantPermissionRule: GrantPermissionRule =
37+
GrantPermissionRule.grant(
38+
android.Manifest.permission.ACCESS_COARSE_LOCATION,
39+
android.Manifest.permission.ACCESS_FINE_LOCATION,
40+
android.Manifest.permission.ACCESS_WIFI_STATE,
41+
android.Manifest.permission.CHANGE_WIFI_STATE,
42+
)
4343

4444
@Test
4545
fun navigation() {
@@ -55,4 +55,4 @@ class MainInstrumentedTest {
5555
fun filter() {
5656
FilterInstrumentedTest().run()
5757
}
58-
}
58+
}

app/src/androidTest/kotlin/com/vrem/wifianalyzer/NavigationInstrumentedTest.kt

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ import androidx.appcompat.widget.Toolbar
2121
import androidx.test.espresso.Espresso.onView
2222
import androidx.test.espresso.action.ViewActions.click
2323
import androidx.test.espresso.assertion.ViewAssertions.matches
24-
import androidx.test.espresso.matcher.ViewMatchers.*
24+
import androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom
25+
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
26+
import androidx.test.espresso.matcher.ViewMatchers.withClassName
27+
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
28+
import androidx.test.espresso.matcher.ViewMatchers.withId
2529
import org.hamcrest.Matchers
2630
import org.hamcrest.Matchers.allOf
2731

@@ -30,28 +34,30 @@ private const val NAVIGATION_DRAWER_ACTION = 1
3034
private const val NAVIGATION_DRAWER_TAG = "Open navigation drawer"
3135

3236
internal class NavigationInstrumentedTest : Runnable {
33-
3437
override fun run() {
3538
listOf(
3639
2 to "Channel Rating",
3740
3 to "Channel Graph",
3841
4 to "Time Graph",
3942
1 to "Access Points",
4043
7 to "Available Channels",
41-
8 to "Vendors"
44+
8 to "Vendors",
4245
).forEach { (id, title) ->
4346
selectMenuItem(id, title)
4447
}
4548
listOf(
4649
10 to "Settings",
47-
11 to "About"
50+
11 to "About",
4851
).forEach { (id, title) ->
4952
selectMenuItem(id, title)
5053
pressBackButton()
5154
}
5255
}
5356

54-
private fun selectMenuItem(menuItem: Int, expectedTitle: String) {
57+
private fun selectMenuItem(
58+
menuItem: Int,
59+
expectedTitle: String,
60+
) {
5561
onView(
5662
allOf(
5763
withContentDescription(NAVIGATION_DRAWER_TAG),
@@ -60,28 +66,28 @@ internal class NavigationInstrumentedTest : Runnable {
6066
withId(R.id.toolbar),
6167
ChildAtPosition(
6268
withClassName(Matchers.`is`("com.google.android.material.appbar.AppBarLayout")),
63-
NAVIGATION_DRAWER_BUTTON
64-
)
69+
NAVIGATION_DRAWER_BUTTON,
70+
),
6571
),
66-
NAVIGATION_DRAWER_ACTION
72+
NAVIGATION_DRAWER_ACTION,
6773
),
68-
isDisplayed()
69-
)
74+
isDisplayed(),
75+
),
7076
).check(matches(isDisplayed())).perform(click())
7177

7278
onView(
7379
allOf(
7480
ChildAtPosition(
7581
allOf(
7682
withId(com.google.android.material.R.id.design_navigation_view),
77-
ChildAtPosition(withId(R.id.nav_drawer), NAVIGATION_DRAWER_BUTTON)
78-
), menuItem
83+
ChildAtPosition(withId(R.id.nav_drawer), NAVIGATION_DRAWER_BUTTON),
84+
),
85+
menuItem,
7986
),
80-
isDisplayed()
81-
)
87+
isDisplayed(),
88+
),
8289
).check(matches(isDisplayed())).perform(click())
8390

8491
onView(isAssignableFrom(Toolbar::class.java)).check(matches(withToolbarTitle(expectedTitle)))
8592
}
86-
87-
}
93+
}

app/src/androidTest/kotlin/com/vrem/wifianalyzer/ScannerInstrumentedTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ package com.vrem.wifianalyzer
1919

2020
import androidx.test.espresso.Espresso.onView
2121
import androidx.test.espresso.action.ViewActions.click
22-
import androidx.test.espresso.matcher.ViewMatchers.*
22+
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
23+
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
24+
import androidx.test.espresso.matcher.ViewMatchers.withId
2325
import com.vrem.wifianalyzer.R.id.action_scanner
2426
import org.hamcrest.Matchers.allOf
2527

2628
private const val PAUSE = "Pause"
2729
private const val PLAY = "Play"
2830

2931
internal class ScannerInstrumentedTest : Runnable {
30-
3132
override fun run() {
3233
onView(allOf(withId(action_scanner), withContentDescription(PAUSE), isDisplayed())).perform(click())
3334
onView(allOf(withId(action_scanner), withContentDescription(PLAY), isDisplayed())).perform(click())
3435
}
35-
36-
}
36+
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ fun Context.packageInfo(): PackageInfo =
4545
private fun Context.packageInfoAndroidT(): PackageInfo =
4646
packageManager.getPackageInfo(packageName, PackageInfoFlags.of(0))
4747

48-
private fun Context.packageInfoLegacy(): PackageInfo =
49-
packageManager.getPackageInfo(packageName, 0)
48+
private fun Context.packageInfoLegacy(): PackageInfo = packageManager.getPackageInfo(packageName, 0)
5049

5150
fun ScanResult.ssid(): String =
5251
if (buildMinVersionT()) {

0 commit comments

Comments
 (0)