Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class CreateShareWithShareeOperation extends SyncOperation {
*/
public CreateShareWithShareeOperation(String path, String shareeName, ShareType shareType, int permissions) {
if (!ShareType.USER.equals(shareType) && !ShareType.GROUP.equals(shareType)
&& !ShareType.FEDERATED.equals(shareType)) {
&& !ShareType.FEDERATED.equals(shareType) && !ShareType.EMAIL.equals(shareType)) {
throw new IllegalArgumentException("Illegal share type " + shareType);
}
mPath = path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public boolean onCreate() {
sShareTypes.put(DATA_USER, ShareType.USER);
sShareTypes.put(DATA_GROUP, ShareType.GROUP);
sShareTypes.put(DATA_REMOTE, ShareType.FEDERATED);
sShareTypes.put(DATA_REMOTE, ShareType.EMAIL);

mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
mUriMatcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY + "/*", SEARCH);
Expand Down Expand Up @@ -215,6 +216,9 @@ private Cursor searchForUsersOrGroups(Uri uri) {
displayName = userName;
icon = R.drawable.ic_user;
dataUri = Uri.withAppendedPath(userBaseUri, shareWith);
} else if (ShareType.EMAIL.getValue() == type) {
icon = R.drawable.ic_email;
displayName = getContext().getString(R.string.share_email_clarification, userName);
}

if (displayName != null && dataUri != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,11 @@

import android.app.SearchManager;
import android.content.ComponentName;
import android.content.res.Resources;
import android.support.v7.widget.SearchView;
import android.view.MenuItem;
import android.view.inputmethod.EditorInfo;

import com.owncloud.android.R;
import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.lib.resources.status.OCCapability;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
* Helper calls for visibility logic of the sharing fragment.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,11 @@

package com.owncloud.android.ui.fragment.util;

import android.app.SearchManager;
import android.content.ComponentName;
import android.content.res.Resources;
import android.support.v7.widget.SearchView;
import android.view.MenuItem;
import android.view.inputmethod.EditorInfo;

import com.owncloud.android.R;
import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.lib.resources.status.OCCapability;

import java.text.SimpleDateFormat;
import java.util.Date;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.content.FileProvider;
Expand Down Expand Up @@ -93,7 +92,7 @@ public class FileOperationsHelper {
private static final String TAG = FileOperationsHelper.class.getSimpleName();
private static final Pattern mPatternUrl = Pattern.compile("^URL=(.+)$");
private static final Pattern mPatternString = Pattern.compile("<string>(.+)</string>");
private FileActivity mFileActivity = null;
private FileActivity mFileActivity;
/// Identifier of operation in progress which result shouldn't be lost
private long mWaitingForOpId = Long.MAX_VALUE;

Expand Down Expand Up @@ -432,10 +431,8 @@ public void shareFileWithSharee(OCFile file, String shareeName, ShareType shareT
* @return 'True' if the server supports the Share API
*/
public boolean isSharedSupported() {
if (mFileActivity.getAccount() != null) {
return AccountUtils.getServerVersion(mFileActivity.getAccount()).isSharedSupported();
}
return false;
return mFileActivity.getAccount() != null &&
AccountUtils.getServerVersion(mFileActivity.getAccount()).isSharedSupported();
}


Expand Down Expand Up @@ -475,8 +472,7 @@ public void unshareFileWithUserOrGroup(OCFile file, ShareType shareType, String
private void queueShareIntent(Intent shareIntent) {
if (isSharedSupported()) {
// Unshare the file
mWaitingForOpId = mFileActivity.getOperationsServiceBinder().
queueNewOperation(shareIntent);
mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(shareIntent);

mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
getString(R.string.wait_a_moment));
Expand Down Expand Up @@ -943,10 +939,8 @@ public void setOpIdWaitingFor(long waitingForOpId) {
* @return 'True' if the server doesn't need to check forbidden characters
*/
public boolean isVersionWithForbiddenCharacters() {
if (mFileActivity.getAccount() != null) {
return AccountUtils.getServerVersion(mFileActivity.getAccount()).isVersionWithForbiddenCharacters();
}
return false;
return mFileActivity.getAccount() != null &&
AccountUtils.getServerVersion(mFileActivity.getAccount()).isVersionWithForbiddenCharacters();
}

/**
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/owncloud/android/utils/ThemeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public static void setStatusBarColor(Activity activity, @ColorInt int color) {
* Adjust lightness of given color
*
* @param lightnessDelta values -1..+1
* @param color
* @param color original color
* @param threshold 0..1 as maximum value, -1 to disable
* @return color adjusted by lightness
*/
Expand Down Expand Up @@ -374,15 +374,16 @@ public static Drawable tintDrawable(@DrawableRes int id, int color) {
return tintDrawable(drawable, color);
}

@Nullable
public static Drawable tintDrawable(Drawable drawable, int color) {
if (drawable != null) {
Drawable wrap = DrawableCompat.wrap(drawable);
wrap.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);

return wrap;
} else {
return drawable;
}

return null;
}

public static String colorToHexString(int color) {
Expand Down