Android fixes + codebase rebranding

This commit is contained in:
OpenSauce04 2024-03-31 19:27:55 +01:00
parent bacd935a90
commit f12b649194
149 changed files with 227 additions and 227 deletions

View File

@ -33,7 +33,7 @@
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<application <application
android:name="io.github.lime3ds.CitraApplication" android:name="io.github.lime3ds.LimeApplication"
android:label="@string/app_name" android:label="@string/app_name"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:allowBackup="false" android:allowBackup="false"
@ -47,7 +47,7 @@
<activity <activity
android:name="io.github.lime3ds.ui.main.MainActivity" android:name="io.github.lime3ds.ui.main.MainActivity"
android:theme="@style/Theme.Citra.Splash.Main" android:theme="@style/Theme.Lime.Splash.Main"
android:exported="true"> android:exported="true">
<!-- This intentfilter marks this Activity as the one that gets launched from Home screen. --> <!-- This intentfilter marks this Activity as the one that gets launched from Home screen. -->
@ -61,13 +61,13 @@
<activity <activity
android:name="io.github.lime3ds.features.settings.ui.SettingsActivity" android:name="io.github.lime3ds.features.settings.ui.SettingsActivity"
android:configChanges="orientation|screenSize|uiMode" android:configChanges="orientation|screenSize|uiMode"
android:theme="@style/Theme.Citra.Main" android:theme="@style/Theme.Lime.Main"
android:label="@string/preferences_settings"/> android:label="@string/preferences_settings"/>
<activity <activity
android:name="io.github.lime3ds.activities.EmulationActivity" android:name="io.github.lime3ds.activities.EmulationActivity"
android:exported="true" android:exported="true"
android:theme="@style/Theme.Citra.Main" android:theme="@style/Theme.Lime.Main"
android:launchMode="singleTop"> android:launchMode="singleTop">
<intent-filter> <intent-filter>
@ -87,7 +87,7 @@
<activity <activity
android:name="io.github.lime3ds.features.cheats.ui.CheatsActivity" android:name="io.github.lime3ds.features.cheats.ui.CheatsActivity"
android:exported="false" android:exported="false"
android:theme="@style/Theme.Citra.Main" android:theme="@style/Theme.Lime.Main"
android:label="@string/cheats"/> android:label="@string/cheats"/>
</application> </application>

View File

