mirror of
https://github.com/nextcloud/android.git
synced 2024-12-19 15:33:00 +03:00
Merge remote-tracking branch 'origin/searchViewWrongFiles' into searchViewWrongFiles
# Conflicts: # src/main/java/com/owncloud/android/providers/FileContentProvider.java
This commit is contained in:
commit
62818760c1
23 changed files with 179 additions and 122 deletions
|
@ -96,7 +96,8 @@ public class AccountUtils {
|
|||
int lastAtPos = account.name.lastIndexOf("@");
|
||||
String hostAndPort = account.name.substring(lastAtPos + 1);
|
||||
String username = account.name.substring(0, lastAtPos);
|
||||
String otherHostAndPort, otherUsername;
|
||||
String otherHostAndPort;
|
||||
String otherUsername;
|
||||
Locale currentLocale = context.getResources().getConfiguration().locale;
|
||||
for (Account otherAccount : ocAccounts) {
|
||||
lastAtPos = otherAccount.name.lastIndexOf("@");
|
||||
|
|
|
@ -50,6 +50,9 @@ public class PassCodeManager {
|
|||
|
||||
public static PassCodeManager mPassCodeManagerInstance = null;
|
||||
|
||||
private Long mTimestamp = 0l;
|
||||
private int mVisibleActivitiesCounter = 0;
|
||||
|
||||
public static PassCodeManager getPassCodeManager() {
|
||||
if (mPassCodeManagerInstance == null) {
|
||||
mPassCodeManagerInstance = new PassCodeManager();
|
||||
|
@ -57,9 +60,6 @@ public class PassCodeManager {
|
|||
return mPassCodeManagerInstance;
|
||||
}
|
||||
|
||||
private Long mTimestamp = 0l;
|
||||
private int mVisibleActivitiesCounter = 0;
|
||||
|
||||
protected PassCodeManager() {};
|
||||
|
||||
public void onActivityCreated(Activity activity) {
|
||||
|
|
|
@ -55,18 +55,17 @@ import java.security.cert.X509Certificate;
|
|||
public class SsoWebViewClient extends WebViewClient {
|
||||
|
||||
private static final String TAG = SsoWebViewClient.class.getSimpleName();
|
||||
|
||||
public interface SsoWebViewClientListener {
|
||||
public void onSsoFinished(String sessionCookie);
|
||||
}
|
||||
|
||||
|
||||
private Context mContext;
|
||||
private Handler mListenerHandler;
|
||||
private WeakReference<SsoWebViewClientListener> mListenerRef;
|
||||
private String mTargetUrl;
|
||||
private String mLastReloadedUrlAtError;
|
||||
|
||||
|
||||
public interface SsoWebViewClientListener {
|
||||
public void onSsoFinished(String sessionCookie);
|
||||
}
|
||||
|
||||
public SsoWebViewClient (Context context, Handler listenerHandler, SsoWebViewClientListener listener) {
|
||||
mContext = context;
|
||||
mListenerHandler = listenerHandler;
|
||||
|
@ -191,5 +190,4 @@ public class SsoWebViewClient extends WebViewClient {
|
|||
|
||||
((AuthenticatorActivity)mContext).createAuthenticationDialog(view, handler);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ package com.owncloud.android.datastorage;
|
|||
import android.os.Build;
|
||||
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.datastorage.providers.EnvironmentStoragePointProvider;
|
||||
import com.owncloud.android.datastorage.providers.HardcodedStoragePointProvider;
|
||||
import com.owncloud.android.datastorage.providers.IStoragePointProvider;
|
||||
|
@ -65,7 +64,7 @@ public class DataStorageProvider {
|
|||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
for (File f : MainApp.getAppContext().getExternalFilesDirs(null)) {
|
||||
for (File f : MainApp.getAppContext().getExternalMediaDirs()) {
|
||||
if (f != null) {
|
||||
mCachedStoragePoints.add(new StoragePoint(f.getAbsolutePath(), f.getAbsolutePath()));
|
||||
}
|
||||
|
@ -87,7 +86,8 @@ public class DataStorageProvider {
|
|||
return s.getDescription();
|
||||
}
|
||||
}
|
||||
return MainApp.getAppContext().getString(R.string.storage_description_unknown);
|
||||
// Fallback to just display complete path
|
||||
return path;
|
||||
}
|
||||
|
||||
public void addStoragePointProvider(IStoragePointProvider provider) {
|
||||
|
|
|
@ -21,14 +21,15 @@
|
|||
|
||||
package com.owncloud.android.datastorage.providers;
|
||||
|
||||
import android.os.Environment;
|
||||
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.datastorage.StoragePoint;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
|
||||
import static android.os.Environment.getExternalStorageDirectory;
|
||||
|
||||
/**
|
||||
* @author Bartosz Przybylski
|
||||
*/
|
||||
|
@ -42,10 +43,17 @@ public class SystemDefaultStoragePointProvider extends AbstractStoragePointProvi
|
|||
public Vector<StoragePoint> getAvailableStoragePoint() {
|
||||
Vector<StoragePoint> result = new Vector<>();
|
||||
|
||||
final String defaultStringDesc =
|
||||
MainApp.getAppContext().getString(R.string.storage_description_default);
|
||||
final String path = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
result.add(new StoragePoint(defaultStringDesc, path));
|
||||
final String defaultStringDesc = MainApp.getAppContext().getString(R.string.storage_description_default);
|
||||
File path;
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
|
||||
path = MainApp.getAppContext().getExternalMediaDirs()[0];
|
||||
} else {
|
||||
path = getExternalStorageDirectory();
|
||||
}
|
||||
|
||||
if (path != null && path.canWrite()) {
|
||||
result.add(new StoragePoint(defaultStringDesc, path.getAbsolutePath()));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -302,7 +302,8 @@ public class FileUploader extends Service
|
|||
UploadsStorageManager uploadsStorageManager = new UploadsStorageManager(context.getContentResolver(), context);
|
||||
OCUpload[] failedUploads = uploadsStorageManager.getFailedUploads();
|
||||
Account currentAccount = null;
|
||||
boolean resultMatch, accountMatch;
|
||||
boolean resultMatch;
|
||||
boolean accountMatch;
|
||||
for ( OCUpload failedUpload: failedUploads) {
|
||||
accountMatch = (account == null || account.name.equals(failedUpload.getAccountName()));
|
||||
resultMatch = (uploadResult == null || uploadResult.equals(failedUpload.getLastResult()));
|
||||
|
@ -434,7 +435,9 @@ public class FileUploader extends Service
|
|||
return Service.START_NOT_STICKY;
|
||||
}
|
||||
|
||||
String[] localPaths = null, remotePaths = null, mimeTypes = null;
|
||||
String[] localPaths = null;
|
||||
String[] remotePaths = null;
|
||||
String[] mimeTypes = null;
|
||||
OCFile[] files = null;
|
||||
|
||||
if (intent.hasExtra(KEY_FILE)) {
|
||||
|
|
|
@ -41,13 +41,13 @@ import java.util.concurrent.ConcurrentMap;
|
|||
*/
|
||||
public class IndexedForest<V> {
|
||||
|
||||
private ConcurrentMap<String, Node<V>> mMap = new ConcurrentHashMap<String, Node<V>>();
|
||||
private ConcurrentMap<String, Node<V>> mMap = new ConcurrentHashMap<>();
|
||||
|
||||
@SuppressWarnings("PMD.ShortClassName")
|
||||
private class Node<V> {
|
||||
String mKey = null;
|
||||
Node<V> mParent = null;
|
||||
Set<Node<V>> mChildren = new HashSet<Node<V>>(); // TODO be careful with hash()
|
||||
Set<Node<V>> mChildren = new HashSet<>(); // TODO be careful with hash()
|
||||
V mPayload = null;
|
||||
|
||||
// payload is optional
|
||||
|
@ -112,7 +112,9 @@ public class IndexedForest<V> {
|
|||
|
||||
} else {
|
||||
// value really added
|
||||
String currentPath = remotePath, parentPath = null, parentKey = null;
|
||||
String currentPath = remotePath;
|
||||
String parentPath = null;
|
||||
String parentKey = null;
|
||||
Node<V> currentNode = valuedNode, parentNode = null;
|
||||
boolean linked = false;
|
||||
while (!OCFile.ROOT_PATH.equals(currentPath) && !linked) {
|
||||
|
|
|
@ -81,9 +81,11 @@ public class DownloadFileOperation extends RemoteOperation {
|
|||
}
|
||||
|
||||
public String getSavePath() {
|
||||
String path = mFile.getStoragePath(); // re-downloads should be done over the original file
|
||||
if (path != null && path.length() > 0) {
|
||||
return path;
|
||||
if (mFile.getStoragePath() != null) {
|
||||
File path = new File(mFile.getStoragePath()); // re-downloads should be done over the original file
|
||||
if (path.canWrite()) {
|
||||
return path.getAbsolutePath();
|
||||
}
|
||||
}
|
||||
return FileStorageUtils.getDefaultSavePathFor(mAccount.name, mFile);
|
||||
}
|
||||
|
|
|
@ -375,7 +375,9 @@ public class RefreshFolderOperation extends RemoteOperation {
|
|||
}
|
||||
|
||||
// loop to update every child
|
||||
OCFile remoteFile = null, localFile = null, updatedFile = null;
|
||||
OCFile remoteFile = null;
|
||||
OCFile localFile = null;
|
||||
OCFile updatedFile = null;
|
||||
RemoteFile r;
|
||||
for (int i=1; i<folderAndFiles.size(); i++) {
|
||||
/// new OCFile instance with the data from the server
|
||||
|
|
|
@ -288,7 +288,9 @@ public class SynchronizeFolderOperation extends SyncOperation {
|
|||
}
|
||||
|
||||
// loop to synchronize every child
|
||||
OCFile remoteFile = null, localFile = null, updatedFile = null;
|
||||
OCFile remoteFile = null;
|
||||
OCFile localFile = null;
|
||||
OCFile updatedFile = null;
|
||||
RemoteFile r;
|
||||
for (int i=1; i<folderAndFiles.size(); i++) {
|
||||
/// new OCFile instance with the data from the server
|
||||
|
|
|
@ -72,43 +72,17 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
*/
|
||||
public class UploadFileOperation extends SyncOperation {
|
||||
|
||||
private static final String TAG = UploadFileOperation.class.getSimpleName();
|
||||
|
||||
public static final int CREATED_BY_USER = 0;
|
||||
public static final int CREATED_AS_INSTANT_PICTURE = 1;
|
||||
public static final int CREATED_AS_INSTANT_VIDEO = 2;
|
||||
|
||||
public static OCFile obtainNewOCFileToUpload(String remotePath, String localPath, String mimeType) {
|
||||
|
||||
// MIME type
|
||||
if (mimeType == null || mimeType.length() <= 0) {
|
||||
mimeType = MimeTypeUtil.getBestMimeTypeByFilename(localPath);
|
||||
}
|
||||
|
||||
OCFile newFile = new OCFile(remotePath);
|
||||
newFile.setStoragePath(localPath);
|
||||
newFile.setLastSyncDateForProperties(0);
|
||||
newFile.setLastSyncDateForData(0);
|
||||
|
||||
// size
|
||||
if (localPath != null && localPath.length() > 0) {
|
||||
File localFile = new File(localPath);
|
||||
newFile.setFileLength(localFile.length());
|
||||
newFile.setLastSyncDateForData(localFile.lastModified());
|
||||
} // don't worry about not assigning size, the problems with localPath
|
||||
// are checked when the UploadFileOperation instance is created
|
||||
|
||||
|
||||
newFile.setMimetype(mimeType);
|
||||
|
||||
return newFile;
|
||||
}
|
||||
|
||||
private static final String TAG = UploadFileOperation.class.getSimpleName();
|
||||
|
||||
private Account mAccount;
|
||||
/**
|
||||
* OCFile which is to be uploaded.
|
||||
*/
|
||||
private OCFile mFile;
|
||||
|
||||
/**
|
||||
* Original OCFile which is to be uploaded in case file had to be renamed
|
||||
* (if forceOverwrite==false and remote file already exists).
|
||||
|
@ -139,6 +113,34 @@ public class UploadFileOperation extends SyncOperation {
|
|||
|
||||
protected RequestEntity mEntity = null;
|
||||
|
||||
private Account mAccount;
|
||||
|
||||
public static OCFile obtainNewOCFileToUpload(String remotePath, String localPath, String mimeType) {
|
||||
|
||||
// MIME type
|
||||
if (mimeType == null || mimeType.length() <= 0) {
|
||||
mimeType = MimeTypeUtil.getBestMimeTypeByFilename(localPath);
|
||||
}
|
||||
|
||||
OCFile newFile = new OCFile(remotePath);
|
||||
newFile.setStoragePath(localPath);
|
||||
newFile.setLastSyncDateForProperties(0);
|
||||
newFile.setLastSyncDateForData(0);
|
||||
|
||||
// size
|
||||
if (localPath != null && localPath.length() > 0) {
|
||||
File localFile = new File(localPath);
|
||||
newFile.setFileLength(localFile.length());
|
||||
newFile.setLastSyncDateForData(localFile.lastModified());
|
||||
} // don't worry about not assigning size, the problems with localPath
|
||||
// are checked when the UploadFileOperation instance is created
|
||||
|
||||
|
||||
newFile.setMimetype(mimeType);
|
||||
|
||||
return newFile;
|
||||
}
|
||||
|
||||
public UploadFileOperation(Account account,
|
||||
OCFile file,
|
||||
OCUpload upload,
|
||||
|
@ -148,8 +150,7 @@ public class UploadFileOperation extends SyncOperation {
|
|||
Context context
|
||||
) {
|
||||
if (account == null) {
|
||||
throw new IllegalArgumentException("Illegal NULL account in UploadFileOperation " +
|
||||
"creation");
|
||||
throw new IllegalArgumentException("Illegal NULL account in UploadFileOperation " + "creation");
|
||||
}
|
||||
if (upload == null) {
|
||||
throw new IllegalArgumentException("Illegal NULL file in UploadFileOperation creation");
|
||||
|
@ -293,7 +294,9 @@ public class UploadFileOperation extends SyncOperation {
|
|||
mCancellationRequested.set(false);
|
||||
mUploadStarted.set(true);
|
||||
RemoteOperationResult result = null;
|
||||
File temporalFile = null, originalFile = new File(mOriginalStoragePath), expectedFile = null;
|
||||
File temporalFile = null;
|
||||
File originalFile = new File(mOriginalStoragePath);
|
||||
File expectedFile = null;
|
||||
|
||||
try {
|
||||
|
||||
|
|
|
@ -354,7 +354,6 @@ public class FileContentProvider extends ContentProvider {
|
|||
|
||||
}
|
||||
return insertedArbitraryDataUri;
|
||||
|
||||
case VIRTUAL:
|
||||
Uri insertedVirtualUri;
|
||||
long virtualId = db.insert(ProviderTableMeta.VIRTUAL_TABLE_NAME, null, values);
|
||||
|
@ -366,7 +365,6 @@ public class FileContentProvider extends ContentProvider {
|
|||
}
|
||||
|
||||
return insertedVirtualUri;
|
||||
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown uri id: " + uri);
|
||||
}
|
||||
|
@ -986,11 +984,13 @@ public class FileContentProvider extends ContentProvider {
|
|||
db.beginTransaction();
|
||||
try {
|
||||
createArbitraryData(db);
|
||||
createVirtualTable(db);
|
||||
upgraded = true;
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!upgraded) {
|
||||
|
@ -1092,7 +1092,7 @@ public class FileContentProvider extends ContentProvider {
|
|||
+ ProviderTableMeta.CAPABILITIES_FILES_UNDELETE + INTEGER // boolean
|
||||
+ ProviderTableMeta.CAPABILITIES_FILES_VERSIONING + INTEGER // boolean
|
||||
+ ProviderTableMeta.CAPABILITIES_FILES_DROP + INTEGER // boolean
|
||||
+ ProviderTableMeta.CAPABILITIES_EXTERNAL_LINKS + " INTEGER );" ); // boolean
|
||||
+ ProviderTableMeta.CAPABILITIES_EXTERNAL_LINKS + " INTEGER );"); // boolean
|
||||
}
|
||||
|
||||
private void createUploadsTable(SQLiteDatabase db) {
|
||||
|
@ -1173,7 +1173,7 @@ public class FileContentProvider extends ContentProvider {
|
|||
*
|
||||
* See {@link com.owncloud.android.authentication.AccountUtils#updateAccountVersion(android.content.Context)}
|
||||
*
|
||||
* @param db Database where table of files is included.
|
||||
* @param db Database where table of files is included.
|
||||
*/
|
||||
private void updateAccountName(SQLiteDatabase db) {
|
||||
Log_OC.d(SQL, "THREAD: " + Thread.currentThread().getName());
|
||||
|
@ -1184,7 +1184,11 @@ public class FileContentProvider extends ContentProvider {
|
|||
// AccountManager are not synchronous
|
||||
Account[] accounts = AccountManager.get(getContext()).getAccountsByType(
|
||||
MainApp.getAccountType());
|
||||
String serverUrl, username, oldAccountName, newAccountName;
|
||||
String serverUrl;
|
||||
String username;
|
||||
String oldAccountName;
|
||||
String newAccountName;
|
||||
|
||||
for (Account account : accounts) {
|
||||
// build both old and new account name
|
||||
serverUrl = ama.getUserData(account, AccountUtils.Constants.KEY_OC_BASE_URL);
|
||||
|
@ -1226,9 +1230,9 @@ public class FileContentProvider extends ContentProvider {
|
|||
* Rename the local ownCloud folder of one account to match the a rename of the account itself. Updates the
|
||||
* table of files in database so that the paths to the local files keep being the same.
|
||||
*
|
||||
* @param db Database where table of files is included.
|
||||
* @param newAccountName New name for the target OC account.
|
||||
* @param oldAccountName Old name of the target OC account.
|
||||
* @param db Database where table of files is included.
|
||||
* @param newAccountName New name for the target OC account.
|
||||
* @param oldAccountName Old name of the target OC account.
|
||||
*/
|
||||
private void updateDownloadedFiles(SQLiteDatabase db, String newAccountName,
|
||||
String oldAccountName) {
|
||||
|
|
|
@ -117,15 +117,16 @@ public class OperationsService extends Service {
|
|||
public static final String ACTION_COPY_FILE = "COPY_FILE";
|
||||
public static final String ACTION_CHECK_CURRENT_CREDENTIALS = "CHECK_CURRENT_CREDENTIALS";
|
||||
|
||||
public static final String ACTION_OPERATION_ADDED = OperationsService.class.getName() +
|
||||
".OPERATION_ADDED";
|
||||
public static final String ACTION_OPERATION_FINISHED = OperationsService.class.getName() +
|
||||
".OPERATION_FINISHED";
|
||||
public static final String ACTION_OPERATION_ADDED = OperationsService.class.getName() + ".OPERATION_ADDED";
|
||||
public static final String ACTION_OPERATION_FINISHED = OperationsService.class.getName() + ".OPERATION_FINISHED";
|
||||
|
||||
private ServiceHandler mOperationsHandler;
|
||||
private OperationsServiceBinder mOperationsBinder;
|
||||
|
||||
private SyncFolderHandler mSyncFolderHandler;
|
||||
|
||||
private ConcurrentMap<Integer, Pair<RemoteOperation, RemoteOperationResult>>
|
||||
mUndispatchedFinishedOperations =
|
||||
new ConcurrentHashMap<Integer, Pair<RemoteOperation, RemoteOperationResult>>();
|
||||
mUndispatchedFinishedOperations = new ConcurrentHashMap<>();
|
||||
|
||||
private static class Target {
|
||||
public Uri mServerUrl = null;
|
||||
|
@ -138,11 +139,6 @@ public class OperationsService extends Service {
|
|||
mCookie = cookie;
|
||||
}
|
||||
}
|
||||
|
||||
private ServiceHandler mOperationsHandler;
|
||||
private OperationsServiceBinder mOperationsBinder;
|
||||
|
||||
private SyncFolderHandler mSyncFolderHandler;
|
||||
|
||||
/**
|
||||
* Service initialization
|
||||
|
@ -165,7 +161,6 @@ public class OperationsService extends Service {
|
|||
mSyncFolderHandler = new SyncFolderHandler(thread.getLooper(), this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Entry point to add a new operation to the queue of operations.
|
||||
* <p/>
|
||||
|
@ -709,7 +704,6 @@ public class OperationsService extends Service {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notifies the currently subscribed listeners about the end of an operation.
|
||||
*
|
||||
|
|
|
@ -26,6 +26,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.BottomNavigationView;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.view.View;
|
||||
|
||||
|
@ -54,6 +55,7 @@ public class ContactsPreferenceActivity extends FileActivity implements FileFrag
|
|||
|
||||
public static final String PREFERENCE_CONTACTS_AUTOMATIC_BACKUP = "PREFERENCE_CONTACTS_AUTOMATIC_BACKUP";
|
||||
public static final String PREFERENCE_CONTACTS_LAST_BACKUP = "PREFERENCE_CONTACTS_LAST_BACKUP";
|
||||
public static final String BACKUP_TO_LIST = "BACKUP_TO_LIST";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -158,4 +160,13 @@ public class ContactsPreferenceActivity extends FileActivity implements FileFrag
|
|||
public void onTransferStateChanged(OCFile file, boolean downloading, boolean uploading) {
|
||||
// not needed
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (getSupportFragmentManager().findFragmentByTag(ContactListFragment.TAG) != null) {
|
||||
getSupportFragmentManager().popBackStack(BACKUP_TO_LIST, FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -425,6 +425,7 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
|
|||
case R.id.nav_on_device:
|
||||
menuItem.setChecked(true);
|
||||
mCheckedMenuItem = menuItem.getItemId();
|
||||
EventBus.getDefault().post(new ChangeMenuEvent());
|
||||
showFiles(true);
|
||||
break;
|
||||
case R.id.nav_uploads:
|
||||
|
|
|
@ -726,7 +726,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
ListView mListView = (ListView) findViewById(android.R.id.list);
|
||||
|
||||
String current_dir = mParents.peek();
|
||||
if (current_dir.equals("")) {
|
||||
if ("".equals(current_dir)) {
|
||||
actionBar.setTitle(getString(R.string.uploader_top_message));
|
||||
} else {
|
||||
actionBar.setTitle(current_dir);
|
||||
|
@ -953,7 +953,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
|
||||
String lastPath = PreferenceManager.getLastUploadPath(this);
|
||||
// "/" equals root-directory
|
||||
if (lastPath.equals("/")) {
|
||||
if ("/".equals(lastPath)) {
|
||||
mParents.add("");
|
||||
} else {
|
||||
String[] dir_names = lastPath.split("/");
|
||||
|
|
|
@ -205,8 +205,14 @@ public class StorageMigration {
|
|||
if (succeed) {
|
||||
mProgressDialog.hide();
|
||||
} else {
|
||||
mProgressDialog.getButton(ProgressDialog.BUTTON_POSITIVE).setVisibility(View.VISIBLE);
|
||||
mProgressDialog.setIndeterminateDrawable(mContext.getResources().getDrawable(R.drawable.image_fail));
|
||||
|
||||
if (code == R.string.file_migration_failed_not_readable) {
|
||||
mProgressDialog.hide();
|
||||
askToStillMove();
|
||||
} else {
|
||||
mProgressDialog.getButton(ProgressDialog.BUTTON_POSITIVE).setVisibility(View.VISIBLE);
|
||||
mProgressDialog.setIndeterminateDrawable(mContext.getResources().getDrawable(R.drawable.image_fail));
|
||||
}
|
||||
}
|
||||
|
||||
if (mListener != null) {
|
||||
|
@ -214,6 +220,28 @@ public class StorageMigration {
|
|||
}
|
||||
}
|
||||
|
||||
private void askToStillMove() {
|
||||
new AlertDialog.Builder(mContext)
|
||||
.setTitle(R.string.file_migration_source_not_readable_title)
|
||||
.setMessage(mContext.getString(R.string.file_migration_source_not_readable, mStorageTarget))
|
||||
.setNegativeButton(R.string.common_no, new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
})
|
||||
.setPositiveButton(R.string.common_yes, new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
if (mListener != null) {
|
||||
mListener.onStorageMigrationFinished(mStorageTarget, true);
|
||||
}
|
||||
}
|
||||
})
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
|
||||
protected boolean[] saveAccountsSyncStatus() {
|
||||
boolean[] syncs = new boolean[mOcAccounts.length];
|
||||
for (int i = 0; i < mOcAccounts.length; ++i) {
|
||||
|
|
|
@ -67,11 +67,14 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
|||
public class ExpandableUploadListAdapter extends BaseExpandableListAdapter implements Observer {
|
||||
|
||||
private static final String TAG = ExpandableUploadListAdapter.class.getSimpleName();
|
||||
|
||||
public ProgressListener mProgressListener;
|
||||
|
||||
private FileActivity mParentActivity;
|
||||
|
||||
private UploadsStorageManager mUploadsStorageManager;
|
||||
|
||||
public ProgressListener mProgressListener;
|
||||
private UploadGroup[] mUploadGroups = null;
|
||||
|
||||
interface Refresh {
|
||||
public void refresh();
|
||||
|
@ -141,8 +144,6 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
|
|||
abstract public int getGroupIcon();
|
||||
}
|
||||
|
||||
private UploadGroup[] mUploadGroups = null;
|
||||
|
||||
public ExpandableUploadListAdapter(FileActivity parentActivity) {
|
||||
Log_OC.d(TAG, "ExpandableUploadListAdapter");
|
||||
mParentActivity = parentActivity;
|
||||
|
|
|
@ -48,6 +48,20 @@ public class CopyAndUploadContentUrisTask extends AsyncTask<Object, Void, Result
|
|||
|
||||
private final String TAG = CopyAndUploadContentUrisTask.class.getSimpleName();
|
||||
|
||||
/**
|
||||
* Listener in main thread to be notified when the task ends. Held in a WeakReference assuming that its
|
||||
* lifespan is associated with an Activity context, that could be finished by the user before the AsyncTask
|
||||
* ends.
|
||||
*/
|
||||
private WeakReference<OnCopyTmpFilesTaskListener> mListener;
|
||||
|
||||
/**
|
||||
* Reference to application context, used to access app resources. Holding it should not be a problem,
|
||||
* since it needs to exist until the end of the AsyncTask although the caller Activity were finished
|
||||
* before.
|
||||
*/
|
||||
private final Context mAppContext;
|
||||
|
||||
/**
|
||||
* Helper method building a correct array of parameters to be passed to {@link #execute(Object[])} )}
|
||||
*
|
||||
|
@ -93,21 +107,6 @@ public class CopyAndUploadContentUrisTask extends AsyncTask<Object, Void, Result
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Listener in main thread to be notified when the task ends. Held in a WeakReference assuming that its
|
||||
* lifespan is associated with an Activity context, that could be finished by the user before the AsyncTask
|
||||
* ends.
|
||||
*/
|
||||
private WeakReference<OnCopyTmpFilesTaskListener> mListener;
|
||||
|
||||
/**
|
||||
* Reference to application context, used to access app resources. Holding it should not be a problem,
|
||||
* since it needs to exist until the end of the AsyncTask although the caller Activity were finished
|
||||
* before.
|
||||
*/
|
||||
private final Context mAppContext;
|
||||
|
||||
|
||||
public CopyAndUploadContentUrisTask(
|
||||
OnCopyTmpFilesTaskListener listener,
|
||||
Context context
|
||||
|
|
|
@ -1030,7 +1030,8 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
|
|||
|
||||
private void updateFooter() {
|
||||
if (!mJustFolders) {
|
||||
int filesCount = 0, foldersCount = 0;
|
||||
int filesCount = 0;
|
||||
int foldersCount = 0;
|
||||
int count = mAdapter.getCount();
|
||||
OCFile file;
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
|
|
@ -29,7 +29,6 @@ import android.support.annotation.NonNull;
|
|||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v7.widget.AppCompatButton;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -450,11 +449,11 @@ public class ContactsBackupFragment extends FileFragment implements DatePickerDi
|
|||
Fragment contactListFragment = ContactListFragment.newInstance(backupToRestore,
|
||||
contactsPreferenceActivity.getAccount());
|
||||
|
||||
FragmentTransaction transaction = contactsPreferenceActivity.getSupportFragmentManager().
|
||||
beginTransaction();
|
||||
transaction.replace(R.id.frame_container, contactListFragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
contactsPreferenceActivity.getSupportFragmentManager().
|
||||
beginTransaction()
|
||||
.replace(R.id.frame_container, contactListFragment, ContactListFragment.TAG)
|
||||
.addToBackStack(ContactsPreferenceActivity.BACKUP_TO_LIST)
|
||||
.commit();
|
||||
} else {
|
||||
Toast.makeText(contactsPreferenceActivity, R.string.contacts_preferences_no_file_found,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
|
|
|
@ -178,7 +178,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
|
|||
|
||||
private void initiateStorageMap() {
|
||||
|
||||
mRootIdToStorageManager = new HashMap<Long, FileDataStorageManager>();
|
||||
mRootIdToStorageManager = new HashMap<>();
|
||||
|
||||
ContentResolver contentResolver = getContext().getContentResolver();
|
||||
|
||||
|
@ -188,7 +188,6 @@ public class DocumentsStorageProvider extends DocumentsProvider {
|
|||
final OCFile rootDir = storageManager.getFileByPath("/");
|
||||
mRootIdToStorageManager.put(rootDir.getFileId(), storageManager);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean waitOrGetCancelled(CancellationSignal cancellationSignal) {
|
||||
|
@ -198,15 +197,11 @@ public class DocumentsStorageProvider extends DocumentsProvider {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (cancellationSignal != null && cancellationSignal.isCanceled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return !(cancellationSignal != null && cancellationSignal.isCanceled());
|
||||
}
|
||||
|
||||
Vector<OCFile> findFiles(OCFile root, String query) {
|
||||
Vector<OCFile> result = new Vector<OCFile>();
|
||||
Vector<OCFile> result = new Vector<>();
|
||||
for (OCFile f : mCurrentStorageManager.getFolderContent(root, false)) {
|
||||
if (f.isFolder()) {
|
||||
result.addAll(findFiles(f, query));
|
||||
|
|
|
@ -412,8 +412,8 @@
|
|||
<string name="file_migration_restoring_accounts_configuration">Restoring configuration of accounts…</string>
|
||||
<string name="file_migration_ok_finished">Finished</string>
|
||||
<string name="file_migration_failed_not_enough_space">ERROR: Insufficient space</string>
|
||||
<string name="file_migration_failed_not_writable">ERROR: File not writable</string>
|
||||
<string name="file_migration_failed_not_readable">ERROR: File not readable</string>
|
||||
<string name="file_migration_failed_not_writable">ERROR: Destination file not writable</string>
|
||||
<string name="file_migration_failed_not_readable">ERROR: Source file not readable</string>
|
||||
<string name="file_migration_failed_dir_already_exists">ERROR: Nextcloud directory already exists</string>
|
||||
<string name="file_migration_failed_while_coping">ERROR: Failed during migration</string>
|
||||
<string name="file_migration_failed_while_updating_index">ERROR: Failed to updating index</string>
|
||||
|
@ -422,6 +422,9 @@
|
|||
<string name="file_migration_override_data_folder">Replace</string>
|
||||
<string name="file_migration_use_data_folder">Use</string>
|
||||
|
||||
<string name="file_migration_source_not_readable_title">Source directory not readable!</string>
|
||||
<string name="file_migration_source_not_readable">Do you still want to change the storage path to %1$s?\n\nNote: all data will have to be downloaded again.</string>
|
||||
|
||||
<string name="prefs_category_accounts">Accounts</string>
|
||||
<string name="prefs_add_account">Add account</string>
|
||||
<string name="drawer_manage_accounts">Manage accounts</string>
|
||||
|
|
Loading…
Reference in a new issue