Skip to content

Commit

Permalink
rework DeviceInfo.kt
Browse files Browse the repository at this point in the history
Reduce duplication to make it easier to maintain.

Fix the following issues:

- possible problem with `EINK` value on `TOLINO_EPOS3` devices
  (since both `TOLINO` and `TOLINO_EPOS3` booleans would be set)
- `EINK` was never set to `EinkDevice.TOLINO_VISION6`,
  but checked in `device/EPDFactory.kt`
- same with `HANVON_960` & `HYREAD_MINI6`
- `LIGHTS` was never set to `LightsDevice.ONYX_NOTE_PRO`,
  but checked in `device/LightsFactory.kt`
- `LIGTS` could be set to `LightsDevice.ONYX_PALMA`,
  but was never checked in `device/LightsFactory.kt`
  • Loading branch information
benoit-pierre committed Nov 4, 2024
1 parent 4af40b5 commit ba80e04
Show file tree
Hide file tree
Showing 5 changed files with 590 additions and 895 deletions.
16 changes: 13 additions & 3 deletions app/src/main/java/org/koreader/launcher/device/Device.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,23 @@ class Device(activity: Activity) {
val einkPlatform = epd.getPlatform()

val properties: String
get() = String.format("%s;%s;%s;%s;%s;%s;%b;%b",
get() = String.format("%s;%s;%s;%s;%s;%s;%s",
DeviceInfo.MANUFACTURER,
DeviceInfo.BRAND,
DeviceInfo.MODEL,
DeviceInfo.DEVICE,
DeviceInfo.PRODUCT,
DeviceInfo.HARDWARE,
DeviceInfo.BOYUE,
DeviceInfo.TOLINO)
when (DeviceInfo.ID) {
DeviceInfo.Id.TOLINO,
DeviceInfo.Id.TOLINO_EPOS2,
DeviceInfo.Id.TOLINO_EPOS3,
DeviceInfo.Id.TOLINO_PAGE2,
DeviceInfo.Id.TOLINO_SHINE3,
DeviceInfo.Id.TOLINO_VISION4,
DeviceInfo.Id.TOLINO_VISION5,
DeviceInfo.Id.TOLINO_VISION6,
-> true else -> false
}
)
}
Loading

0 comments on commit ba80e04

Please sign in to comment.