mirror of
https://github.com/geode-sdk/android-launcher.git
synced 2026-10-21 16:32:39 +00:00
show download button if geode not installed
This commit is contained in:
4 files changed
+40
-10
No files matched your search
@@ -323,18 +323,31 @@ fun MainScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (gdInstalled && !geodeInstalled) {
|
} else if (gdInstalled) {
|
||||||
Text(
|
Text(
|
||||||
context.getString(R.string.geode_download_title),
|
context.getString(R.string.geode_download_title),
|
||||||
modifier = Modifier.padding(12.dp)
|
modifier = Modifier.padding(12.dp)
|
||||||
)
|
)
|
||||||
OutlinedButton(onClick = { onSettings(context) }) {
|
|
||||||
|
Row {
|
||||||
|
Button(
|
||||||
|
onClick = { releaseViewModel.runReleaseCheck() },
|
||||||
|
enabled = !releaseViewModel.isInUpdate
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
painterResource(R.drawable.icon_download),
|
||||||
|
contentDescription = context.getString(R.string.launcher_download_icon_alt)
|
||||||
|
)
|
||||||
|
Spacer(Modifier.size(ButtonDefaults.IconSpacing))
|
||||||
|
Text(context.getString(R.string.launcher_download))
|
||||||
|
}
|
||||||
|
Spacer(Modifier.size(2.dp))
|
||||||
|
IconButton(onClick = { onSettings(context) }) {
|
||||||
Icon(
|
Icon(
|
||||||
Icons.Filled.Settings,
|
Icons.Filled.Settings,
|
||||||
contentDescription = context.getString(R.string.launcher_settings_icon_alt)
|
contentDescription = context.getString(R.string.launcher_settings_icon_alt)
|
||||||
)
|
)
|
||||||
Spacer(Modifier.size(ButtonDefaults.IconSpacing))
|
}
|
||||||
Text(context.getString(R.string.launcher_settings))
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Text(
|
Text(
|
||||||
|
|||||||
@@ -106,8 +106,7 @@ class ReleaseManager private constructor(
|
|||||||
_uiState.value = ReleaseManagerState.InDownload(progress, outOf)
|
_uiState.value = ReleaseManagerState.InDownload(progress, outOf)
|
||||||
}
|
}
|
||||||
|
|
||||||
val geodeName = LaunchUtils.getGeodeFilename()
|
val geodeFile = getGeodeOutputPath()
|
||||||
val geodeFile = getGeodeOutputPath(geodeName)
|
|
||||||
|
|
||||||
// work around a permission issue from adb push
|
// work around a permission issue from adb push
|
||||||
if (geodeFile.exists()) {
|
if (geodeFile.exists()) {
|
||||||
@@ -117,7 +116,7 @@ class ReleaseManager private constructor(
|
|||||||
DownloadUtils.extractFileFromZipStream(
|
DownloadUtils.extractFileFromZipStream(
|
||||||
fileStream,
|
fileStream,
|
||||||
geodeFile.outputStream(),
|
geodeFile.outputStream(),
|
||||||
geodeName
|
geodeFile.name
|
||||||
)
|
)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
sendError(e)
|
sendError(e)
|
||||||
@@ -147,8 +146,11 @@ class ReleaseManager private constructor(
|
|||||||
val currentVersion = sharedPreferences.getLong(PreferenceUtils.Key.CURRENT_VERSION_TIMESTAMP)
|
val currentVersion = sharedPreferences.getLong(PreferenceUtils.Key.CURRENT_VERSION_TIMESTAMP)
|
||||||
val latestVersion = release.getDescriptor()
|
val latestVersion = release.getDescriptor()
|
||||||
|
|
||||||
|
// make sure geode is still here. just in case
|
||||||
|
val geodeFile = getGeodeOutputPath()
|
||||||
|
|
||||||
// check if an update is needed
|
// check if an update is needed
|
||||||
if (latestVersion <= currentVersion) {
|
if (latestVersion <= currentVersion && geodeFile.exists()) {
|
||||||
_uiState.value = ReleaseManagerState.Finished()
|
_uiState.value = ReleaseManagerState.Finished()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -172,7 +174,9 @@ class ReleaseManager private constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getGeodeOutputPath(geodeName: String): File {
|
private fun getGeodeOutputPath(): File {
|
||||||
|
val geodeName = LaunchUtils.getGeodeFilename()
|
||||||
|
|
||||||
val fallbackPath = File(applicationContext.filesDir, "launcher")
|
val fallbackPath = File(applicationContext.filesDir, "launcher")
|
||||||
val geodeDirectory = applicationContext.getExternalFilesDir("") ?: fallbackPath
|
val geodeDirectory = applicationContext.getExternalFilesDir("") ?: fallbackPath
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<!-- Using the download icon from Google's Material Icons. -->
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="960"
|
||||||
|
android:viewportHeight="960"
|
||||||
|
android:tint="?attr/colorControlNormal">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M480,640L280,440L336,382L440,486L440,160L520,160L520,486L624,382L680,440L480,640ZM240,800Q207,800 183.5,776.5Q160,753 160,720L160,600L240,600L240,720Q240,720 240,720Q240,720 240,720L720,720Q720,720 720,720Q720,720 720,720L720,600L800,600L800,720Q800,753 776.5,776.5Q753,800 720,800L240,800Z"/>
|
||||||
|
</vector>
|
||||||
@@ -6,11 +6,13 @@
|
|||||||
<string name="game_not_found">Geometry Dash was not found.</string>
|
<string name="game_not_found">Geometry Dash was not found.</string>
|
||||||
<string name="launcher_launch">Launch</string>
|
<string name="launcher_launch">Launch</string>
|
||||||
<string name="launcher_settings">Settings</string>
|
<string name="launcher_settings">Settings</string>
|
||||||
|
<string name="launcher_download">Download</string>
|
||||||
<string name="launcher_title">Geode</string>
|
<string name="launcher_title">Geode</string>
|
||||||
<string name="launcher_logo_alt">geode logo</string>
|
<string name="launcher_logo_alt">geode logo</string>
|
||||||
<string name="launcher_launch_icon_alt">play icon</string>
|
<string name="launcher_launch_icon_alt">play icon</string>
|
||||||
|
<string name="launcher_download_icon_alt">download icon</string>
|
||||||
<string name="launcher_settings_icon_alt">settings icon</string>
|
<string name="launcher_settings_icon_alt">settings icon</string>
|
||||||
<string name="geode_download_title">Geode is not installed</string>
|
<string name="geode_download_title">Geode is not installed.</string>
|
||||||
<string name="geode_download_description">Geode is downloading. Please wait.</string>
|
<string name="geode_download_description">Geode is downloading. Please wait.</string>
|
||||||
<plurals name="automatically_load_countdown">
|
<plurals name="automatically_load_countdown">
|
||||||
<item quantity="one">Automatically launching game in %1$d second.</item>
|
<item quantity="one">Automatically launching game in %1$d second.</item>
|
||||||
|
|||||||
Reference in new issue
Block a user