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

Unified Diff: platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java

Issue 2071333002: Keep drawer open in xlarge-land and add float fps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: FPS -> Render time Created 4 years, 6 months 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: platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java
diff --git a/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java b/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java
index 0291f5e29145bcfd76d5f7c58ce0819763c8b2ea..ea610397b99ec550ff7118eee924ee1862632df5 100644
--- a/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java
+++ b/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerActivity.java
@@ -52,7 +52,7 @@ public class ViewerActivity
public boolean onOptionsItemSelected(MenuItem item) {
// Pass the event to ActionBarDrawerToggle, if it returns
// true, then it has handled the app icon touch event
- if (mDrawerToggle.onOptionsItemSelected(item)) {
+ if (mDrawerToggle != null && mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
@@ -78,11 +78,13 @@ public class ViewerActivity
surfaceView.setOnTouchListener(this);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);
- mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
- R.string.drawer_open, R.string.drawer_close);
- mDrawerLayout.addDrawerListener(mDrawerToggle);
- getActionBar().setDisplayHomeAsUpEnabled(true);
- getActionBar().setHomeButtonEnabled(true);
+ if (mDrawerLayout != null) { // xlarge-land has no drawer layout (drawer is always open)
+ mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
+ R.string.drawer_open, R.string.drawer_close);
+ mDrawerLayout.addDrawerListener(mDrawerToggle);
+ getActionBar().setDisplayHomeAsUpEnabled(true);
+ getActionBar().setHomeButtonEnabled(true);
+ }
mDrawerList = (ListView) findViewById(R.id.leftDrawer);
mStateAdapter = new StateAdapter(this);
@@ -95,13 +97,17 @@ public class ViewerActivity
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
- mDrawerToggle.syncState();
+ if (mDrawerToggle != null) {
+ mDrawerToggle.syncState();
+ }
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
- mDrawerToggle.onConfigurationChanged(newConfig);
+ if (mDrawerToggle != null) {
+ mDrawerToggle.onConfigurationChanged(newConfig);
+ }
}
@Override

Powered by Google App Engine
This is Rietveld 408576698