Android: Convert Skylander to Kotlin

This commit is contained in:
Charles Lombardo 2023-03-01 17:13:01 -05:00
parent c5e00b085e
commit 85b30f198b
3 changed files with 18 additions and 40 deletions

View File

@ -406,7 +406,7 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
outState.putBoolean(EXTRA_MENU_TOAST_SHOWN, mMenuToastShown); outState.putBoolean(EXTRA_MENU_TOAST_SHOWN, mMenuToastShown);
outState.putInt(EXTRA_SKYLANDER_SLOT, mSkylanderSlot); outState.putInt(EXTRA_SKYLANDER_SLOT, mSkylanderSlot);
outState.putInt(EXTRA_SKYLANDER_ID, mSkylanderData.getId()); outState.putInt(EXTRA_SKYLANDER_ID, mSkylanderData.getId());
outState.putInt(EXTRA_SKYLANDER_VAR, mSkylanderData.getVar()); outState.putInt(EXTRA_SKYLANDER_VAR, mSkylanderData.getVariant());
outState.putString(EXTRA_SKYLANDER_NAME, mSkylanderData.getName()); outState.putString(EXTRA_SKYLANDER_NAME, mSkylanderData.getName());
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
} }
@ -546,10 +546,10 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
} }
else if (requestCode == REQUEST_CREATE_SKYLANDER) else if (requestCode == REQUEST_CREATE_SKYLANDER)
{ {
if (!(mSkylanderData.getId() == -1) && !(mSkylanderData.getVar() == -1)) if (!(mSkylanderData.getId() == -1) && !(mSkylanderData.getVariant() == -1))
{ {
Pair<Integer, String> slot = SkylanderConfig.createSkylander(mSkylanderData.getId(), Pair<Integer, String> slot = SkylanderConfig.createSkylander(mSkylanderData.getId(),
mSkylanderData.getVar(), mSkylanderData.getVariant(),
result.getData().toString(), sSkylanderSlots.get(mSkylanderSlot).getPortalSlot()); result.getData().toString(), sSkylanderSlots.get(mSkylanderSlot).getPortalSlot());
clearSkylander(mSkylanderSlot); clearSkylander(mSkylanderSlot);
sSkylanderSlots.get(mSkylanderSlot).setPortalSlot(slot.first); sSkylanderSlots.get(mSkylanderSlot).setPortalSlot(slot.first);

View File

@ -1,37 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later
package org.dolphinemu.dolphinemu.features.skylanders.model;
public class Skylander
{
private SkylanderPair mPair;
private String mName;
public final static Skylander BLANK_SKYLANDER = new Skylander(-1, -1, "Blank");
public Skylander(int id, int var, String name)
{
mPair = new SkylanderPair(id, var);
mName = name;
}
public String getName()
{
return mName;
}
public void setName(String name)
{
this.mName = name;
}
public int getId()
{
return mPair.getId();
}
public int getVar()
{
return mPair.getVar();
}
}

View File

@ -0,0 +1,15 @@
// SPDX-License-Identifier: GPL-2.0-or-later
package org.dolphinemu.dolphinemu.features.skylanders.model
class Skylander(id: Int, variant: Int, var name: String) {
private val pair: SkylanderPair = SkylanderPair(id, variant)
val id: Int get() = pair.id
val variant: Int get() = pair.variant
companion object {
@JvmField
val BLANK_SKYLANDER = Skylander(-1, -1, "Blank")
}
}