Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import io.github.wiiznokes.gitnote.ui.model.Cred
import io.github.wiiznokes.gitnote.ui.model.CredType
import io.github.wiiznokes.gitnote.ui.model.GitAuthor
import io.github.wiiznokes.gitnote.ui.model.NoteMinWidth
import io.github.wiiznokes.gitnote.ui.model.NoteViewType
import io.github.wiiznokes.gitnote.ui.model.SortOrder
import io.github.wiiznokes.gitnote.ui.model.StorageConfiguration
import io.github.wiiznokes.gitnote.ui.theme.Theme
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.runBlocking
import kotlin.io.path.pathString

Expand Down Expand Up @@ -140,6 +140,7 @@ class AppPreferences(

val noteMinWidth = enumPreference("noteMinWidth", NoteMinWidth.Default)
val showFullNoteHeight = booleanPreference("showFullNoteHeight", false)
val noteViewType = enumPreference("noteViewType", NoteViewType.Grid)

val rememberLastOpenedFolder = booleanPreference("rememberLastOpenedFolder", false)
val lastOpenedFolder = stringPreference("lastOpenedFolder", "")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.github.wiiznokes.gitnote.data.room

import android.util.Log
import android.webkit.MimeTypeMap
import androidx.paging.PagingSource
import androidx.room.Dao
import androidx.room.Delete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ abstract class RepoDatabase : RoomDatabase() {
abstract val repoDatabaseDao: RepoDatabaseDao

companion object {
fun generateUid() = Random.Default.nextInt()
fun generateUid() = Random.nextInt()

fun buildDatabase(context: Context): RepoDatabase {
val onMigration = object : Callback() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalResources
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.DpOffset
import androidx.compose.ui.unit.dp
import androidx.core.util.TypedValueCompat.pxToDp


private val TAG = "CustomDropDown"
Expand All @@ -41,10 +40,10 @@ fun CustomDropDown(
mutableStateOf(Offset.Zero)
}
) {
val m = LocalResources.current.displayMetrics
val x = pxToDp(clickPosition.value.x, m).dp
val y = pxToDp(clickPosition.value.y, m).dp
val offset = DpOffset(x, y)
val density = LocalDensity.current
val offset = with(density) {
DpOffset(clickPosition.value.x.toDp(), clickPosition.value.y.toDp())
}

MaterialTheme(
shapes = MaterialTheme.shapes.copy(extraSmall = shape)
Expand Down Expand Up @@ -75,4 +74,4 @@ fun CustomDropDown(
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ enum class NoteMinWidth(val size: Int) {
override fun toString(): String = this.size.toString()
}

enum class NoteViewType {
Grid,
List,
}

data class GridNote(
@Embedded
val note: Note,
val isUnique: Boolean,
val selected: Boolean = false,
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ enum class CredType {
@Parcelize
sealed class StorageConfiguration : Parcelable {
data object App : StorageConfiguration()
class Device(var path: String, val useUrlForRootFolder: Boolean = false) : StorageConfiguration()
class Device(var path: String, val useUrlForRootFolder: Boolean = false) :
StorageConfiguration()

fun repoPath(): String {
return when (this) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.github.wiiznokes.gitnote.ui.screen.app.edit

import android.webkit.MimeTypeMap
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -49,7 +48,6 @@ import io.github.wiiznokes.gitnote.manager.extensionType
import io.github.wiiznokes.gitnote.ui.component.SimpleIcon
import io.github.wiiznokes.gitnote.ui.destination.EditParams
import io.github.wiiznokes.gitnote.ui.model.EditType
import io.github.wiiznokes.gitnote.ui.model.FileExtension
import io.github.wiiznokes.gitnote.ui.viewmodel.edit.MarkDownVM
import io.github.wiiznokes.gitnote.ui.viewmodel.edit.TextVM
import io.github.wiiznokes.gitnote.ui.viewmodel.edit.newEditViewModel
Expand Down
Loading