mirror of
https://github.com/TimeCrafters/TimeCraftersConfigurationTool.git
synced 2025-12-15 05:02:33 +00:00
Fixed adding action presets to a group preset would incorrectly add the action to a config group instead
This commit is contained in:
@@ -3,6 +3,7 @@ package org.timecrafters.TimeCraftersConfigurationTool.dialogs;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.timecrafters.TimeCraftersConfigurationTool.dialogs;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -54,6 +55,7 @@ public class AddFromPresetDialog extends TimeCraftersDialog {
|
||||
Button name = view.findViewById(R.id.name);
|
||||
TextView description = view.findViewById(R.id.description);
|
||||
name.setText(group.name);
|
||||
description.setVisibility(View.GONE);
|
||||
|
||||
if (i % 2 == 0) { // even
|
||||
view.setBackgroundColor(getResources().getColor(R.color.list_even));
|
||||
@@ -61,7 +63,20 @@ public class AddFromPresetDialog extends TimeCraftersDialog {
|
||||
view.setBackgroundColor(getResources().getColor(R.color.list_odd));
|
||||
}
|
||||
|
||||
description.setVisibility(View.GONE);
|
||||
final int index = i;
|
||||
name.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
CloneDialog dialog = new CloneDialog();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean("is_cloning_preset", true);
|
||||
bundle.putInt("group_index", index);
|
||||
dialog.setArguments(bundle);
|
||||
dialog.show(getFragmentManager(), "clone_group_preset");
|
||||
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
container.addView(view);
|
||||
i++;
|
||||
@@ -86,6 +101,9 @@ public class AddFromPresetDialog extends TimeCraftersDialog {
|
||||
CloneDialog dialog = new CloneDialog();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean("is_cloning_preset", true);
|
||||
if (getArguments().getBoolean("group_is_preset", false)) {
|
||||
bundle.putBoolean("group_is_preset", true);
|
||||
}
|
||||
bundle.putInt("group_index", getArguments().getInt("group_index"));
|
||||
bundle.putInt("action_index", index);
|
||||
dialog.setArguments(bundle);
|
||||
|
||||
@@ -37,7 +37,12 @@ public class CloneDialog extends TimeCraftersDialog {
|
||||
|
||||
if (getArguments().getBoolean("is_cloning_preset", false)) {
|
||||
if (getArguments().getInt("action_index", -1) != -1) {
|
||||
this.group = Backend.instance().getConfig().getGroups().get(getArguments().getInt("group_index"));
|
||||
if (getArguments().getBoolean("group_is_preset", false)) {
|
||||
this.group = Backend.instance().getConfig().getPresets().getGroups().get(getArguments().getInt("group_index"));
|
||||
} else {
|
||||
this.group = Backend.instance().getConfig().getGroups().get(getArguments().getInt("group_index"));
|
||||
}
|
||||
|
||||
this.action = Backend.instance().getConfig().getPresets().getActions().get(getArguments().getInt("action_index"));
|
||||
} else {
|
||||
this.group = Backend.instance().getConfig().getPresets().getGroups().get(getArguments().getInt("group_index"));
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.timecrafters.TimeCraftersConfigurationTool.ui.editor;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
@@ -38,6 +39,7 @@ import org.timecrafters.TimeCraftersConfigurationTool.library.TimeCraftersFragme
|
||||
|
||||
public class ActionsFragment extends TimeCraftersFragment {
|
||||
final private String deleteActionKey = "delete_action";
|
||||
final private String TAG = "ActionsFragment";
|
||||
|
||||
private Config config;
|
||||
private Group group;
|
||||
@@ -249,6 +251,10 @@ public class ActionsFragment extends TimeCraftersFragment {
|
||||
AddFromPresetDialog dialog = new AddFromPresetDialog();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean("show_actions", true);
|
||||
if (groupIsPreset) {
|
||||
bundle.putBoolean("group_is_preset", true);
|
||||
}
|
||||
bundle.putInt("group_index", getArguments().getInt("group_index"));
|
||||
dialog.setArguments(bundle);
|
||||
dialog.show(getFragmentManager(), "add_from_preset_dialog");
|
||||
return true;
|
||||
|
||||
@@ -198,8 +198,8 @@ public class GroupsFragment extends TimeCraftersFragment {
|
||||
case R.id.save_as_preset: {
|
||||
PresetDialog dialog = new PresetDialog();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt("group_index", group_index);
|
||||
bundle.putBoolean("is_new_preset", true);
|
||||
bundle.putInt("group_index", group_index);
|
||||
dialog.setArguments(bundle);
|
||||
dialog.show(getFragmentManager(), "preset_dialog");
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user