@ -17,7 +17,7 @@ import io.github.lime3ds.utils.PermissionsHandler
import io.github.lime3ds.utils.Log import io.github.lime3ds.utils.Log
import io.github.lime3ds.utils.MemoryUtil import io.github.lime3ds.utils.MemoryUtil
class CitraApplication : Application() { class LimeApplication : Application() {
private fun createNotificationChannel() { private fun createNotificationChannel() {
with(getSystemService(NotificationManager::class.java)) { with(getSystemService(NotificationManager::class.java)) {
// General notification // General notification
@ -71,7 +71,7 @@ class CitraApplication : Application() {
} }
companion object { companion object {
private var application: CitraApplication? = null private var application: LimeApplication? = null
val appContext: Context get() = application!!.applicationContext val appContext: Context get() = application!!.applicationContext

View File

@ -247,7 +247,7 @@ object NativeLibrary {
@get:Keep @get:Keep
@get:JvmStatic @get:JvmStatic
val isPortraitMode: Boolean val isPortraitMode: Boolean
get() = CitraApplication.appContext.resources.configuration.orientation == get() = LimeApplication.appContext.resources.configuration.orientation ==
Configuration.ORIENTATION_PORTRAIT Configuration.ORIENTATION_PORTRAIT
@Keep @Keep
@ -369,7 +369,7 @@ object NativeLibrary {
.setTitle(captionId) .setTitle(captionId)
.setMessage( .setMessage(
Html.fromHtml( Html.fromHtml(
CitraApplication.appContext.resources.getString(R.string.redump_games), LimeApplication.appContext.resources.getString(R.string.redump_games),
Html.FROM_HTML_MODE_LEGACY Html.FROM_HTML_MODE_LEGACY
) )
) )
@ -519,7 +519,7 @@ object NativeLibrary {
@JvmStatic @JvmStatic
fun createFile(directory: String, filename: String): Boolean = fun createFile(directory: String, filename: String): Boolean =
if (FileUtil.isNativePath(directory)) { if (FileUtil.isNativePath(directory)) {
CitraApplication.documentsTree.createFile(directory, filename) LimeApplication.documentsTree.createFile(directory, filename)
} else { } else {
FileUtil.createFile(directory, filename) != null FileUtil.createFile(directory, filename) != null
} }
@ -528,7 +528,7 @@ object NativeLibrary {
@JvmStatic @JvmStatic
fun createDir(directory: String, directoryName: String): Boolean = fun createDir(directory: String, directoryName: String): Boolean =
if (FileUtil.isNativePath(directory)) { if (FileUtil.isNativePath(directory)) {
CitraApplication.documentsTree.createDir(directory, directoryName) LimeApplication.documentsTree.createDir(directory, directoryName)
} else { } else {
FileUtil.createDir(directory, directoryName) != null FileUtil.createDir(directory, directoryName) != null
} }
@ -537,7 +537,7 @@ object NativeLibrary {
@JvmStatic @JvmStatic
fun openContentUri(path: String, openMode: String): Int = fun openContentUri(path: String, openMode: String): Int =
if (FileUtil.isNativePath(path)) { if (FileUtil.isNativePath(path)) {
CitraApplication.documentsTree.openContentUri(path, openMode) LimeApplication.documentsTree.openContentUri(path, openMode)
} else { } else {
FileUtil.openContentUri(path, openMode) FileUtil.openContentUri(path, openMode)
} }
@ -546,7 +546,7 @@ object NativeLibrary {
@JvmStatic @JvmStatic
fun getFilesName(path: String): Array<String?> = fun getFilesName(path: String): Array<String?> =
if (FileUtil.isNativePath(path)) { if (FileUtil.isNativePath(path)) {
CitraApplication.documentsTree.getFilesName(path) LimeApplication.documentsTree.getFilesName(path)
} else { } else {
FileUtil.getFilesName(path) FileUtil.getFilesName(path)
} }
@ -555,7 +555,7 @@ object NativeLibrary {
@JvmStatic @JvmStatic
fun getSize(path: String): Long = fun getSize(path: String): Long =
if (FileUtil.isNativePath(path)) { if (FileUtil.isNativePath(path)) {
CitraApplication.documentsTree.getFileSize(path) LimeApplication.documentsTree.getFileSize(path)
} else { } else {
FileUtil.getFileSize(path) FileUtil.getFileSize(path)
} }
@ -564,7 +564,7 @@ object NativeLibrary {
@JvmStatic @JvmStatic
fun fileExists(path: String): Boolean = fun fileExists(path: String): Boolean =
if (FileUtil.isNativePath(path)) { if (FileUtil.isNativePath(path)) {
CitraApplication.documentsTree.exists(path) LimeApplication.documentsTree.exists(path)
} else { } else {
FileUtil.exists(path) FileUtil.exists(path)
} }
@ -573,7 +573,7 @@ object NativeLibrary {
@JvmStatic @JvmStatic
fun isDirectory(path: String): Boolean = fun isDirectory(path: String): Boolean =
if (FileUtil.isNativePath(path)) { if (FileUtil.isNativePath(path)) {
CitraApplication.documentsTree.isDirectory(path) LimeApplication.documentsTree.isDirectory(path)
} else { } else {
FileUtil.isDirectory(path) FileUtil.isDirectory(path)
} }
@ -588,7 +588,7 @@ object NativeLibrary {
if (FileUtil.isNativePath(sourcePath) && if (FileUtil.isNativePath(sourcePath) &&
FileUtil.isNativePath(destinationParentPath) FileUtil.isNativePath(destinationParentPath)
) { ) {
CitraApplication.documentsTree LimeApplication.documentsTree
.copyFile(sourcePath, destinationParentPath, destinationFilename) .copyFile(sourcePath, destinationParentPath, destinationFilename)
} else { } else {
FileUtil.copyFile( FileUtil.copyFile(
@ -602,7 +602,7 @@ object NativeLibrary {
@JvmStatic @JvmStatic
fun renameFile(path: String, destinationFilename: String): Boolean = fun renameFile(path: String, destinationFilename: String): Boolean =
if (FileUtil.isNativePath(path)) { if (FileUtil.isNativePath(path)) {
CitraApplication.documentsTree.renameFile(path, destinationFilename) LimeApplication.documentsTree.renameFile(path, destinationFilename)
} else { } else {
FileUtil.renameFile(path, destinationFilename) FileUtil.renameFile(path, destinationFilename)
} }
@ -611,7 +611,7 @@ object NativeLibrary {
@JvmStatic @JvmStatic
fun deleteDocument(path: String): Boolean = fun deleteDocument(path: String): Boolean =
if (FileUtil.isNativePath(path)) { if (FileUtil.isNativePath(path)) {
CitraApplication.documentsTree.deleteDocument(path) LimeApplication.documentsTree.deleteDocument(path)
} else { } else {
FileUtil.deleteDocument(path) FileUtil.deleteDocument(path)
} }

View File

@ -25,7 +25,7 @@ import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat import androidx.core.view.WindowInsetsControllerCompat
import androidx.navigation.fragment.NavHostFragment import androidx.navigation.fragment.NavHostFragment
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import io.github.lime3ds.CitraApplication import io.github.lime3ds.LimeApplication
import io.github.lime3ds.NativeLibrary import io.github.lime3ds.NativeLibrary
import io.github.lime3ds.R import io.github.lime3ds.R
import io.github.lime3ds.camera.StillImageCameraHelper.OnFilePickerResult import io.github.lime3ds.camera.StillImageCameraHelper.OnFilePickerResult
@ -46,7 +46,7 @@ import io.github.lime3ds.viewmodel.EmulationViewModel
class EmulationActivity : AppCompatActivity() { class EmulationActivity : AppCompatActivity() {
private val preferences: SharedPreferences private val preferences: SharedPreferences
get() = PreferenceManager.getDefaultSharedPreferences(CitraApplication.appContext) get() = PreferenceManager.getDefaultSharedPreferences(LimeApplication.appContext)
private var foregroundService: Intent? = null private var foregroundService: Intent? = null
var isActivityRecreated = false var isActivityRecreated = false

View File

@ -24,7 +24,7 @@ import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.color.MaterialColors import com.google.android.material.color.MaterialColors
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import io.github.lime3ds.HomeNavigationDirections import io.github.lime3ds.HomeNavigationDirections
import io.github.lime3ds.CitraApplication import io.github.lime3ds.LimeApplication
import io.github.lime3ds.R import io.github.lime3ds.R
import io.github.lime3ds.adapters.GameAdapter.GameViewHolder import io.github.lime3ds.adapters.GameAdapter.GameViewHolder
import io.github.lime3ds.databinding.CardGameBinding import io.github.lime3ds.databinding.CardGameBinding
@ -70,7 +70,7 @@ class GameAdapter(private val activity: AppCompatActivity) :
gameExists(holder) gameExists(holder)
val preferences = val preferences =
PreferenceManager.getDefaultSharedPreferences(CitraApplication.appContext) PreferenceManager.getDefaultSharedPreferences(LimeApplication.appContext)
preferences.edit() preferences.edit()
.putLong( .putLong(
holder.game.keyLastPlayedTime, holder.game.keyLastPlayedTime,
@ -112,12 +112,12 @@ class GameAdapter(private val activity: AppCompatActivity) :
} }
val gameExists = DocumentFile.fromSingleUri( val gameExists = DocumentFile.fromSingleUri(
CitraApplication.appContext, LimeApplication.appContext,
Uri.parse(holder.game.path) Uri.parse(holder.game.path)
)?.exists() == true )?.exists() == true
return if (!gameExists) { return if (!gameExists) {
Toast.makeText( Toast.makeText(
CitraApplication.appContext, LimeApplication.appContext,
R.string.loader_error_file_not_found, R.string.loader_error_file_not_found,
Toast.LENGTH_LONG Toast.LENGTH_LONG
).show() ).show()

View File

@ -10,7 +10,7 @@ import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.ViewHolder import androidx.recyclerview.widget.RecyclerView.ViewHolder
import io.github.lime3ds.CitraApplication import io.github.lime3ds.LimeApplication
import io.github.lime3ds.databinding.ListItemSettingBinding import io.github.lime3ds.databinding.ListItemSettingBinding
import io.github.lime3ds.fragments.LicenseBottomSheetDialogFragment import io.github.lime3ds.fragments.LicenseBottomSheetDialogFragment
import io.github.lime3ds.model.License import io.github.lime3ds.model.License
@ -47,7 +47,7 @@ class LicenseAdapter(private val activity: AppCompatActivity, var licenses: List
fun bind(license: License) { fun bind(license: License) {
this.license = license this.license = license
val context = CitraApplication.appContext val context = LimeApplication.appContext
binding.textSettingName.text = context.getString(license.titleId) binding.textSettingName.text = context.getString(license.titleId)
binding.textSettingDescription.text = context.getString(license.descriptionId) binding.textSettingDescription.text = context.getString(license.descriptionId)
} }

View File

@ -7,7 +7,7 @@ package io.github.lime3ds.applets
import android.text.InputFilter import android.text.InputFilter
import android.text.Spanned import android.text.Spanned
import androidx.annotation.Keep import androidx.annotation.Keep
import io.github.lime3ds.CitraApplication.Companion.appContext import io.github.lime3ds.LimeApplication.Companion.appContext
import io.github.lime3ds.NativeLibrary import io.github.lime3ds.NativeLibrary
import io.github.lime3ds.R import io.github.lime3ds.R
import io.github.lime3ds.fragments.KeyboardDialogFragment import io.github.lime3ds.fragments.KeyboardDialogFragment

View File

@ -12,7 +12,7 @@ import androidx.core.graphics.drawable.toBitmap
import coil.executeBlocking import coil.executeBlocking
import coil.imageLoader import coil.imageLoader
import coil.request.ImageRequest import coil.request.ImageRequest
import io.github.lime3ds.CitraApplication import io.github.lime3ds.LimeApplication
import io.github.lime3ds.NativeLibrary import io.github.lime3ds.NativeLibrary
// Used in native code. // Used in native code.
@ -53,7 +53,7 @@ object StillImageCameraHelper {
@Keep @Keep
@JvmStatic @JvmStatic
fun LoadImageFromFile(uri: String?, width: Int, height: Int): Bitmap? { fun LoadImageFromFile(uri: String?, width: Int, height: Int): Bitmap? {
val context = CitraApplication.appContext val context = LimeApplication.appContext
val request = ImageRequest.Builder(context) val request = ImageRequest.Builder(context)
.data(uri) .data(uri)
.size(width, height) .size(width, height)

View File

@ -5,7 +5,7 @@
package io.github.lime3ds.features.settings.model package io.github.lime3ds.features.settings.model
import android.text.TextUtils import android.text.TextUtils
import io.github.lime3ds.CitraApplication import io.github.lime3ds.LimeApplication
import io.github.lime3ds.R import io.github.lime3ds.R
import io.github.lime3ds.features.settings.ui.SettingsActivityView import io.github.lime3ds.features.settings.ui.SettingsActivityView
import io.github.lime3ds.features.settings.utils.SettingsFile import io.github.lime3ds.features.settings.utils.SettingsFile
@ -79,7 +79,7 @@ class Settings {
fun saveSettings(view: SettingsActivityView) { fun saveSettings(view: SettingsActivityView) {
if (TextUtils.isEmpty(gameId)) { if (TextUtils.isEmpty(gameId)) {
view.showToastMessage( view.showToastMessage(
CitraApplication.appContext.getString(R.string.ini_saved), LimeApplication.appContext.getString(R.string.ini_saved),
false false
) )
for ((fileName, sectionNames) in configFileSectionsMap.entries) { for ((fileName, sectionNames) in configFileSectionsMap.entries) {

View File

@ -11,7 +11,7 @@ import android.view.InputDevice.MotionRange
import android.view.KeyEvent import android.view.KeyEvent
import android.widget.Toast import android.widget.Toast
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import io.github.lime3ds.CitraApplication import io.github.lime3ds.LimeApplication
import io.github.lime3ds.NativeLibrary import io.github.lime3ds.NativeLibrary
import io.github.lime3ds.R import io.github.lime3ds.R
import io.github.lime3ds.features.hotkeys.Hotkey import io.github.lime3ds.features.hotkeys.Hotkey
@ -22,7 +22,7 @@ class InputBindingSetting(
val abstractSetting: AbstractSetting, val abstractSetting: AbstractSetting,
titleId: Int titleId: Int
) : SettingsItem(abstractSetting, titleId, 0) { ) : SettingsItem(abstractSetting, titleId, 0) {
private val context: Context get() = CitraApplication.appContext private val context: Context get() = LimeApplication.appContext
private val preferences: SharedPreferences private val preferences: SharedPreferences
get() = PreferenceManager.getDefaultSharedPreferences(context) get() = PreferenceManager.getDefaultSharedPreferences(context)

View File

@ -21,7 +21,7 @@ import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updatePadding import androidx.core.view.updatePadding
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import com.google.android.material.color.MaterialColors import com.google.android.material.color.MaterialColors
import io.github.lime3ds.CitraApplication import io.github.lime3ds.LimeApplication
import io.github.lime3ds.NativeLibrary import io.github.lime3ds.NativeLibrary
import io.github.lime3ds.R import io.github.lime3ds.R
import io.github.lime3ds.databinding.ActivitySettingsBinding import io.github.lime3ds.databinding.ActivitySettingsBinding
@ -193,7 +193,7 @@ class SettingsActivity : AppCompatActivity(), SettingsActivityView {
val controllerKeys = Settings.buttonKeys + Settings.circlePadKeys + Settings.cStickKeys + val controllerKeys = Settings.buttonKeys + Settings.circlePadKeys + Settings.cStickKeys +
Settings.dPadKeys + Settings.triggerKeys Settings.dPadKeys + Settings.triggerKeys
val editor = val editor =
PreferenceManager.getDefaultSharedPreferences(CitraApplication.appContext).edit() PreferenceManager.getDefaultSharedPreferences(LimeApplication.appContext).edit()
controllerKeys.forEach { editor.remove(it) } controllerKeys.forEach { editor.remove(it) }
editor.apply() editor.apply()
@ -213,7 +213,7 @@ class SettingsActivity : AppCompatActivity(), SettingsActivityView {
// Set the root of the document tree before we create a new config file or the native code // Set the root of the document tree before we create a new config file or the native code
// will fail when creating the file. // will fail when creating the file.
if (DirectoryInitialization.setCitraUserDirectory()) { if (DirectoryInitialization.setCitraUserDirectory()) {
CitraApplication.documentsTree.setRoot(Uri.parse(DirectoryInitialization.userPath)) LimeApplication.documentsTree.setRoot(Uri.parse(DirectoryInitialization.userPath))
NativeLibrary.createConfigFile() NativeLibrary.createConfigFile()
} else { } else {
throw IllegalStateException("Citra directory unavailable when accessing config file!") throw IllegalStateException("Citra directory unavailable when accessing config file!")

View File

@ -12,7 +12,7 @@ import android.hardware.camera2.CameraManager
import android.os.Build import android.os.Build
import android.text.TextUtils import android.text.TextUtils
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import io.github.lime3ds.CitraApplication import io.github.lime3ds.LimeApplication
import io.github.lime3ds.R import io.github.lime3ds.R
import io.github.lime3ds.features.settings.model.AbstractBooleanSetting import io.github.lime3ds.features.settings.model.AbstractBooleanSetting
import io.github.lime3ds.features.settings.model.AbstractIntSetting import io.github.lime3ds.features.settings.model.AbstractIntSetting
@ -60,7 +60,7 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
fun onViewCreated(settingsAdapter: SettingsAdapter) { fun onViewCreated(settingsAdapter: SettingsAdapter) {
this.settingsAdapter = settingsAdapter this.settingsAdapter = settingsAdapter
preferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.appContext) preferences = PreferenceManager.getDefaultSharedPreferences(LimeApplication.appContext)
loadSettingsList() loadSettingsList()
} }

View File

@ -6,7 +6,7 @@ package io.github.lime3ds.features.settings.ui.viewholder
import android.view.View import android.view.View
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import io.github.lime3ds.CitraApplication import io.github.lime3ds.LimeApplication
import io.github.lime3ds.databinding.ListItemSettingBinding import io.github.lime3ds.databinding.ListItemSettingBinding
import io.github.lime3ds.features.settings.model.view.InputBindingSetting import io.github.lime3ds.features.settings.model.view.InputBindingSetting
import io.github.lime3ds.features.settings.model.view.SettingsItem import io.github.lime3ds.features.settings.model.view.SettingsItem
@ -17,7 +17,7 @@ class InputBindingSettingViewHolder(val binding: ListItemSettingBinding, adapter
private lateinit var setting: InputBindingSetting private lateinit var setting: InputBindingSetting
override fun bind(item: SettingsItem) { override fun bind(item: SettingsItem) {
val preferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.appContext) val preferences = PreferenceManager.getDefaultSharedPreferences(LimeApplication.appContext)
setting = item as InputBindingSetting setting = item as InputBindingSetting
binding.textSettingName.setText(item.nameId) binding.textSettingName.setText(item.nameId)
val uiString = preferences.getString(setting.abstractSetting.key, "")!! val uiString = preferences.getString(setting.abstractSetting.key, "")!!

View File

@ -7,7 +7,7 @@ package io.github.lime3ds.features.settings.utils
import android.content.Context import android.content.Context
import android.net.Uri import android.net.Uri
import androidx.documentfile.provider.DocumentFile import androidx.documentfile.provider.DocumentFile
import io.github.lime3ds.CitraApplication import io.github.lime3ds.LimeApplication
import io.github.lime3ds.R import io.github.lime3ds.R
import io.github.lime3ds.features.settings.model.AbstractSetting import io.github.lime3ds.features.settings.model.AbstractSetting
import io.github.lime3ds.features.settings.model.BooleanSetting import io.github.lime3ds.features.settings.model.BooleanSetting
@ -55,7 +55,7 @@ object SettingsFile {
val sections: HashMap<String, SettingSection?> = SettingsSectionMap() val sections: HashMap<String, SettingSection?> = SettingsSectionMap()
var reader: BufferedReader? = null var reader: BufferedReader? = null
try { try {
val context: Context = CitraApplication.appContext val context: Context = LimeApplication.appContext
val inputStream = context.contentResolver.openInputStream(ini.uri) val inputStream = context.contentResolver.openInputStream(ini.uri)
reader = BufferedReader(InputStreamReader(inputStream)) reader = BufferedReader(InputStreamReader(inputStream))
var current: SettingSection? = null var current: SettingSection? = null
@ -125,7 +125,7 @@ object SettingsFile {
) { ) {
val ini = getSettingsFile(fileName) val ini = getSettingsFile(fileName)
try { try {
val context: Context = CitraApplication.appContext val context: Context = LimeApplication.appContext
val inputStream = context.contentResolver.openInputStream(ini.uri) val inputStream = context.contentResolver.openInputStream(ini.uri)
val writer = Wini(inputStream) val writer = Wini(inputStream)
val keySet: Set<String> = sections.keys val keySet: Set<String> = sections.keys
@ -141,7 +141,7 @@ object SettingsFile {
} catch (e: Exception) { } catch (e: Exception) {
Log.error("[SettingsFile] File not found: $fileName.ini: ${e.message}") Log.error("[SettingsFile] File not found: $fileName.ini: ${e.message}")
view.showToastMessage( view.showToastMessage(
CitraApplication.appContext LimeApplication.appContext
.getString(R.string.error_saving, fileName, e.message), false .getString(R.string.error_saving, fileName, e.message), false
) )
} }
@ -153,7 +153,7 @@ object SettingsFile {
) { ) {
val ini = getSettingsFile(fileName) val ini = getSettingsFile(fileName)
try { try {
val context: Context = CitraApplication.appContext val context: Context = LimeApplication.appContext
val inputStream = context.contentResolver.openInputStream(ini.uri) val inputStream = context.contentResolver.openInputStream(ini.uri)
val writer = Wini(inputStream) val writer = Wini(inputStream)
writer.put(setting.section, setting.key, setting.valueAsString) writer.put(setting.section, setting.key, setting.valueAsString)
@ -184,13 +184,13 @@ object SettingsFile {
} }
fun getSettingsFile(fileName: String): DocumentFile { fun getSettingsFile(fileName: String): DocumentFile {
val root = DocumentFile.fromTreeUri(CitraApplication.appContext, Uri.parse(userDirectory)) val root = DocumentFile.fromTreeUri(LimeApplication.appContext, Uri.parse(userDirectory))
val configDirectory = root!!.findFile("config") val configDirectory = root!!.findFile("config")
return configDirectory!!.findFile("$fileName.ini")!! return configDirectory!!.findFile("$fileName.ini")!!
} }
private fun getCustomGameSettingsFile(gameId: String): DocumentFile { private fun getCustomGameSettingsFile(gameId: String): DocumentFile {
val root = DocumentFile.fromTreeUri(CitraApplication.appContext, Uri.parse(userDirectory)) val root = DocumentFile.fromTreeUri(LimeApplication.appContext, Uri.parse(userDirectory))
val configDirectory = root!!.findFile("GameSettings") val configDirectory = root!!.findFile("GameSettings")
return configDirectory!!.findFile("$gameId.ini")!! return configDirectory!!.findFile("$gameId.ini")!!
} }

View File

@ -23,7 +23,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import io.github.lime3ds.CitraApplication import io.github.lime3ds.LimeApplication
import io.github.lime3ds.R import io.github.lime3ds.R
import io.github.lime3ds.databinding.DialogCopyDirBinding import io.github.lime3ds.databinding.DialogCopyDirBinding
import io.github.lime3ds.model.SetupCallback import io.github.lime3ds.model.SetupCallback
@ -125,14 +125,14 @@ class CopyDirProgressDialog : DialogFragment() {
object : FileUtil.CopyDirListener { object : FileUtil.CopyDirListener {
override fun onSearchProgress(directoryName: String) { override fun onSearchProgress(directoryName: String) {
viewModel.onUpdateSearchProgress( viewModel.onUpdateSearchProgress(
CitraApplication.appContext.resources, LimeApplication.appContext.resources,
directoryName directoryName
) )
} }
override fun onCopyProgress(filename: String, progress: Int, max: Int) { override fun onCopyProgress(filename: String, progress: Int, max: Int) {
viewModel.onUpdateCopyProgress( viewModel.onUpdateCopyProgress(
CitraApplication.appContext.resources, LimeApplication.appContext.resources,
filename, filename,
progress, progress,
max max

View File

@ -43,7 +43,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.slider.Slider import com.google.android.material.slider.Slider
import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import io.github.lime3ds.CitraApplication import io.github.lime3ds.LimeApplication
import io.github.lime3ds.EmulationNavigationDirections import io.github.lime3ds.EmulationNavigationDirections
import io.github.lime3ds.NativeLibrary import io.github.lime3ds.NativeLibrary
import io.github.lime3ds.R import io.github.lime3ds.R
@ -70,7 +70,7 @@ import io.github.lime3ds.viewmodel.EmulationViewModel
class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.FrameCallback { class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.FrameCallback {
private val preferences: SharedPreferences private val preferences: SharedPreferences
get() = PreferenceManager.getDefaultSharedPreferences(CitraApplication.appContext) get() = PreferenceManager.getDefaultSharedPreferences(LimeApplication.appContext)
private lateinit var emulationState: EmulationState private lateinit var emulationState: EmulationState
private var perfStatsUpdater: Runnable? = null private var perfStatsUpdater: Runnable? = null

View File

@ -25,7 +25,7 @@ import com.google.android.material.color.MaterialColors
import com.google.android.material.transition.MaterialFadeThrough import com.google.android.material.transition.MaterialFadeThrough
import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import io.github.lime3ds.CitraApplication import io.github.lime3ds.LimeApplication
import io.github.lime3ds.R import io.github.lime3ds.R
import io.github.lime3ds.adapters.GameAdapter import io.github.lime3ds.adapters.GameAdapter
import io.github.lime3ds.databinding.FragmentGamesBinding import io.github.lime3ds.databinding.FragmentGamesBinding
@ -147,7 +147,7 @@ class GamesFragment : Fragment() {
} }
private fun setAdapter(games: List<Game>) { private fun setAdapter(games: List<Game>) {
val preferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.appContext) val preferences = PreferenceManager.getDefaultSharedPreferences(LimeApplication.appContext)
if (preferences.getBoolean(Settings.PREF_SHOW_HOME_APPS, false)) { if (preferences.getBoolean(Settings.PREF_SHOW_HOME_APPS, false)) {
(binding.gridGames.adapter as GameAdapter).submitList(games) (binding.gridGames.adapter as GameAdapter).submitList(games)
} else { } else {

View File

@ -24,7 +24,7 @@ import androidx.navigation.fragment.findNavController
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import com.google.android.material.transition.MaterialSharedAxis import com.google.android.material.transition.MaterialSharedAxis
import io.github.lime3ds.CitraApplication import io.github.lime3ds.LimeApplication
import io.github.lime3ds.R import io.github.lime3ds.R
import io.github.lime3ds.adapters.HomeSettingAdapter import io.github.lime3ds.adapters.HomeSettingAdapter
import io.github.lime3ds.databinding.FragmentHomeSettingsBinding import io.github.lime3ds.databinding.FragmentHomeSettingsBinding
@ -50,7 +50,7 @@ class HomeSettingsFragment : Fragment() {
private val driverViewModel: DriverViewModel by activityViewModels() private val driverViewModel: DriverViewModel by activityViewModels()
private val preferences get() = private val preferences get() =
PreferenceManager.getDefaultSharedPreferences(CitraApplication.appContext) PreferenceManager.getDefaultSharedPreferences(LimeApplication.appContext)
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -188,7 +188,7 @@ class HomeSettingsFragment : Fragment() {
.apply() .apply()
Toast.makeText( Toast.makeText(
CitraApplication.appContext, LimeApplication.appContext,
R.string.games_dir_selected, R.string.games_dir_selected,
Toast.LENGTH_LONG Toast.LENGTH_LONG
).show() ).show()

View File

@ -27,7 +27,7 @@ import androidx.recyclerview.widget.GridLayoutManager
import info.debatty.java.stringsimilarity.Jaccard import info.debatty.java.stringsimilarity.Jaccard
import info.debatty.java.stringsimilarity.JaroWinkler import info.debatty.java.stringsimilarity.JaroWinkler
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import io.github.lime3ds.CitraApplication import io.github.lime3ds.LimeApplication
import io.github.lime3ds.R import io.github.lime3ds.R
import io.github.lime3ds.adapters.GameAdapter import io.github.lime3ds.adapters.GameAdapter
import io.github.lime3ds.databinding.FragmentSearchBinding import io.github.lime3ds.databinding.FragmentSearchBinding
@ -65,7 +65,7 @@ class SearchFragment : Fragment() {
homeViewModel.setNavigationVisibility(visible = true, animated = true) homeViewModel.setNavigationVisibility(visible = true, animated = true)
homeViewModel.setStatusBarShadeVisibility(visible = true) homeViewModel.setStatusBarShadeVisibility(visible = true)
preferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.appContext) preferences = PreferenceManager.getDefaultSharedPreferences(LimeApplication.appContext)
if (savedInstanceState != null) { if (savedInstanceState != null) {
binding.searchText.setText(savedInstanceState.getString(SEARCH_TEXT)) binding.searchText.setText(savedInstanceState.getString(SEARCH_TEXT))

View File

@ -30,7 +30,7 @@ import androidx.preference.PreferenceManager
import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import com.google.android.material.transition.MaterialFadeThrough import com.google.android.material.transition.MaterialFadeThrough
import io.github.lime3ds.CitraApplication import io.github.lime3ds.LimeApplication
import io.github.lime3ds.R import io.github.lime3ds.R
import io.github.lime3ds.adapters.SetupAdapter import io.github.lime3ds.adapters.SetupAdapter
import io.github.lime3ds.databinding.FragmentSetupBinding import io.github.lime3ds.databinding.FragmentSetupBinding
@ -60,7 +60,7 @@ class SetupFragment : Fragment() {
private lateinit var pages: MutableList<SetupPage> private lateinit var pages: MutableList<SetupPage>
private val preferences: SharedPreferences private val preferences: SharedPreferences
get() = PreferenceManager.getDefaultSharedPreferences(CitraApplication.appContext) get() = PreferenceManager.getDefaultSharedPreferences(LimeApplication.appContext)
companion object { companion object {
const val KEY_NEXT_VISIBILITY = "NextButtonVisibility" const val KEY_NEXT_VISIBILITY = "NextButtonVisibility"

View File

@ -26,7 +26,7 @@ import androidx.preference.PreferenceManager
import com.google.android.material.textfield.MaterialAutoCompleteTextView import com.google.android.material.textfield.MaterialAutoCompleteTextView
import com.google.android.material.transition.MaterialSharedAxis import com.google.android.material.transition.MaterialSharedAxis
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import io.github.lime3ds.CitraApplication import io.github.lime3ds.LimeApplication
import io.github.lime3ds.HomeNavigationDirections import io.github.lime3ds.HomeNavigationDirections
import io.github.lime3ds.NativeLibrary import io.github.lime3ds.NativeLibrary
import io.github.lime3ds.R import io.github.lime3ds.R
@ -92,7 +92,7 @@ class SystemFilesFragment : Fragment() {
homeViewModel.setNavigationVisibility(visible = false, animated = true) homeViewModel.setNavigationVisibility(visible = false, animated = true)
homeViewModel.setStatusBarShadeVisibility(visible = false) homeViewModel.setStatusBarShadeVisibility(visible = false)
val preferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.appContext) val preferences = PreferenceManager.getDefaultSharedPreferences(LimeApplication.appContext)
if (!preferences.getBoolean(WARNING_SHOWN, false)) { if (!preferences.getBoolean(WARNING_SHOWN, false)) {
MessageDialogFragment.newInstance( MessageDialogFragment.newInstance(
R.string.home_menu_warning, R.string.home_menu_warning,
@ -155,7 +155,7 @@ class SystemFilesFragment : Fragment() {
} }
private fun reloadUi() { private fun reloadUi() {
val preferences = PreferenceManager.getDefaultSharedPreferences(CitraApplication.appContext) val preferences = PreferenceManager.getDefaultSharedPreferences(LimeApplication.appContext)
binding.switchRunSystemSetup.isChecked = SystemSaveGame.getIsSystemSetupNeeded() binding.switchRunSystemSetup.isChecked = SystemSaveGame.getIsSystemSetupNeeded()
binding.switchRunSystemSetup.setOnCheckedChangeListener { _, isChecked -> binding.switchRunSystemSetup.setOnCheckedChangeListener { _, isChecked ->

View File

@ -21,7 +21,7 @@ import android.view.View
import android.view.View.OnTouchListener import android.view.View.OnTouchListener
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import io.github.lime3ds.CitraApplication import io.github.lime3ds.LimeApplication
import io.github.lime3ds.NativeLibrary import io.github.lime3ds.NativeLibrary
import io.github.lime3ds.R import io.github.lime3ds.R
import io.github.lime3ds.utils.EmulationMenuSettings import io.github.lime3ds.utils.EmulationMenuSettings
@ -778,7 +778,7 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) : SurfaceView(contex
companion object { companion object {
private val preferences private val preferences
get() = PreferenceManager.getDefaultSharedPreferences(CitraApplication.appContext) get() = PreferenceManager.getDefaultSharedPreferences(LimeApplication.appContext)
/** /**
* Resizes a [Bitmap] by a given scale factor * Resizes a [Bitmap] by a given scale factor

Some files were not shown because too many files have changed in this diff Show More