Add a AppRTCDemo setting to change the GAE server.
BUG=4041
R=tkchin@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/36599004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7966 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/examples/android/res/values/strings.xml b/talk/examples/android/res/values/strings.xml
index 08ff541..a1eea4b 100644
--- a/talk/examples/android/res/values/strings.xml
+++ b/talk/examples/android/res/values/strings.xml
@@ -60,5 +60,9 @@
<string name="pref_value_enabled">Enabled</string>
<string name="pref_value_disabled">Disabled</string>
+ <string name="pref_room_server_url_key">room_server_url_preference</string>
+ <string name="pref_room_server_url_title">Room server URL.</string>
+ <string name="pref_room_server_url_dlg">Enter a room server URL.</string>
+ <string name="pref_room_server_url_default">https://apprtc.appspot.com</string>
</resources>
diff --git a/talk/examples/android/res/xml/preferences.xml b/talk/examples/android/res/xml/preferences.xml
index cffcb6b..4ff7939 100644
--- a/talk/examples/android/res/xml/preferences.xml
+++ b/talk/examples/android/res/xml/preferences.xml
@@ -43,4 +43,10 @@
android:dialogTitle="@string/pref_cpu_usage_detection_dlg"
android:defaultValue="@string/pref_cpu_usage_detection_default" />
+ <EditTextPreference
+ android:key="@string/pref_room_server_url_key"
+ android:title="@string/pref_room_server_url_title"
+ android:inputType="text"
+ android:defaultValue="@string/pref_room_server_url_default"
+ android:dialogTitle="@string/pref_room_server_url_dlg" />
</PreferenceScreen>
diff --git a/talk/examples/android/src/org/appspot/apprtc/ConnectActivity.java b/talk/examples/android/src/org/appspot/apprtc/ConnectActivity.java
index 7427bb4..15ca908 100644
--- a/talk/examples/android/src/org/appspot/apprtc/ConnectActivity.java
+++ b/talk/examples/android/src/org/appspot/apprtc/ConnectActivity.java
@@ -71,7 +71,6 @@
public static final String EXTRA_HWCODEC = "org.appspot.apprtc.HWCODEC";
public static final String EXTRA_WEBSOCKET = "org.appspot.apprtc.WEBSOCKET";
private static final String TAG = "ConnectRTCClient";
- private final String APPRTC_SERVER = "https://apprtc.appspot.com";
private final int CONNECTION_REQUEST = 1;
private static boolean commandLineRun = false;
@@ -88,6 +87,7 @@
private String keyprefBitrateValue;
private String keyprefHwCodec;
private String keyprefCpuUsageDetection;
+ private String keyprefRoomServerUrl;
private String keyprefRoom;
private String keyprefRoomList;
private ArrayList<String> roomList;
@@ -106,6 +106,7 @@
keyprefBitrateValue = getString(R.string.pref_startbitratevalue_key);
keyprefHwCodec = getString(R.string.pref_hwcodec_key);
keyprefCpuUsageDetection = getString(R.string.pref_cpu_usage_detection_key);
+ keyprefRoomServerUrl = getString(R.string.pref_room_server_url_key);
keyprefRoom = getString(R.string.pref_room_key);
keyprefRoomList = getString(R.string.pref_room_list_key);
@@ -252,8 +253,10 @@
}
}
- String url;
- url = APPRTC_SERVER + "/register/" + roomName;
+ String url = sharedPref.getString(
+ keyprefRoomServerUrl,
+ getString(R.string.pref_room_server_url_default));
+ url = url + "/register/" + roomName;
// Check HW codec flag.
boolean hwCodec = sharedPref.getBoolean(keyprefHwCodec,
diff --git a/talk/examples/android/src/org/appspot/apprtc/SettingsActivity.java b/talk/examples/android/src/org/appspot/apprtc/SettingsActivity.java
index aef1d77..43d7620 100644
--- a/talk/examples/android/src/org/appspot/apprtc/SettingsActivity.java
+++ b/talk/examples/android/src/org/appspot/apprtc/SettingsActivity.java
@@ -43,6 +43,7 @@
private String keyprefHwCodec;
private String keyprefCpuUsageDetection;
private String keyprefSignaling;
+ private String keyPrefRoomServerUrl;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -53,6 +54,7 @@
keyprefStartBitrateValue = getString(R.string.pref_startbitratevalue_key);
keyprefHwCodec = getString(R.string.pref_hwcodec_key);
keyprefCpuUsageDetection = getString(R.string.pref_cpu_usage_detection_key);
+ keyPrefRoomServerUrl = getString(R.string.pref_room_server_url_key);
// Display the fragment as the main content.
settingsFragment = new SettingsFragment();
@@ -71,6 +73,7 @@
updateSummary(sharedPreferences, keyprefResolution);
updateSummary(sharedPreferences, keyprefFps);
updateSummary(sharedPreferences, keyprefStartBitrateType);
+ updateSummary(sharedPreferences, keyPrefRoomServerUrl);
updateSummaryBitrate(sharedPreferences, keyprefStartBitrateValue);
setBitrateEnable(sharedPreferences);
updateSummaryB(sharedPreferences, keyprefHwCodec);
@@ -89,8 +92,10 @@
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
- if (key.equals(keyprefResolution) || key.equals(keyprefFps) ||
- key.equals(keyprefStartBitrateType)) {
+ if (key.equals(keyprefResolution) ||
+ key.equals(keyprefFps) ||
+ key.equals(keyprefStartBitrateType) ||
+ key.equals(keyPrefRoomServerUrl)) {
updateSummary(sharedPreferences, key);
} else if (key.equals(keyprefStartBitrateValue)) {
updateSummaryBitrate(sharedPreferences, key);
@@ -134,5 +139,4 @@
bitratePreferenceValue.setEnabled(true);
}
}
-
}