style: format code and remove unnecessary blank lines and imports
This commit is contained in:
parent
0ea1870bbc
commit
6e88a9f1f6
26 changed files with 146 additions and 102 deletions
|
@ -4,7 +4,6 @@
|
||||||
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
|
||||||
package org.yuzu.yuzu_emu
|
package org.yuzu.yuzu_emu
|
||||||
|
|
||||||
import android.content.DialogInterface
|
import android.content.DialogInterface
|
||||||
|
@ -17,7 +16,6 @@ import android.widget.TextView
|
||||||
import androidx.annotation.Keep
|
import androidx.annotation.Keep
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import net.swiftzer.semver.SemVer
|
|
||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
import org.yuzu.yuzu_emu.activities.EmulationActivity
|
import org.yuzu.yuzu_emu.activities.EmulationActivity
|
||||||
import org.yuzu.yuzu_emu.fragments.CoreErrorDialogFragment
|
import org.yuzu.yuzu_emu.fragments.CoreErrorDialogFragment
|
||||||
|
@ -28,7 +26,6 @@ import org.yuzu.yuzu_emu.model.InstallResult
|
||||||
import org.yuzu.yuzu_emu.model.Patch
|
import org.yuzu.yuzu_emu.model.Patch
|
||||||
import org.yuzu.yuzu_emu.model.GameVerificationResult
|
import org.yuzu.yuzu_emu.model.GameVerificationResult
|
||||||
import org.yuzu.yuzu_emu.network.NetPlayManager
|
import org.yuzu.yuzu_emu.network.NetPlayManager
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class which contains methods that interact
|
* Class which contains methods that interact
|
||||||
|
@ -276,8 +273,7 @@ object NativeLibrary {
|
||||||
val emulationActivity = sEmulationActivity.get()
|
val emulationActivity = sEmulationActivity.get()
|
||||||
if (emulationActivity != null) {
|
if (emulationActivity != null) {
|
||||||
emulationActivity.addNetPlayMessages(type, message)
|
emulationActivity.addNetPlayMessages(type, message)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
NetPlayManager.addNetPlayMessage(type, message)
|
NetPlayManager.addNetPlayMessage(type, message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,15 +4,10 @@
|
||||||
package org.yuzu.yuzu_emu.adapters
|
package org.yuzu.yuzu_emu.adapters
|
||||||
|
|
||||||
import android.content.DialogInterface
|
import android.content.DialogInterface
|
||||||
import android.net.Uri
|
|
||||||
import android.text.Html
|
import android.text.Html
|
||||||
import android.text.method.LinkMovementMethod
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.LinearLayout
|
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.TextView
|
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.content.pm.ShortcutInfoCompat
|
import androidx.core.content.pm.ShortcutInfoCompat
|
||||||
|
@ -37,7 +32,6 @@ import org.yuzu.yuzu_emu.model.GamesViewModel
|
||||||
import org.yuzu.yuzu_emu.utils.GameIconUtils
|
import org.yuzu.yuzu_emu.utils.GameIconUtils
|
||||||
import org.yuzu.yuzu_emu.utils.ViewUtils.marquee
|
import org.yuzu.yuzu_emu.utils.ViewUtils.marquee
|
||||||
import org.yuzu.yuzu_emu.viewholder.AbstractViewHolder
|
import org.yuzu.yuzu_emu.viewholder.AbstractViewHolder
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
@ -94,7 +88,7 @@ class GameAdapter(private val activity: AppCompatActivity) :
|
||||||
}
|
}
|
||||||
VIEW_TYPE_CAROUSEL -> {
|
VIEW_TYPE_CAROUSEL -> {
|
||||||
val carouselBinding = holder.binding as CardGameCarouselBinding
|
val carouselBinding = holder.binding as CardGameCarouselBinding
|
||||||
//soothens transient flickering
|
// soothens transient flickering
|
||||||
carouselBinding.cardGameCarousel.scaleY = 0f
|
carouselBinding.cardGameCarousel.scaleY = 0f
|
||||||
carouselBinding.cardGameCarousel.alpha = 0f
|
carouselBinding.cardGameCarousel.alpha = 0f
|
||||||
}
|
}
|
||||||
|
@ -103,9 +97,21 @@ class GameAdapter(private val activity: AppCompatActivity) :
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GameViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GameViewHolder {
|
||||||
val binding = when (viewType) {
|
val binding = when (viewType) {
|
||||||
VIEW_TYPE_LIST -> CardGameListBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
VIEW_TYPE_LIST -> CardGameListBinding.inflate(
|
||||||
VIEW_TYPE_GRID -> CardGameGridBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
LayoutInflater.from(parent.context),
|
||||||
VIEW_TYPE_CAROUSEL -> CardGameCarouselBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
parent,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
VIEW_TYPE_GRID -> CardGameGridBinding.inflate(
|
||||||
|
LayoutInflater.from(parent.context),
|
||||||
|
parent,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
VIEW_TYPE_CAROUSEL -> CardGameCarouselBinding.inflate(
|
||||||
|
LayoutInflater.from(parent.context),
|
||||||
|
parent,
|
||||||
|
false
|
||||||
|
)
|
||||||
else -> throw IllegalArgumentException("Invalid view type")
|
else -> throw IllegalArgumentException("Invalid view type")
|
||||||
}
|
}
|
||||||
return GameViewHolder(binding, viewType)
|
return GameViewHolder(binding, viewType)
|
||||||
|
@ -212,7 +218,10 @@ class GameAdapter(private val activity: AppCompatActivity) :
|
||||||
.setIcon(GameIconUtils.getShortcutIcon(activity, game))
|
.setIcon(GameIconUtils.getShortcutIcon(activity, game))
|
||||||
.setIntent(game.launchIntent)
|
.setIntent(game.launchIntent)
|
||||||
.build()
|
.build()
|
||||||
ShortcutManagerCompat.pushDynamicShortcut(YuzuApplication.appContext, shortcut)
|
ShortcutManagerCompat.pushDynamicShortcut(
|
||||||
|
YuzuApplication.appContext,
|
||||||
|
shortcut
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +241,7 @@ class GameAdapter(private val activity: AppCompatActivity) :
|
||||||
.setPositiveButton(android.R.string.ok) { _: DialogInterface?, _: Int ->
|
.setPositiveButton(android.R.string.ok) { _: DialogInterface?, _: Int ->
|
||||||
launch()
|
launch()
|
||||||
}
|
}
|
||||||
.setNegativeButton(android.R.string.cancel) { _,_ -> }
|
.setNegativeButton(android.R.string.cancel) { _, _ -> }
|
||||||
.show()
|
.show()
|
||||||
} else {
|
} else {
|
||||||
launch()
|
launch()
|
||||||
|
|
|
@ -6,10 +6,8 @@ package org.yuzu.yuzu_emu.adapters
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import androidx.core.content.res.ResourcesCompat
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import androidx.lifecycle.LifecycleOwner
|
import androidx.lifecycle.LifecycleOwner
|
||||||
import org.yuzu.yuzu_emu.R
|
|
||||||
import org.yuzu.yuzu_emu.databinding.CardHomeOptionBinding
|
import org.yuzu.yuzu_emu.databinding.CardHomeOptionBinding
|
||||||
import org.yuzu.yuzu_emu.fragments.MessageDialogFragment
|
import org.yuzu.yuzu_emu.fragments.MessageDialogFragment
|
||||||
import org.yuzu.yuzu_emu.model.HomeSetting
|
import org.yuzu.yuzu_emu.model.HomeSetting
|
||||||
|
|
|
@ -220,7 +220,7 @@ class LobbyBrowser(context: Context) : BottomSheetDialog(context) {
|
||||||
val baseList = NetPlayManager.getPublicRooms()
|
val baseList = NetPlayManager.getPublicRooms()
|
||||||
val filteredList = baseList.filter { room ->
|
val filteredList = baseList.filter { room ->
|
||||||
(!binding.chipHideFull.isChecked || room.members.size < room.maxPlayers) &&
|
(!binding.chipHideFull.isChecked || room.members.size < room.maxPlayers) &&
|
||||||
(!binding.chipHideEmpty.isChecked || room.members.isNotEmpty())
|
(!binding.chipHideEmpty.isChecked || room.members.isNotEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
if (binding.searchText.text.toString().isEmpty() &&
|
if (binding.searchText.text.toString().isEmpty() &&
|
||||||
|
@ -245,7 +245,6 @@ class LobbyBrowser(context: Context) : BottomSheetDialog(context) {
|
||||||
it.score
|
it.score
|
||||||
}.map { it.item }
|
}.map { it.item }
|
||||||
adapter.updateRooms(sortedList)
|
adapter.updateRooms(sortedList)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import android.widget.EditText
|
|
||||||
import android.widget.PopupMenu
|
import android.widget.PopupMenu
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
@ -38,7 +37,6 @@ import org.yuzu.yuzu_emu.network.NetDataValidators
|
||||||
import org.yuzu.yuzu_emu.network.NetPlayManager
|
import org.yuzu.yuzu_emu.network.NetPlayManager
|
||||||
import org.yuzu.yuzu_emu.utils.CompatUtils
|
import org.yuzu.yuzu_emu.utils.CompatUtils
|
||||||
import org.yuzu.yuzu_emu.utils.GameHelper
|
import org.yuzu.yuzu_emu.utils.GameHelper
|
||||||
import java.net.InetAddress
|
|
||||||
|
|
||||||
class NetPlayDialog(context: Context) : BottomSheetDialog(context) {
|
class NetPlayDialog(context: Context) : BottomSheetDialog(context) {
|
||||||
private lateinit var adapter: NetPlayAdapter
|
private lateinit var adapter: NetPlayAdapter
|
||||||
|
@ -55,7 +53,9 @@ class NetPlayDialog(context: Context) : BottomSheetDialog(context) {
|
||||||
context.resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
|
context.resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
|
||||||
|
|
||||||
when {
|
when {
|
||||||
NetPlayManager.netPlayIsJoined() -> DialogMultiplayerLobbyBinding.inflate(layoutInflater)
|
NetPlayManager.netPlayIsJoined() -> DialogMultiplayerLobbyBinding.inflate(
|
||||||
|
layoutInflater
|
||||||
|
)
|
||||||
.apply {
|
.apply {
|
||||||
setContentView(root)
|
setContentView(root)
|
||||||
adapter = NetPlayAdapter()
|
adapter = NetPlayAdapter()
|
||||||
|
@ -77,7 +77,6 @@ class NetPlayDialog(context: Context) : BottomSheetDialog(context) {
|
||||||
btnModeration.setOnClickListener {
|
btnModeration.setOnClickListener {
|
||||||
showModerationDialog()
|
showModerationDialog()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
|
@ -140,7 +139,8 @@ class NetPlayDialog(context: Context) : BottomSheetDialog(context) {
|
||||||
inner class NetPlayAdapter : RecyclerView.Adapter<NetPlayAdapter.NetPlayViewHolder>() {
|
inner class NetPlayAdapter : RecyclerView.Adapter<NetPlayAdapter.NetPlayViewHolder>() {
|
||||||
val netPlayItems = mutableListOf<NetPlayItems>()
|
val netPlayItems = mutableListOf<NetPlayItems>()
|
||||||
|
|
||||||
abstract inner class NetPlayViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView),
|
abstract inner class NetPlayViewHolder(itemView: View) :
|
||||||
|
RecyclerView.ViewHolder(itemView),
|
||||||
View.OnClickListener {
|
View.OnClickListener {
|
||||||
init {
|
init {
|
||||||
itemView.setOnClickListener(this)
|
itemView.setOnClickListener(this)
|
||||||
|
@ -167,7 +167,9 @@ class NetPlayDialog(context: Context) : BottomSheetDialog(context) {
|
||||||
visibility = if (iconRes != 0) {
|
visibility = if (iconRes != 0) {
|
||||||
setImageResource(iconRes)
|
setImageResource(iconRes)
|
||||||
View.VISIBLE
|
View.VISIBLE
|
||||||
} else View.GONE
|
} else {
|
||||||
|
View.GONE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,14 +188,13 @@ class NetPlayDialog(context: Context) : BottomSheetDialog(context) {
|
||||||
|
|
||||||
override fun onClick(clicked: View) {}
|
override fun onClick(clicked: View) {}
|
||||||
|
|
||||||
|
|
||||||
private fun showPopupMenu(view: View) {
|
private fun showPopupMenu(view: View) {
|
||||||
PopupMenu(view.context, view).apply {
|
PopupMenu(view.context, view).apply {
|
||||||
menuInflater.inflate(R.menu.menu_netplay_member, menu)
|
menuInflater.inflate(R.menu.menu_netplay_member, menu)
|
||||||
menu.findItem(R.id.action_kick).isEnabled = isModerator &&
|
menu.findItem(R.id.action_kick).isEnabled = isModerator &&
|
||||||
netPlayItems.name != StringSetting.WEB_USERNAME.getString()
|
netPlayItems.name != StringSetting.WEB_USERNAME.getString()
|
||||||
menu.findItem(R.id.action_ban).isEnabled = isModerator &&
|
menu.findItem(R.id.action_ban).isEnabled = isModerator &&
|
||||||
netPlayItems.name != StringSetting.WEB_USERNAME.getString()
|
netPlayItems.name != StringSetting.WEB_USERNAME.getString()
|
||||||
setOnMenuItemClickListener { item ->
|
setOnMenuItemClickListener { item ->
|
||||||
if (item.itemId == R.id.action_kick) {
|
if (item.itemId == R.id.action_kick) {
|
||||||
NetPlayManager.netPlayKickUser(netPlayItems.name)
|
NetPlayManager.netPlayKickUser(netPlayItems.name)
|
||||||
|
@ -201,7 +202,9 @@ class NetPlayDialog(context: Context) : BottomSheetDialog(context) {
|
||||||
} else if (item.itemId == R.id.action_ban) {
|
} else if (item.itemId == R.id.action_ban) {
|
||||||
NetPlayManager.netPlayBanUser(netPlayItems.name)
|
NetPlayManager.netPlayBanUser(netPlayItems.name)
|
||||||
true
|
true
|
||||||
} else false
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
show()
|
show()
|
||||||
}
|
}
|
||||||
|
@ -360,12 +363,15 @@ class NetPlayDialog(context: Context) : BottomSheetDialog(context) {
|
||||||
|
|
||||||
val visibilityList: List<String> = listOf(
|
val visibilityList: List<String> = listOf(
|
||||||
context.getString(R.string.multiplayer_public_visibility),
|
context.getString(R.string.multiplayer_public_visibility),
|
||||||
context.getString(R.string.multiplayer_unlisted_visibility),
|
context.getString(R.string.multiplayer_unlisted_visibility)
|
||||||
)
|
)
|
||||||
|
|
||||||
binding.textTitle.text = activity.getString(
|
binding.textTitle.text = activity.getString(
|
||||||
if (isCreateRoom) R.string.multiplayer_create_room
|
if (isCreateRoom) {
|
||||||
else R.string.multiplayer_join_room
|
R.string.multiplayer_create_room
|
||||||
|
} else {
|
||||||
|
R.string.multiplayer_join_room
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// setup listeners etc
|
// setup listeners etc
|
||||||
|
@ -446,7 +452,9 @@ class NetPlayDialog(context: Context) : BottomSheetDialog(context) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.dropdownLobbyVisibility.setText(context.getString(R.string.multiplayer_unlisted_visibility))
|
binding.dropdownLobbyVisibility.setText(
|
||||||
|
context.getString(R.string.multiplayer_unlisted_visibility)
|
||||||
|
)
|
||||||
|
|
||||||
binding.dropdownLobbyVisibility.apply {
|
binding.dropdownLobbyVisibility.apply {
|
||||||
setAdapter(
|
setAdapter(
|
||||||
|
@ -501,8 +509,11 @@ class NetPlayDialog(context: Context) : BottomSheetDialog(context) {
|
||||||
binding.btnConfirm.isEnabled = false
|
binding.btnConfirm.isEnabled = false
|
||||||
binding.btnConfirm.text =
|
binding.btnConfirm.text =
|
||||||
activity.getString(
|
activity.getString(
|
||||||
if (isCreateRoom) R.string.multiplayer_creating
|
if (isCreateRoom) {
|
||||||
else R.string.multiplayer_joining
|
R.string.multiplayer_creating
|
||||||
|
} else {
|
||||||
|
R.string.multiplayer_joining
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// We don't need to worry about validation because it's already been done.
|
// We don't need to worry about validation because it's already been done.
|
||||||
|
@ -546,8 +557,11 @@ class NetPlayDialog(context: Context) : BottomSheetDialog(context) {
|
||||||
|
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
YuzuApplication.appContext,
|
YuzuApplication.appContext,
|
||||||
if (isCreateRoom) R.string.multiplayer_create_room_success
|
if (isCreateRoom) {
|
||||||
else R.string.multiplayer_join_room_success,
|
R.string.multiplayer_create_room_success
|
||||||
|
} else {
|
||||||
|
R.string.multiplayer_join_room_success
|
||||||
|
},
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show()
|
).show()
|
||||||
|
|
||||||
|
@ -619,7 +633,9 @@ class NetPlayDialog(context: Context) : BottomSheetDialog(context) {
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
val binding = ItemBanListBinding.inflate(
|
val binding = ItemBanListBinding.inflate(
|
||||||
LayoutInflater.from(parent.context), parent, false
|
LayoutInflater.from(parent.context),
|
||||||
|
parent,
|
||||||
|
false
|
||||||
)
|
)
|
||||||
return ViewHolder(binding)
|
return ViewHolder(binding)
|
||||||
}
|
}
|
||||||
|
@ -654,6 +670,5 @@ class NetPlayDialog(context: Context) : BottomSheetDialog(context) {
|
||||||
notifyItemRemoved(position)
|
notifyItemRemoved(position)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ class ReleaseAdapter(
|
||||||
|
|
||||||
// truncates to 150 chars so it does not take up too much space.
|
// truncates to 150 chars so it does not take up too much space.
|
||||||
var bodyPreview = release.body.take(150)
|
var bodyPreview = release.body.take(150)
|
||||||
bodyPreview = bodyPreview.replace("#", "").removeSurrounding(" ");
|
bodyPreview = bodyPreview.replace("#", "").removeSurrounding(" ")
|
||||||
|
|
||||||
val body =
|
val body =
|
||||||
bodyPreview.replace("\\r\\n", "\n").replace("\\n", "\n").replace("\n", "<br>")
|
bodyPreview.replace("\\r\\n", "\n").replace("\\n", "\n").replace("\n", "<br>")
|
||||||
|
@ -122,8 +122,11 @@ class ReleaseAdapter(
|
||||||
|
|
||||||
binding.imageDownloadsArrow.rotation = if (isVisible) 0f else 180f
|
binding.imageDownloadsArrow.rotation = if (isVisible) 0f else 180f
|
||||||
binding.buttonToggleDownloads.text =
|
binding.buttonToggleDownloads.text =
|
||||||
if (isVisible) activity.getString(R.string.show_downloads)
|
if (isVisible) {
|
||||||
else activity.getString(R.string.hide_downloads)
|
activity.getString(R.string.show_downloads)
|
||||||
|
} else {
|
||||||
|
activity.getString(R.string.hide_downloads)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.buttonToggleDownloads.setOnClickListener {
|
binding.buttonToggleDownloads.setOnClickListener {
|
||||||
|
@ -139,9 +142,15 @@ class ReleaseAdapter(
|
||||||
release.artifacts.forEach { artifact ->
|
release.artifacts.forEach { artifact ->
|
||||||
val button = MaterialButton(binding.root.context).apply {
|
val button = MaterialButton(binding.root.context).apply {
|
||||||
text = artifact.name
|
text = artifact.name
|
||||||
setTextAppearance(com.google.android.material.R.style.TextAppearance_Material3_LabelLarge)
|
setTextAppearance(
|
||||||
|
com.google.android.material.R.style.TextAppearance_Material3_LabelLarge
|
||||||
|
)
|
||||||
textAlignment = MaterialButton.TEXT_ALIGNMENT_VIEW_START
|
textAlignment = MaterialButton.TEXT_ALIGNMENT_VIEW_START
|
||||||
setBackgroundColor(context.getColor(com.google.android.material.R.color.m3_button_background_color_selector))
|
setBackgroundColor(
|
||||||
|
context.getColor(
|
||||||
|
com.google.android.material.R.color.m3_button_background_color_selector
|
||||||
|
)
|
||||||
|
)
|
||||||
setIconResource(R.drawable.ic_import)
|
setIconResource(R.drawable.ic_import)
|
||||||
iconTint = ColorStateList.valueOf(
|
iconTint = ColorStateList.valueOf(
|
||||||
MaterialColors.getColor(
|
MaterialColors.getColor(
|
||||||
|
@ -199,7 +208,9 @@ class ReleaseAdapter(
|
||||||
input.copyTo(output)
|
input.copyTo(output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?: throw IOException(context.getString(R.string.empty_response_body))
|
?: throw IOException(
|
||||||
|
context.getString(R.string.empty_response_body)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +222,9 @@ class ReleaseAdapter(
|
||||||
|
|
||||||
val driverData = GpuDriverHelper.getMetadataFromZip(file)
|
val driverData = GpuDriverHelper.getMetadataFromZip(file)
|
||||||
val driverPath =
|
val driverPath =
|
||||||
"${GpuDriverHelper.driverStoragePath}${FileUtil.getFilename(file.toUri())}"
|
"${GpuDriverHelper.driverStoragePath}${FileUtil.getFilename(
|
||||||
|
file.toUri()
|
||||||
|
)}"
|
||||||
|
|
||||||
if (GpuDriverHelper.copyDriverToInternalStorage(file.toUri())) {
|
if (GpuDriverHelper.copyDriverToInternalStorage(file.toUri())) {
|
||||||
driverViewModel.onDriverAdded(Pair(driverPath, driverData))
|
driverViewModel.onDriverAdded(Pair(driverPath, driverData))
|
||||||
|
@ -254,7 +267,9 @@ class ReleaseAdapter(
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ReleaseViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ReleaseViewHolder {
|
||||||
val binding = ItemReleaseBinding.inflate(
|
val binding = ItemReleaseBinding.inflate(
|
||||||
LayoutInflater.from(parent.context), parent, false
|
LayoutInflater.from(parent.context),
|
||||||
|
parent,
|
||||||
|
false
|
||||||
)
|
)
|
||||||
return ReleaseViewHolder(binding)
|
return ReleaseViewHolder(binding)
|
||||||
}
|
}
|
||||||
|
@ -264,4 +279,4 @@ class ReleaseAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount(): Int = releases.size
|
override fun getItemCount(): Int = releases.size
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,4 +16,4 @@ class SpacingItemDecoration(private val spacing: Int) : RecyclerView.ItemDecorat
|
||||||
outRect.top = spacing
|
outRect.top = spacing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ enum class IntSetting(override val key: String) : AbstractIntSetting {
|
||||||
OFFLINE_WEB_APPLET("offline_web_applet_mode"),
|
OFFLINE_WEB_APPLET("offline_web_applet_mode"),
|
||||||
LOGIN_SHARE_APPLET("login_share_applet_mode"),
|
LOGIN_SHARE_APPLET("login_share_applet_mode"),
|
||||||
WIFI_WEB_AUTH_APPLET("wifi_web_auth_applet_mode"),
|
WIFI_WEB_AUTH_APPLET("wifi_web_auth_applet_mode"),
|
||||||
MY_PAGE_APPLET("my_page_applet_mode"),
|
MY_PAGE_APPLET("my_page_applet_mode")
|
||||||
;
|
;
|
||||||
|
|
||||||
override fun getInt(needsGlobal: Boolean): Int = NativeConfig.getInt(key, needsGlobal)
|
override fun getInt(needsGlobal: Boolean): Int = NativeConfig.getInt(key, needsGlobal)
|
||||||
|
|
|
@ -13,7 +13,7 @@ enum class StringSetting(override val key: String) : AbstractStringSetting {
|
||||||
DEVICE_NAME("device_name"),
|
DEVICE_NAME("device_name"),
|
||||||
|
|
||||||
WEB_TOKEN("eden_token"),
|
WEB_TOKEN("eden_token"),
|
||||||
WEB_USERNAME("eden_username"),
|
WEB_USERNAME("eden_username")
|
||||||
;
|
;
|
||||||
|
|
||||||
override fun getString(needsGlobal: Boolean): String = NativeConfig.getString(key, needsGlobal)
|
override fun getString(needsGlobal: Boolean): String = NativeConfig.getString(key, needsGlobal)
|
||||||
|
|
|
@ -21,7 +21,6 @@ import org.yuzu.yuzu_emu.features.settings.model.LongSetting
|
||||||
import org.yuzu.yuzu_emu.features.settings.model.ShortSetting
|
import org.yuzu.yuzu_emu.features.settings.model.ShortSetting
|
||||||
import org.yuzu.yuzu_emu.features.settings.model.StringSetting
|
import org.yuzu.yuzu_emu.features.settings.model.StringSetting
|
||||||
import org.yuzu.yuzu_emu.network.NetDataValidators
|
import org.yuzu.yuzu_emu.network.NetDataValidators
|
||||||
import org.yuzu.yuzu_emu.utils.GpuDriverHelper
|
|
||||||
import org.yuzu.yuzu_emu.utils.NativeConfig
|
import org.yuzu.yuzu_emu.utils.NativeConfig
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,7 +78,7 @@ abstract class SettingsItem(
|
||||||
|
|
||||||
val needsRuntimeGlobal: Boolean
|
val needsRuntimeGlobal: Boolean
|
||||||
get() = NativeLibrary.isRunning() && !setting.global &&
|
get() = NativeLibrary.isRunning() && !setting.global &&
|
||||||
!NativeConfig.isPerGameConfigLoaded()
|
!NativeConfig.isPerGameConfigLoaded()
|
||||||
|
|
||||||
val clearable: Boolean
|
val clearable: Boolean
|
||||||
get() = !setting.global && NativeConfig.isPerGameConfigLoaded()
|
get() = !setting.global && NativeConfig.isPerGameConfigLoaded()
|
||||||
|
@ -516,7 +515,6 @@ abstract class SettingsItem(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
put(
|
put(
|
||||||
SingleChoiceSetting(
|
SingleChoiceSetting(
|
||||||
IntSetting.RENDERER_VSYNC,
|
IntSetting.RENDERER_VSYNC,
|
||||||
|
@ -724,7 +722,7 @@ abstract class SettingsItem(
|
||||||
val fastmem = object : AbstractBooleanSetting {
|
val fastmem = object : AbstractBooleanSetting {
|
||||||
override fun getBoolean(needsGlobal: Boolean): Boolean =
|
override fun getBoolean(needsGlobal: Boolean): Boolean =
|
||||||
BooleanSetting.FASTMEM.getBoolean() &&
|
BooleanSetting.FASTMEM.getBoolean() &&
|
||||||
BooleanSetting.FASTMEM_EXCLUSIVES.getBoolean()
|
BooleanSetting.FASTMEM_EXCLUSIVES.getBoolean()
|
||||||
|
|
||||||
override fun setBoolean(value: Boolean) {
|
override fun setBoolean(value: Boolean) {
|
||||||
BooleanSetting.FASTMEM.setBoolean(value)
|
BooleanSetting.FASTMEM.setBoolean(value)
|
||||||
|
@ -739,7 +737,7 @@ abstract class SettingsItem(
|
||||||
override var global: Boolean
|
override var global: Boolean
|
||||||
get() {
|
get() {
|
||||||
return BooleanSetting.FASTMEM.global &&
|
return BooleanSetting.FASTMEM.global &&
|
||||||
BooleanSetting.FASTMEM_EXCLUSIVES.global
|
BooleanSetting.FASTMEM_EXCLUSIVES.global
|
||||||
}
|
}
|
||||||
set(value) {
|
set(value) {
|
||||||
BooleanSetting.FASTMEM.global = value
|
BooleanSetting.FASTMEM.global = value
|
||||||
|
|
|
@ -18,7 +18,7 @@ class SingleChoiceSetting(
|
||||||
@ArrayRes val choicesId: Int,
|
@ArrayRes val choicesId: Int,
|
||||||
@ArrayRes val valuesId: Int,
|
@ArrayRes val valuesId: Int,
|
||||||
val warnChoices: List<Int> = ArrayList(),
|
val warnChoices: List<Int> = ArrayList(),
|
||||||
@StringRes val warningMessage: Int = 0,
|
@StringRes val warningMessage: Int = 0
|
||||||
) : SettingsItem(setting, titleId, titleString, descriptionId, descriptionString) {
|
) : SettingsItem(setting, titleId, titleString, descriptionId, descriptionString) {
|
||||||
override val type = TYPE_SINGLE_CHOICE
|
override val type = TYPE_SINGLE_CHOICE
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
package org.yuzu.yuzu_emu.features.settings.model.view
|
package org.yuzu.yuzu_emu.features.settings.model.view
|
||||||
|
|
||||||
import android.text.Editable
|
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import org.yuzu.yuzu_emu.features.settings.model.AbstractStringSetting
|
import org.yuzu.yuzu_emu.features.settings.model.AbstractStringSetting
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,13 @@ class SettingsDialogFragment : DialogFragment(), DialogInterface.OnClickListener
|
||||||
override fun afterTextChanged(s: Editable?) {
|
override fun afterTextChanged(s: Editable?) {
|
||||||
val isValid = validator(s.toString())
|
val isValid = validator(s.toString())
|
||||||
stringInputBinding.editTextLayout.isErrorEnabled = !isValid
|
stringInputBinding.editTextLayout.isErrorEnabled = !isValid
|
||||||
stringInputBinding.editTextLayout.error = if (isValid) null else requireContext().getString(item.errorId)
|
stringInputBinding.editTextLayout.error = if (isValid) {
|
||||||
|
null
|
||||||
|
} else {
|
||||||
|
requireContext().getString(
|
||||||
|
item.errorId
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.content.edit
|
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
import androidx.core.view.updatePadding
|
import androidx.core.view.updatePadding
|
||||||
|
@ -16,13 +15,11 @@ import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.navigation.findNavController
|
import androidx.navigation.findNavController
|
||||||
import androidx.navigation.fragment.navArgs
|
import androidx.navigation.fragment.navArgs
|
||||||
import androidx.preference.PreferenceManager
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.google.android.material.transition.MaterialSharedAxis
|
import com.google.android.material.transition.MaterialSharedAxis
|
||||||
import org.yuzu.yuzu_emu.R
|
import org.yuzu.yuzu_emu.R
|
||||||
import org.yuzu.yuzu_emu.databinding.FragmentSettingsBinding
|
import org.yuzu.yuzu_emu.databinding.FragmentSettingsBinding
|
||||||
import org.yuzu.yuzu_emu.features.input.NativeInput
|
import org.yuzu.yuzu_emu.features.input.NativeInput
|
||||||
import org.yuzu.yuzu_emu.features.settings.model.BooleanSetting
|
|
||||||
import org.yuzu.yuzu_emu.features.settings.model.Settings
|
import org.yuzu.yuzu_emu.features.settings.model.Settings
|
||||||
import org.yuzu.yuzu_emu.fragments.MessageDialogFragment
|
import org.yuzu.yuzu_emu.fragments.MessageDialogFragment
|
||||||
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
package org.yuzu.yuzu_emu.features.settings.ui
|
package org.yuzu.yuzu_emu.features.settings.ui
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.Activity
|
|
||||||
import android.app.AlertDialog
|
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
|
@ -1056,7 +1054,9 @@ class SettingsFragmentPresenter(
|
||||||
}
|
}
|
||||||
|
|
||||||
val staticThemeColor: AbstractIntSetting = object : AbstractIntSetting {
|
val staticThemeColor: AbstractIntSetting = object : AbstractIntSetting {
|
||||||
val preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext)
|
val preferences = PreferenceManager.getDefaultSharedPreferences(
|
||||||
|
YuzuApplication.appContext
|
||||||
|
)
|
||||||
override fun getInt(needsGlobal: Boolean): Int =
|
override fun getInt(needsGlobal: Boolean): Int =
|
||||||
preferences.getInt(Settings.PREF_STATIC_THEME_COLOR, 0)
|
preferences.getInt(Settings.PREF_STATIC_THEME_COLOR, 0)
|
||||||
override fun setInt(value: Int) {
|
override fun setInt(value: Int) {
|
||||||
|
|
|
@ -27,7 +27,6 @@ import androidx.navigation.findNavController
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
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 org.yuzu.yuzu_emu.BuildConfig
|
|
||||||
import org.yuzu.yuzu_emu.HomeNavigationDirections
|
import org.yuzu.yuzu_emu.HomeNavigationDirections
|
||||||
import org.yuzu.yuzu_emu.NativeLibrary
|
import org.yuzu.yuzu_emu.NativeLibrary
|
||||||
import org.yuzu.yuzu_emu.R
|
import org.yuzu.yuzu_emu.R
|
||||||
|
@ -41,9 +40,7 @@ import org.yuzu.yuzu_emu.model.HomeSetting
|
||||||
import org.yuzu.yuzu_emu.model.HomeViewModel
|
import org.yuzu.yuzu_emu.model.HomeViewModel
|
||||||
import org.yuzu.yuzu_emu.ui.main.MainActivity
|
import org.yuzu.yuzu_emu.ui.main.MainActivity
|
||||||
import org.yuzu.yuzu_emu.utils.FileUtil
|
import org.yuzu.yuzu_emu.utils.FileUtil
|
||||||
import org.yuzu.yuzu_emu.utils.GpuDriverHelper
|
|
||||||
import org.yuzu.yuzu_emu.utils.Log
|
import org.yuzu.yuzu_emu.utils.Log
|
||||||
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
|
||||||
|
|
||||||
class HomeSettingsFragment : Fragment() {
|
class HomeSettingsFragment : Fragment() {
|
||||||
private var _binding: FragmentHomeSettingsBinding? = null
|
private var _binding: FragmentHomeSettingsBinding? = null
|
||||||
|
@ -112,7 +109,7 @@ class HomeSettingsFragment : Fragment() {
|
||||||
.actionHomeSettingsFragmentToDriverManagerFragment(null)
|
.actionHomeSettingsFragmentToDriverManagerFragment(null)
|
||||||
binding.root.findNavController().navigate(action)
|
binding.root.findNavController().navigate(action)
|
||||||
},
|
},
|
||||||
{true},
|
{ true },
|
||||||
R.string.custom_driver_not_supported,
|
R.string.custom_driver_not_supported,
|
||||||
R.string.custom_driver_not_supported_description,
|
R.string.custom_driver_not_supported_description,
|
||||||
driverViewModel.selectedDriverTitle
|
driverViewModel.selectedDriverTitle
|
||||||
|
@ -125,7 +122,7 @@ class HomeSettingsFragment : Fragment() {
|
||||||
R.drawable.ic_two_users,
|
R.drawable.ic_two_users,
|
||||||
{
|
{
|
||||||
mainActivity.displayMultiplayerDialog()
|
mainActivity.displayMultiplayerDialog()
|
||||||
},
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
add(
|
add(
|
||||||
|
@ -403,7 +400,7 @@ class HomeSettingsFragment : Fragment() {
|
||||||
val cutoutInsets = windowInsets.getInsets(WindowInsetsCompat.Type.displayCutout())
|
val cutoutInsets = windowInsets.getInsets(WindowInsetsCompat.Type.displayCutout())
|
||||||
|
|
||||||
binding.scrollViewSettings.updatePadding(
|
binding.scrollViewSettings.updatePadding(
|
||||||
top = barInsets.top,
|
top = barInsets.top
|
||||||
)
|
)
|
||||||
|
|
||||||
binding.homeSettingsList.updatePadding(
|
binding.homeSettingsList.updatePadding(
|
||||||
|
|
|
@ -134,10 +134,10 @@ class InstallableFragment : Fragment() {
|
||||||
install = { mainActivity.getFirmware.launch(arrayOf("application/zip")) }
|
install = { mainActivity.getFirmware.launch(arrayOf("application/zip")) }
|
||||||
),
|
),
|
||||||
Installable(
|
Installable(
|
||||||
R.string.uninstall_firmware,
|
R.string.uninstall_firmware,
|
||||||
R.string.uninstall_firmware_description,
|
R.string.uninstall_firmware_description,
|
||||||
install = { mainActivity.uninstallFirmware() }
|
install = { mainActivity.uninstallFirmware() }
|
||||||
),
|
),
|
||||||
Installable(
|
Installable(
|
||||||
R.string.install_prod_keys,
|
R.string.install_prod_keys,
|
||||||
R.string.install_prod_keys_description,
|
R.string.install_prod_keys_description,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// SPDX-FileCopyrightText: 2025 Eden Emulator Project
|
// SPDX-FileCopyrightText: 2025 Eden Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
|
||||||
package org.yuzu.yuzu_emu.fragments
|
package org.yuzu.yuzu_emu.fragments
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
|
|
@ -78,7 +78,6 @@ class SetupFragment : Fragment() {
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
mainActivity = requireActivity() as MainActivity
|
mainActivity = requireActivity() as MainActivity
|
||||||
|
|
||||||
|
|
||||||
requireActivity().onBackPressedDispatcher.addCallback(
|
requireActivity().onBackPressedDispatcher.addCallback(
|
||||||
viewLifecycleOwner,
|
viewLifecycleOwner,
|
||||||
object : OnBackPressedCallback(true) {
|
object : OnBackPressedCallback(true) {
|
||||||
|
@ -129,7 +128,7 @@ class SetupFragment : Fragment() {
|
||||||
0,
|
0,
|
||||||
{
|
{
|
||||||
if (NotificationManagerCompat.from(requireContext())
|
if (NotificationManagerCompat.from(requireContext())
|
||||||
.areNotificationsEnabled()
|
.areNotificationsEnabled()
|
||||||
) {
|
) {
|
||||||
StepState.COMPLETE
|
StepState.COMPLETE
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -22,7 +22,11 @@ class MidScreenSwipeRefreshLayout @JvmOverloads constructor(
|
||||||
MotionEvent.ACTION_DOWN -> {
|
MotionEvent.ACTION_DOWN -> {
|
||||||
startX = ev.x
|
startX = ev.x
|
||||||
val width = width
|
val width = width
|
||||||
val center_fraction = resources.getFraction(R.fraction.carousel_midscreenswipe_width_fraction, 1, 1).coerceIn(0f, 1f)
|
val center_fraction = resources.getFraction(
|
||||||
|
R.fraction.carousel_midscreenswipe_width_fraction,
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
).coerceIn(0f, 1f)
|
||||||
val leftBound = ((1 - center_fraction) / 2) * width
|
val leftBound = ((1 - center_fraction) / 2) * width
|
||||||
val rightBound = leftBound + (width * center_fraction)
|
val rightBound = leftBound + (width * center_fraction)
|
||||||
allowRefresh = startX >= leftBound && startX <= rightBound
|
allowRefresh = startX >= leftBound && startX <= rightBound
|
||||||
|
@ -30,4 +34,4 @@ class MidScreenSwipeRefreshLayout @JvmOverloads constructor(
|
||||||
}
|
}
|
||||||
return if (allowRefresh) super.onInterceptTouchEvent(ev) else false
|
return if (allowRefresh) super.onInterceptTouchEvent(ev) else false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,7 @@ class GamesViewModel : ViewModel() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addFolder(gameDir: GameDir, savedFromGameFragment: Boolean) =
|
fun addFolder(gameDir: GameDir, savedFromGameFragment: Boolean) =
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
NativeConfig.addGameDir(gameDir)
|
NativeConfig.addGameDir(gameDir)
|
||||||
|
|
|
@ -27,7 +27,7 @@ object NetDataValidators {
|
||||||
|
|
||||||
fun roomVisibility(s: String, context: Context): Boolean {
|
fun roomVisibility(s: String, context: Context): Boolean {
|
||||||
if (s != context.getString(R.string.multiplayer_public_visibility)) {
|
if (s != context.getString(R.string.multiplayer_public_visibility)) {
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return token()
|
return token()
|
||||||
|
@ -53,4 +53,4 @@ object NetDataValidators {
|
||||||
fun port(s: String): Boolean {
|
fun port(s: String): Boolean {
|
||||||
return s.toIntOrNull() in 1..65535
|
return s.toIntOrNull() in 1..65535
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,6 @@ object NetPlayManager {
|
||||||
val gameName: String
|
val gameName: String
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
private var messageListener: ((Int, String) -> Unit)? = null
|
private var messageListener: ((Int, String) -> Unit)? = null
|
||||||
private var adapterRefreshListener: ((Int, String) -> Unit)? = null
|
private var adapterRefreshListener: ((Int, String) -> Unit)? = null
|
||||||
|
|
||||||
|
@ -199,7 +198,6 @@ object NetPlayManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Handler(Looper.getMainLooper()).post {
|
Handler(Looper.getMainLooper()).post {
|
||||||
if (!isChatOpen) {
|
if (!isChatOpen) {
|
||||||
// TODO(alekpop, crueter): Improve this, potentially a drawer at the top?
|
// TODO(alekpop, crueter): Improve this, potentially a drawer at the top?
|
||||||
|
@ -207,7 +205,6 @@ object NetPlayManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
messageListener?.invoke(type, msg)
|
messageListener?.invoke(type, msg)
|
||||||
adapterRefreshListener?.invoke(type, msg)
|
adapterRefreshListener?.invoke(type, msg)
|
||||||
}
|
}
|
||||||
|
@ -218,19 +215,29 @@ object NetPlayManager {
|
||||||
NetPlayStatus.LOST_CONNECTION -> context.getString(R.string.multiplayer_lost_connection)
|
NetPlayStatus.LOST_CONNECTION -> context.getString(R.string.multiplayer_lost_connection)
|
||||||
NetPlayStatus.NAME_COLLISION -> context.getString(R.string.multiplayer_name_collision)
|
NetPlayStatus.NAME_COLLISION -> context.getString(R.string.multiplayer_name_collision)
|
||||||
NetPlayStatus.MAC_COLLISION -> context.getString(R.string.multiplayer_mac_collision)
|
NetPlayStatus.MAC_COLLISION -> context.getString(R.string.multiplayer_mac_collision)
|
||||||
NetPlayStatus.CONSOLE_ID_COLLISION -> context.getString(R.string.multiplayer_console_id_collision)
|
NetPlayStatus.CONSOLE_ID_COLLISION -> context.getString(
|
||||||
|
R.string.multiplayer_console_id_collision
|
||||||
|
)
|
||||||
NetPlayStatus.WRONG_VERSION -> context.getString(R.string.multiplayer_wrong_version)
|
NetPlayStatus.WRONG_VERSION -> context.getString(R.string.multiplayer_wrong_version)
|
||||||
NetPlayStatus.WRONG_PASSWORD -> context.getString(R.string.multiplayer_wrong_password)
|
NetPlayStatus.WRONG_PASSWORD -> context.getString(R.string.multiplayer_wrong_password)
|
||||||
NetPlayStatus.COULD_NOT_CONNECT -> context.getString(R.string.multiplayer_could_not_connect)
|
NetPlayStatus.COULD_NOT_CONNECT -> context.getString(
|
||||||
|
R.string.multiplayer_could_not_connect
|
||||||
|
)
|
||||||
NetPlayStatus.ROOM_IS_FULL -> context.getString(R.string.multiplayer_room_is_full)
|
NetPlayStatus.ROOM_IS_FULL -> context.getString(R.string.multiplayer_room_is_full)
|
||||||
NetPlayStatus.HOST_BANNED -> context.getString(R.string.multiplayer_host_banned)
|
NetPlayStatus.HOST_BANNED -> context.getString(R.string.multiplayer_host_banned)
|
||||||
NetPlayStatus.PERMISSION_DENIED -> context.getString(R.string.multiplayer_permission_denied)
|
NetPlayStatus.PERMISSION_DENIED -> context.getString(
|
||||||
|
R.string.multiplayer_permission_denied
|
||||||
|
)
|
||||||
NetPlayStatus.NO_SUCH_USER -> context.getString(R.string.multiplayer_no_such_user)
|
NetPlayStatus.NO_SUCH_USER -> context.getString(R.string.multiplayer_no_such_user)
|
||||||
NetPlayStatus.ALREADY_IN_ROOM -> context.getString(R.string.multiplayer_already_in_room)
|
NetPlayStatus.ALREADY_IN_ROOM -> context.getString(R.string.multiplayer_already_in_room)
|
||||||
NetPlayStatus.CREATE_ROOM_ERROR -> context.getString(R.string.multiplayer_create_room_error)
|
NetPlayStatus.CREATE_ROOM_ERROR -> context.getString(
|
||||||
|
R.string.multiplayer_create_room_error
|
||||||
|
)
|
||||||
NetPlayStatus.HOST_KICKED -> context.getString(R.string.multiplayer_host_kicked)
|
NetPlayStatus.HOST_KICKED -> context.getString(R.string.multiplayer_host_kicked)
|
||||||
NetPlayStatus.UNKNOWN_ERROR -> context.getString(R.string.multiplayer_unknown_error)
|
NetPlayStatus.UNKNOWN_ERROR -> context.getString(R.string.multiplayer_unknown_error)
|
||||||
NetPlayStatus.ROOM_UNINITIALIZED -> context.getString(R.string.multiplayer_room_uninitialized)
|
NetPlayStatus.ROOM_UNINITIALIZED -> context.getString(
|
||||||
|
R.string.multiplayer_room_uninitialized
|
||||||
|
)
|
||||||
NetPlayStatus.ROOM_IDLE -> context.getString(R.string.multiplayer_room_idle)
|
NetPlayStatus.ROOM_IDLE -> context.getString(R.string.multiplayer_room_idle)
|
||||||
NetPlayStatus.ROOM_JOINING -> context.getString(R.string.multiplayer_room_joining)
|
NetPlayStatus.ROOM_JOINING -> context.getString(R.string.multiplayer_room_joining)
|
||||||
NetPlayStatus.ROOM_JOINED -> context.getString(R.string.multiplayer_room_joined)
|
NetPlayStatus.ROOM_JOINED -> context.getString(R.string.multiplayer_room_joined)
|
||||||
|
@ -247,7 +254,9 @@ object NetPlayManager {
|
||||||
msg
|
msg
|
||||||
)
|
)
|
||||||
|
|
||||||
NetPlayStatus.ADDRESS_UNBANNED -> context.getString(R.string.multiplayer_address_unbanned)
|
NetPlayStatus.ADDRESS_UNBANNED -> context.getString(
|
||||||
|
R.string.multiplayer_address_unbanned
|
||||||
|
)
|
||||||
NetPlayStatus.CHAT_MESSAGE -> msg
|
NetPlayStatus.CHAT_MESSAGE -> msg
|
||||||
else -> ""
|
else -> ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
|
||||||
package org.yuzu.yuzu_emu.utils
|
package org.yuzu.yuzu_emu.utils
|
||||||
|
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
|
@ -17,7 +16,6 @@ object PowerStateUpdater {
|
||||||
private var isStarted = false
|
private var isStarted = false
|
||||||
|
|
||||||
fun start() {
|
fun start() {
|
||||||
|
|
||||||
if (isStarted) {
|
if (isStarted) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -43,4 +41,4 @@ object PowerStateUpdater {
|
||||||
}
|
}
|
||||||
isStarted = false
|
isStarted = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ object PowerStateUtils {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getBatteryInfo(context: Context?): IntArray {
|
fun getBatteryInfo(context: Context?): IntArray {
|
||||||
|
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
return intArrayOf(0, 0, 0) // Percentage, IsCharging, HasBattery
|
return intArrayOf(0, 0, 0) // Percentage, IsCharging, HasBattery
|
||||||
}
|
}
|
||||||
|
@ -42,4 +41,4 @@ object PowerStateUtils {
|
||||||
|
|
||||||
return results
|
return results
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,10 +23,12 @@ import org.yuzu.yuzu_emu.features.settings.model.Settings
|
||||||
|
|
||||||
object ThemeHelper {
|
object ThemeHelper {
|
||||||
const val SYSTEM_BAR_ALPHA = 0.9f
|
const val SYSTEM_BAR_ALPHA = 0.9f
|
||||||
|
|
||||||
// Listener that detects if the theme keys are being changed from the setting menu and recreates the activity
|
// Listener that detects if the theme keys are being changed from the setting menu and recreates the activity
|
||||||
private var listener: SharedPreferences.OnSharedPreferenceChangeListener? = null
|
private var listener: SharedPreferences.OnSharedPreferenceChangeListener? = null
|
||||||
private val preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext)
|
private val preferences = PreferenceManager.getDefaultSharedPreferences(
|
||||||
|
YuzuApplication.appContext
|
||||||
|
)
|
||||||
|
|
||||||
fun setTheme(activity: AppCompatActivity) {
|
fun setTheme(activity: AppCompatActivity) {
|
||||||
setThemeMode(activity)
|
setThemeMode(activity)
|
||||||
|
@ -52,6 +54,7 @@ object ThemeHelper {
|
||||||
private fun getSelectedStaticThemeColor(): Int {
|
private fun getSelectedStaticThemeColor(): Int {
|
||||||
val themeIndex = preferences.getInt(Settings.PREF_STATIC_THEME_COLOR, 0)
|
val themeIndex = preferences.getInt(Settings.PREF_STATIC_THEME_COLOR, 0)
|
||||||
val themes = arrayOf(
|
val themes = arrayOf(
|
||||||
|
R.style.Theme_Eden_Main,
|
||||||
R.style.Theme_Yuzu_Main_Violet,
|
R.style.Theme_Yuzu_Main_Violet,
|
||||||
R.style.Theme_Yuzu_Main_Blue,
|
R.style.Theme_Yuzu_Main_Blue,
|
||||||
R.style.Theme_Yuzu_Main_Cyan,
|
R.style.Theme_Yuzu_Main_Cyan,
|
||||||
|
@ -120,7 +123,11 @@ object ThemeHelper {
|
||||||
|
|
||||||
fun ThemeChangeListener(activity: AppCompatActivity) {
|
fun ThemeChangeListener(activity: AppCompatActivity) {
|
||||||
listener = SharedPreferences.OnSharedPreferenceChangeListener { _, key ->
|
listener = SharedPreferences.OnSharedPreferenceChangeListener { _, key ->
|
||||||
val relevantKeys = listOf(Settings.PREF_STATIC_THEME_COLOR, Settings.PREF_THEME_MODE, Settings.PREF_BLACK_BACKGROUNDS)
|
val relevantKeys = listOf(
|
||||||
|
Settings.PREF_STATIC_THEME_COLOR,
|
||||||
|
Settings.PREF_THEME_MODE,
|
||||||
|
Settings.PREF_BLACK_BACKGROUNDS
|
||||||
|
)
|
||||||
if (key in relevantKeys) {
|
if (key in relevantKeys) {
|
||||||
activity.recreate()
|
activity.recreate()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue