Index: blimp/client/app/android/java/src/org/chromium/blimp/BlimpRendererActivity.java |
diff --git a/blimp/client/app/android/java/src/org/chromium/blimp/BlimpRendererActivity.java b/blimp/client/app/android/java/src/org/chromium/blimp/BlimpRendererActivity.java |
index cd830b17b1aba6d5e200fea9d0bc964f633cfaa1..5435ece782095a4e91533d424d7efc278df93817 100644 |
--- a/blimp/client/app/android/java/src/org/chromium/blimp/BlimpRendererActivity.java |
+++ b/blimp/client/app/android/java/src/org/chromium/blimp/BlimpRendererActivity.java |
@@ -7,7 +7,9 @@ package org.chromium.blimp; |
import android.app.Activity; |
import android.content.Intent; |
import android.os.Bundle; |
+import android.os.Handler; |
import android.text.TextUtils; |
+import android.widget.TextView; |
import org.chromium.base.Log; |
import org.chromium.base.annotations.SuppressFBWarnings; |
@@ -29,7 +31,8 @@ import org.chromium.ui.widget.Toast; |
*/ |
public class BlimpRendererActivity |
extends Activity implements BlimpLibraryLoader.Callback, TokenSource.Callback, |
- BlimpClientSession.ConnectionObserver { |
+ BlimpClientSession.ConnectionObserver, |
+ BlimpClientSession.NetworkActivityObserver { |
private static final int ACCOUNT_CHOOSER_INTENT_REQUEST_CODE = 100; |
private static final String TAG = "BlimpRendererActivity"; |
@@ -43,7 +46,7 @@ public class BlimpRendererActivity |
private BlimpClientSession mBlimpClientSession; |
private TabControlFeature mTabControlFeature; |
private WebInputBox mWebInputBox; |
- |
+ Handler mHandler = new Handler(); |
private boolean mFirstUrlLoadDone = false; |
@Override |
@@ -148,6 +151,7 @@ public class BlimpRendererActivity |
mBlimpClientSession = new BlimpClientSession(PreferencesUtil.findAssignerUrl(this)); |
mBlimpClientSession.addObserver(this); |
+ mBlimpClientSession.setDataObserver(this); |
mBlimpView = (BlimpView) findViewById(R.id.renderer); |
mBlimpView.initializeRenderer(mBlimpClientSession); |
@@ -165,6 +169,28 @@ public class BlimpRendererActivity |
} |
@Override |
+ public void onPacketSent(final int bytes) { |
+ mHandler.post(new Runnable() { |
+ @Override |
+ public void run() { |
+ TextView sTv = (TextView) findViewById(R.id.bytes_sent_client); |
+ sTv.setText("Sent (KB) : " + bytes / 1000); |
+ } |
+ }); |
+ } |
+ |
+ @Override |
+ public void onPacketReceived(final int bytes) { |
+ mHandler.post(new Runnable() { |
+ @Override |
+ public void run() { |
+ TextView rTv = (TextView) findViewById(R.id.bytes_received_client); |
+ rTv.setText("Received (KB) : " + bytes / 1000); |
+ } |
+ }); |
+ } |
+ |
+ @Override |
protected void onNewIntent(Intent intent) { |
super.onNewIntent(intent); |
handleUrlFromIntent(intent); |