-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDF 화면 구성 및 PDF 렌더링 #27
Changes from all commits
bdff90f
e95c491
cf10836
0785726
2d70b89
4b66946
58596a1
c4aa77c
e65341e
809743a
0de159f
21a6a33
308e067
830538f
b7e491a
1a1ed20
641f6de
6020dd8
3bd4b0d
91e5fa5
003c38d
a7f951d
39ab182
ea25198
514b612
1b8822a
04c1ab7
6345800
9a39999
7afa071
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ | |
.externalNativeBuild | ||
.cxx | ||
local.properties | ||
/.idea |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package kr.co.database | ||
|
||
import androidx.room.Database | ||
import androidx.room.RoomDatabase | ||
import kr.co.database.dao.RecentFileDao | ||
import kr.co.database.model.RecentFile | ||
|
||
@Database( | ||
entities = [ | ||
RecentFile::class | ||
], | ||
version = 1, | ||
exportSchema = true | ||
) | ||
|
||
abstract class SeeDocsDatabase : RoomDatabase() { | ||
|
||
abstract fun recentFileDao(): RecentFileDao | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 현재의 PR에서 SeeDocsDatabase가 사용되는 곳은 없는데, 이 PR에 포함된 이유가 있을까요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 잘못 포함된 커밋입니다,, revert해서 도려낼까요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 가급적 PR에 포함되지 않아야할 내용은 포함되지 않도록 하는것이 좋습니다. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package kr.co.database.converter | ||
|
||
import androidx.room.ProvidedTypeConverter | ||
import androidx.room.TypeConverter | ||
|
||
@ProvidedTypeConverter | ||
internal class EnumConverter { | ||
|
||
@TypeConverter | ||
fun <T: Enum<T>> fromEnum(value: T): String = | ||
value.name | ||
|
||
@TypeConverter | ||
fun <T: Enum<T>> toEnum(value: String, enumClass: Class<T>): T? = | ||
enumClass.enumConstants?.firstOrNull { it.name == value } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package kr.co.database.converter | ||
|
||
import androidx.room.ProvidedTypeConverter | ||
import androidx.room.TypeConverter | ||
import java.time.LocalDateTime | ||
|
||
@ProvidedTypeConverter | ||
internal class LocalDateTimeConverter { | ||
|
||
@TypeConverter | ||
fun fromString(value: String): LocalDateTime = | ||
LocalDateTime.parse(value) | ||
|
||
@TypeConverter | ||
fun toString(value: LocalDateTime): String = | ||
value.toString() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package kr.co.database.dao | ||
|
||
import androidx.room.Dao | ||
import androidx.room.Delete | ||
import androidx.room.Insert | ||
import androidx.room.OnConflictStrategy | ||
import androidx.room.Query | ||
import kotlinx.coroutines.flow.Flow | ||
import kr.co.database.model.RecentFile | ||
|
||
@Dao | ||
interface RecentFileDao { | ||
|
||
@Insert(onConflict = OnConflictStrategy.REPLACE) | ||
suspend fun insert(recentFile: RecentFile) | ||
|
||
@Query("SELECT * FROM recent_file ORDER BY updatedAt DESC LIMIT 10") | ||
fun get(): Flow<List<RecentFile>> | ||
|
||
@Delete | ||
suspend fun delete(recentFile: RecentFile) | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package kr.co.database.model | ||
|
||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
import kr.co.model.FileInfo.Type | ||
import java.time.LocalDateTime | ||
|
||
@Entity(tableName = "recent_file") | ||
data class RecentFile( | ||
val name: String, | ||
@PrimaryKey val path: String, | ||
val type: Type, | ||
val size: Long, | ||
val updatedAt: LocalDateTime = LocalDateTime.now(), | ||
) |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package kr.co.model | ||
|
||
data class FileInfo( | ||
val name: String, | ||
val path: String, | ||
val type: Type, | ||
val isDirectory: Boolean, | ||
val isHidden: Boolean, | ||
val size: Long, | ||
) { | ||
enum class Type { | ||
PDF, | ||
IMAGE, | ||
FOLDER | ||
; | ||
|
||
companion object { | ||
fun from(extension: String): Type = | ||
when(extension) { | ||
"pdf" -> PDF | ||
"jpg", "jpeg", "png", "gif" -> IMAGE | ||
else -> IMAGE | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이외의 확장자를 IMAGE로 했을 때 문제가 되는 부분은 없을까요? |
||
} | ||
} | ||
} | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package kr.co.ui.util | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.rememberCoroutineScope | ||
import androidx.compose.runtime.setValue | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Job | ||
import kotlinx.coroutines.MainCoroutineDispatcher | ||
import kotlinx.coroutines.delay | ||
import kotlinx.coroutines.launch | ||
import kotlin.coroutines.ContinuationInterceptor | ||
|
||
class TopBarState private constructor( | ||
private val scope: CoroutineScope | ||
) { | ||
var topBarVisible by mutableStateOf(false) | ||
private set | ||
|
||
private var currentJob: Job? = null | ||
|
||
fun show() { | ||
currentJob?.cancel() | ||
|
||
currentJob = scope.launch { | ||
topBarVisible = true | ||
delay(3000) | ||
topBarVisible = false | ||
} | ||
} | ||
|
||
companion object { | ||
fun create(scope: CoroutineScope): TopBarState { | ||
require(scope.coroutineContext[ContinuationInterceptor] is MainCoroutineDispatcher) { | ||
"TopBar state should be created in main thread" | ||
} | ||
return TopBarState(scope) | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun rememberTopBarState( | ||
scope: CoroutineScope = rememberCoroutineScope() | ||
) : TopBarState = | ||
remember { TopBarState.create(scope) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 리팩토링은 이 브랜치에 어울리지 않는 커밋인 것 같습니다.