X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/e7493203deca0edc7edeb5fb26f2774ede84a479..00482b6dcb1e98da39df54374f7098b51d66bee5:/src/com/owncloud/android/ui/preview/PreviewImageActivity.java diff --git a/src/com/owncloud/android/ui/preview/PreviewImageActivity.java b/src/com/owncloud/android/ui/preview/PreviewImageActivity.java index 6dc87cbb..2b0d96ce 100644 --- a/src/com/owncloud/android/ui/preview/PreviewImageActivity.java +++ b/src/com/owncloud/android/ui/preview/PreviewImageActivity.java @@ -8,7 +8,7 @@ * it under the terms of the GNU General Public License version 2, * as published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, + * This program is distributed in the hd that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. @@ -31,7 +31,9 @@ import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Message; +import android.support.v4.view.GravityCompat; import android.support.v4.view.ViewPager; +import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBar; import android.view.MenuItem; import android.view.View; @@ -90,16 +92,22 @@ public class PreviewImageActivity extends FileActivity implements @Override protected void onCreate(Bundle savedInstanceState) { + requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); + super.onCreate(savedInstanceState); - requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); setContentView(R.layout.preview_image_activity); - + + // Navigation Drawer + initDrawer(); + + // ActionBar ActionBar actionBar = getSupportActionBar(); actionBar.setIcon(DisplayUtils.getSeasonalIconId()); - actionBar.setDisplayHomeAsUpEnabled(true); + updateActionBarTitleAndHomeButton(null); actionBar.hide(); + // Make sure we're running on Honeycomb or higher to use FullScreen and // Immersive Mode if (isHoneycombOrHigher()) { @@ -107,7 +115,8 @@ public class PreviewImageActivity extends FileActivity implements mFullScreenAnchorView = getWindow().getDecorView(); // to keep our UI controls visibility in line with system bars // visibility - mFullScreenAnchorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() { + mFullScreenAnchorView.setOnSystemUiVisibilityChangeListener + (new View.OnSystemUiVisibilityChangeListener() { @SuppressLint("InlinedApi") @Override public void onSystemUiVisibilityChange(int flags) { @@ -115,8 +124,10 @@ public class PreviewImageActivity extends FileActivity implements ActionBar actionBar = getSupportActionBar(); if (visible) { actionBar.show(); + mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); } else { actionBar.hide(); + mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); } } }); @@ -140,8 +151,11 @@ public class PreviewImageActivity extends FileActivity implements // should not be necessary parentFolder = getStorageManager().getFileByPath(OCFile.ROOT_PATH); } + + // TODO Enable when "On Device" is recovered ? mPreviewImagePagerAdapter = new PreviewImagePagerAdapter(getSupportFragmentManager(), - parentFolder, getAccount(), getStorageManager()); + parentFolder, getAccount(), getStorageManager()/*, MainApp.getOnlyOnDevice()*/); + mViewPager = (ExtendedViewPager) findViewById(R.id.fragmentPager); int position = mHasSavedPosition ? mSavedPosition : mPreviewImagePagerAdapter.getFilePosition(getFile()); @@ -312,7 +326,11 @@ public class PreviewImageActivity extends FileActivity implements switch(item.getItemId()){ case android.R.id.home: - backToDisplayActivity(); + if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) { + mDrawerLayout.closeDrawer(GravityCompat.START); + } else { + backToDisplayActivity(); + } returnValue = true; break; default: @@ -396,6 +414,7 @@ public class PreviewImageActivity extends FileActivity implements } else { OCFile currentFile = mPreviewImagePagerAdapter.getFileAt(position); getSupportActionBar().setTitle(currentFile.getFileName()); + mDrawerToggle.setDrawerIndicatorEnabled(false); if (!currentFile.isDown()) { if (!mPreviewImagePagerAdapter.pendingErrorAt(position)) { requestForDownload(currentFile); @@ -500,9 +519,11 @@ public class PreviewImageActivity extends FileActivity implements ActionBar actionBar = getSupportActionBar(); if (!actionBar.isShowing()) { actionBar.show(); + mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); } else { actionBar.hide(); + mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); } @@ -586,4 +607,10 @@ public class PreviewImageActivity extends FileActivity implements } return false; } + + @Override + public void allFilesOption(){ + backToDisplayActivity(); + super.allFilesOption(); + } }