refactor use constants for proxy preference key.
--- a/res/layout/preferences.xml Fri May 07 18:16:41 2010 +0200
+++ b/res/layout/preferences.xml Mon May 10 20:13:12 2010 +0200
@@ -56,31 +56,31 @@
android:summary="@string/settings_proxy_sum">
<CheckBoxPreference android:title="@string/SettingsProxyProxy"
android:defaultValue="false" android:summary="@string/SettingsProxySummary"
- android:key="settings_key_proxy_use" />
+ android:key="proxy_use" />
<PreferenceCategory android:title="@string/proxy_proxy_settings">
- <ListPreference android:dependency="settings_key_proxy_use"
+ <ListPreference android:dependency="proxy_use"
android:title="@string/SettingsProxyType" android:entries="@array/proxy_types"
android:summary="@string/SettingsProxyTypeSummary"
android:defaultValue="HTTP" android:entryValues="@array/proxy_types"
- android:key="settings_key_proxy_type" />
+ android:key="proxy_type" />
<EditTextPreference android:singleLine="true"
- android:dependency="settings_key_proxy_use" android:name="serveur"
+ android:dependency="proxy_use" android:name="serveur"
android:summary="@string/SettingsProxyServer" android:title="@string/settings_proxy_server"
- android:key="settings_key_proxy_server" />
+ android:key="proxy_server" />
<EditTextPreference android:singleLine="true"
- android:dependency="settings_key_proxy_use" android:name="port"
+ android:dependency="proxy_use" android:name="port"
android:summary="@string/SettingsProxyPort" android:title="@string/settings_proxy_port"
- android:key="settings_key_proxy_port" android:numeric="signed" android:hint="@string/comments_proxy_port" />
+ android:key="proxy_port" android:numeric="signed" android:hint="@string/comments_proxy_port" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/proxy_user_settings">
<EditTextPreference android:singleLine="true"
- android:dependency="settings_key_proxy_use" android:name="Utilisateur"
+ android:dependency="proxy_use" android:name="Utilisateur"
android:summary="@string/SettingsProxyUser" android:title="@string/settings_proxy_username"
- android:key="settings_key_proxy_username" />
+ android:key="proxy_username" />
<EditTextPreference android:singleLine="true"
- android:dependency="settings_key_proxy_use" android:name="pass_user"
+ android:dependency="proxy_use" android:name="pass_user"
android:password="true" android:summary="@string/SettingsProxyPassword"
- android:title="@string/settings_proxy_password" android:key="settings_key_proxy_password" />
+ android:title="@string/settings_proxy_password" android:key="proxy_password" />
</PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen android:key="advanced"
--- a/src/com/beem/project/beem/BeemApplication.java Fri May 07 18:16:41 2010 +0200
+++ b/src/com/beem/project/beem/BeemApplication.java Mon May 10 20:13:12 2010 +0200
@@ -67,6 +67,18 @@
public static final String STATUS_KEY = "status";
/** Preference key for status message. */
public static final String STATUS_TEXT_KEY = "status_text";
+ /** Preference key for the use of a proxy */
+ public static final String PROXY_USE_KEY = "proxy_use";
+ /** Preference key for the type of proxy */
+ public static final String PROXY_TYPE_KEY = "proxy_type";
+ /** Preference key for the proxy server */
+ public static final String PROXY_SERVER_KEY = "proxy_server";
+ /** Preference key for the proxy port */
+ public static final String PROXY_PORT_KEY = "proxy_port";
+ /** Preference key for the proxy username */
+ public static final String PROXY_USERNAME_KEY = "proxy_username";
+ /** Preference key for the proxy password */
+ public static final String PROXY_PASSWORD_KEY = "proxy_password";
//TODO add the other one
private boolean mIsConnected;
--- a/src/com/beem/project/beem/BeemService.java Fri May 07 18:16:41 2010 +0200
+++ b/src/com/beem/project/beem/BeemService.java Mon May 10 20:13:12 2010 +0200
@@ -119,13 +119,13 @@
* Initialize the connection.
*/
private void initConnectionConfig() {
- mUseProxy = mSettings.getBoolean("settings_key_proxy_use", false);
+ mUseProxy = mSettings.getBoolean(BeemApplication.PROXY_USE_KEY, false);
if (mUseProxy) {
- String stype = mSettings.getString("settings_key_proxy_type", "HTTP");
- String phost = mSettings.getString("settings_key_proxy_server", "");
- String puser = mSettings.getString("settings_key_proxy_username", "");
- String ppass = mSettings.getString("settings_key_proxy_password", "");
- int pport = Integer.parseInt(mSettings.getString("settings_key_proxy_port", "1080"));
+ String stype = mSettings.getString(BeemApplication.PROXY_TYPE_KEY, "HTTP");
+ String phost = mSettings.getString(BeemApplication.PROXY_SERVER_KEY, "");
+ String puser = mSettings.getString(BeemApplication.PROXY_USERNAME_KEY, "");
+ String ppass = mSettings.getString(BeemApplication.PROXY_PASSWORD_KEY, "");
+ int pport = Integer.parseInt(mSettings.getString(BeemApplication.PROXY_PORT_KEY, "1080"));
ProxyInfo.ProxyType type = ProxyType.valueOf(stype);
mProxyInfo = new ProxyInfo(type, phost, pport, puser, ppass);
} else {
--- a/src/com/beem/project/beem/ui/CreateAccount.java Fri May 07 18:16:41 2010 +0200
+++ b/src/com/beem/project/beem/ui/CreateAccount.java Mon May 10 20:13:12 2010 +0200
@@ -172,7 +172,7 @@
* @return Registered proxy password
*/
private String getRegisteredProxyPassword() {
- return mSettings.getString("settings_key_proxy_password", DEFAULT_STRING_VALUE);
+ return mSettings.getString(BeemApplication.PROXY_PASSWORD_KEY, DEFAULT_STRING_VALUE);
}
/**
@@ -180,7 +180,7 @@
* @return Registered proxy port
*/
private int getRegisteredProxyPort() {
- return Integer.parseInt(mSettings.getString("settings_key_proxy_port", DEFAULT_STRING_VALUE));
+ return Integer.parseInt(mSettings.getString(BeemApplication.PROXY_PORT_KEY, DEFAULT_STRING_VALUE));
}
/**
@@ -188,7 +188,7 @@
* @return Registered proxy server
*/
private String getRegisteredProxyServer() {
- return mSettings.getString("settings_key_proxy_server", DEFAULT_STRING_VALUE);
+ return mSettings.getString(BeemApplication.PROXY_SERVER_KEY, DEFAULT_STRING_VALUE);
}
/**
@@ -197,8 +197,8 @@
*/
private ProxyInfo.ProxyType getRegisteredProxyType() {
ProxyInfo.ProxyType result = ProxyInfo.ProxyType.NONE;
- if (mSettings.getBoolean("settings_key_proxy_use", false)) {
- String type = mSettings.getString("settings_key_proxy_type", "none");
+ if (mSettings.getBoolean(BeemApplication.PROXY_USE_KEY, false)) {
+ String type = mSettings.getString(BeemApplication.PROXY_TYPE_KEY, "none");
if ("HTTP".equals(type))
result = ProxyInfo.ProxyType.HTTP;
else if ("SOCKS4".equals(type))
@@ -216,7 +216,7 @@
* @return Registered proxy use
*/
private boolean getRegisteredProxyUse() {
- return mSettings.getBoolean("settings_key_proxy_use", DEFAULT_BOOLEAN_VALUE);
+ return mSettings.getBoolean(BeemApplication.PROXY_USE_KEY, DEFAULT_BOOLEAN_VALUE);
}
/**
@@ -224,7 +224,7 @@
* @return Registered proxy username
*/
private String getRegisteredProxyUsername() {
- return mSettings.getString("settings_key_proxy_username", DEFAULT_STRING_VALUE);
+ return mSettings.getString(BeemApplication.PROXY_USERNAME_KEY, DEFAULT_STRING_VALUE);
}
/**