Skip to content

Commit

Permalink
Athena: Enum.values() -> Enum.entries
Browse files Browse the repository at this point in the history
Change-Id: I97311fd6efc8fc88daf467a8e37f77faf0bf9c8c
  • Loading branch information
SebaUbuntu committed Feb 20, 2025
1 parent 018edea commit dda0387
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/dev/sebaubuntu/athena/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class MainActivity : AppCompatActivity() {
.setMessage(R.string.export_data_description)
.setPositiveButton(R.string.yes) { _, _ ->
requestPermissionsContract.launch(
SectionEnum.values().map {
SectionEnum.entries.map {
it.clazz.requiredPermissions.toList()
}.flatten().toTypedArray()
)
Expand All @@ -123,7 +123,7 @@ class MainActivity : AppCompatActivity() {
withContext(Dispatchers.IO) {
contentResolver.openFileDescriptor(uri, "wt")?.use { parcelFileDescriptor ->
FileWriter(parcelFileDescriptor.fileDescriptor).use { fileWriter ->
val sections = SectionEnum.values().map { it.clazz }
val sections = SectionEnum.entries.map { it.clazz }

withContext(Dispatchers.Main) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class MainFragment : RecyclerViewFragment() {
)
}

sectionsAdapter.submitList(SectionEnum.values().toList())
sectionsAdapter.submitList(SectionEnum.entries)
}

companion object {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/dev/sebaubuntu/athena/models/cpu/Midr.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ data class Midr(
SAMSUNG(0x53U);

companion object {
fun fromValue(value: UByte) = values().firstOrNull { it.value == value } ?: UNKNOWN
fun fromValue(value: UByte) = entries.firstOrNull { it.value == value } ?: UNKNOWN
}
}

Expand All @@ -52,7 +52,7 @@ data class Midr(
DEFINED_BY_CPUID(0xFU);

companion object {
fun fromValue(value: UByte) = values().first { it.value == value }
fun fromValue(value: UByte) = entries.first { it.value == value }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ enum class Uarch(
companion object {
@JvmStatic
fun fromCpuInfo(value: Int) = value.toUInt().let {
values().firstOrNull { uarch -> uarch.value == it } ?: UNKNOWN
entries.firstOrNull { uarch -> uarch.value == it } ?: UNKNOWN
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ enum class Vendor(
companion object {
@JvmStatic
fun fromCpuInfo(value: Int) = value.toUInt().let {
values().firstOrNull { vendor -> vendor.value == it } ?: UNKNOWN
entries.firstOrNull { vendor -> vendor.value == it } ?: UNKNOWN
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ enum class HidlTransportType(private val lshalValue: String) {
HWBINDER("hwbinder");

companion object {
fun fromLshalValue(value: String) = values().firstOrNull {
fun fromLshalValue(value: String) = entries.firstOrNull {
it.lshalValue == value
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ object SecuritySection : Section(
);

companion object {
val errorToStringResId = values().associateWith {
val errorToStringResId = entries.associateWith {
it.stringResId
}
}
Expand Down Expand Up @@ -139,7 +139,7 @@ object SecuritySection : Section(
),
R.string.security_general,
),
*Component.values().map {
*Component.entries.map {
securityPatchState.getComponentSubsection(it)
}.toTypedArray(),
)
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/dev/sebaubuntu/athena/utils/BytesUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object BytesUtils {
EiB(PiB.unitBase shl 10);

companion object {
fun unitsInDescending() = values().toList().asReversed()
fun unitsInDescending() = entries.asReversed()
}
}

Expand All @@ -36,7 +36,7 @@ object BytesUtils {
EB(PB.unitBase * 1000);

companion object {
fun unitsInDescending() = values().toList().asReversed()
fun unitsInDescending() = entries.asReversed()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object FrequencyUtils {
EHz(PHz.unitBase * 1000);

companion object {
fun unitsInDescending() = values().toList().asReversed()
fun unitsInDescending() = entries.asReversed()
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/dev/sebaubuntu/athena/utils/VkUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ object VkUtils {
MOBILEYE(0x10007U);

companion object {
fun fromValue(value: ULong) = VkVendorId.values().firstOrNull {
fun fromValue(value: ULong) = entries.firstOrNull {
it.value == value
}
}
Expand Down

0 comments on commit dda0387

Please sign in to comment.