parent
ed8d88ffd9
commit
4c53700bb1
@ -1,19 +0,0 @@ |
||||
package io.legado.app.data.entities |
||||
|
||||
import com.android.tools.r8.Keep |
||||
|
||||
@Keep |
||||
data class RemoteBook( |
||||
val filename: String, |
||||
val path: String, |
||||
val size: Long, |
||||
val contentType: String, |
||||
val lastModify: Long, |
||||
var isOnBookShelf: Boolean = false |
||||
) { |
||||
|
||||
val isDir by lazy { |
||||
contentType == "folder" |
||||
} |
||||
|
||||
} |
@ -0,0 +1,31 @@ |
||||
package io.legado.app.model.remote |
||||
|
||||
import com.android.tools.r8.Keep |
||||
import io.legado.app.lib.webdav.WebDavFile |
||||
import io.legado.app.model.localBook.LocalBook |
||||
|
||||
@Keep |
||||
data class RemoteBook( |
||||
val filename: String, |
||||
val path: String, |
||||
val size: Long, |
||||
val lastModify: Long, |
||||
var contentType: String = "folder", |
||||
var isOnBookShelf: Boolean = false |
||||
) { |
||||
|
||||
val isDir get() = contentType == "folder" |
||||
|
||||
constructor(webDavFile: WebDavFile) : this( |
||||
webDavFile.displayName, |
||||
webDavFile.path, |
||||
webDavFile.size, |
||||
webDavFile.lastModify |
||||
) { |
||||
if (!webDavFile.isDir) { |
||||
contentType = webDavFile.displayName.substringAfterLast(".") |
||||
isOnBookShelf = LocalBook.isOnBookShelf(webDavFile.displayName) |
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue