changes due to rebase

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2018-06-13 10:23:18 +02:00 committed by AndyScherzinger
parent 0b19ba7d9a
commit 0867879f59
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
18 changed files with 49 additions and 96 deletions

View file

@ -208,9 +208,7 @@ dependencies {
// dependencies for app building
implementation 'com.android.support:multidex:1.0.3'
// implementation project('nextcloud-android-library')
genericImplementation "com.github.nextcloud:android-library:removeCheckForOlderVersions-SNAPSHOT"
gplayImplementation "com.github.nextcloud:android-library:removeCheckForOlderVersions-SNAPSHOT"
versionDevImplementation 'com.github.nextcloud:android-library:removeCheckForOlderVersions-SNAPSHOT' // use always latest master
implementation "com.github.nextcloud:android-library:removeCheckForOlderVersions_2-SNAPSHOT"
implementation "com.android.support:support-v4:${supportLibraryVersion}"
implementation "com.android.support:design:${supportLibraryVersion}"
implementation 'com.jakewharton:disklrucache:2.0.2'

View file

@ -211,10 +211,6 @@ public class AccountUtils {
return serverVersion;
}
public static boolean hasSearchUsersSupport(Account account) {
return getServerVersion(account).isSearchUsersSupported();
}
public static boolean hasSearchSupport(Account account) {
return getServerVersion(account).isSearchSupported();
}

View file

@ -22,7 +22,6 @@
package com.owncloud.android.datamodel;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
@ -47,7 +46,6 @@ import android.widget.ImageView;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.lib.common.OwnCloudAccount;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
@ -560,10 +558,10 @@ public class ThumbnailsCacheManager {
getMethod = new GetMethod(uri);
getMethod.setRequestHeader("Cookie",
"nc_sameSiteCookielax=true;nc_sameSiteCookiestrict=true");
getMethod.setRequestHeader(RemoteOperation.OCS_API_HEADER,
RemoteOperation.OCS_API_HEADER_VALUE);
int status = mClient.executeMethod(getMethod);
if (status == HttpStatus.SC_OK) {
InputStream inputStream = getMethod.getResponseBodyAsStream();
@ -572,7 +570,7 @@ public class ThumbnailsCacheManager {
} else {
mClient.exhaustResponse(getMethod.getResponseBodyAsStream());
}
// Handle PNG
if (file.getMimeType().equalsIgnoreCase(PNG_MIMETYPE)) {
thumbnail = handlePNG(thumbnail, pxW, pxH);
@ -583,6 +581,7 @@ public class ThumbnailsCacheManager {
if (getMethod != null) {
getMethod.releaseConnection();
}
}
}
}
@ -595,7 +594,6 @@ public class ThumbnailsCacheManager {
}
return thumbnail;
}
/**
@ -812,9 +810,9 @@ public class ThumbnailsCacheManager {
thumbnail = doAvatarInBackground();
} catch(OutOfMemoryError oome) {
} catch (OutOfMemoryError oome) {
Log_OC.e(TAG, "Out of memory");
} catch(Throwable t){
} catch (Throwable t) {
// the app should never break due to a problem with avatars
Log_OC.e(TAG, "Generation of avatar for " + mUserId + " failed", t);
}
@ -835,6 +833,7 @@ public class ThumbnailsCacheManager {
/**
* Converts size of file icon from dp to pixel
*
* @return int
*/
private int getAvatarDimension() {
@ -866,9 +865,9 @@ public class ThumbnailsCacheManager {
// only use eTag if available and corresponding avatar is still there
// (might be deleted from cache)
if (!eTag.isEmpty() && getBitmapFromDiskCache(avatarKey) != null) {
get.setRequestHeader("If-None-Match", eTag);
}
if (!eTag.isEmpty() && getBitmapFromDiskCache(avatarKey) != null) {
get.setRequestHeader("If-None-Match", eTag);
}
int status = mClient.executeMethod(get);
@ -908,28 +907,26 @@ public class ThumbnailsCacheManager {
mClient.exhaustResponse(get.getResponseBodyAsStream());
break;
}
} catch (Exception e) {
try {
return TextDrawable.createAvatar(mAccount.name, mAvatarRadius);
} catch (Exception e1) {
Log_OC.e(TAG, "Error generating fallback avatar");
}
} finally {
if (get != null) {
get.releaseConnection();
}
}
} else {
Log_OC.d(TAG, "Server too old");
} catch (Exception e) {
try {
return TextDrawable.createAvatar(mAccount.name, mAvatarRadius);
} catch (Exception e) {
} catch (Exception e1) {
Log_OC.e(TAG, "Error generating fallback avatar");
}
} finally {
if (get != null) {
get.releaseConnection();
}
}
try {
return TextDrawable.createAvatar(mAccount.name, mAvatarRadius);
} catch (Exception e) {
Log_OC.e(TAG, "Error generating fallback avatar");
}
}
return BitmapUtils.bitmapToCircularBitmapDrawable(mResources, avatar);
}
}
@ -1085,6 +1082,7 @@ public class ThumbnailsCacheManager {
return null;
}
public static class AsyncThumbnailDrawable extends BitmapDrawable {
private final WeakReference<ThumbnailGenerationTask> bitmapWorkerTaskReference;

View file

@ -106,9 +106,6 @@ public class RefreshFolderOperation extends RemoteOperation {
*/
private boolean mSyncFullAccount;
/** 'True' means that Share resources bound to the files into should be refreshed also */
private boolean mIsShareSupported;
/** 'True' means that the remote folder changed and should be fetched */
private boolean mRemoteFolderChanged;
@ -126,7 +123,6 @@ public class RefreshFolderOperation extends RemoteOperation {
* @param currentSyncTime Time stamp for the synchronization process in progress.
* @param syncFullAccount 'True' means that this operation is part of a full account
* synchronization.
* @param isShareSupported 'True' means that the server supports the sharing API.
* @param ignoreETag 'True' means that the content of the remote folder should
* be fetched and updated even though the 'eTag' did not
* change.
@ -137,7 +133,6 @@ public class RefreshFolderOperation extends RemoteOperation {
public RefreshFolderOperation(OCFile folder,
long currentSyncTime,
boolean syncFullAccount,
boolean isShareSupported,
boolean ignoreETag,
FileDataStorageManager dataStorageManager,
Account account,
@ -145,7 +140,6 @@ public class RefreshFolderOperation extends RemoteOperation {
mLocalFolder = folder;
mCurrentSyncTime = currentSyncTime;
mSyncFullAccount = syncFullAccount;
mIsShareSupported = isShareSupported;
mStorageManager = dataStorageManager;
mAccount = account;
mContext = context;
@ -219,7 +213,7 @@ public class RefreshFolderOperation extends RemoteOperation {
);
}
if (result.isSuccess() && mIsShareSupported && !mSyncFullAccount) {
if (result.isSuccess() && !mSyncFullAccount) {
refreshSharesForFolder(client); // share result is ignored
}
@ -237,8 +231,6 @@ public class RefreshFolderOperation extends RemoteOperation {
UpdateOCVersionOperation update = new UpdateOCVersionOperation(mAccount, mContext);
RemoteOperationResult result = update.execute(client);
if (result.isSuccess()) {
mIsShareSupported = true;
// Update Capabilities for this account
updateCapabilities();
}

View file

@ -112,10 +112,6 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
/** {@link SyncResult} instance to return to the system when the synchronization finish */
private SyncResult mSyncResult;
/** 'True' means that the server supports the share API */
private boolean mIsShareSupported;
/**
* Creates a {@link FileSyncAdapter}
*
@ -238,8 +234,6 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
RemoteOperationResult result = update.execute(getClient());
if (!result.isSuccess()) {
mLastFailedResult = result;
} else {
mIsShareSupported = true;
}
}
@ -265,7 +259,6 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
RefreshFolderOperation synchFolderOp = new RefreshFolderOperation( folder,
mCurrentSyncTime,
true,
mIsShareSupported,
false,
getStorageManager(),
getAccount(),

View file

@ -235,8 +235,7 @@ public class ActivitiesActivity extends FileActivity implements ActivityListInte
@Override
public void onActivityClicked(RichObject richObject) {
String path = FileUtils.PATH_SEPARATOR + richObject.getPath();
mActionListener.openActivity(path, this,
getFileOperationsHelper().isSharedSupported());
mActionListener.openActivity(path, this);
}
@Override

View file

@ -39,7 +39,8 @@ public interface ActivitiesContract {
interface ActionListener {
void loadActivities(String pageUrl);
void openActivity(String fileUrl, BaseActivity baseActivity, boolean isSharingSupported);
void openActivity(String fileUrl, BaseActivity baseActivity);
void stopLoadingActivity();
}

View file

@ -71,10 +71,9 @@ public class ActivitiesPresenter implements ActivitiesContract.ActionListener {
}
@Override
public void openActivity(String fileUrl, BaseActivity baseActivity, boolean isSharingSupported) {
public void openActivity(String fileUrl, BaseActivity baseActivity) {
activitiesView.setProgressIndicatorState(true);
filesRepository.readRemoteFile(fileUrl, baseActivity, isSharingSupported,
new FilesRepository.ReadRemoteFileCallback() {
filesRepository.readRemoteFile(fileUrl, baseActivity, new FilesRepository.ReadRemoteFileCallback() {
@Override
public void onFileLoaded(@Nullable OCFile ocFile) {
activitiesView.setProgressIndicatorState(false);

View file

@ -33,6 +33,5 @@ public interface FilesRepository {
void onFileLoadError(String error);
}
void readRemoteFile(String path, BaseActivity activity, boolean isSharingSupported,
@NonNull ReadRemoteFileCallback callback);
void readRemoteFile(String path, BaseActivity activity, @NonNull ReadRemoteFileCallback callback);
}

View file

@ -32,6 +32,5 @@ public interface FilesServiceApi {
void onError(String error);
}
void readRemoteFile(String fileUrl, BaseActivity activity, boolean isSharingSupported,
FilesServiceApi.FilesServiceCallback<OCFile> callback);
void readRemoteFile(String fileUrl, BaseActivity activity, FilesServiceApi.FilesServiceCallback<OCFile> callback);
}

View file

@ -49,10 +49,8 @@ public class FilesServiceApiImpl implements FilesServiceApi {
private static final String TAG = FilesServiceApiImpl.class.getSimpleName();
@Override
public void readRemoteFile(String fileUrl, BaseActivity activity,
boolean isSharingSupported, FilesServiceCallback<OCFile> callback) {
ReadRemoteFileTask readRemoteFileTask = new ReadRemoteFileTask(fileUrl, activity,
isSharingSupported, callback);
public void readRemoteFile(String fileUrl, BaseActivity activity, FilesServiceCallback<OCFile> callback) {
ReadRemoteFileTask readRemoteFileTask = new ReadRemoteFileTask(fileUrl, activity, callback);
readRemoteFileTask.execute();
}
@ -62,15 +60,11 @@ public class FilesServiceApiImpl implements FilesServiceApi {
private String errorMessage;
// TODO: Figure out a better way to do this than passing a BaseActivity reference.
private final BaseActivity baseActivity;
private final boolean isSharingSupported;
private final String fileUrl;
private ReadRemoteFileTask(String fileUrl, BaseActivity baseActivity,
boolean isSharingSupported,
FilesServiceCallback<OCFile> callback) {
private ReadRemoteFileTask(String fileUrl, BaseActivity baseActivity, FilesServiceCallback<OCFile> callback) {
this.callback = callback;
this.baseActivity = baseActivity;
this.isSharingSupported = isSharingSupported;
this.fileUrl = fileUrl;
}
@ -97,7 +91,6 @@ public class FilesServiceApiImpl implements FilesServiceApi {
RemoteOperation synchFolderOp = new RefreshFolderOperation(remoteOcFile,
System.currentTimeMillis(),
false,
isSharingSupported,
true,
baseActivity.getStorageManager(),
baseActivity.getAccount(),

View file

@ -33,9 +33,8 @@ class RemoteFilesRepository implements FilesRepository {
@Override
public void readRemoteFile(String path, BaseActivity activity, boolean isSharingSupported, @NonNull ReadRemoteFileCallback callback) {
filesServiceApi.readRemoteFile(path, activity, isSharingSupported,
new FilesServiceApi.FilesServiceCallback<OCFile>() {
public void readRemoteFile(String path, BaseActivity activity, @NonNull ReadRemoteFileCallback callback) {
filesServiceApi.readRemoteFile(path, activity, new FilesServiceApi.FilesServiceCallback<OCFile>() {
@Override
public void onLoaded(OCFile ocFile) {
callback.onFileLoaded(ocFile);

View file

@ -581,14 +581,8 @@ public class FileDisplayActivity extends HookActivity
return OCShare.READ_PERMISSION_FLAG; // minimum permissions
} else if (isFederated) {
if (com.owncloud.android.authentication.AccountUtils
.getServerVersion(getAccount()).isNotReshareableFederatedSupported()) {
return (getFile().isFolder() ? OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER_AFTER_OC9 :
OCShare.FEDERATED_PERMISSIONS_FOR_FILE_AFTER_OC9);
} else {
return (getFile().isFolder() ? OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER_UP_TO_OC9 :
OCShare.FEDERATED_PERMISSIONS_FOR_FILE_UP_TO_OC9);
}
return (getFile().isFolder() ? OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER_AFTER_OC9 :
OCShare.FEDERATED_PERMISSIONS_FOR_FILE_AFTER_OC9);
} else {
return (getFile().isFolder() ? OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER :
OCShare.MAXIMUM_PERMISSIONS_FOR_FILE);
@ -2201,7 +2195,6 @@ public class FileDisplayActivity extends HookActivity
RemoteOperation synchFolderOp = new RefreshFolderOperation(folder,
currentSyncTime,
false,
true,
ignoreETag,
getStorageManager(),
getAccount(),

View file

@ -250,8 +250,7 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
// perform folder synchronization
RemoteOperation refreshFolderOperation = new RefreshFolderOperation(folder, currentSyncTime, false,
true, ignoreETag, getStorageManager(), getAccount(),
getApplicationContext());
ignoreETag, getStorageManager(), getAccount(), getApplicationContext());
refreshFolderOperation.execute(getAccount(), this, null, null);
setIndeterminate(true);

View file

@ -835,7 +835,6 @@ public class ReceiveExternalFilesActivity extends FileActivity
currentSyncTime,
false,
false,
false,
getStorageManager(),
getAccount(),
getApplicationContext()

View file

@ -38,7 +38,6 @@ import android.widget.PopupMenu;
import android.widget.TextView;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.resources.shares.OCShare;
@ -236,8 +235,7 @@ public class UserListAdapter extends RecyclerView.Adapter<UserListAdapter.UserVi
}
private boolean isEditOptionsAvailable(OCShare share) {
return !ShareType.FEDERATED.equals(share.getShareType())
|| AccountUtils.getServerVersion(account).isNotReshareableFederatedSupported();
return !ShareType.FEDERATED.equals(share.getShareType());
}
private boolean isReshareForbidden(OCShare share) {

View file

@ -85,6 +85,7 @@ import com.owncloud.android.ui.activity.FolderPickerActivity;
import com.owncloud.android.ui.activity.OnEnforceableRefreshListener;
import com.owncloud.android.ui.activity.ToolbarActivity;
import com.owncloud.android.ui.activity.UploadFilesActivity;
import com.owncloud.android.ui.adapter.OCFileListAdapter;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
import com.owncloud.android.ui.dialog.CreateFolderDialogFragment;
import com.owncloud.android.ui.dialog.RemoveFilesDialogFragment;
@ -1078,14 +1079,11 @@ public class OCFileListFragment extends ExtendedListFragment implements
}
private void updateLayout() {
if (!mJustFolders) {
updateFooter();
// decide grid vs list view
if (isGridViewPreferred(mFile)) {
switchToGridView();
} else {
switchToListView();
}
// decide grid vs list view
if (isGridViewPreferred(mFile)) {
switchToGridView();
} else {
switchToListView();
}
invalidateActionMode();

View file

@ -225,7 +225,7 @@ public class ContactsBackupFragment extends FileFragment implements DatePickerDi
if (folder != null) {
RefreshFolderOperation operation = new RefreshFolderOperation(folder, System.currentTimeMillis(),
false, false, false, storageManager, account, getContext());
false, false, storageManager, account, getContext());
RemoteOperationResult result = operation.execute(account, getContext());
return result.isSuccess();