changed currentView to int

This commit is contained in:
paul-loedige 2021-01-07 21:08:33 +01:00
parent 0faf25f00b
commit 552fc5cb32

View File

@ -121,7 +121,7 @@ public class ConfigurationHandler implements IFAVORITES {
* Method to get the name of the current view.
* @return the name of the current view
*/
public String getCurrentView() {
public int getCurrentView() {
return configurations.getCurrentView();
}
@ -130,7 +130,7 @@ public class ConfigurationHandler implements IFAVORITES {
* @param viewName the name to be set
* @return the name that has been set
*/
public String setCurrentView(final String viewName) {
public int setCurrentView(final int viewName) {
configurations.setCurrentView(viewName);
writeJsonFile();
return getCurrentView();
@ -155,7 +155,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"));
configurations.setCurrentView(jsonObject.getInt("currentView"));
List<String> favoriteNames = new ArrayList<>();
JSONArray favorites = jsonObject.getJSONArray("favorites");
for (int i = 0; i < favorites.length(); i++) {
@ -211,12 +211,14 @@ public class ConfigurationHandler implements IFAVORITES {
private int port = -1;
/** The names of the favorite devices. **/
private List<String> favoriteNames = new ArrayList<>();
/** The name of the current view. **/
private int currentView = -1;
/**
* Getter for currentView.
* @return the name of the current view
*/
public String getCurrentView() {
public int getCurrentView() {
return currentView;
}
@ -224,13 +226,11 @@ public class ConfigurationHandler implements IFAVORITES {
* Setter for currentView.
* @param pCurrentView the name of the current view
*/
public void setCurrentView(final String pCurrentView) {
public int setCurrentView(final int pCurrentView) {
this.currentView = pCurrentView;
return this.currentView;
}
/** The name of the current view. **/
private String currentView = "";
/**
* Getter for the address variable.
* @return the address of the raspberry