Skip to content

Commit b1df07a

Browse files
committed
Use version code constants to make code more readable
1 parent eca0e03 commit b1df07a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/src/main/java/tk/superl2/xwifi/MainActivity.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class MainActivity : Activity() {
5959
}
6060
wifi_ListView.setOnItemLongClickListener { _, _, position, _ ->
6161
val builder = AlertDialog.Builder(this)
62-
builder.setMessage(if (Build.VERSION.SDK_INT >= 24) {
62+
builder.setMessage(if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
6363
Html.fromHtml(
6464
"<b>SSID</b>: ${wifiEntries[position].title}<br>" +
6565
(if (wifiEntries[position].getPassword(true) != "") "<b>Password</b>: ${wifiEntries[position].getPassword(true)}<br>" else { "" }) +
@@ -125,7 +125,7 @@ class MainActivity : Activity() {
125125
if (::wifiEntries.isInitialized) wifiEntries.clear()
126126
wifiEntrySSIDs.clear()
127127
try {
128-
wifiEntries = if (Build.VERSION.SDK_INT >= 26) readOreoFile() else readNonOreoFile()
128+
wifiEntries = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) readOreoFile() else readNonOreoFile()
129129
wifiEntries.mapTo(wifiEntrySSIDs) { it.title }
130130
Log.v(TAG, "Wifi entries loaded.")
131131
} catch (e: WifiUnparseableException) {
@@ -144,7 +144,7 @@ class MainActivity : Activity() {
144144
runOnUiThread {
145145
dialog.dismiss()
146146
}
147-
if (Build.VERSION.SDK_INT >= 21) {
147+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
148148
finishAndRemoveTask()
149149
} else {
150150
finish()

0 commit comments

Comments
 (0)