-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Allow creating instance with custom .minecraft directory
Feat: Fullscreen mode Feat: Buttons to open some common directories Improvement: Use trailing icon button for choosing jvm path Fix: Play button on home screen getting squished when title or desc too long Feat: List user mods as a category
- Loading branch information
Showing
23 changed files
with
407 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
group=com.mineinabyss | ||
version=2.0.0-alpha.12 | ||
version=2.0.0-alpha.13 | ||
idofrontVersion=0.22.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.mineinabyss.launchy.state | ||
|
||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.setValue | ||
import com.mineinabyss.launchy.data.config.Config | ||
|
||
class UIState(config: Config) { | ||
var preferHue: Float by mutableStateOf(config.preferHue ?: 0f) | ||
var fullscreen: Boolean by mutableStateOf(config.startInFullscreen) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
src/main/kotlin/com/mineinabyss/launchy/ui/elements/SingleFileDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package com.mineinabyss.launchy.ui.elements | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.window.AwtWindow | ||
import com.darkrockstudios.libraries.mpfilepicker.DirectoryPicker | ||
import com.darkrockstudios.libraries.mpfilepicker.FilePicker | ||
import com.mineinabyss.launchy.data.Dirs | ||
import com.mineinabyss.launchy.util.OS | ||
import java.awt.FileDialog | ||
import java.awt.Frame | ||
import java.io.FilenameFilter | ||
import java.nio.file.Path | ||
import kotlin.io.path.Path | ||
import kotlin.io.path.isDirectory | ||
|
||
|
||
@Composable | ||
fun DirectoryDialog( | ||
shown: Boolean, | ||
title: String, | ||
fallbackTitle: String? = null, | ||
parent: Frame? = null, | ||
onCloseRequest: (result: Path?) -> Unit, | ||
) { | ||
when { | ||
OS.get() == OS.WINDOWS || OS.get() == OS.MAC -> DirectoryPicker( | ||
shown, | ||
initialDirectory = Dirs.jdks.toString(), | ||
title = title, | ||
onFileSelected = { dir -> | ||
onCloseRequest(dir?.let { Path(it) }) | ||
}) | ||
|
||
shown -> AwtWindow( | ||
create = { | ||
object : FileDialog(parent, fallbackTitle ?: title, LOAD) { | ||
override fun setVisible(value: Boolean) { | ||
super.setVisible(value) | ||
if (value) { | ||
val path = files.firstOrNull()?.toPath() | ||
if (path?.isDirectory() == true) | ||
onCloseRequest(path) | ||
else onCloseRequest(path?.parent) | ||
} | ||
} | ||
} | ||
}, | ||
dispose = FileDialog::dispose | ||
) | ||
} | ||
} | ||
|
||
@Composable | ||
fun SingleFileDialog( | ||
shown: Boolean, | ||
title: String, | ||
fallbackTitle: String? = null, | ||
parent: Frame? = null, | ||
onCloseRequest: (result: Path?) -> Unit, | ||
fileExtensions: () -> List<String>, | ||
fallbackFilter: FilenameFilter | ||
) { | ||
when { | ||
OS.get() == OS.WINDOWS || OS.get() == OS.MAC -> FilePicker( | ||
shown, | ||
initialDirectory = Dirs.jdks.toString(), | ||
title = title, | ||
fileExtensions = fileExtensions(), | ||
onFileSelected = { file -> | ||
onCloseRequest(file?.let { Path(it.path) }) | ||
}) | ||
|
||
shown -> AwtWindow( | ||
create = { | ||
object : FileDialog(parent, fallbackTitle ?: title, LOAD) { | ||
override fun setVisible(value: Boolean) { | ||
super.setVisible(value) | ||
if (value) { | ||
onCloseRequest(files.firstOrNull()?.toPath()) | ||
} | ||
} | ||
}.apply { | ||
setFilenameFilter(fallbackFilter) | ||
} | ||
}, | ||
dispose = FileDialog::dispose | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.