Android: Remove hardcoded strings from system update dialogs

This commit is contained in:
Charles Lombardo 2023-01-26 13:02:53 -05:00
parent 410aaef56e
commit 917ca2273e
5 changed files with 24 additions and 6 deletions

View File

@ -27,10 +27,14 @@ class OnlineUpdateRegionSelectDialogFragment : DialogFragment() {
viewModel.region = which
SystemUpdateProgressBarDialogFragment().show(
parentFragmentManager,
"OnlineUpdateProgressBarDialogFragment"
SystemUpdateProgressBarDialogFragment.TAG
)
dismiss()
}
.create()
}
companion object {
const val TAG = "OnlineUpdateRegionSelectDialogFragment"
}
}

View File

@ -17,11 +17,15 @@ class SystemMenuNotInstalledDialogFragment : DialogFragment() {
.setPositiveButton(R.string.yes) { _: DialogInterface?, _: Int ->
OnlineUpdateRegionSelectDialogFragment().show(
parentFragmentManager,
"OnlineUpdateRegionSelectDialogFragment"
OnlineUpdateRegionSelectDialogFragment.TAG
)
dismiss()
}
.setNegativeButton(R.string.no) { _: DialogInterface?, _: Int -> dismiss() }
.create()
}
companion object {
const val TAG = "SystemMenuNotInstalledDialogFragment"
}
}

View File

@ -76,7 +76,7 @@ class SystemUpdateProgressBarDialogFragment : DialogFragment() {
}
val progressBarFragment = SystemUpdateResultFragment()
progressBarFragment.show(parentFragmentManager, "OnlineUpdateResultFragment")
progressBarFragment.show(parentFragmentManager, SystemUpdateResultFragment.TAG)
dismiss()
}
@ -100,4 +100,8 @@ class SystemUpdateProgressBarDialogFragment : DialogFragment() {
viewModel.setCanceled()
}
}
companion object {
const val TAG = "SystemUpdateProgressBarDialogFragment"
}
}

View File

@ -12,6 +12,8 @@ import org.dolphinemu.dolphinemu.R
import org.dolphinemu.dolphinemu.utils.WiiUtils
class SystemUpdateResultFragment : DialogFragment() {
private val resultKey = "result"
private var mResult = 0
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
@ -20,7 +22,7 @@ class SystemUpdateResultFragment : DialogFragment() {
mResult = viewModel.resultData.value!!.toInt()
viewModel.clear()
} else {
mResult = savedInstanceState.getInt("result")
mResult = savedInstanceState.getInt(resultKey)
}
val message: String = when (mResult) {
WiiUtils.UPDATE_RESULT_SUCCESS -> getString(R.string.update_success)
@ -56,6 +58,10 @@ class SystemUpdateResultFragment : DialogFragment() {
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
outState.putInt("result", mResult)
outState.putInt(resultKey, mResult)
}
companion object {
const val TAG = "SystemUpdateResultFragment"
}
}

View File

@ -319,7 +319,7 @@ public final class MainPresenter
SystemUpdateProgressBarDialogFragment progressBarFragment =
new SystemUpdateProgressBarDialogFragment();
progressBarFragment
.show(activity.getSupportFragmentManager(), "SystemUpdateProgressBarDialogFragment");
.show(activity.getSupportFragmentManager(), SystemUpdateProgressBarDialogFragment.TAG);
progressBarFragment.setCancelable(false);
}