Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: blimp/client/android/java/src/org/chromium/blimp/BlimpRendererActivity.java

Issue 1422363008: Add a basic UI to the Android Blimp client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made sure to clear old control data Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: blimp/client/android/java/src/org/chromium/blimp/BlimpRendererActivity.java
diff --git a/blimp/client/android/java/src/org/chromium/blimp/BlimpRendererActivity.java b/blimp/client/android/java/src/org/chromium/blimp/BlimpRendererActivity.java
index f0327176706257ac38f4306ffd460eb2b51e2933..da2501104d8dc476780b21cd6932e5458ccc166f 100644
--- a/blimp/client/android/java/src/org/chromium/blimp/BlimpRendererActivity.java
+++ b/blimp/client/android/java/src/org/chromium/blimp/BlimpRendererActivity.java
@@ -13,6 +13,7 @@ import org.chromium.base.library_loader.ProcessInitException;
import org.chromium.blimp.auth.RetryingTokenSource;
import org.chromium.blimp.auth.TokenSource;
import org.chromium.blimp.auth.TokenSourceImpl;
+import org.chromium.blimp.toolbar.Toolbar;
import org.chromium.ui.widget.Toast;
/**
@@ -26,6 +27,7 @@ public class BlimpRendererActivity extends Activity implements BlimpLibraryLoade
private static final String TAG = "Blimp";
private TokenSource mTokenSource;
private BlimpView mBlimpView;
+ private Toolbar mToolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -51,6 +53,11 @@ public class BlimpRendererActivity extends Activity implements BlimpLibraryLoade
mBlimpView = null;
}
+ if (mToolbar != null) {
+ mToolbar.destroy();
+ mToolbar = null;
+ }
+
if (mTokenSource != null) {
mTokenSource.destroy();
mTokenSource = null;
@@ -73,6 +80,15 @@ public class BlimpRendererActivity extends Activity implements BlimpLibraryLoade
}
}
+ @Override
+ public void onBackPressed() {
+ // Check if the toolbar can handle the back navigation.
+ if (mToolbar != null && mToolbar.onBackPressed()) return;
+
+ // If not, use the default Activity behavior.
+ super.onBackPressed();
+ }
+
// BlimpLibraryLoader.Callback implementation.
@Override
public void onStartupComplete(boolean success) {
@@ -83,8 +99,12 @@ public class BlimpRendererActivity extends Activity implements BlimpLibraryLoade
}
setContentView(R.layout.blimp_main);
+
mBlimpView = (BlimpView) findViewById(R.id.renderer);
mBlimpView.initializeRenderer();
+
+ mToolbar = (Toolbar) findViewById(R.id.toolbar);
+ mToolbar.initialize();
}
// TokenSource.Callback implementation.
« no previous file with comments | « blimp/client/android/java/res/layout/blimp_main.xml ('k') | blimp/client/android/java/src/org/chromium/blimp/BlimpView.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698