Chromium Code Reviews| 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 23d52e68d5f9244885f1ffa0af225003005954c9..78f299fdcbd5abea981033bca322bc7eb7a4bc0f 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 |
| @@ -22,9 +22,8 @@ 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 { |
| - |
| +public class BlimpRendererActivity extends Activity |
| + implements BlimpLibraryLoader.Callback, TokenSource.Callback, BlimpClientSession.Callback { |
| private static final int ACCOUNT_CHOOSER_INTENT_REQUEST_CODE = 100; |
| private static final String TAG = "Blimp"; |
| private TokenSource mTokenSource; |
|
Kevin M
2016/02/12 19:45:26
Could you document tokenSource?
David Trainor- moved to gerrit
2016/02/17 21:09:47
Done.
|
| @@ -115,8 +114,7 @@ public class BlimpRendererActivity extends Activity implements BlimpLibraryLoade |
| setContentView(R.layout.blimp_main); |
| - mBlimpClientSession = new BlimpClientSession(); |
| - mBlimpClientSession.connect(); |
| + mBlimpClientSession = new BlimpClientSession(this); |
| mBlimpView = (BlimpView) findViewById(R.id.renderer); |
| mBlimpView.initializeRenderer(mBlimpClientSession); |
| @@ -131,8 +129,7 @@ public class BlimpRendererActivity extends Activity implements BlimpLibraryLoade |
| // TokenSource.Callback implementation. |
| @Override |
| public void onTokenReceived(String token) { |
| - // TODO(dtrainor): Do something with the token and the assigner! |
| - Toast.makeText(this, R.string.signin_get_token_succeeded, Toast.LENGTH_SHORT).show(); |
| + if (mBlimpClientSession != null) mBlimpClientSession.connect(token); |
| } |
| @Override |
| @@ -140,11 +137,18 @@ public class BlimpRendererActivity extends Activity implements BlimpLibraryLoade |
| // Ignore isTransient here because we're relying on the auto-retry TokenSource. |
| // TODO(dtrainor): Show a better error dialog/message. |
| Toast.makeText(this, R.string.signin_get_token_failed, Toast.LENGTH_LONG).show(); |
| - finish(); |
| } |
| @Override |
| public void onNeedsAccountToBeSelected(Intent suggestedIntent) { |
| startActivityForResult(suggestedIntent, ACCOUNT_CHOOSER_INTENT_REQUEST_CODE); |
| } |
| + |
| + // BlimpClientSession.Callback implementation. |
| + @Override |
| + public void onAssignmentReceived(int result, int suggestedMessageResourceId) { |
| + if (result != AssignmentSourceResult.OKAY) { |
| + Toast.makeText(this, suggestedMessageResourceId, Toast.LENGTH_LONG).show(); |
| + } |
| + } |
| } |