mirror of
https://github.com/skyline-emu/skyline.git
synced 2025-01-12 08:09:09 +01:00
Make GpuDriverInstallResult
PascalCase
This commit is contained in:
parent
7f1667de82
commit
ee8c055641
app/src/main/java/emu/skyline
@ -59,7 +59,7 @@ class GpuDriverActivity : AppCompatActivity() {
|
||||
val result = GpuDriverHelper.installDriver(this@GpuDriverActivity, fileStream)
|
||||
runOnUiThread {
|
||||
Snackbar.make(binding.root, resolveInstallResultString(result), Snackbar.LENGTH_LONG).show()
|
||||
if (result == GpuDriverInstallResult.SUCCESS)
|
||||
if (result == GpuDriverInstallResult.Success)
|
||||
populateAdapter()
|
||||
}
|
||||
}
|
||||
@ -185,11 +185,11 @@ class GpuDriverActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
private fun resolveInstallResultString(result : GpuDriverInstallResult) = when (result) {
|
||||
GpuDriverInstallResult.SUCCESS -> getString(R.string.gpu_driver_install_success)
|
||||
GpuDriverInstallResult.INVALID_ARCHIVE -> getString(R.string.gpu_driver_install_invalid_archive)
|
||||
GpuDriverInstallResult.MISSING_METADATA -> getString(R.string.gpu_driver_install_missing_metadata)
|
||||
GpuDriverInstallResult.INVALID_METADATA -> getString(R.string.gpu_driver_install_invalid_metadata)
|
||||
GpuDriverInstallResult.UNSUPPORTED_ANDROID_VERSION -> getString(R.string.gpu_driver_install_unsupported_android_version)
|
||||
GpuDriverInstallResult.ALREADY_INSTALLED -> getString(R.string.gpu_driver_install_already_installed)
|
||||
GpuDriverInstallResult.Success -> getString(R.string.gpu_driver_install_success)
|
||||
GpuDriverInstallResult.InvalidArchive -> getString(R.string.gpu_driver_install_invalid_archive)
|
||||
GpuDriverInstallResult.MissingMetadata -> getString(R.string.gpu_driver_install_missing_metadata)
|
||||
GpuDriverInstallResult.InvalidMetadata -> getString(R.string.gpu_driver_install_invalid_metadata)
|
||||
GpuDriverInstallResult.UnsupportedAndroidVersion -> getString(R.string.gpu_driver_install_unsupported_android_version)
|
||||
GpuDriverInstallResult.AlreadyInstalled -> getString(R.string.gpu_driver_install_already_installed)
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ interface GpuDriverHelper {
|
||||
} catch (e : Exception) {
|
||||
e.printStackTrace()
|
||||
installTempDir.deleteRecursively()
|
||||
return GpuDriverInstallResult.INVALID_ARCHIVE
|
||||
return GpuDriverInstallResult.InvalidArchive
|
||||
}
|
||||
|
||||
return installUnpackedDriver(context, installTempDir)
|
||||
@ -125,7 +125,7 @@ interface GpuDriverHelper {
|
||||
} catch (e : Exception) {
|
||||
e.printStackTrace()
|
||||
installTempDir.deleteRecursively()
|
||||
return GpuDriverInstallResult.INVALID_ARCHIVE
|
||||
return GpuDriverInstallResult.InvalidArchive
|
||||
}
|
||||
|
||||
return installUnpackedDriver(context, installTempDir)
|
||||
@ -145,7 +145,7 @@ interface GpuDriverHelper {
|
||||
val metadataFile = File(unpackDir, GPU_DRIVER_META_FILE)
|
||||
if (!metadataFile.isFile) {
|
||||
cleanup()
|
||||
return GpuDriverInstallResult.MISSING_METADATA
|
||||
return GpuDriverInstallResult.MissingMetadata
|
||||
}
|
||||
|
||||
// Check that the driver metadata is valid
|
||||
@ -153,13 +153,13 @@ interface GpuDriverHelper {
|
||||
GpuDriverMetadata.deserialize(metadataFile)
|
||||
} catch (e : SerializationException) {
|
||||
cleanup()
|
||||
return GpuDriverInstallResult.INVALID_METADATA
|
||||
return GpuDriverInstallResult.InvalidMetadata
|
||||
}
|
||||
|
||||
// Check that the device satisfies the driver's minimum Android version requirements
|
||||
if (Build.VERSION.SDK_INT < driverMetadata.minApi) {
|
||||
cleanup()
|
||||
return GpuDriverInstallResult.UNSUPPORTED_ANDROID_VERSION
|
||||
return GpuDriverInstallResult.UnsupportedAndroidVersion
|
||||
}
|
||||
|
||||
// Check that the driver is not already installed
|
||||
@ -167,7 +167,7 @@ interface GpuDriverHelper {
|
||||
val finalInstallDir = File(getDriversDirectory(context), driverMetadata.label)
|
||||
if (installedDrivers[finalInstallDir] != null) {
|
||||
cleanup()
|
||||
return GpuDriverInstallResult.ALREADY_INSTALLED
|
||||
return GpuDriverInstallResult.AlreadyInstalled
|
||||
}
|
||||
|
||||
// Move the driver files to the final location
|
||||
@ -176,7 +176,7 @@ interface GpuDriverHelper {
|
||||
throw IOException("Failed to create directory ${finalInstallDir.name}")
|
||||
}
|
||||
|
||||
return GpuDriverInstallResult.SUCCESS
|
||||
return GpuDriverInstallResult.Success
|
||||
}
|
||||
|
||||
/**
|
||||
@ -216,10 +216,10 @@ interface GpuDriverHelper {
|
||||
}
|
||||
|
||||
enum class GpuDriverInstallResult {
|
||||
SUCCESS,
|
||||
INVALID_ARCHIVE,
|
||||
MISSING_METADATA,
|
||||
INVALID_METADATA,
|
||||
UNSUPPORTED_ANDROID_VERSION,
|
||||
ALREADY_INSTALLED,
|
||||
Success,
|
||||
InvalidArchive,
|
||||
MissingMetadata,
|
||||
InvalidMetadata,
|
||||
UnsupportedAndroidVersion,
|
||||
AlreadyInstalled,
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
package emu.skyline.utils
|
||||
|
||||
import java.io.*
|
||||
import java.lang.reflect.Field
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipFile
|
||||
import java.util.zip.ZipInputStream
|
||||
|
Loading…
x
Reference in New Issue
Block a user