public void loadPreviousSettingsToServerInfo(){
  String REMOTE_SERVER_USERNAME="remote_server_username";
  String REMOTE_SERVER_PASSWORD="remote_server_password";
  String REMOTE_SERVER_URL="remote_server_url";
  String REMOTE_SERVER_PORT="remote_server_port";
  String REMOTE_SERVER_DIRECTORY="remote_server_directory";
  String REMOTE_SERVER_SECURE="remote_server_secure";
  String REMOTE_SERVER_AUTHENTICATION_METHOD="remote_server_authentication_method";
  String IS_LOCAL_SERVER_ADDRESS_DIFFERENT="local_server_different_address";
  String USE_ONLY_LOCAL="use_ony_local";
  String LOCAL_SERVER_USERNAME="local_server_username";
  String LOCAL_SERVER_PASSWORD="local_server_password";
  String LOCAL_SERVER_URL="local_server_url";
  String LOCAL_SERVER_PORT="local_server_port";
  String LOCAL_SERVER_DIRECTORY="local_server_directory";
  String LOCAL_SERVER_SECURE="local_server_secure";
  String LOCAL_SERVER_AUTHENTICATION_METHOD="local_server_authentication_method";
  String LOCAL_SERVER_SSID="local_server_ssid";
  ServerInfo oPrefServer=new ServerInfo();
  oPrefServer.setRemoteServerUsername(prefs.getString(REMOTE_SERVER_USERNAME,""));
  oPrefServer.setRemoteServerPassword(prefs.getString(REMOTE_SERVER_PASSWORD,""));
  oPrefServer.setRemoteServerUrl(prefs.getString(REMOTE_SERVER_URL,""));
  oPrefServer.setRemoteServerDirectory(prefs.getString(REMOTE_SERVER_DIRECTORY,""));
  oPrefServer.setRemoteServerPort(prefs.getString(REMOTE_SERVER_PORT,""));
  oPrefServer.setRemoteServerSecure(prefs.getBoolean(REMOTE_SERVER_SECURE,true));
  oPrefServer.setRemoteServerAuthentication(prefs.getBoolean(REMOTE_SERVER_AUTHENTICATION_METHOD,true));
  if (!prefs.getBoolean(IS_LOCAL_SERVER_ADDRESS_DIFFERENT,false))   oPrefServer.setLocalSameAddressAsRemote();
  oPrefServer.setUseOnlyLocal(prefs.getBoolean(USE_ONLY_LOCAL,false));
  oPrefServer.setIsLocalServerAddressDifferent(prefs.getBoolean(IS_LOCAL_SERVER_ADDRESS_DIFFERENT,false));
  oPrefServer.setLocalServerUsername(prefs.getString(LOCAL_SERVER_USERNAME,""));
  oPrefServer.setLocalServerPassword(prefs.getString(LOCAL_SERVER_PASSWORD,""));
  oPrefServer.setLocalServerUrl(prefs.getString(LOCAL_SERVER_URL,""));
  oPrefServer.setLocalServerPort(prefs.getString(LOCAL_SERVER_PORT,""));
  oPrefServer.setLocalServerDirectory(prefs.getString(LOCAL_SERVER_DIRECTORY,""));
  oPrefServer.setLocalServerSecure(prefs.getBoolean(LOCAL_SERVER_SECURE,false));
  oPrefServer.setLocalServerAuthentication(prefs.getBoolean(LOCAL_SERVER_AUTHENTICATION_METHOD,false));
  oPrefServer.setLocalServerSsid(prefs.getStringSet(LOCAL_SERVER_SSID,null));
  oPrefServer.setEnabled(true);
  setActiveServer(oPrefServer);
  if (mServerList == null || mServerList.size() <= 0)   mServerList=new ArrayList<>();
  mServerList.add(oPrefServer);
  saveDomoticzServers(false);
}

