mirror of
https://github.com/TimeCrafters/TimeCraftersConfigurationTool.git
synced 2025-12-16 05:22:35 +00:00
Hide add button from groups fragment when no config is active, made configurations fragment unset active config if the deleted config is the active config
This commit is contained in:
@@ -63,7 +63,6 @@ public class Backend {
|
|||||||
private Settings settings;
|
private Settings settings;
|
||||||
private boolean configChanged, settingsChanged;
|
private boolean configChanged, settingsChanged;
|
||||||
private MediaPlayer mediaPlayer;
|
private MediaPlayer mediaPlayer;
|
||||||
private SoundPool soundPool;
|
|
||||||
|
|
||||||
public static HashMap<String, Object> getStorage() {
|
public static HashMap<String, Object> getStorage() {
|
||||||
return storage;
|
return storage;
|
||||||
@@ -145,6 +144,11 @@ public class Backend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void loadConfig(String name) {
|
public void loadConfig(String name) {
|
||||||
|
if (name.equals("")) {
|
||||||
|
config = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String path = configPath(name);
|
String path = configPath(name);
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ public class GroupsFragment extends TimeCraftersFragment {
|
|||||||
});
|
});
|
||||||
|
|
||||||
floatingActionButtonAutoHide(actionButton, scrollView);
|
floatingActionButtonAutoHide(actionButton, scrollView);
|
||||||
|
if (Backend.instance().getConfig() == null) {
|
||||||
|
actionButton.hide();
|
||||||
|
}
|
||||||
|
|
||||||
if (Backend.instance() != null)
|
if (Backend.instance() != null)
|
||||||
this.config = Backend.instance().getConfig();
|
this.config = Backend.instance().getConfig();
|
||||||
|
|||||||
@@ -111,6 +111,12 @@ public class ConfigurationsFragment extends TimeCraftersFragment {
|
|||||||
Backend.instance().deleteConfig(configFile);
|
Backend.instance().deleteConfig(configFile);
|
||||||
Backend.getStorage().remove(deleteActionKey);
|
Backend.getStorage().remove(deleteActionKey);
|
||||||
|
|
||||||
|
if (Backend.instance().getConfig().getName().equals(configFile)) {
|
||||||
|
Backend.instance().getSettings().config = "";
|
||||||
|
Backend.instance().saveSettings();
|
||||||
|
Backend.instance().loadConfig("");
|
||||||
|
}
|
||||||
|
|
||||||
ConfigurationsFragment fragment = (ConfigurationsFragment) dialog.getFragmentManager().getPrimaryNavigationFragment();
|
ConfigurationsFragment fragment = (ConfigurationsFragment) dialog.getFragmentManager().getPrimaryNavigationFragment();
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
||||||
fragment.populateConfigFiles();
|
fragment.populateConfigFiles();
|
||||||
|
|||||||
Reference in New Issue
Block a user