mirror of
https://github.com/TimeCrafters/TimeCraftersConfigurationTool.git
synced 2025-12-15 05:02:33 +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 boolean configChanged, settingsChanged;
|
||||
private MediaPlayer mediaPlayer;
|
||||
private SoundPool soundPool;
|
||||
|
||||
public static HashMap<String, Object> getStorage() {
|
||||
return storage;
|
||||
@@ -145,6 +144,11 @@ public class Backend {
|
||||
}
|
||||
|
||||
public void loadConfig(String name) {
|
||||
if (name.equals("")) {
|
||||
config = null;
|
||||
return;
|
||||
}
|
||||
|
||||
String path = configPath(name);
|
||||
File file = new File(path);
|
||||
|
||||
|
||||
@@ -60,6 +60,9 @@ public class GroupsFragment extends TimeCraftersFragment {
|
||||
});
|
||||
|
||||
floatingActionButtonAutoHide(actionButton, scrollView);
|
||||
if (Backend.instance().getConfig() == null) {
|
||||
actionButton.hide();
|
||||
}
|
||||
|
||||
if (Backend.instance() != null)
|
||||
this.config = Backend.instance().getConfig();
|
||||
|
||||
@@ -111,6 +111,12 @@ public class ConfigurationsFragment extends TimeCraftersFragment {
|
||||
Backend.instance().deleteConfig(configFile);
|
||||
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();
|
||||
if (fragment != null) {
|
||||
fragment.populateConfigFiles();
|
||||
|
||||
Reference in New Issue
Block a user