From: David A. Velasco Date: Thu, 18 Sep 2014 07:31:24 +0000 (+0200) Subject: Fixed conflict - Merge branch 'develop' into better_loggin_system X-Git-Tag: oc-android-1.7.0_signed~176^2 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/ea5c4760c2f150f907b17c2c8609ab1353a3ef62?hp=74c29e1ce1fcfdaac2c166678904258bbe8dddc2 Fixed conflict - Merge branch 'develop' into better_loggin_system --- diff --git a/res/values-el/strings.xml b/res/values-el/strings.xml index a343b9b7..39f099e2 100644 --- a/res/values-el/strings.xml +++ b/res/values-el/strings.xml @@ -31,6 +31,7 @@ Σχόλια Αποτύπωμα Δοκιμάστε %1$s στο κινητό σας! + Θα ήθελα να σε προσκαλέσω να χρησιμοποιήσεις το %1$s στο κινητό σου!\nΛήψη εδώ: %2$s Έλεγχος Διακομιστή Διεύθυνση διακομιστή https://… Όνομα χρήστη diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index 117abcb7..ac37b198 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -31,6 +31,7 @@ Segnalazioni Imprint Prova %1$s sul tuo smartphone! + Vorrei invitarti a usare %1$s sul tuo smartphone!\nScarica qui: %2$s Verifica server Indirizzo server https://... Nome utente diff --git a/res/values-sl/strings.xml b/res/values-sl/strings.xml index b8dfbec1..b1bf1bcb 100644 --- a/res/values-sl/strings.xml +++ b/res/values-sl/strings.xml @@ -31,6 +31,7 @@ Odziv Natis Preizkusi %1$s na pametnem telefonu! + Želim ti predstaviti %1$s na pametnem telefonu!\nPrejmeš ga lahko na: %2$s Preveri strežnik Naslov strežnika https://… Uporabniško ime diff --git a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java index 46231c7a..f5426527 100644 --- a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java +++ b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java @@ -109,6 +109,9 @@ public class SynchronizeFolderOperation extends RemoteOperation { /** 'True' means that the remote folder changed from last synchronization and should be fetched */ private boolean mRemoteFolderChanged; + /** 'True' means that Etag will be ignored */ + private boolean mIgnoreETag; + /** * Creates a new instance of {@link SynchronizeFolderOperation}. @@ -126,6 +129,7 @@ public class SynchronizeFolderOperation extends RemoteOperation { long currentSyncTime, boolean syncFullAccount, boolean isShareSupported, + boolean ignoreETag, FileDataStorageManager dataStorageManager, Account account, Context context ) { @@ -138,6 +142,7 @@ public class SynchronizeFolderOperation extends RemoteOperation { mContext = context; mForgottenLocalFiles = new HashMap(); mRemoteFolderChanged = false; + mIgnoreETag = ignoreETag; } @@ -215,7 +220,7 @@ public class SynchronizeFolderOperation extends RemoteOperation { private RemoteOperationResult checkForChanges(OwnCloudClient client) { - mRemoteFolderChanged = false; + mRemoteFolderChanged = true; RemoteOperationResult result = null; String remotePath = null; @@ -227,10 +232,12 @@ public class SynchronizeFolderOperation extends RemoteOperation { result = operation.execute(client); if (result.isSuccess()){ OCFile remoteFolder = FileStorageUtils.fillOCFile((RemoteFile) result.getData().get(0)); - - // check if remote and local folder are different - mRemoteFolderChanged = !(remoteFolder.getEtag().equalsIgnoreCase(mLocalFolder.getEtag())); - + + if (!mIgnoreETag) { + // check if remote and local folder are different + mRemoteFolderChanged = !(remoteFolder.getEtag().equalsIgnoreCase(mLocalFolder.getEtag())); + } + result = new RemoteOperationResult(ResultCode.OK); Log_OC.i(TAG, "Checked " + mAccount.name + remotePath + " : " + (mRemoteFolderChanged ? "changed" : "not changed")); diff --git a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java index 360dcf40..b095981e 100644 --- a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java +++ b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java @@ -264,6 +264,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { mCurrentSyncTime, true, mIsShareSupported, + true, getStorageManager(), getAccount(), getContext() diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index 69d44212..21472fd1 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -21,8 +21,6 @@ package com.owncloud.android.ui.activity; import java.io.File; import java.io.IOException; -import org.apache.commons.httpclient.methods.PostMethod; - import android.accounts.Account; import android.accounts.AccountManager; import android.accounts.AuthenticatorException; @@ -50,7 +48,6 @@ import android.provider.MediaStore; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; -import android.support.v4.widget.SwipeRefreshLayout; import android.util.Log; import android.view.View; import android.view.ViewGroup; @@ -115,7 +112,7 @@ import com.owncloud.android.utils.ErrorMessageAdapter; public class FileDisplayActivity extends HookActivity implements FileFragment.ContainerActivity, OnNavigationListener, -OnSslUntrustedCertListener, SwipeRefreshLayout.OnRefreshListener { +OnSslUntrustedCertListener, OnEnforceableRefreshListener { private ArrayAdapter mDirectories; @@ -252,7 +249,7 @@ OnSslUntrustedCertListener, SwipeRefreshLayout.OnRefreshListener { Log_OC.e(TAG, "Initializing Fragments in onAccountChanged.."); initFragmentsWithFile(); if (file.isFolder()) { - startSyncFolderOperation(file); + startSyncFolderOperation(file, false); } } else { @@ -1169,7 +1166,7 @@ OnSslUntrustedCertListener, SwipeRefreshLayout.OnRefreshListener { OCFile root = getStorageManager().getFileByPath(OCFile.ROOT_PATH); listOfFiles.listDirectory(root); setFile(listOfFiles.getCurrentFile()); - startSyncFolderOperation(root); + startSyncFolderOperation(root, false); } cleanSecondFragment(); } @@ -1184,7 +1181,7 @@ OnSslUntrustedCertListener, SwipeRefreshLayout.OnRefreshListener { setNavigationListWithFolder(folder); listOfFiles.listDirectory(folder); setFile(listOfFiles.getCurrentFile()); - startSyncFolderOperation(folder); + startSyncFolderOperation(folder, false); } else { Log_OC.e(TAG, "Unexpected null when accessing list fragment"); } @@ -1203,7 +1200,7 @@ OnSslUntrustedCertListener, SwipeRefreshLayout.OnRefreshListener { cleanSecondFragment(); // Sync Folder - startSyncFolderOperation(directory); + startSyncFolderOperation(directory, false); } @@ -1320,7 +1317,7 @@ OnSslUntrustedCertListener, SwipeRefreshLayout.OnRefreshListener { @Override public void onSavedCertificate() { - startSyncFolderOperation(getCurrentDir()); + startSyncFolderOperation(getCurrentDir(), false); } @@ -1608,7 +1605,7 @@ OnSslUntrustedCertListener, SwipeRefreshLayout.OnRefreshListener { return null; } - public void startSyncFolderOperation(OCFile folder) { + public void startSyncFolderOperation(OCFile folder, boolean ignoreETag) { long currentSyncTime = System.currentTimeMillis(); mSyncInProgress = true; @@ -1618,6 +1615,7 @@ OnSslUntrustedCertListener, SwipeRefreshLayout.OnRefreshListener { currentSyncTime, false, getFileOperationsHelper().isSharedSupported(), + ignoreETag, getStorageManager(), getAccount(), getApplicationContext() @@ -1730,16 +1728,24 @@ OnSslUntrustedCertListener, SwipeRefreshLayout.OnRefreshListener { } @Override + public void onRefresh(boolean ignoreETag) { + refreshList(ignoreETag); + } + + @Override public void onRefresh() { + refreshList(true); + } + + private void refreshList(boolean ignoreETag) { OCFileListFragment listOfFiles = getListOfFilesFragment(); if (listOfFiles != null) { OCFile folder = listOfFiles.getCurrentFile(); if (folder != null) { /*mFile = mContainerActivity.getStorageManager().getFileById(mFile.getFileId()); listDirectory(mFile);*/ - startSyncFolderOperation(folder); + startSyncFolderOperation(folder, ignoreETag); } } } - } diff --git a/src/com/owncloud/android/ui/activity/MoveActivity.java b/src/com/owncloud/android/ui/activity/MoveActivity.java index c6025c4c..2d6824c8 100644 --- a/src/com/owncloud/android/ui/activity/MoveActivity.java +++ b/src/com/owncloud/android/ui/activity/MoveActivity.java @@ -145,7 +145,7 @@ public class MoveActivity extends HookActivity implements FileFragment.Container OCFileListFragment listOfFolders = getListOfFilesFragment(); listOfFolders.listDirectory(folder); - startSyncFolderOperation(folder); + startSyncFolderOperation(folder, false); } updateNavigationElementsInActionBar(); @@ -201,12 +201,12 @@ public class MoveActivity extends HookActivity implements FileFragment.Container setFile(directory); updateNavigationElementsInActionBar(); // Sync Folder - startSyncFolderOperation(directory); + startSyncFolderOperation(directory, false); } - public void startSyncFolderOperation(OCFile folder) { + public void startSyncFolderOperation(OCFile folder, boolean ignoreETag) { long currentSyncTime = System.currentTimeMillis(); mSyncInProgress = true; @@ -216,6 +216,7 @@ public class MoveActivity extends HookActivity implements FileFragment.Container currentSyncTime, false, getFileOperationsHelper().isSharedSupported(), + ignoreETag, getStorageManager(), getAccount(), getApplicationContext() @@ -323,7 +324,7 @@ public class MoveActivity extends HookActivity implements FileFragment.Container listOfFiles.listDirectory(root); setFile(listOfFiles.getCurrentFile()); updateNavigationElementsInActionBar(); - startSyncFolderOperation(root); + startSyncFolderOperation(root, false); } } @@ -560,7 +561,7 @@ public class MoveActivity extends HookActivity implements FileFragment.Container if (listOfFiles != null) { OCFile folder = listOfFiles.getCurrentFile(); if (folder != null) { - startSyncFolderOperation(folder); + startSyncFolderOperation(folder, true); } } } diff --git a/src/com/owncloud/android/ui/activity/OnEnforceableRefreshListener.java b/src/com/owncloud/android/ui/activity/OnEnforceableRefreshListener.java new file mode 100644 index 00000000..22bdb18b --- /dev/null +++ b/src/com/owncloud/android/ui/activity/OnEnforceableRefreshListener.java @@ -0,0 +1,10 @@ +package com.owncloud.android.ui.activity; + +import android.support.v4.widget.SwipeRefreshLayout; + + public interface OnEnforceableRefreshListener extends SwipeRefreshLayout.OnRefreshListener { + + public void onRefresh(boolean enforced); + + } + diff --git a/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java b/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java index 45a6aafe..5d3f7ace 100644 --- a/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java +++ b/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java @@ -35,12 +35,13 @@ import com.actionbarsherlock.app.SherlockFragment; import com.owncloud.android.R; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.ui.ExtendedListView; +import com.owncloud.android.ui.activity.OnEnforceableRefreshListener; /** * TODO extending SherlockListFragment instead of SherlockFragment */ public class ExtendedListFragment extends SherlockFragment -implements OnItemClickListener, SwipeRefreshLayout.OnRefreshListener { +implements OnItemClickListener, OnEnforceableRefreshListener { private static final String TAG = ExtendedListFragment.class.getSimpleName(); @@ -63,7 +64,7 @@ implements OnItemClickListener, SwipeRefreshLayout.OnRefreshListener { private ArrayList mTops; private int mHeightCell = 0; - private SwipeRefreshLayout.OnRefreshListener mOnRefreshListener = null; + private OnEnforceableRefreshListener mOnRefreshListener = null; public void setListAdapter(ListAdapter listAdapter) { @@ -240,7 +241,7 @@ implements OnItemClickListener, SwipeRefreshLayout.OnRefreshListener { } } - public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) { + public void setOnRefreshListener(OnEnforceableRefreshListener listener) { mOnRefreshListener = listener; } @@ -300,4 +301,13 @@ implements OnItemClickListener, SwipeRefreshLayout.OnRefreshListener { refreshLayout.setOnRefreshListener(this); } + @Override + public void onRefresh(boolean ignoreETag) { + mRefreshLayout.setRefreshing(false); + mRefreshEmptyLayout.setRefreshing(false); + + if (mOnRefreshListener != null) { + mOnRefreshListener.onRefresh(ignoreETag); + } + } } diff --git a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java index 099e442f..3665fe0b 100644 --- a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -37,6 +37,7 @@ import com.owncloud.android.files.FileMenuFilter; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.ui.activity.FileDisplayActivity; import com.owncloud.android.ui.activity.MoveActivity; +import com.owncloud.android.ui.activity.OnEnforceableRefreshListener; import com.owncloud.android.ui.adapter.FileListListAdapter; import com.owncloud.android.ui.dialog.ConfirmationDialogFragment; import com.owncloud.android.ui.dialog.RemoveFileDialogFragment; @@ -88,7 +89,7 @@ public class OCFileListFragment extends ExtendedListFragment { FileFragment.ContainerActivity.class.getSimpleName()); } try { - setOnRefreshListener((SwipeRefreshLayout.OnRefreshListener) activity); + setOnRefreshListener((OnEnforceableRefreshListener) activity); } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement " + @@ -174,7 +175,7 @@ public class OCFileListFragment extends ExtendedListFragment { listDirectory(mFile); - onRefresh(); + onRefresh(false); // restore index and top position restoreIndexAndTopPosition();