| 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..bb41fb15dc96c0ca9145db09a21f1dde5bc9c377 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
|
| @@ -8,6 +8,8 @@ import android.app.Activity;
|
| import android.content.Intent;
|
| import android.os.Bundle;
|
| import android.text.TextUtils;
|
| +import android.view.View;
|
| +import android.widget.TextView;
|
|
|
| import org.chromium.base.Log;
|
| import org.chromium.base.annotations.SuppressFBWarnings;
|
| @@ -21,15 +23,16 @@ import org.chromium.blimp.session.BlimpClientSession;
|
| import org.chromium.blimp.session.EngineInfo;
|
| import org.chromium.blimp.session.TabControlFeature;
|
| import org.chromium.blimp.toolbar.Toolbar;
|
| +import org.chromium.blimp.toolbar.ToolbarMenu;
|
| import org.chromium.ui.widget.Toast;
|
|
|
| /**
|
| * The {@link Activity} for rendering the main Blimp client. This loads the Blimp rendering stack
|
| * and displays it.
|
| */
|
| -public class BlimpRendererActivity
|
| - extends Activity implements BlimpLibraryLoader.Callback, TokenSource.Callback,
|
| - BlimpClientSession.ConnectionObserver {
|
| +public class BlimpRendererActivity extends Activity
|
| + implements BlimpLibraryLoader.Callback, TokenSource.Callback,
|
| + BlimpClientSession.ConnectionObserver, ToolbarMenu.ToolbarMenuDelegate {
|
| private static final int ACCOUNT_CHOOSER_INTENT_REQUEST_CODE = 100;
|
| private static final String TAG = "BlimpRendererActivity";
|
|
|
| @@ -83,9 +86,6 @@ public class BlimpRendererActivity
|
| }
|
|
|
| if (mToolbar != null) {
|
| - if (mBlimpClientSession != null) {
|
| - mBlimpClientSession.removeObserver(mToolbar);
|
| - }
|
| mToolbar.destroy();
|
| mToolbar = null;
|
| }
|
| @@ -154,7 +154,6 @@ public class BlimpRendererActivity
|
|
|
| mToolbar = (Toolbar) findViewById(R.id.toolbar);
|
| mToolbar.initialize(mBlimpClientSession);
|
| - mBlimpClientSession.addObserver(mToolbar);
|
|
|
| mWebInputBox = (WebInputBox) findViewById(R.id.editText);
|
| mWebInputBox.initialize(mBlimpClientSession);
|
| @@ -164,6 +163,14 @@ public class BlimpRendererActivity
|
| handleUrlFromIntent(getIntent());
|
| }
|
|
|
| + // ToolbarMenu.ToolbarMenuDelegate implementation.
|
| + @Override
|
| + public void showDebugView(boolean show) {
|
| + View debugView = findViewById(R.id.debug_stats);
|
| + debugView.setVisibility(show ? View.VISIBLE : View.INVISIBLE);
|
| + mBlimpClientSession.enableDebugInfo(show);
|
| + }
|
| +
|
| @Override
|
| protected void onNewIntent(Intent intent) {
|
| super.onNewIntent(intent);
|
| @@ -234,6 +241,16 @@ public class BlimpRendererActivity
|
| }
|
|
|
| @Override
|
| + public void updateDebugInfo(int received, int sent, int commits) {
|
| + TextView tv = (TextView) findViewById(R.id.bytes_received_client);
|
| + tv.setText(String.valueOf(received / 1000));
|
| + tv = (TextView) findViewById(R.id.bytes_sent_client);
|
| + tv.setText(String.valueOf(sent / 1000));
|
| + tv = (TextView) findViewById(R.id.commit_count);
|
| + tv.setText(String.valueOf(commits));
|
| + }
|
| +
|
| + @Override
|
| public void onDisconnected(String reason) {
|
| Toast.makeText(this,
|
| String.format(getResources().getString(R.string.network_disconnected), reason),
|
|
|