mirror of
https://github.com/rafaelvcaetano/melonDS-android.git
synced 2024-11-26 23:20:40 +00:00
Update AndroidX dependencies
This commit is contained in:
parent
587e3c8c9a
commit
0ac5cf2d8a
@ -59,15 +59,15 @@ class MelonDSApplication : Application(), Configuration.Provider {
|
||||
migrator.performMigrations()
|
||||
}
|
||||
|
||||
override fun getWorkManagerConfiguration(): Configuration {
|
||||
return Configuration.Builder()
|
||||
.setWorkerFactory(workerFactory)
|
||||
.build()
|
||||
}
|
||||
|
||||
override fun onTerminate() {
|
||||
super.onTerminate()
|
||||
themeObserverDisposable?.dispose()
|
||||
MelonDSAndroidInterface.cleanup()
|
||||
}
|
||||
|
||||
override val workManagerConfiguration: Configuration get() {
|
||||
return Configuration.Builder()
|
||||
.setWorkerFactory(workerFactory)
|
||||
.build()
|
||||
}
|
||||
}
|
@ -60,7 +60,7 @@ object MelonEmulator {
|
||||
|
||||
fun bootFirmware(): FirmwareLoadResult {
|
||||
val loadResult = bootFirmwareInternal()
|
||||
return FirmwareLoadResult.values()[loadResult]
|
||||
return FirmwareLoadResult.entries[loadResult]
|
||||
}
|
||||
|
||||
private external fun loadRomInternal(romPath: String, sramPath: String, loadGbaRom: Boolean, gbaRomPath: String?, gbaSramPath: String?): Int
|
||||
|
@ -4,8 +4,8 @@ import androidx.room.migration.Migration
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
|
||||
class Migration1to2 : Migration(1, 2) {
|
||||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
database.execSQL("ALTER TABLE game ADD COLUMN game_checksum TEXT")
|
||||
database.execSQL("CREATE INDEX index_game_game_checksum ON game(game_checksum)")
|
||||
override fun migrate(db: SupportSQLiteDatabase) {
|
||||
db.execSQL("ALTER TABLE game ADD COLUMN game_checksum TEXT")
|
||||
db.execSQL("CREATE INDEX index_game_game_checksum ON game(game_checksum)")
|
||||
}
|
||||
}
|
@ -10,6 +10,9 @@ import androidx.camera.core.CameraSelector
|
||||
import androidx.camera.core.ImageAnalysis
|
||||
import androidx.camera.core.ImageInfo
|
||||
import androidx.camera.core.ImageProxy.PlaneProxy
|
||||
import androidx.camera.core.resolutionselector.AspectRatioStrategy
|
||||
import androidx.camera.core.resolutionselector.ResolutionSelector
|
||||
import androidx.camera.core.resolutionselector.ResolutionStrategy
|
||||
import androidx.camera.lifecycle.ProcessCameraProvider
|
||||
import androidx.core.content.ContextCompat
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
@ -17,8 +20,8 @@ import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.launch
|
||||
import me.magnum.melonds.common.PermissionHandler
|
||||
import me.magnum.melonds.common.camera.DSiCameraSource
|
||||
import me.magnum.melonds.common.camera.CameraType
|
||||
import me.magnum.melonds.common.camera.DSiCameraSource
|
||||
import me.magnum.melonds.impl.emulator.LifecycleOwnerProvider
|
||||
import java.nio.ByteBuffer
|
||||
import java.util.Arrays
|
||||
@ -81,7 +84,12 @@ class PhysicalDSiCameraSource(
|
||||
val cameraProvider = future.get()
|
||||
|
||||
val analyzer = ImageAnalysis.Builder()
|
||||
.setTargetResolution(Size(640, 480))
|
||||
.setResolutionSelector(
|
||||
ResolutionSelector.Builder()
|
||||
.setAspectRatioStrategy(AspectRatioStrategy.RATIO_4_3_FALLBACK_AUTO_STRATEGY)
|
||||
.setResolutionStrategy(ResolutionStrategy(Size(640, 480), ResolutionStrategy.FALLBACK_RULE_CLOSEST_HIGHER))
|
||||
.build()
|
||||
)
|
||||
.setOutputImageFormat(ImageAnalysis.OUTPUT_IMAGE_FORMAT_YUV_420_888)
|
||||
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
|
||||
.build()
|
||||
|
@ -18,7 +18,7 @@ class BackgroundParcelable : Parcelable {
|
||||
private constructor(parcel: Parcel) {
|
||||
val id = parcel.readString()?.let { UUID.fromString(it) }
|
||||
val name = parcel.readString() ?: throw NullPointerException("Missing name string")
|
||||
val orientation = Orientation.values()[parcel.readInt()]
|
||||
val orientation = Orientation.entries[parcel.readInt()]
|
||||
val uri = parcel.readString()!!.toUri()
|
||||
background = Background(id, name, orientation, uri)
|
||||
}
|
||||
|
@ -17,8 +17,8 @@ class RomConfigParcelable : Parcelable {
|
||||
|
||||
private constructor(parcel: Parcel) {
|
||||
romConfig = RomConfig()
|
||||
romConfig.runtimeConsoleType = RuntimeConsoleType.values()[parcel.readInt()]
|
||||
romConfig.runtimeMicSource = RuntimeMicSource.values()[parcel.readInt()]
|
||||
romConfig.runtimeConsoleType = RuntimeConsoleType.entries[parcel.readInt()]
|
||||
romConfig.runtimeMicSource = RuntimeMicSource.entries[parcel.readInt()]
|
||||
romConfig.layoutId = parcel.readString()?.let { UUID.fromString(it) }
|
||||
romConfig.loadGbaCart = parcel.readInt() == 1
|
||||
romConfig.gbaCartPath = parcel.readString()?.toUri()
|
||||
|
@ -33,7 +33,7 @@ class BackgroundsViewModel @Inject constructor(
|
||||
init {
|
||||
val initialBackgroundId = savedStateHandle.get<String?>(BackgroundsActivity.KEY_INITIAL_BACKGROUND_ID)?.let { UUID.fromString(it) }
|
||||
currentSelectedBackground = MutableLiveData(initialBackgroundId)
|
||||
backgroundOrientationFilter = savedStateHandle.get<Int>(BackgroundsActivity.KEY_ORIENTATION_FILTER).let { Orientation.values()[it ?: throw NullPointerException()] }
|
||||
backgroundOrientationFilter = savedStateHandle.get<Int>(BackgroundsActivity.KEY_ORIENTATION_FILTER).let { Orientation.entries[it ?: throw NullPointerException()] }
|
||||
|
||||
backgroundsRepository.getBackgrounds()
|
||||
.subscribeOn(schedulers.backgroundThreadScheduler)
|
||||
|
@ -257,12 +257,12 @@ class EmulatorViewModel @Inject constructor(
|
||||
if (showPauseMenu) {
|
||||
val pauseOptions = when (_emulatorState.value) {
|
||||
is EmulatorState.RunningRom -> {
|
||||
RomPauseMenuOption.values().filter {
|
||||
RomPauseMenuOption.entries.filter {
|
||||
filterRomPauseMenuOption(it)
|
||||
}
|
||||
}
|
||||
is EmulatorState.RunningFirmware -> {
|
||||
FirmwarePauseMenuOption.values().toList()
|
||||
FirmwarePauseMenuOption.entries
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
|
@ -72,14 +72,14 @@ class LayoutBackgroundsDialog : DialogFragment() {
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
currentPortraitBackgroundId = savedInstanceState.getString(KEY_PORTRAIT_BACKGROUND_ID, null)?.let { UUID.fromString(it) }
|
||||
currentPortraitBackgroundMode = BackgroundMode.values()[savedInstanceState.getInt(KEY_PORTRAIT_BACKGROUND_MODE, 0)]
|
||||
currentPortraitBackgroundMode = BackgroundMode.entries[savedInstanceState.getInt(KEY_PORTRAIT_BACKGROUND_MODE, 0)]
|
||||
currentLandscapeBackgroundId = savedInstanceState.getString(KEY_LANDSCAPE_BACKGROUND_ID, null)?.let { UUID.fromString(it) }
|
||||
currentLandscapeBackgroundMode = BackgroundMode.values()[savedInstanceState.getInt(KEY_LANDSCAPE_BACKGROUND_MODE, 0)]
|
||||
currentLandscapeBackgroundMode = BackgroundMode.entries[savedInstanceState.getInt(KEY_LANDSCAPE_BACKGROUND_MODE, 0)]
|
||||
} else {
|
||||
currentPortraitBackgroundId = arguments?.getString(KEY_PORTRAIT_BACKGROUND_ID, null)?.let { UUID.fromString(it) }
|
||||
currentPortraitBackgroundMode = BackgroundMode.values()[arguments?.getInt(KEY_PORTRAIT_BACKGROUND_MODE, 0) ?: 0]
|
||||
currentPortraitBackgroundMode = BackgroundMode.entries[arguments?.getInt(KEY_PORTRAIT_BACKGROUND_MODE, 0) ?: 0]
|
||||
currentLandscapeBackgroundId = arguments?.getString(KEY_LANDSCAPE_BACKGROUND_ID, null)?.let { UUID.fromString(it) }
|
||||
currentLandscapeBackgroundMode = BackgroundMode.values()[arguments?.getInt(KEY_LANDSCAPE_BACKGROUND_MODE, 0) ?: 0]
|
||||
currentLandscapeBackgroundMode = BackgroundMode.entries[arguments?.getInt(KEY_LANDSCAPE_BACKGROUND_MODE, 0) ?: 0]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,7 @@ class LayoutEditorActivity : AppCompatActivity() {
|
||||
private fun openButtonsMenu() {
|
||||
hideBottomControls()
|
||||
val instantiatedComponents = binding.viewLayoutEditor.getInstantiatedComponents()
|
||||
val componentsToShow = LayoutComponent.values().filterNot { instantiatedComponents.contains(it) }
|
||||
val componentsToShow = LayoutComponent.entries.filterNot { instantiatedComponents.contains(it) }
|
||||
|
||||
val dialogBuilder = AlertDialog.Builder(this)
|
||||
.setTitle(R.string.choose_component)
|
||||
@ -322,7 +322,7 @@ class LayoutEditorActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
private fun openMenu() {
|
||||
val values = MenuOption.values()
|
||||
val values = MenuOption.entries
|
||||
val options = Array(values.size) { i -> getString(values[i].stringRes) }
|
||||
|
||||
AlertDialog.Builder(this)
|
||||
|
@ -53,12 +53,12 @@ class LayoutPropertiesDialog : DialogFragment() {
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
layoutName = savedInstanceState.getString(KEY_LAYOUT_NAME)
|
||||
layoutOrientation = LayoutConfiguration.LayoutOrientation.values()[savedInstanceState.getInt(KEY_LAYOUT_ORIENTATION)]
|
||||
layoutOrientation = LayoutConfiguration.LayoutOrientation.entries[savedInstanceState.getInt(KEY_LAYOUT_ORIENTATION)]
|
||||
useCustomOpacity = savedInstanceState.getBoolean(KEY_CUSTOM_OPACITY)
|
||||
layoutOpacity = savedInstanceState.getInt(KEY_LAYOUT_OPACITY)
|
||||
} else {
|
||||
layoutName = arguments?.getString(KEY_LAYOUT_NAME)
|
||||
layoutOrientation = LayoutConfiguration.LayoutOrientation.values()[arguments?.getInt(KEY_LAYOUT_ORIENTATION) ?: 0]
|
||||
layoutOrientation = LayoutConfiguration.LayoutOrientation.entries[arguments?.getInt(KEY_LAYOUT_ORIENTATION) ?: 0]
|
||||
useCustomOpacity = arguments?.getBoolean(KEY_CUSTOM_OPACITY) ?: true
|
||||
layoutOpacity = arguments?.getInt(KEY_LAYOUT_OPACITY) ?: 0
|
||||
}
|
||||
@ -82,8 +82,8 @@ class LayoutPropertiesDialog : DialogFragment() {
|
||||
binding.layoutOrientation.setOnClickListener {
|
||||
AlertDialog.Builder(requireContext())
|
||||
.setTitle(R.string.layout_orientation)
|
||||
.setSingleChoiceItems(R.array.layout_orientation_options, LayoutConfiguration.LayoutOrientation.values().indexOf(layoutOrientation)) { dialog, which ->
|
||||
val newOrientation = LayoutConfiguration.LayoutOrientation.values()[which]
|
||||
.setSingleChoiceItems(R.array.layout_orientation_options, LayoutConfiguration.LayoutOrientation.entries.indexOf(layoutOrientation)) { dialog, which ->
|
||||
val newOrientation = LayoutConfiguration.LayoutOrientation.entries[which]
|
||||
setLayoutOrientation(newOrientation)
|
||||
dialog.dismiss()
|
||||
}
|
||||
@ -136,7 +136,7 @@ class LayoutPropertiesDialog : DialogFragment() {
|
||||
|
||||
private fun setLayoutOrientation(orientation: LayoutConfiguration.LayoutOrientation) {
|
||||
val orientationNames = requireContext().resources.getStringArray(R.array.layout_orientation_options)
|
||||
binding.textOrientation.text = orientationNames[LayoutConfiguration.LayoutOrientation.values().indexOf(orientation)]
|
||||
binding.textOrientation.text = orientationNames[LayoutConfiguration.LayoutOrientation.entries.indexOf(orientation)]
|
||||
layoutOrientation = orientation
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ private fun Content(
|
||||
items = consoleOptions.toList(),
|
||||
selectedItemIndex = romConfig.runtimeConsoleType.ordinal,
|
||||
onItemSelected = {
|
||||
onConfigUpdate(RomConfigUpdateEvent.RuntimeConsoleUpdate(RuntimeConsoleType.values()[it]))
|
||||
onConfigUpdate(RomConfigUpdateEvent.RuntimeConsoleUpdate(RuntimeConsoleType.entries[it]))
|
||||
}
|
||||
)
|
||||
|
||||
@ -83,7 +83,7 @@ private fun Content(
|
||||
items = micSourceOptions.toList(),
|
||||
selectedItemIndex = romConfig.runtimeMicSource.ordinal,
|
||||
onItemSelected = {
|
||||
onConfigUpdate(RomConfigUpdateEvent.RuntimeMicSourceUpdate(RuntimeMicSource.values()[it]))
|
||||
onConfigUpdate(RomConfigUpdateEvent.RuntimeMicSourceUpdate(RuntimeMicSource.entries[it]))
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -32,7 +32,10 @@ fun RomScreen(
|
||||
onRetroAchievementsRetryLoad: () -> Unit,
|
||||
onViewAchievement: (RAAchievement) -> Unit,
|
||||
) {
|
||||
val pagerState = rememberPagerState(RomDetailsTab.CONFIG.tabIndex)
|
||||
val pagerState = rememberPagerState(
|
||||
initialPage = RomDetailsTab.CONFIG.tabIndex,
|
||||
pageCount = { RomDetailsTab.entries.size },
|
||||
)
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
|
||||
Column(modifier) {
|
||||
@ -49,7 +52,6 @@ fun RomScreen(
|
||||
}
|
||||
HorizontalPager(
|
||||
modifier = Modifier.fillMaxWidth().weight(1f),
|
||||
pageCount = RomDetailsTab.values().size,
|
||||
state = pagerState,
|
||||
) {
|
||||
when (it) {
|
||||
|
@ -127,7 +127,10 @@ fun RomHeaderUi(
|
||||
@Composable
|
||||
private fun PreviewRomHeaderUi() {
|
||||
MelonTheme {
|
||||
val pagerState = rememberPagerState(RomDetailsTab.CONFIG.tabIndex)
|
||||
val pagerState = rememberPagerState(
|
||||
initialPage = RomDetailsTab.CONFIG.tabIndex,
|
||||
pageCount = { RomDetailsTab.entries.size },
|
||||
)
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
|
||||
RomHeaderUi(
|
||||
|
@ -106,7 +106,7 @@ class RomConfigDialog : DialogFragment() {
|
||||
AlertDialog.Builder(requireContext())
|
||||
.setTitle(R.string.label_rom_config_console)
|
||||
.setSingleChoiceItems(R.array.game_runtime_console_type_options, romConfig.runtimeConsoleType.ordinal) { dialog, which ->
|
||||
val newConsoleType = RuntimeConsoleType.values()[which]
|
||||
val newConsoleType = RuntimeConsoleType.entries[which]
|
||||
onRuntimeConsoleTypeSelected(newConsoleType)
|
||||
dialog.dismiss()
|
||||
}
|
||||
@ -119,7 +119,7 @@ class RomConfigDialog : DialogFragment() {
|
||||
AlertDialog.Builder(requireContext())
|
||||
.setTitle(R.string.microphone_source)
|
||||
.setSingleChoiceItems(R.array.game_runtime_mic_source_options, romConfig.runtimeMicSource.ordinal) { dialog, which ->
|
||||
val newMicSource = RuntimeMicSource.values()[which]
|
||||
val newMicSource = RuntimeMicSource.entries[which]
|
||||
// Request mic permission if required
|
||||
if (newMicSource == RuntimeMicSource.DEVICE && !requireContext().isMicrophonePermissionGranted()) {
|
||||
microphonePermissionLauncher.launch(Manifest.permission.RECORD_AUDIO)
|
||||
|
@ -72,7 +72,7 @@ class BiosDirectoryPickerPreference(context: Context, attrs: AttributeSet?) : St
|
||||
return
|
||||
|
||||
val attrArray = context.theme.obtainStyledAttributes(attrs, R.styleable.BiosDirectoryPickerPreference, 0, 0)
|
||||
consoleType = ConsoleType.values()[attrArray.getIntOrThrow(R.styleable.BiosDirectoryPickerPreference_consoleType)]
|
||||
consoleType = ConsoleType.entries[attrArray.getIntOrThrow(R.styleable.BiosDirectoryPickerPreference_consoleType)]
|
||||
|
||||
attrArray.recycle()
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ class FirmwareColourPickerPreference(context: Context, attrs: AttributeSet?) : P
|
||||
}
|
||||
|
||||
private fun updateSelectedColour(selectedColour: Int) {
|
||||
val firmwareColour = FirmwareColour.values()[selectedColour]
|
||||
val firmwareColour = FirmwareColour.entries[selectedColour]
|
||||
colorMapper[firmwareColour]?.let {
|
||||
val colourWithAlpha = (0xFF000000 or it.toLong())
|
||||
viewSelectedColour.setBackgroundColor(colourWithAlpha.toInt())
|
||||
|
@ -60,8 +60,8 @@ open class StoragePickerPreference(context: Context, attrs: AttributeSet?) : Pre
|
||||
val attr = attrArray.getIndex(i)
|
||||
when (attr) {
|
||||
R.styleable.DirectoryPickerPreference_selection -> multiSelection = attrArray.getInt(R.styleable.DirectoryPickerPreference_selection, 0) == 1
|
||||
R.styleable.DirectoryPickerPreference_type -> selectionType = SelectionType.values()[attrArray.getInt(R.styleable.DirectoryPickerPreference_type, 0)]
|
||||
R.styleable.DirectoryPickerPreference_permissions -> permissions = Permission.values()[attrArray.getInt(R.styleable.DirectoryPickerPreference_permissions, 0)]
|
||||
R.styleable.DirectoryPickerPreference_type -> selectionType = SelectionType.entries[attrArray.getInt(R.styleable.DirectoryPickerPreference_type, 0)]
|
||||
R.styleable.DirectoryPickerPreference_permissions -> permissions = Permission.entries[attrArray.getInt(R.styleable.DirectoryPickerPreference_permissions, 0)]
|
||||
R.styleable.DirectoryPickerPreference_persistPermissions -> persistPermissions = attrArray.getBoolean(R.styleable.DirectoryPickerPreference_persistPermissions, false)
|
||||
R.styleable.DirectoryPickerPreference_mimeType -> mimeType = attrArray.getString(R.styleable.DirectoryPickerPreference_mimeType)
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
object Dependencies {
|
||||
object Versions {
|
||||
const val Accompanist = "0.30.1"
|
||||
const val Activity = "1.7.2"
|
||||
const val Activity = "1.8.2"
|
||||
const val AppCompat = "1.6.1"
|
||||
const val CameraX = "1.2.3"
|
||||
const val CameraX = "1.3.1"
|
||||
const val CardView = "1.0.0"
|
||||
const val Coil = "2.2.2"
|
||||
const val CommonsCompress = "1.21"
|
||||
const val ComposeBom = "2023.06.01"
|
||||
const val ComposeBom = "2023.10.01"
|
||||
const val ConstraintLayout = "2.1.4"
|
||||
const val Core = "1.10.1"
|
||||
const val Core = "1.12.0"
|
||||
const val Desugar = "2.0.2"
|
||||
const val DocumentFile = "1.0.1"
|
||||
const val Flexbox = "3.0.0"
|
||||
const val Fragment = "1.5.7"
|
||||
const val Fragment = "1.6.2"
|
||||
const val Gradle = "8.2.0"
|
||||
const val Gson = "2.8.6"
|
||||
const val HiltX = "1.1.0"
|
||||
@ -22,18 +22,18 @@ object Dependencies {
|
||||
const val Kotlin = "1.9.21"
|
||||
const val KotlinxCoroutines = "1.7.3"
|
||||
const val Ksp = "1.9.0-1.0.12"
|
||||
const val LifecycleViewModel = "2.6.1"
|
||||
const val LifecycleViewModel = "2.6.2"
|
||||
const val Material = "1.7.0"
|
||||
const val OkHttp = "4.11.0"
|
||||
const val Picasso = "2.71828"
|
||||
const val Preference = "1.2.0"
|
||||
const val RecyclerView = "1.3.1"
|
||||
const val Room = "2.6.0"
|
||||
const val Preference = "1.2.1"
|
||||
const val RecyclerView = "1.3.2"
|
||||
const val Room = "2.6.1"
|
||||
const val RxAndroid = "2.1.1"
|
||||
const val RxJava = "2.2.10"
|
||||
const val Splashscreen = "1.0.0"
|
||||
const val SwipeRefreshLayout = "1.1.0"
|
||||
const val Work = "2.8.1"
|
||||
const val Work = "2.9.0"
|
||||
const val Markwon = "4.6.2"
|
||||
const val Retrofit = "2.9.0"
|
||||
const val Xz = "1.9"
|
||||
@ -76,7 +76,7 @@ object Dependencies {
|
||||
const val roomRxJava = "androidx.room:room-rxjava2:${Versions.Room}"
|
||||
const val splashscreen = "androidx.core:core-splashscreen:${Versions.Splashscreen}"
|
||||
const val swipeRefreshLayout = "androidx.swiperefreshlayout:swiperefreshlayout:${Versions.SwipeRefreshLayout}"
|
||||
const val work = "androidx.work:work-runtime-ktx:${Versions.Work}"
|
||||
const val work = "androidx.work:work-runtime:${Versions.Work}"
|
||||
const val material = "com.google.android.material:material:${Versions.Material}"
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user