Large diffs are not rendered by default.

Expand Up @@ -92,7 +92,7 @@ public boolean onLongClick(View clicked)
.setMessage(R.string.setting_clear_confirm)
.setPositiveButton(R.string.ok, (dialog, whichButton) ->
{
getAdapter().clearSetting(item, getBindingAdapterPosition());
getAdapter().clearSetting(item);
bind(item);
Toast.makeText(context, R.string.setting_cleared, Toast.LENGTH_SHORT).show();
dialog.dismiss();
Expand Down
Expand Up @@ -6,18 +6,18 @@

import androidx.annotation.Nullable;

import org.dolphinemu.dolphinemu.databinding.ListItemSettingCheckboxBinding;
import org.dolphinemu.dolphinemu.features.settings.model.view.CheckBoxSetting;
import org.dolphinemu.dolphinemu.databinding.ListItemSettingSwitchBinding;
import org.dolphinemu.dolphinemu.features.settings.model.view.SwitchSetting;
import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem;
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter;

public final class CheckBoxSettingViewHolder extends SettingViewHolder
public final class SwitchSettingViewHolder extends SettingViewHolder
{
private CheckBoxSetting mItem;
private SwitchSetting mItem;

private final ListItemSettingCheckboxBinding mBinding;
private final ListItemSettingSwitchBinding mBinding;

public CheckBoxSettingViewHolder(ListItemSettingCheckboxBinding binding, SettingsAdapter adapter)
public SwitchSettingViewHolder(ListItemSettingSwitchBinding binding, SettingsAdapter adapter)
{
super(binding.getRoot(), adapter);
mBinding = binding;
Expand All @@ -26,12 +26,12 @@ public CheckBoxSettingViewHolder(ListItemSettingCheckboxBinding binding, Setting
@Override
public void bind(SettingsItem item)
{
mItem = (CheckBoxSetting) item;
mItem = (SwitchSetting) item;

mBinding.textSettingName.setText(item.getName());
mBinding.textSettingDescription.setText(item.getDescription());

mBinding.checkbox.setChecked(mItem.isChecked(getAdapter().getSettings()));
mBinding.settingSwitch.setChecked(mItem.isChecked(getAdapter().getSettings()));

setStyle(mBinding.textSettingName, mItem);
}
Expand All @@ -45,9 +45,9 @@ public void onClick(View clicked)
return;
}

mBinding.checkbox.toggle();
mBinding.settingSwitch.toggle();

getAdapter().onBooleanClick(mItem, getBindingAdapterPosition(), mBinding.checkbox.isChecked());
getAdapter().onBooleanClick(mItem, mBinding.settingSwitch.isChecked());

setStyle(mBinding.textSettingName, mItem);
}
Expand Down
Expand Up @@ -181,7 +181,7 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState)
setDropdownSelection(mBinding.dropdownCompressionLevel, mCompressionLevel,
savedInstanceState.getInt(KEY_COMPRESSION_LEVEL));

mBinding.checkboxRemoveJunkData.setChecked(
mBinding.switchRemoveJunkData.setChecked(
savedInstanceState.getBoolean(KEY_REMOVE_JUNK_DATA));
}
}
Expand All @@ -194,7 +194,7 @@ public void onSaveInstanceState(@NonNull Bundle outState)
outState.putInt(KEY_COMPRESSION, mCompression.getPosition());
outState.putInt(KEY_COMPRESSION_LEVEL, mCompressionLevel.getPosition());

outState.putBoolean(KEY_REMOVE_JUNK_DATA, mBinding.checkboxRemoveJunkData.isChecked());
outState.putBoolean(KEY_REMOVE_JUNK_DATA, mBinding.switchRemoveJunkData.isChecked());
}

private void setDropdownSelection(MaterialAutoCompleteTextView dropdown,
Expand Down Expand Up @@ -365,15 +365,15 @@ private void populateRemoveJunkData()
boolean scrubbingAllowed = mFormat.getValue(requireContext()) != BLOB_TYPE_RVZ &&
!gameFile.isDatelDisc();

mBinding.checkboxRemoveJunkData.setEnabled(scrubbingAllowed);
mBinding.switchRemoveJunkData.setEnabled(scrubbingAllowed);
if (!scrubbingAllowed)
mBinding.checkboxRemoveJunkData.setChecked(false);
mBinding.switchRemoveJunkData.setChecked(false);
}

