* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* 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.
* 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.
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import com.ortiz.touch.ExtendedViewPager;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.ortiz.touch.ExtendedViewPager;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
-public class PreviewImageActivity extends FileActivity implements
- FileFragment.ContainerActivity,
-ViewPager.OnPageChangeListener, OnRemoteOperationListener {
+public class PreviewImageActivity extends FileActivity implements
+ FileFragment.ContainerActivity,
+ ViewPager.OnPageChangeListener, OnRemoteOperationListener {
mFullScreenAnchorView = getWindow().getDecorView();
// to keep our UI controls visibility in line with system bars
// visibility
mFullScreenAnchorView = getWindow().getDecorView();
// to keep our UI controls visibility in line with system bars
// visibility
- String parentPath = getFile().getRemotePath().substring(0, getFile().getRemotePath().lastIndexOf(getFile().getFileName()));
+ String parentPath = getFile().getRemotePath().substring(0,
+ getFile().getRemotePath().lastIndexOf(getFile().getFileName()));
OCFile parentFolder = getStorageManager().getFileByPath(parentPath);
if (parentFolder == null) {
// should not be necessary
parentFolder = getStorageManager().getFileByPath(OCFile.ROOT_PATH);
}
OCFile parentFolder = getStorageManager().getFileByPath(parentPath);
if (parentFolder == null) {
// should not be necessary
parentFolder = getStorageManager().getFileByPath(OCFile.ROOT_PATH);
}
// TODO Enable when "On Device" is recovered ?
mPreviewImagePagerAdapter = new PreviewImagePagerAdapter(getSupportFragmentManager(),
parentFolder, getAccount(), getStorageManager()/*, MainApp.getOnlyOnDevice()*/);
// TODO Enable when "On Device" is recovered ?
mPreviewImagePagerAdapter = new PreviewImagePagerAdapter(getSupportFragmentManager(),
parentFolder, getAccount(), getStorageManager()/*, MainApp.getOnlyOnDevice()*/);
position = (position >= 0) ? position : 0;
mViewPager.setAdapter(mPreviewImagePagerAdapter);
mViewPager.setOnPageChangeListener(this);
mViewPager.setCurrentItem(position);
if (position == 0 && !getFile().isDown()) {
position = (position >= 0) ? position : 0;
mViewPager.setAdapter(mPreviewImagePagerAdapter);
mViewPager.setOnPageChangeListener(this);
mViewPager.setCurrentItem(position);
if (position == 0 && !getFile().isDown()) {
- private void onUnshareLinkOperationFinish(UnshareLinkOperation operation, RemoteOperationResult result) {
+ private void onUnshareLinkOperationFinish(UnshareLinkOperation operation,
+ RemoteOperationResult result) {
if (result.isSuccess()) {
OCFile file = getStorageManager().getFileByPath(getFile().getRemotePath());
if (file != null) {
if (result.isSuccess()) {
OCFile file = getStorageManager().getFileByPath(getFile().getRemotePath());
if (file != null) {
- private void onCreateShareOperationFinish(CreateShareOperation operation, RemoteOperationResult result) {
+ private void onCreateShareOperationFinish(CreateShareOperation operation,
+ RemoteOperationResult result) {
if (result.isSuccess()) {
OCFile file = getStorageManager().getFileByPath(getFile().getRemotePath());
if (file != null) {
if (result.isSuccess()) {
OCFile file = getStorageManager().getFileByPath(getFile().getRemotePath());
if (file != null) {
mDownloaderBinder = (FileDownloaderBinder) service;
if (mRequestWaitingForBinder) {
mRequestWaitingForBinder = false;
mDownloaderBinder = (FileDownloaderBinder) service;
if (mRequestWaitingForBinder) {
mRequestWaitingForBinder = false;
Log_OC.d(TAG, "Upload service connected");
mUploaderBinder = (FileUploaderBinder) service;
} else {
Log_OC.d(TAG, "Upload service connected");
mUploaderBinder = (FileUploaderBinder) service;
} else {
Log_OC.d(TAG, "Download service suddenly disconnected");
mDownloaderBinder = null;
Log_OC.d(TAG, "Download service suddenly disconnected");
mDownloaderBinder = null;
Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
showDetailsIntent.setAction(FileDisplayActivity.ACTION_DETAILS);
showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, file);
Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
showDetailsIntent.setAction(FileDisplayActivity.ACTION_DETAILS);
showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, file);
- showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, AccountUtils.getCurrentOwnCloudAccount(this));
+ showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT,
+ AccountUtils.getCurrentOwnCloudAccount(this));
startActivity(showDetailsIntent);
int pos = mPreviewImagePagerAdapter.getFilePosition(file);
file = mPreviewImagePagerAdapter.getFileAt(pos);
startActivity(showDetailsIntent);
int pos = mPreviewImagePagerAdapter.getFilePosition(file);
file = mPreviewImagePagerAdapter.getFileAt(pos);
} else {
OCFile currentFile = mPreviewImagePagerAdapter.getFileAt(position);
getSupportActionBar().setTitle(currentFile.getFileName());
} else {
OCFile currentFile = mPreviewImagePagerAdapter.getFileAt(position);
getSupportActionBar().setTitle(currentFile.getFileName());
if (!currentFile.isDown()) {
if (!mPreviewImagePagerAdapter.pendingErrorAt(position)) {
requestForDownload(currentFile);
if (!currentFile.isDown()) {
if (!mPreviewImagePagerAdapter.pendingErrorAt(position)) {
requestForDownload(currentFile);
* Called when the scroll state changes. Useful for discovering when the user begins dragging,
* when the pager is automatically settling to the current page. when it is fully stopped/idle.
*
* Called when the scroll state changes. Useful for discovering when the user begins dragging,
* when the pager is automatically settling to the current page. when it is fully stopped/idle.
*
- * This method will be invoked when the current page is scrolled, either as part of a programmatically
- * initiated smooth scroll or a user initiated touch scroll.
+ * This method will be invoked when the current page is scrolled, either as part of a
+ * programmatically initiated smooth scroll or a user initiated touch scroll.
OCFile file = getStorageManager().getFileByPath(downloadedRemotePath);
int position = mPreviewImagePagerAdapter.getFilePosition(file);
OCFile file = getStorageManager().getFileByPath(downloadedRemotePath);
int position = mPreviewImagePagerAdapter.getFilePosition(file);
- boolean downloadWasFine = intent.getBooleanExtra(FileDownloader.EXTRA_DOWNLOAD_RESULT, false);
- //boolean isOffscreen = Math.abs((mViewPager.getCurrentItem() - position)) <= mViewPager.getOffscreenPageLimit();
+ boolean downloadWasFine = intent.getBooleanExtra(
+ FileDownloader.EXTRA_DOWNLOAD_RESULT, false);
+ //boolean isOffscreen = Math.abs((mViewPager.getCurrentItem() - position))
+ // <= mViewPager.getOffscreenPageLimit();
if (downloadWasFine) {
mPreviewImagePagerAdapter.updateFile(position, file);
} else {
mPreviewImagePagerAdapter.updateWithDownloadError(position);
}
if (downloadWasFine) {
mPreviewImagePagerAdapter.updateFile(position, file);
} else {
mPreviewImagePagerAdapter.updateWithDownloadError(position);
}