mirror of
https://github.com/TimeCrafters/TimeCraftersConfigurationTool.git
synced 2025-12-16 05:22:35 +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.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.timecrafters.TimeCraftersConfigurationTool.dialogs;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -54,6 +55,7 @@ public class AddFromPresetDialog extends TimeCraftersDialog {
|
|||||||
Button name = view.findViewById(R.id.name);
|
Button name = view.findViewById(R.id.name);
|
||||||
TextView description = view.findViewById(R.id.description);
|
TextView description = view.findViewById(R.id.description);
|
||||||
name.setText(group.name);
|
name.setText(group.name);
|
||||||
|
description.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (i % 2 == 0) { // even
|
if (i % 2 == 0) { // even
|
||||||
view.setBackgroundColor(getResources().getColor(R.color.list_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));
|
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);
|
container.addView(view);
|
||||||
i++;
|
i++;
|
||||||
@@ -86,6 +101,9 @@ public class AddFromPresetDialog extends TimeCraftersDialog {
|
|||||||
CloneDialog dialog = new CloneDialog();
|
CloneDialog dialog = new CloneDialog();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putBoolean("is_cloning_preset", true);
|
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("group_index", getArguments().getInt("group_index"));
|
||||||
bundle.putInt("action_index", index);
|
bundle.putInt("action_index", index);
|
||||||
dialog.setArguments(bundle);
|
dialog.setArguments(bundle);
|
||||||
|
|||||||
@@ -37,7 +37,12 @@ public class CloneDialog extends TimeCraftersDialog {
|
|||||||
|
|
||||||
if (getArguments().getBoolean("is_cloning_preset", false)) {
|
if (getArguments().getBoolean("is_cloning_preset", false)) {
|
||||||
if (getArguments().getInt("action_index", -1) != -1) {
|
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"));
|
this.action = Backend.instance().getConfig().getPresets().getActions().get(getArguments().getInt("action_index"));
|
||||||
} else {
|
} else {
|
||||||
this.group = Backend.instance().getConfig().getPresets().getGroups().get(getArguments().getInt("group_index"));
|
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.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.ContextThemeWrapper;
|
import android.view.ContextThemeWrapper;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
@@ -38,6 +39,7 @@ import org.timecrafters.TimeCraftersConfigurationTool.library.TimeCraftersFragme
|
|||||||
|
|
||||||
public class ActionsFragment extends TimeCraftersFragment {
|
public class ActionsFragment extends TimeCraftersFragment {
|
||||||
final private String deleteActionKey = "delete_action";
|
final private String deleteActionKey = "delete_action";
|
||||||
|
final private String TAG = "ActionsFragment";
|
||||||
|
|
||||||
private Config config;
|
private Config config;
|
||||||
private Group group;
|
private Group group;
|
||||||
@@ -249,6 +251,10 @@ public class ActionsFragment extends TimeCraftersFragment {
|
|||||||
AddFromPresetDialog dialog = new AddFromPresetDialog();
|
AddFromPresetDialog dialog = new AddFromPresetDialog();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putBoolean("show_actions", true);
|
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.setArguments(bundle);
|
||||||
dialog.show(getFragmentManager(), "add_from_preset_dialog");
|
dialog.show(getFragmentManager(), "add_from_preset_dialog");
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -198,8 +198,8 @@ public class GroupsFragment extends TimeCraftersFragment {
|
|||||||
case R.id.save_as_preset: {
|
case R.id.save_as_preset: {
|
||||||
PresetDialog dialog = new PresetDialog();
|
PresetDialog dialog = new PresetDialog();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putInt("group_index", group_index);
|
|
||||||
bundle.putBoolean("is_new_preset", true);
|
bundle.putBoolean("is_new_preset", true);
|
||||||
|
bundle.putInt("group_index", group_index);
|
||||||
dialog.setArguments(bundle);
|
dialog.setArguments(bundle);
|
||||||
dialog.show(getFragmentManager(), "preset_dialog");
|
dialog.show(getFragmentManager(), "preset_dialog");
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user