public void loadPreviousSettingsToServerInfo ( ) { String REMOTE_SERVER_USERNAME = "remote_server_username" ; String REMOTE_SERVER_PASSWORD = "remote_server_password" ; String REMOTE_SERVER_URL = "remote_server_url" ; String REMOTE_SERVER_PORT = "remote_server_port" ; String REMOTE_SERVER_DIRECTORY = "remote_server_directory" ; String REMOTE_SERVER_SECURE = "remote_server_secure" ; String REMOTE_SERVER_AUTHENTICATION_METHOD = "remote_server_authentication_method" ; String IS_LOCAL_SERVER_ADDRESS_DIFFERENT = "local_server_different_address" ; String USE_ONLY_LOCAL = "use_ony_local" ; String LOCAL_SERVER_USERNAME = "local_server_username" ; String LOCAL_SERVER_PASSWORD = "local_server_password" ; String LOCAL_SERVER_URL = "local_server_url" ; String LOCAL_SERVER_PORT = "local_server_port" ; String LOCAL_SERVER_DIRECTORY = "local_server_directory" ; String LOCAL_SERVER_SECURE = "local_server_secure" ; String LOCAL_SERVER_AUTHENTICATION_METHOD = "local_server_authentication_method" ; String LOCAL_SERVER_SSID = "local_server_ssid" ; ServerInfo oPrefServer = new ServerInfo ( ) ; oPrefServer . setRemoteServerUsername ( prefs . getString ( REMOTE_SERVER_USERNAME , "" ) ) ; oPrefServer . setRemoteServerPassword ( prefs . getString ( REMOTE_SERVER_PASSWORD , "" ) ) ; oPrefServer . setRemoteServerUrl ( prefs . getString ( REMOTE_SERVER_URL , "" ) ) ; oPrefServer . setRemoteServerDirectory ( prefs . getString ( REMOTE_SERVER_DIRECTORY , "" ) ) ; oPrefServer . setRemoteServerPort ( prefs . getString ( REMOTE_SERVER_PORT , "" ) ) ; oPrefServer . setRemoteServerSecure ( prefs . getBoolean ( REMOTE_SERVER_SECURE , true ) ) ; oPrefServer . setRemoteServerAuthentication ( prefs . getBoolean ( REMOTE_SERVER_AUTHENTICATION_METHOD , true ) ) ; if ( ! prefs . getBoolean ( IS_LOCAL_SERVER_ADDRESS_DIFFERENT , false ) ) oPrefServer . setLocalSameAddressAsRemote ( ) ; oPrefServer . setUseOnlyLocal ( prefs . getBoolean ( USE_ONLY_LOCAL , false ) ) ; oPrefServer . setIsLocalServerAddressDifferent ( prefs . getBoolean ( IS_LOCAL_SERVER_ADDRESS_DIFFERENT , false ) ) ; oPrefServer . setLocalServerUsername ( prefs . getString ( LOCAL_SERVER_USERNAME , "" ) ) ; oPrefServer . setLocalServerPassword ( prefs . getString ( LOCAL_SERVER_PASSWORD , "" ) ) ; oPrefServer . setLocalServerUrl ( prefs . getString ( LOCAL_SERVER_URL , "" ) ) ; oPrefServer . setLocalServerPort ( prefs . getString ( LOCAL_SERVER_PORT , "" ) ) ; oPrefServer . setLocalServerDirectory ( prefs . getString ( LOCAL_SERVER_DIRECTORY , "" ) ) ; oPrefServer . setLocalServerSecure ( prefs . getBoolean ( LOCAL_SERVER_SECURE , false ) ) ; oPrefServer . setLocalServerAuthentication ( prefs . getBoolean ( LOCAL_SERVER_AUTHENTICATION_METHOD , false ) ) ; oPrefServer . setLocalServerSsid ( prefs . getStringSet ( LOCAL_SERVER_SSID , null ) ) ; oPrefServer . setEnabled ( true ) ; setActiveServer ( oPrefServer ) ; if ( mServerList == null || mServerList . size ( ) <= 0 ) mServerList = new ArrayList < > ( ) ; mServerList . add ( oPrefServer ) ; saveDomoticzServers ( false ) ; }
this method is to parse the previous settings from shared preferences into the new structure
