11 package com.freerdp.freerdpcore.domain;
13 import android.content.SharedPreferences;
14 import android.os.Parcel;
15 import android.os.Parcelable;
31 private String hostname;
33 private boolean enableGatewaySettings;
40 hostname = parcel.readString();
41 port = parcel.readInt();
43 enableGatewaySettings = (parcel.readInt() == 1 ? true :
false);
44 gatewaySettings = parcel.readParcelable(
GatewaySettings.class.getClassLoader());
58 enableGatewaySettings =
false;
62 public String getHostname()
67 public void setHostname(String hostname)
69 this.hostname = hostname;
77 public void setPort(
int port)
82 public boolean getEnableGatewaySettings()
84 return enableGatewaySettings;
87 public void setEnableGatewaySettings(
boolean enableGatewaySettings)
89 this.enableGatewaySettings = enableGatewaySettings;
94 return gatewaySettings;
99 this.gatewaySettings = gatewaySettings;
102 @Override
public int describeContents()
107 @Override
public void writeToParcel(Parcel out,
int flags)
109 super.writeToParcel(out, flags);
110 out.writeString(hostname);
112 out.writeInt(enableGatewaySettings ? 1 : 0);
113 out.writeParcelable(gatewaySettings, flags);
116 @Override
public void writeToSharedPreferences(SharedPreferences sharedPrefs)
118 super.writeToSharedPreferences(sharedPrefs);
120 SharedPreferences.Editor editor = sharedPrefs.edit();
121 editor.putString(
"bookmark.hostname", hostname);
122 editor.putInt(
"bookmark.port", port);
123 editor.putBoolean(
"bookmark.enable_gateway_settings", enableGatewaySettings);
124 editor.putString(
"bookmark.gateway_hostname", gatewaySettings.getHostname());
125 editor.putInt(
"bookmark.gateway_port", gatewaySettings.getPort());
126 editor.putString(
"bookmark.gateway_username", gatewaySettings.getUsername());
127 editor.putString(
"bookmark.gateway_password", gatewaySettings.getPassword());
128 editor.putString(
"bookmark.gateway_domain", gatewaySettings.getDomain());
132 @Override
public void readFromSharedPreferences(SharedPreferences sharedPrefs)
134 super.readFromSharedPreferences(sharedPrefs);
136 hostname = sharedPrefs.getString(
"bookmark.hostname",
"");
137 port = sharedPrefs.getInt(
"bookmark.port", 3389);
138 enableGatewaySettings = sharedPrefs.getBoolean(
"bookmark.enable_gateway_settings",
false);
139 gatewaySettings.setHostname(sharedPrefs.getString(
"bookmark.gateway_hostname",
""));
140 gatewaySettings.setPort(sharedPrefs.getInt(
"bookmark.gateway_port", 443));
141 gatewaySettings.setUsername(sharedPrefs.getString(
"bookmark.gateway_username",
""));
142 gatewaySettings.setPassword(sharedPrefs.getString(
"bookmark.gateway_password",
""));
143 gatewaySettings.setDomain(sharedPrefs.getString(
"bookmark.gateway_domain",
""));
147 public Object clone()
149 return super.clone();
167 private String hostname;
169 private String username;
170 private String password;
171 private String domain;
184 hostname = parcel.readString();
185 port = parcel.readInt();
186 username = parcel.readString();
187 password = parcel.readString();
188 domain = parcel.readString();
191 public String getHostname()
196 public void setHostname(String hostname)
198 this.hostname = hostname;
206 public void setPort(
int port)
211 public String getUsername()
216 public void setUsername(String username)
218 this.username = username;
221 public String getPassword()
226 public void setPassword(String password)
228 this.password = password;
231 public String getDomain()
236 public void setDomain(String domain)
238 this.domain = domain;
241 @Override
public int describeContents()
246 @Override
public void writeToParcel(Parcel out,
int flags)
248 out.writeString(hostname);
250 out.writeString(username);
251 out.writeString(password);
252 out.writeString(domain);