mirror of
https://github.com/geode-sdk/android-launcher.git
synced 2026-10-21 16:32:39 +00:00
add copy external button
This commit is contained in:
3 files changed
+32
-21
No files matched your search
@@ -58,22 +58,6 @@ fun onSettings(context: Context) {
|
|||||||
context.startActivity(launchIntent)
|
context.startActivity(launchIntent)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onOpenFolder(context: Context) {
|
|
||||||
context.getExternalFilesDir(null)?.let { file ->
|
|
||||||
val clipboardManager =
|
|
||||||
context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
|
||||||
clipboardManager.setPrimaryClip(
|
|
||||||
ClipData.newPlainText(
|
|
||||||
"Launcher External Folder",
|
|
||||||
file.path
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) {
|
|
||||||
Toast.makeText(context, "Copied!", Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun MainScreen(gdInstalled: Boolean = true) {
|
fun MainScreen(gdInstalled: Boolean = true) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package com.geode.geodelauncher
|
package com.geode.geodelauncher
|
||||||
|
|
||||||
|
import android.content.ClipData
|
||||||
|
import android.content.ClipboardManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
@@ -53,6 +56,22 @@ fun onExportSaveData(context: Context) {
|
|||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun onOpenFolder(context: Context) {
|
||||||
|
context.getExternalFilesDir(null)?.let { file ->
|
||||||
|
val clipboardManager =
|
||||||
|
context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
|
clipboardManager.setPrimaryClip(
|
||||||
|
ClipData.newPlainText(
|
||||||
|
"Launcher External Folder",
|
||||||
|
file.path
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) {
|
||||||
|
Toast.makeText(context, "Copied!", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun SettingsScreen(onBackPressedDispatcher: OnBackPressedDispatcher?) {
|
fun SettingsScreen(onBackPressedDispatcher: OnBackPressedDispatcher?) {
|
||||||
@@ -95,11 +114,16 @@ fun SettingsScreen(onBackPressedDispatcher: OnBackPressedDispatcher?) {
|
|||||||
description = context.getString(R.string.preference_load_automatically_description),
|
description = context.getString(R.string.preference_load_automatically_description),
|
||||||
preferenceId = R.string.preference_load_automatically
|
preferenceId = R.string.preference_load_automatically
|
||||||
)
|
)
|
||||||
|
OptionsButton(
|
||||||
|
title = context.getString(R.string.preferences_copy_external_button),
|
||||||
|
onClick = { onOpenFolder(context) }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
OptionsGroup("Data") {
|
OptionsGroup("Data") {
|
||||||
OptionsButton(onClick = { onExportSaveData(context) }) {
|
OptionsButton(
|
||||||
Text("Export save data")
|
title = "Export save data",
|
||||||
}
|
onClick = { onExportSaveData(context) }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,9 +167,11 @@ fun OptionsGroup(title: String, content: @Composable () -> Unit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun OptionsButton(onClick: () -> Unit, content: @Composable () -> Unit) {
|
fun OptionsButton(title: String, onClick: () -> Unit) {
|
||||||
OptionsCard(
|
OptionsCard(
|
||||||
title = content,
|
title = {
|
||||||
|
Text(title)
|
||||||
|
},
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.clickable(onClick = onClick, role = Role.Button)
|
.clickable(onClick = onClick, role = Role.Button)
|
||||||
) { }
|
) { }
|
||||||
|
|||||||
@@ -10,5 +10,6 @@
|
|||||||
<string name="preference_load_automatically">PreferenceLoadAutomatically</string>
|
<string name="preference_load_automatically">PreferenceLoadAutomatically</string>
|
||||||
<string name="preference_load_automatically_name">Automatically launch</string>
|
<string name="preference_load_automatically_name">Automatically launch</string>
|
||||||
<string name="preference_load_automatically_description">Launches the game after a second-long delay.</string>
|
<string name="preference_load_automatically_description">Launches the game after a second-long delay.</string>
|
||||||
|
<string name="preferences_copy_external_button">Copy external files directory</string>
|
||||||
<string name="title_activity_settings">SettingsActivity</string>
|
<string name="title_activity_settings">SettingsActivity</string>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in new issue
Block a user