library UI + reader mode
This commit is contained in:
commit
8f8b466e89
81 files changed
+7502
No files matched your search
@@ -0,0 +1,44 @@
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="450dp"
|
||||
android:height="450dp"
|
||||
android:viewportWidth="64"
|
||||
android:viewportHeight="64">
|
||||
<path
|
||||
android:pathData="M56.25,18V46L32,60 7.75,46V18L32,4Z"
|
||||
android:fillColor="#6075f2"/>
|
||||
<path
|
||||
android:pathData="m41.5,26.5v11L32,43V60L56.25,46V18Z"
|
||||
android:fillColor="#6b57ff"/>
|
||||
<path
|
||||
android:pathData="m32,43 l-9.5,-5.5v-11L7.75,18V46L32,60Z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:centerX="23.131"
|
||||
android:centerY="18.441"
|
||||
android:gradientRadius="42.132"
|
||||
android:type="radial">
|
||||
<item android:offset="0" android:color="#FF5383EC"/>
|
||||
<item android:offset="0.867" android:color="#FF7F52FF"/>
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:pathData="M22.5,26.5 L32,21 41.5,26.5 56.25,18 32,4 7.75,18Z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:startX="44.172"
|
||||
android:startY="4.377"
|
||||
android:endX="17.973"
|
||||
android:endY="34.035"
|
||||
android:type="linear">
|
||||
<item android:offset="0" android:color="#FF33C3FF"/>
|
||||
<item android:offset="0.878" android:color="#FF5383EC"/>
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:pathData="m32,21 l9.526,5.5v11L32,43 22.474,37.5v-11z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,109 @@
|
||||
package net.sergeych.toread
|
||||
|
||||
import net.sergeych.toread.fb2.Fb2Binary
|
||||
import net.sergeych.toread.fb2.Fb2Book
|
||||
|
||||
data class LibraryItem(
|
||||
val fileId: String,
|
||||
val bookId: String?,
|
||||
val title: String,
|
||||
val authors: List<String> = emptyList(),
|
||||
val language: String? = null,
|
||||
val date: String? = null,
|
||||
val format: String?,
|
||||
val sizeBytes: Long?,
|
||||
val storageUri: String?,
|
||||
val lastSeenAt: Long?,
|
||||
val coverImage: ByteArray? = null,
|
||||
val coverImageMimeType: String? = null,
|
||||
)
|
||||
|
||||
data class LibraryScanReport(
|
||||
val scannedFiles: Int,
|
||||
val importedFiles: Int,
|
||||
val skippedFiles: Int,
|
||||
val failedFiles: Int,
|
||||
)
|
||||
|
||||
data class LibraryScanProgress(
|
||||
val scannedFiles: Int,
|
||||
val importedFiles: Int,
|
||||
val skippedFiles: Int,
|
||||
val failedFiles: Int,
|
||||
val currentFile: String? = null,
|
||||
)
|
||||
|
||||
data class PlatformOpenBookRequest(
|
||||
val id: String,
|
||||
val displayName: String,
|
||||
val bytes: ByteArray,
|
||||
)
|
||||
|
||||
data class ReadingPosition(
|
||||
val itemIndex: Int,
|
||||
val scrollOffset: Int,
|
||||
)
|
||||
|
||||
data class BookInfoExtras(
|
||||
val bookmarks: List<BookmarkInfo> = emptyList(),
|
||||
val notes: List<NoteInfo> = emptyList(),
|
||||
val lastReadingPosition: ReadingPosition? = null,
|
||||
)
|
||||
|
||||
data class BookmarkInfo(
|
||||
val title: String?,
|
||||
val selectedText: String?,
|
||||
val progress: Double?,
|
||||
val updatedAt: Long,
|
||||
)
|
||||
|
||||
data class NoteInfo(
|
||||
val text: String,
|
||||
val progress: Double?,
|
||||
val updatedAt: Long,
|
||||
)
|
||||
|
||||
enum class ThemeMode {
|
||||
LIGHT,
|
||||
DARK,
|
||||
SYSTEM,
|
||||
}
|
||||
|
||||
expect fun defaultLibraryScanPath(): String?
|
||||
|
||||
expect suspend fun loadPlatformOpenBookRequest(): PlatformOpenBookRequest?
|
||||
|
||||
expect suspend fun chooseLibraryScanDirectory(): String?
|
||||
|
||||
expect suspend fun loadLibraryItems(): List<LibraryItem>
|
||||
|
||||
expect suspend fun scanLibrarySubtree(path: String, onProgress: (LibraryScanProgress) -> Unit): LibraryScanReport
|
||||
|
||||
expect suspend fun openLibraryBook(fileId: String): ByteArray?
|
||||
|
||||
expect suspend fun deleteLibraryItem(fileId: String): Boolean
|
||||
|
||||
expect suspend fun loadLibraryReadingPosition(fileId: String): ReadingPosition?
|
||||
|
||||
expect suspend fun saveLibraryReadingPosition(fileId: String, position: ReadingPosition)
|
||||
|
||||
expect suspend fun loadBookInfoExtras(fileId: String): BookInfoExtras
|
||||
|
||||
expect suspend fun loadActiveReadingFileId(): String?
|
||||
|
||||
expect suspend fun saveActiveReadingFileId(fileId: String?)
|
||||
|
||||
expect suspend fun loadThemeMode(): ThemeMode
|
||||
|
||||
expect suspend fun saveThemeMode(mode: ThemeMode)
|
||||
|
||||
expect fun isPlatformDarkTheme(): Boolean
|
||||
|
||||
expect fun watchPlatformDarkTheme(onChange: (Boolean) -> Unit): () -> Unit
|
||||
|
||||
expect fun libraryLogPath(): String?
|
||||
|
||||
internal fun Fb2Book.libraryCoverBinary(): Fb2Binary? {
|
||||
val image = coverImages.firstOrNull() ?: bodyImages.firstOrNull()
|
||||
return image?.let(::binaryFor)
|
||||
}
|
||||
Reference in new issue
Block a user