You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 1, 2018. It is now read-only.
Please apply the following patches in order, they will apply against the latest sources from Gitorious.
When a file is updated on the ownCloud server, the app does not show this, and there is no way to force the download of the newer file. Instead, indicate the update to the user, based on modification times, and change the open button to download.
commit 0229bd8d82eda67028b488624c8ce18c05743aa6
Author: Andrew Barr <andrew_james_barr@fastmail.fm>
Date: Tue Jul 17 16:00:33 2012 -0400
if the remote file is newer, do not show an open button,
show download instead.
Conflicts:
src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java
diff --git a/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java b/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java
index 1ee24c8..4b0a856 100644
--- a/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java
+++ b/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java
@@ -327,14 +327,23 @@ public class FileDetailFragment extends SherlockFragment implements
CheckBox cb = (CheckBox)getView().findViewById(R.id.fdKeepInSync);
cb.setChecked(mFile.keepInSync());
+
+ boolean openButton = false;
- if (mFile.getStoragePath() != null) {
- // Update preview
+ if(mFile.getStoragePath() != null) {
+ File f = new File(mFile.getStoragePath());
+ if(mFile.getModificationTimestamp() > f.lastModified()) {
+ openButton = false;
+ } else
+ openButton = true;
+
if (mFile.getMimetype().startsWith("image/")) {
BitmapLoader bl = new BitmapLoader();
bl.execute(new String[]{mFile.getStoragePath()});
}
-
+ }
+
+ if(openButton) {
// Change download button to open button
downloadButton.setText(R.string.filedetails_open);
downloadButton.setOnClickListener(new OnClickListener() {
commit edb5f6a96f563e0fa286205396bc2479e913330a
Author: Andrew Barr <andrew_james_barr@fastmail.fm>
Date: Wed Jun 13 15:37:46 2012 -0400
- indicate to the user when a newer copy of a file is available.
- do not indicate that a file previously downloaded but which does
not actually exist in the local storage is already downloaded.
Conflicts:
src/eu/alefzero/owncloud/ui/adapter/FileListListAdapter.java
diff --git a/res/drawable/updated_file_indicator.png b/res/drawable/updated_file_indicator.png
new file mode 100644
index 0000000..89abc6b
Binary files /dev/null and b/res/drawable/updated_file_indicator.png differ
diff --git a/res/layout/list_layout.xml b/res/layout/list_layout.xml
index bf6dade..151e730 100644
--- a/res/layout/list_layout.xml
+++ b/res/layout/list_layout.xml
@@ -34,6 +34,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/local_file_indicator"/>
+
+ <ImageView
+ android:id="@+id/imageViewUpdated"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/updated_file_indicator"/>
+
<ImageView
android:id="@+id/imageView1"
diff --git a/src/eu/alefzero/owncloud/ui/adapter/FileListListAdapter.java b/src/eu/alefzero/owncloud/ui/adapter/FileListListAdapter.java
index 646a1ca..77cfc6a 100644
--- a/src/eu/alefzero/owncloud/ui/adapter/FileListListAdapter.java
+++ b/src/eu/alefzero/owncloud/ui/adapter/FileListListAdapter.java
@@ -17,22 +17,21 @@
*/
package eu.alefzero.owncloud.ui.adapter;
+import java.io.File;
import java.util.Vector;
-import eu.alefzero.owncloud.DisplayUtils;
-import eu.alefzero.owncloud.R;
-import eu.alefzero.owncloud.datamodel.DataStorageManager;
-import eu.alefzero.owncloud.datamodel.OCFile;
-
import android.content.Context;
import android.database.DataSetObserver;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.TextView;
+import eu.alefzero.owncloud.DisplayUtils;
+import eu.alefzero.owncloud.R;
+import eu.alefzero.owncloud.datamodel.DataStorageManager;
+import eu.alefzero.owncloud.datamodel.OCFile;
/**
* This Adapter populates a ListView with all files and folders in an ownCloud
@@ -110,10 +109,21 @@ public class FileListListAdapter implements ListAdapter {
fileIcon.setImageResource(R.drawable.ic_menu_archive);
}
ImageView down = (ImageView) view.findViewById(R.id.imageView2);
- if (file.getStoragePath() != null)
- down.setVisibility(View.VISIBLE);
- else
+ ImageView updated = (ImageView) view.findViewById(R.id.imageViewUpdated);
+
+ if (file.getStoragePath() != null) {
+ long localFileModificationTime = new File(file.getStoragePath()).lastModified();
+ long remoteFileModificationTime = file.getModificationTimestamp();
+
+ if(remoteFileModificationTime > localFileModificationTime)
+ updated.setVisibility(View.VISIBLE);
+ else
+ down.setVisibility(View.VISIBLE);
+
+ } else {
down.setVisibility(View.INVISIBLE);
+ updated.setVisibility(View.INVISIBLE);
+ }
if (!file.isDirectory()) {
view.findViewById(R.id.file_size).setVisibility(View.VISIBLE);
diff --git a/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java b/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java
index 4b0a856..af86e27 100644
--- a/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java
+++ b/src/eu/alefzero/owncloud/ui/fragment/FileDetailFragment.java
@@ -332,7 +332,8 @@ public class FileDetailFragment extends SherlockFragment implements
if(mFile.getStoragePath() != null) {
File f = new File(mFile.getStoragePath());
- if(mFile.getModificationTimestamp() > f.lastModified()) {
+ if((mFile.getModificationTimestamp() > f.lastModified()) ||
+ !mFile.fileExists()) {
openButton = false;
} else
openButton = true;
commit 29cb46867e7a32283ee83a142b71348eacec8455
Author: Andrew Barr <andrew_james_barr@fastmail.fm>
Date: Wed Jun 13 17:50:34 2012 -0400
need to account for the case where modification times are equal,
which is actually what happens a lot of the time.
diff --git a/src/eu/alefzero/owncloud/ui/adapter/FileListListAdapter.java b/src/eu/alefzero/owncloud/ui/adapter/FileListListAdapter.java
index 77cfc6a..f665de5 100644
--- a/src/eu/alefzero/owncloud/ui/adapter/FileListListAdapter.java
+++ b/src/eu/alefzero/owncloud/ui/adapter/FileListListAdapter.java
@@ -117,7 +117,7 @@ public class FileListListAdapter implements ListAdapter {
if(remoteFileModificationTime > localFileModificationTime)
updated.setVisibility(View.VISIBLE);
- else
+ else if(remoteFileModificationTime <= localFileModificationTime)
down.setVisibility(View.VISIBLE);
} else {
commit 5d3d7f8b7ec5e74c028526d1eb941b81ccccd228
Author: Andrew Barr <andrew_james_barr@fastmail.fm>
Date: Wed Jun 13 18:11:44 2012 -0400
still tweaking this logic.
diff --git a/src/eu/alefzero/owncloud/ui/adapter/FileListListAdapter.java b/src/eu/alefzero/owncloud/ui/adapter/FileListListAdapter.java
index f665de5..a7ff100 100644
--- a/src/eu/alefzero/owncloud/ui/adapter/FileListListAdapter.java
+++ b/src/eu/alefzero/owncloud/ui/adapter/FileListListAdapter.java
@@ -111,6 +111,9 @@ public class FileListListAdapter implements ListAdapter {
ImageView down = (ImageView) view.findViewById(R.id.imageView2);
ImageView updated = (ImageView) view.findViewById(R.id.imageViewUpdated);
+ down.setVisibility(View.INVISIBLE);
+ updated.setVisibility(View.INVISIBLE);
+
if (file.getStoragePath() != null) {
long localFileModificationTime = new File(file.getStoragePath()).lastModified();
long remoteFileModificationTime = file.getModificationTimestamp();
@@ -120,11 +123,8 @@ public class FileListListAdapter implements ListAdapter {
else if(remoteFileModificationTime <= localFileModificationTime)
down.setVisibility(View.VISIBLE);
- } else {
- down.setVisibility(View.INVISIBLE);
- updated.setVisibility(View.INVISIBLE);
}
-
+
if (!file.isDirectory()) {
view.findViewById(R.id.file_size).setVisibility(View.VISIBLE);
view.findViewById(R.id.last_mod).setVisibility(View.VISIBLE);
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Please apply the following patches in order, they will apply against the latest sources from Gitorious.
When a file is updated on the ownCloud server, the app does not show this, and there is no way to force the download of the newer file. Instead, indicate the update to the user, based on modification times, and change the open button to download.
My repository is located at https://gitorious.org/~andrewjamesbarr/owncloud/andrewjamesbarrs-android-devel/commits/upstream which may be easier to apply.
The text was updated successfully, but these errors were encountered: