Cleaning up Android AppRTCDemo.
- Move signaling code from Activity to a separate class and add interface for AppRTC signaling. For now only pure GAE signaling implements this interface. - Move peer connection, video source and peer connection and SDP observer code from Activity to a separate class. - Main Activity class will do only high level calls and event handling for peer connection and signaling classes. - Also add video renderer position update and use full screen for local preview until the connection is established. BUG= R=braveyao@webrtc.org, pthatcher@webrtc.org Review URL: https://webrtc-codereview.appspot.com/24019004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7469 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -45,7 +45,7 @@ import android.webkit.WebViewClient;
|
||||
* "androidMessageHandler".
|
||||
*/
|
||||
public class GAEChannelClient {
|
||||
private static final String TAG = "GAEChannelClient";
|
||||
private static final String TAG = "GAERTCClient";
|
||||
private WebView webView;
|
||||
private final ProxyingMessageHandler proxyingMessageHandler;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class GAEChannelClient {
|
||||
* Methods are guaranteed to be invoked on the UI thread of |activity| passed
|
||||
* to GAEChannelClient's constructor.
|
||||
*/
|
||||
public interface MessageHandler {
|
||||
public interface GAEMessageHandler {
|
||||
public void onOpen();
|
||||
public void onMessage(String data);
|
||||
public void onClose();
|
||||
@@ -65,7 +65,7 @@ public class GAEChannelClient {
|
||||
/** Asynchronously open an AppEngine channel. */
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
public GAEChannelClient(
|
||||
Activity activity, String token, MessageHandler handler) {
|
||||
Activity activity, String token, GAEMessageHandler handler) {
|
||||
webView = new WebView(activity);
|
||||
webView.getSettings().setJavaScriptEnabled(true);
|
||||
webView.setWebChromeClient(new WebChromeClient() { // Purely for debugging.
|
||||
@@ -105,12 +105,12 @@ public class GAEChannelClient {
|
||||
// (private, background) thread to the Activity's UI thread.
|
||||
private static class ProxyingMessageHandler {
|
||||
private final Activity activity;
|
||||
private final MessageHandler handler;
|
||||
private final GAEMessageHandler handler;
|
||||
private final boolean[] disconnected = { false };
|
||||
private final String token;
|
||||
|
||||
public
|
||||
ProxyingMessageHandler(Activity activity, MessageHandler handler,
|
||||
ProxyingMessageHandler(Activity activity, GAEMessageHandler handler,
|
||||
String token) {
|
||||
this.activity = activity;
|
||||
this.handler = handler;
|
||||
|
||||
Reference in New Issue
Block a user