mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-04 23:55:08 +01:00
Miscellaneous imports cleanup in preference
package
This commit is contained in:
parent
1dfea9ef6f
commit
f3dd3e53c1
@ -34,12 +34,11 @@ import emu.skyline.databinding.MainActivityBinding
|
||||
import emu.skyline.loader.AppEntry
|
||||
import emu.skyline.loader.LoaderResult
|
||||
import emu.skyline.loader.RomFormat
|
||||
import emu.skyline.utils.PreferenceSettings
|
||||
import emu.skyline.provider.DocumentsProvider
|
||||
import emu.skyline.utils.PreferenceSettings
|
||||
import javax.inject.Inject
|
||||
import kotlin.math.ceil
|
||||
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MainActivity : AppCompatActivity() {
|
||||
companion object {
|
||||
|
@ -12,9 +12,10 @@ import androidx.activity.ComponentActivity
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.Preference.SummaryProvider
|
||||
import emu.skyline.R
|
||||
import androidx.preference.R
|
||||
import emu.skyline.di.getInputManager
|
||||
import emu.skyline.input.ControllerActivity
|
||||
import emu.skyline.R as SkylineR
|
||||
|
||||
/**
|
||||
* This preference is used to launch [ControllerActivity] using a preference
|
||||
@ -52,7 +53,7 @@ class ControllerPreference @JvmOverloads constructor(context : Context, attrs :
|
||||
if (key == null)
|
||||
key = "controller_$index"
|
||||
|
||||
title = "${context.getString(R.string.config_controller)} #${index + 1}"
|
||||
title = "${context.getString(SkylineR.string.config_controller)} #${index + 1}"
|
||||
summaryProvider = SummaryProvider<ControllerPreference> { inputManager.controllers[index]!!.type.stringRes.let { context.getString(it) } }
|
||||
}
|
||||
|
||||
|
@ -13,10 +13,10 @@ import android.util.AttributeSet
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.R
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import emu.skyline.R as SkylineR
|
||||
import emu.skyline.SettingsActivity
|
||||
import emu.skyline.provider.DocumentsProvider
|
||||
|
||||
|
||||
class DocumentsProviderPreference @JvmOverloads constructor(context : Context, attrs : AttributeSet? = null, defStyleAttr : Int = R.attr.preferenceStyle) : Preference(context, attrs, defStyleAttr) {
|
||||
fun launchOpenIntent(action : String) : Boolean {
|
||||
return try {
|
||||
@ -34,6 +34,6 @@ class DocumentsProviderPreference @JvmOverloads constructor(context : Context, a
|
||||
override fun onClick() {
|
||||
if (launchOpenIntent(Intent.ACTION_VIEW) or launchOpenIntent("android.provider.action.BROWSE"))
|
||||
return
|
||||
Snackbar.make((context as SettingsActivity).binding.root, emu.skyline.R.string.failed_open_directory, Snackbar.LENGTH_SHORT).show()
|
||||
Snackbar.make((context as SettingsActivity).binding.root, SkylineR.string.failed_open_directory, Snackbar.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ package emu.skyline.preference
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.R
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user