diff --git a/APED/app/src/main/assets/defaultConfig.json b/APED/app/src/main/assets/defaultConfig.json index 9285101..a3f1800 100644 --- a/APED/app/src/main/assets/defaultConfig.json +++ b/APED/app/src/main/assets/defaultConfig.json @@ -1,5 +1,6 @@ { "address": "192.168.1.100", "port" : 8080, + "currentView" : "", "favorites" : [ ] } \ No newline at end of file diff --git a/APED/app/src/main/java/com/example/aped/utils/ConfigurationHandler.java b/APED/app/src/main/java/com/example/aped/utils/ConfigurationHandler.java index c1eac72..9c89348 100644 --- a/APED/app/src/main/java/com/example/aped/utils/ConfigurationHandler.java +++ b/APED/app/src/main/java/com/example/aped/utils/ConfigurationHandler.java @@ -117,6 +117,18 @@ public class ConfigurationHandler implements IFAVORITES { return deviceName; } + //cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc + public String getCurrentView() { + return configurations.getCurrentView(); + } + + //cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc + public String setCurrentView(String viewName) { + configurations.setCurrentView(viewName); + writeJsonFile(); + return getCurrentView(); + } + //endregion //region private methods @@ -136,6 +148,7 @@ public class ConfigurationHandler implements IFAVORITES { JSONObject jsonObject = new JSONObject(jsonData); configurations.setAddress(jsonObject.getString("address")); configurations.setPort(jsonObject.getInt("port")); + configurations.setCurrentView(jsonObject.getString("currentView")); List favoriteNames = new ArrayList<>(); JSONArray favorites = jsonObject.getJSONArray("favorites"); for (int i = 0; i < favorites.length(); i++) { @@ -192,6 +205,19 @@ public class ConfigurationHandler implements IFAVORITES { /** The names of the favorite devices. **/ private List favoriteNames = new ArrayList<>(); + //cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc + public String getCurrentView() { + return currentView; + } + + //cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc + public void setCurrentView(String currentView) { + this.currentView = currentView; + } + + /** The name of the current view. **/ + private String currentView = ""; + /** * Getter for the address variable. * @return the address of the raspberry @@ -254,6 +280,7 @@ public class ConfigurationHandler implements IFAVORITES { return "{\n" + "\t\"address\":\"" + address + "\",\n" + "\t\"port\":\"" + port + "\",\n" + + "\t\"currentView\":\"" + currentView + "\",\n" + "\t\"favorites\":" + favoriteNamesString.toString() + "\n" + "}"; }