@Override
public void onClick(View view)
{
boolean scrub = mBinding.checkboxRemoveJunkData.isChecked();
boolean scrub = mBinding.switchRemoveJunkData.isChecked();
int format = mFormat.getValue(requireContext());

Runnable action = this::showSavePrompt;
Expand Down Expand Up @@ -478,7 +478,7 @@ private void convert(String outPath)
boolean success = NativeLibrary.ConvertDiscImage(gameFile.getPath(), outPath,
gameFile.getPlatform(), mFormat.getValue(context), mBlockSize.getValueOr(context, 0),
mCompression.getValueOr(context, 0), mCompressionLevel.getValueOr(context, 0),
mBinding.checkboxRemoveJunkData.isChecked(), (text, completion) ->
mBinding.switchRemoveJunkData.isChecked(), (text, completion) ->
{
requireActivity().runOnUiThread(() ->
{
Expand Down
16 changes: 9 additions & 7 deletions Source/Android/app/src/main/res/layout-ldrtl/list_item_cheat.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Set nextFocusLeft so checkbox functionality is maintained in rtl layouts -->
<!-- Set nextFocusLeft so switch functionality is maintained in rtl layouts -->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
Expand All @@ -9,27 +9,29 @@
android:focusable="true"
android:clickable="true"
android:background="?android:attr/selectableItemBackground"
android:nextFocusLeft="@id/checkbox">
android:nextFocusLeft="@id/cheat_switch">

<TextView
android:id="@+id/text_name"
style="@style/TextAppearance.MaterialComponents.Headline5"
android:layout_width="wrap_content"
android:layout_height="64dp"
android:layout_height="76dp"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:gravity="center_vertical"
android:layout_marginEnd="@dimen/spacing_large"
android:layout_marginStart="@dimen/spacing_large"
android:layout_toStartOf="@+id/cheat_switch"
android:gravity="center_vertical|end"
android:textSize="16sp"
tools:text="Hyrule Field Speed Hack" />

<CheckBox
android:id="@+id/checkbox"
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/cheat_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/spacing_small"
android:layout_marginEnd="24dp"
android:focusable="true"
android:nextFocusRight="@id/root" />

Expand Down
17 changes: 10 additions & 7 deletions Source/Android/app/src/main/res/layout/fragment_convert.xml
Expand Up @@ -77,20 +77,23 @@

<TextView
android:id="@+id/label_remove_junk_data"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="@dimen/spacing_small"
android:layout_marginEnd="@dimen/spacing_large"
android:gravity="center_vertical"
android:text="@string/convert_remove_junk_data"
android:layout_marginStart="@dimen/spacing_small"
app:layout_constraintTop_toTopOf="@id/checkbox_remove_junk_data"
app:layout_constraintBottom_toBottomOf="@id/checkbox_remove_junk_data"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintBottom_toBottomOf="@id/switch_remove_junk_data"
app:layout_constraintEnd_toStartOf="@+id/switch_remove_junk_data"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/switch_remove_junk_data" />

<CheckBox
android:id="@+id/checkbox_remove_junk_data"
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switch_remove_junk_data"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintTop_toBottomOf="@id/compression_level" />
Expand Down
14 changes: 7 additions & 7 deletions Source/Android/app/src/main/res/layout/list_item_cheat.xml
Expand Up @@ -8,29 +8,29 @@
android:focusable="true"
android:clickable="true"
android:background="?android:attr/selectableItemBackground"
android:nextFocusRight="@id/checkbox">
android:nextFocusRight="@id/cheat_switch">

<TextView
android:id="@+id/text_name"
style="@style/TextAppearance.MaterialComponents.Headline5"
android:layout_width="wrap_content"
android:layout_height="64dp"
android:layout_height="76dp"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/spacing_large"
android:layout_marginEnd="@dimen/spacing_large"
android:layout_toStartOf="@+id/checkbox"
android:gravity="center_vertical"
android:layout_toStartOf="@id/cheat_switch"
android:gravity="center_vertical|start"
android:textSize="16sp"
tools:text="Hyrule Field Speed Hack" />

<CheckBox
android:id="@+id/checkbox"
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/cheat_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/spacing_small"
android:layout_marginEnd="20dp"
android:focusable="true"
android:nextFocusRight="@id/root" />

Expand Down
Expand Up @@ -16,10 +16,10 @@
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="@dimen/spacing_large"
android:layout_marginEnd="24dp"
android:layout_marginStart="@dimen/spacing_large"
android:layout_marginTop="@dimen/spacing_large"
android:layout_toStartOf="@+id/checkbox"
android:layout_toStartOf="@+id/setting_switch"
android:textSize="16sp"
tools:text="@string/overclock_enable"/>

Expand All @@ -31,19 +31,19 @@
android:layout_alignStart="@+id/text_setting_name"
android:layout_below="@+id/text_setting_name"
android:layout_marginBottom="@dimen/spacing_large"
android:layout_marginEnd="@dimen/spacing_large"
android:layout_marginEnd="24dp"
android:layout_marginStart="@dimen/spacing_large"
android:layout_marginTop="@dimen/spacing_small"
android:layout_toStartOf="@+id/checkbox"
android:layout_toStartOf="@+id/setting_switch"
tools:text="@string/overclock_enable_description"/>

<CheckBox
android:id="@+id/checkbox"
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/setting_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/spacing_large"
android:layout_marginEnd="24dp"
android:clickable="false"
android:focusable="false"
android:minHeight="0dp"
Expand Down