mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
show notes on receiving shares
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
7c28461679
commit
92bbcfb973
12 changed files with 149 additions and 101 deletions
|
@ -207,6 +207,7 @@ public class FileDataStorageManager {
|
|||
cv.put(ProviderTableMeta.FILE_UNREAD_COMMENTS_COUNT, file.getUnreadCommentsCount());
|
||||
cv.put(ProviderTableMeta.FILE_OWNER_ID, file.getOwnerId());
|
||||
cv.put(ProviderTableMeta.FILE_OWNER_DISPLAY_NAME, file.getOwnerDisplayName());
|
||||
cv.put(ProviderTableMeta.FILE_NOTE, file.getNote());
|
||||
|
||||
boolean sameRemotePath = fileExists(file.getRemotePath());
|
||||
if (sameRemotePath ||
|
||||
|
@ -448,6 +449,7 @@ public class FileDataStorageManager {
|
|||
cv.put(ProviderTableMeta.FILE_UNREAD_COMMENTS_COUNT, folder.getUnreadCommentsCount());
|
||||
cv.put(ProviderTableMeta.FILE_OWNER_ID, folder.getOwnerId());
|
||||
cv.put(ProviderTableMeta.FILE_OWNER_DISPLAY_NAME, folder.getOwnerDisplayName());
|
||||
cv.put(ProviderTableMeta.FILE_NOTE, folder.getNote());
|
||||
|
||||
return cv;
|
||||
}
|
||||
|
@ -486,6 +488,7 @@ public class FileDataStorageManager {
|
|||
cv.put(ProviderTableMeta.FILE_UNREAD_COMMENTS_COUNT, file.getUnreadCommentsCount());
|
||||
cv.put(ProviderTableMeta.FILE_OWNER_ID, file.getOwnerId());
|
||||
cv.put(ProviderTableMeta.FILE_OWNER_DISPLAY_NAME, file.getOwnerDisplayName());
|
||||
cv.put(ProviderTableMeta.FILE_NOTE, file.getNote());
|
||||
|
||||
return cv;
|
||||
}
|
||||
|
@ -984,6 +987,7 @@ public class FileDataStorageManager {
|
|||
file.setUnreadCommentsCount(c.getInt(c.getColumnIndex(ProviderTableMeta.FILE_UNREAD_COMMENTS_COUNT)));
|
||||
file.setOwnerId(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_OWNER_ID)));
|
||||
file.setOwnerDisplayName(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_OWNER_DISPLAY_NAME)));
|
||||
file.setNote(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_NOTE)));
|
||||
}
|
||||
|
||||
return file;
|
||||
|
|
|
@ -87,6 +87,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
|
|||
@Getter @Setter private int unreadCommentsCount;
|
||||
@Getter @Setter private String ownerId;
|
||||
@Getter @Setter private String ownerDisplayName;
|
||||
@Getter @Setter String note;
|
||||
|
||||
/**
|
||||
* URI to the local path of the file contents, if stored in the device; cached after first call
|
||||
|
|
|
@ -42,7 +42,6 @@ import android.view.Display;
|
|||
import android.view.MenuItem;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.lib.common.OwnCloudAccount;
|
||||
|
@ -61,7 +60,7 @@ import com.owncloud.android.utils.ConnectivityUtils;
|
|||
import com.owncloud.android.utils.DisplayUtils.AvatarGenerationListener;
|
||||
import com.owncloud.android.utils.FileStorageUtils;
|
||||
import com.owncloud.android.utils.MimeTypeUtil;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import org.apache.commons.httpclient.HttpStatus;
|
||||
import org.apache.commons.httpclient.methods.GetMethod;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -73,8 +72,6 @@ import java.lang.ref.WeakReference;
|
|||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
/**
|
||||
* Manager for concurrent access to thumbnails cache.
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@ import com.owncloud.android.MainApp;
|
|||
public class ProviderMeta {
|
||||
|
||||
public static final String DB_NAME = "filelist";
|
||||
public static final int DB_VERSION = 43;
|
||||
public static final int DB_VERSION = 44;
|
||||
|
||||
private ProviderMeta() {
|
||||
}
|
||||
|
@ -108,6 +108,7 @@ public class ProviderMeta {
|
|||
public static final String FILE_UNREAD_COMMENTS_COUNT = "unread_comments_count";
|
||||
public static final String FILE_OWNER_ID = "owner_id";
|
||||
public static final String FILE_OWNER_DISPLAY_NAME = "owner_display_name";
|
||||
public static final String FILE_NOTE = "note";
|
||||
|
||||
public static final String[] FILE_ALL_COLUMNS = {
|
||||
_ID, FILE_PARENT, FILE_NAME, FILE_CREATION, FILE_MODIFIED,
|
||||
|
|
|
@ -700,7 +700,8 @@ public class FileContentProvider extends ContentProvider {
|
|||
+ ProviderTableMeta.FILE_HAS_PREVIEW + INTEGER
|
||||
+ ProviderTableMeta.FILE_UNREAD_COMMENTS_COUNT + INTEGER
|
||||
+ ProviderTableMeta.FILE_OWNER_ID + TEXT
|
||||
+ ProviderTableMeta.FILE_OWNER_DISPLAY_NAME + " TEXT);"
|
||||
+ ProviderTableMeta.FILE_OWNER_DISPLAY_NAME + TEXT
|
||||
+ ProviderTableMeta.FILE_NOTE + " TEXT);"
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1887,6 +1888,24 @@ public class FileContentProvider extends ContentProvider {
|
|||
if (!upgraded) {
|
||||
Log_OC.i(SQL, String.format(Locale.ENGLISH, UPGRADE_VERSION_MSG, oldVersion, newVersion));
|
||||
}
|
||||
|
||||
if (oldVersion < 44 && newVersion >= 44) {
|
||||
Log_OC.i(SQL, "Entering in the #44 add note to file table");
|
||||
db.beginTransaction();
|
||||
try {
|
||||
db.execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
|
||||
ADD_COLUMN + ProviderTableMeta.FILE_NOTE + " TEXT ");
|
||||
|
||||
upgraded = true;
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
if (!upgraded) {
|
||||
Log_OC.i(SQL, String.format(Locale.ENGLISH, UPGRADE_VERSION_MSG, oldVersion, newVersion));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -71,6 +71,6 @@ public class FileDetailTabAdapter extends FragmentStatePagerAdapter {
|
|||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return file.canReshare() ? 2 : 1;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -288,9 +288,9 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
|
||||
if (isCheckedFile(file)) {
|
||||
gridViewHolder.itemLayout.setBackgroundColor(mContext.getResources()
|
||||
.getColor(R.color.selected_item_background));
|
||||
.getColor(R.color.selected_item_background));
|
||||
gridViewHolder.checkbox.setImageDrawable(ThemeUtils.tintDrawable(R.drawable.ic_checkbox_marked,
|
||||
ThemeUtils.primaryColor(mContext)));
|
||||
ThemeUtils.primaryColor(mContext)));
|
||||
} else {
|
||||
gridViewHolder.itemLayout.setBackgroundColor(Color.WHITE);
|
||||
gridViewHolder.checkbox.setImageResource(R.drawable.ic_checkbox_blank_outline);
|
||||
|
@ -301,7 +301,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
if (!mHideItemOptions) {
|
||||
gridViewHolder.itemLayout.setLongClickable(true);
|
||||
gridViewHolder.itemLayout.setOnLongClickListener(v ->
|
||||
ocFileListFragmentInterface.onLongItemClicked(file));
|
||||
ocFileListFragmentInterface.onLongItemClicked(file));
|
||||
}
|
||||
|
||||
// unread comments
|
||||
|
@ -352,14 +352,14 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
itemViewHolder.fileSize.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength()));
|
||||
}
|
||||
itemViewHolder.lastModification.setText(DisplayUtils.getRelativeTimestamp(mContext,
|
||||
file.getModificationTimestamp()));
|
||||
file.getModificationTimestamp()));
|
||||
|
||||
if (multiSelect || gridView || mHideItemOptions) {
|
||||
itemViewHolder.overflowMenu.setVisibility(View.GONE);
|
||||
} else {
|
||||
itemViewHolder.overflowMenu.setVisibility(View.VISIBLE);
|
||||
itemViewHolder.overflowMenu.setOnClickListener(view -> ocFileListFragmentInterface
|
||||
.onOverflowIconClicked(file, view));
|
||||
.onOverflowIconClicked(file, view));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -422,49 +422,50 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
}
|
||||
}
|
||||
|
||||
private void showFederatedShareAvatar(OCFile file, float avatarRadius, Resources resources,
|
||||
OCFileListItemViewHolder itemViewHolder) {
|
||||
// maybe federated share
|
||||
String userId = file.getOwnerId().split("@")[0];
|
||||
String server = file.getOwnerId().split("@")[1];
|
||||
private void showFederatedShareAvatar(OCFile file, float avatarRadius, Resources resources,
|
||||
OCFileListItemViewHolder itemViewHolder) {
|
||||
// maybe federated share
|
||||
String userId = file.getOwnerId().split("@")[0];
|
||||
String server = file.getOwnerId().split("@")[1];
|
||||
|
||||
String url = "https://" + server + "/avatar/" + userId + "/" +
|
||||
DisplayUtils.convertDpToPixel(avatarRadius, mContext);
|
||||
String url = "https://" + server + "/avatar/" + userId + "/" +
|
||||
DisplayUtils.convertDpToPixel(avatarRadius, mContext);
|
||||
|
||||
Drawable placeholder;
|
||||
try {
|
||||
placeholder = TextDrawable.createAvatarByUserId(userId, avatarRadius);
|
||||
} catch (Exception e) {
|
||||
Log_OC.e(TAG, "Error calculating RGB value for active account icon.", e);
|
||||
placeholder = resources.getDrawable(R.drawable.account_circle_white);
|
||||
}
|
||||
|
||||
itemViewHolder.sharedAvatar.setTag(null);
|
||||
Glide.with(mContext).load(url)
|
||||
.asBitmap()
|
||||
.placeholder(placeholder)
|
||||
.error(placeholder)
|
||||
.into(new BitmapImageViewTarget(itemViewHolder.sharedAvatar) {
|
||||
@Override
|
||||
protected void setResource(Bitmap resource) {
|
||||
RoundedBitmapDrawable circularBitmapDrawable =
|
||||
RoundedBitmapDrawableFactory.create(mContext.getResources(), resource);
|
||||
circularBitmapDrawable.setCircular(true);
|
||||
itemViewHolder.sharedAvatar.setImageDrawable(circularBitmapDrawable);
|
||||
}
|
||||
});
|
||||
Drawable placeholder;
|
||||
try {
|
||||
placeholder = TextDrawable.createAvatarByUserId(userId, avatarRadius);
|
||||
} catch (Exception e) {
|
||||
Log_OC.e(TAG, "Error calculating RGB value for active account icon.", e);
|
||||
placeholder = resources.getDrawable(R.drawable.account_circle_white);
|
||||
}
|
||||
|
||||
itemViewHolder.sharedAvatar.setTag(null);
|
||||
Glide.with(mContext).load(url)
|
||||
.asBitmap()
|
||||
.placeholder(placeholder)
|
||||
.error(placeholder)
|
||||
.into(new BitmapImageViewTarget(itemViewHolder.sharedAvatar) {
|
||||
@Override
|
||||
protected void setResource(Bitmap resource) {
|
||||
RoundedBitmapDrawable circularBitmapDrawable =
|
||||
RoundedBitmapDrawableFactory.create(mContext.getResources(), resource);
|
||||
circularBitmapDrawable.setCircular(true);
|
||||
itemViewHolder.sharedAvatar.setImageDrawable(circularBitmapDrawable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setThumbnail(OCFile file, ImageView thumbnailView) {
|
||||
if (file.isFolder()) {
|
||||
thumbnailView.setImageDrawable(MimeTypeUtil.getFolderTypeIcon(file.isSharedWithMe() ||
|
||||
file.isSharedWithSharee(), file.isSharedViaLink(), file.isEncrypted(), file.getMountType(),
|
||||
mContext));
|
||||
thumbnailView.setImageDrawable(MimeTypeUtil
|
||||
.getFolderTypeIcon(file.isSharedWithMe() || file.isSharedWithSharee(),
|
||||
file.isSharedViaLink(), file.isEncrypted(),
|
||||
file.getMountType(), mContext));
|
||||
} else {
|
||||
if (file.getRemoteId() != null && file.isPreviewAvailable()) {
|
||||
// Thumbnail in cache?
|
||||
Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(
|
||||
ThumbnailsCacheManager.PREFIX_THUMBNAIL + file.getRemoteId()
|
||||
ThumbnailsCacheManager.PREFIX_THUMBNAIL + file.getRemoteId()
|
||||
);
|
||||
|
||||
if (thumbnail != null && !file.isUpdateThumbnailNeeded()) {
|
||||
|
@ -479,8 +480,8 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
if (ThumbnailsCacheManager.cancelPotentialThumbnailWork(file, thumbnailView)) {
|
||||
try {
|
||||
final ThumbnailsCacheManager.ThumbnailGenerationTask task =
|
||||
new ThumbnailsCacheManager.ThumbnailGenerationTask(thumbnailView, mStorageManager,
|
||||
mAccount, asyncTasks);
|
||||
new ThumbnailsCacheManager.ThumbnailGenerationTask(thumbnailView, mStorageManager,
|
||||
mAccount, asyncTasks);
|
||||
|
||||
if (thumbnail == null) {
|
||||
if (MimeTypeUtil.isVideo(file)) {
|
||||
|
@ -490,12 +491,12 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
}
|
||||
}
|
||||
final ThumbnailsCacheManager.AsyncThumbnailDrawable asyncDrawable =
|
||||
new ThumbnailsCacheManager.AsyncThumbnailDrawable(mContext.getResources(),
|
||||
thumbnail, task);
|
||||
new ThumbnailsCacheManager.AsyncThumbnailDrawable(mContext.getResources(),
|
||||
thumbnail, task);
|
||||
thumbnailView.setImageDrawable(asyncDrawable);
|
||||
asyncTasks.add(task);
|
||||
task.execute(new ThumbnailsCacheManager.ThumbnailGenerationTaskObject(file,
|
||||
file.getRemoteId()));
|
||||
file.getRemoteId()));
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log_OC.d(TAG, "ThumbnailGenerationTask : " + e.getMessage());
|
||||
}
|
||||
|
@ -507,7 +508,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
}
|
||||
} else {
|
||||
thumbnailView.setImageDrawable(MimeTypeUtil.getFileTypeIcon(file.getMimeType(), file.getFileName(),
|
||||
mAccount, mContext));
|
||||
mAccount, mContext));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -545,7 +546,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
output = resources.getQuantityString(R.plurals.file_list__footer__folder, foldersCount, foldersCount);
|
||||
} else {
|
||||
output = resources.getQuantityString(R.plurals.file_list__footer__file, filesCount, filesCount) + ", " +
|
||||
resources.getQuantityString(R.plurals.file_list__footer__folder, foldersCount, foldersCount);
|
||||
resources.getQuantityString(R.plurals.file_list__footer__folder, foldersCount, foldersCount);
|
||||
}
|
||||
|
||||
return output;
|
||||
|
@ -598,10 +599,10 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
|
||||
/**
|
||||
* Change the adapted directory for a new one
|
||||
* @param directory New folder to adapt. Can be NULL, meaning
|
||||
* "no content to adapt".
|
||||
*
|
||||
* @param directory New folder to adapt. Can be NULL, meaning "no content to adapt".
|
||||
* @param updatedStorageManager Optional updated storage manager; used to replace
|
||||
* @param limitToMimeType show only files of this mimeType
|
||||
* @param limitToMimeType show only files of this mimeType
|
||||
*/
|
||||
public void swapDirectory(OCFile directory, FileDataStorageManager updatedStorageManager,
|
||||
boolean onlyOnDevice, String limitToMimeType) {
|
||||
|
@ -688,7 +689,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
|
||||
// get ocFile from Server to have an up-to-date copy
|
||||
RemoteOperationResult result = new ReadFileRemoteOperation(ocShare.getPath()).execute(mAccount,
|
||||
mContext);
|
||||
mContext);
|
||||
|
||||
if (result.isSuccess()) {
|
||||
OCFile file = FileStorageUtils.fillOCFile((RemoteFile) result.getData().get(0));
|
||||
|
@ -699,7 +700,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
if (newShareType == ShareType.PUBLIC_LINK) {
|
||||
file.setSharedViaLink(true);
|
||||
} else if (newShareType == ShareType.USER || newShareType == ShareType.GROUP ||
|
||||
newShareType == ShareType.EMAIL || newShareType == ShareType.FEDERATED) {
|
||||
newShareType == ShareType.EMAIL || newShareType == ShareType.FEDERATED) {
|
||||
file.setSharedWithSharee(true);
|
||||
}
|
||||
|
||||
|
@ -747,7 +748,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
if (ocFile.isFolder()) {
|
||||
long currentSyncTime = System.currentTimeMillis();
|
||||
RemoteOperation refreshFolderOperation = new RefreshFolderOperation(ocFile, currentSyncTime, false,
|
||||
false, mStorageManager, mAccount, mContext);
|
||||
false, mStorageManager, mAccount, mContext);
|
||||
refreshFolderOperation.execute(mAccount, mContext);
|
||||
}
|
||||
|
||||
|
@ -810,7 +811,6 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
}
|
||||
|
||||
private class FilesFilter extends Filter {
|
||||
|
||||
@Override
|
||||
protected FilterResults performFiltering(CharSequence constraint) {
|
||||
FilterResults results = new FilterResults();
|
||||
|
@ -820,8 +820,8 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
for (OCFile file : mFilesAll) {
|
||||
if (file.getParentRemotePath().equals(currentDirectory.getRemotePath()) &&
|
||||
file.getFileName().toLowerCase(Locale.getDefault()).contains(
|
||||
constraint.toString().toLowerCase(Locale.getDefault())) &&
|
||||
!filteredFiles.contains(file)) {
|
||||
constraint.toString().toLowerCase(Locale.getDefault())) &&
|
||||
!filteredFiles.contains(file)) {
|
||||
filteredFiles.add(file);
|
||||
}
|
||||
}
|
||||
|
@ -852,7 +852,6 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Filter for hidden files
|
||||
*
|
||||
|
@ -901,7 +900,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
gridView = bool;
|
||||
}
|
||||
|
||||
static class OCFileListItemViewHolder extends OCFileListGridItemViewHolder {
|
||||
static class OCFileListItemViewHolder extends OCFileListGridItemViewHolder {
|
||||
@BindView(R.id.file_size)
|
||||
public TextView fileSize;
|
||||
|
||||
|
@ -920,7 +919,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
}
|
||||
}
|
||||
|
||||
static class OCFileListGridItemViewHolder extends OCFileListGridImageViewHolder {
|
||||
static class OCFileListGridItemViewHolder extends OCFileListGridImageViewHolder {
|
||||
@BindView(R.id.Filename) public TextView fileName;
|
||||
|
||||
private OCFileListGridItemViewHolder(View itemView) {
|
||||
|
@ -929,26 +928,26 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
}
|
||||
}
|
||||
|
||||
static class OCFileListGridImageViewHolder extends RecyclerView.ViewHolder {
|
||||
@BindView(R.id.thumbnail)
|
||||
public ImageView thumbnail;
|
||||
static class OCFileListGridImageViewHolder extends RecyclerView.ViewHolder {
|
||||
@BindView(R.id.thumbnail)
|
||||
public ImageView thumbnail;
|
||||
|
||||
@BindView(R.id.favorite_action)
|
||||
public ImageView favorite;
|
||||
@BindView(R.id.favorite_action)
|
||||
public ImageView favorite;
|
||||
|
||||
@BindView(R.id.localFileIndicator)
|
||||
public ImageView localFileIndicator;
|
||||
@BindView(R.id.localFileIndicator)
|
||||
public ImageView localFileIndicator;
|
||||
|
||||
@BindView(R.id.sharedIcon)
|
||||
public ImageView shared;
|
||||
@BindView(R.id.sharedIcon)
|
||||
public ImageView shared;
|
||||
|
||||
@BindView(R.id.custom_checkbox)
|
||||
public ImageView checkbox;
|
||||
@BindView(R.id.custom_checkbox)
|
||||
public ImageView checkbox;
|
||||
|
||||
@BindView(R.id.ListItemLayout)
|
||||
public LinearLayout itemLayout;
|
||||
@BindView(R.id.ListItemLayout)
|
||||
public LinearLayout itemLayout;
|
||||
|
||||
@BindView(R.id.unreadComments)
|
||||
@BindView(R.id.unreadComments)
|
||||
public ImageView unreadComments;
|
||||
|
||||
private OCFileListGridImageViewHolder(View itemView) {
|
||||
|
@ -957,7 +956,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
}
|
||||
}
|
||||
|
||||
static class OCFileListFooterViewHolder extends RecyclerView.ViewHolder {
|
||||
static class OCFileListFooterViewHolder extends RecyclerView.ViewHolder {
|
||||
@BindView(R.id.footerText)
|
||||
public TextView footerText;
|
||||
|
||||
|
|
|
@ -302,10 +302,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener
|
|||
tabLayout.removeAllTabs();
|
||||
|
||||
tabLayout.addTab(tabLayout.newTab().setText(R.string.drawer_item_activities));
|
||||
|
||||
if (getFile().canReshare()) {
|
||||
tabLayout.addTab(tabLayout.newTab().setText(R.string.share_dialog_title));
|
||||
}
|
||||
tabLayout.addTab(tabLayout.newTab().setText(R.string.share_dialog_title));
|
||||
|
||||
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
|
||||
tabLayout.setSelectedTabIndicatorColor(ThemeUtils.primaryAccentColor(getContext()));
|
||||
|
|
|
@ -128,6 +128,9 @@ public class FileDetailSharingFragment extends Fragment implements UserListAdapt
|
|||
@BindView(R.id.shared_with_you_username)
|
||||
TextView sharedWithYouUsername;
|
||||
|
||||
@BindView(R.id.shared_with_you_note)
|
||||
TextView sharedWithYouNote;
|
||||
|
||||
public static FileDetailSharingFragment newInstance(OCFile file, Account account) {
|
||||
FileDetailSharingFragment fragment = new FileDetailSharingFragment();
|
||||
Bundle args = new Bundle();
|
||||
|
@ -208,13 +211,19 @@ public class FileDetailSharingFragment extends Fragment implements UserListAdapt
|
|||
}
|
||||
|
||||
private void setupView() {
|
||||
setShareByLinkInfo(file.isSharedViaLink());
|
||||
setShareWithUserInfo();
|
||||
setShareWithYou();
|
||||
FileDetailSharingFragmentHelper.setupSearchView(
|
||||
(SearchManager) fileDisplayActivity.getSystemService(Context.SEARCH_SERVICE), searchView,
|
||||
fileDisplayActivity.getComponentName());
|
||||
ThemeUtils.themeSearchView(getContext(), searchView, false);
|
||||
|
||||
if (file.canReshare()) {
|
||||
setShareByLinkInfo(file.isSharedViaLink());
|
||||
setShareWithUserInfo();
|
||||
FileDetailSharingFragmentHelper.setupSearchView(
|
||||
(SearchManager) fileDisplayActivity.getSystemService(Context.SEARCH_SERVICE), searchView,
|
||||
fileDisplayActivity.getComponentName());
|
||||
ThemeUtils.themeSearchView(getContext(), searchView, false);
|
||||
} else {
|
||||
searchView.setVisibility(View.GONE);
|
||||
noList.setText(R.string.reshare_not_allowed);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -271,6 +280,15 @@ public class FileDetailSharingFragment extends Fragment implements UserListAdapt
|
|||
R.dimen.file_list_item_avatar_icon_radius), getResources(), sharedWithYouAvatar,
|
||||
getContext());
|
||||
sharedWithYouAvatar.setVisibility(View.VISIBLE);
|
||||
|
||||
String note = file.getNote();
|
||||
|
||||
if (!note.isEmpty()) {
|
||||
sharedWithYouNote.setText(file.getNote());
|
||||
sharedWithYouNote.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
sharedWithYouNote.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -535,7 +553,7 @@ public class FileDetailSharingFragment extends Fragment implements UserListAdapt
|
|||
* Takes into account server capabilities before reading database.
|
||||
*/
|
||||
public void refreshPublicShareFromDB() {
|
||||
if (FileDetailSharingFragmentHelper.isPublicShareDisabled(capabilities)) {
|
||||
if (FileDetailSharingFragmentHelper.isPublicShareDisabled(capabilities) || !file.canReshare()) {
|
||||
shareByLinkContainer.setVisibility(View.GONE);
|
||||
} else {
|
||||
// Get public share
|
||||
|
|
|
@ -209,6 +209,7 @@ public final class FileStorageUtils {
|
|||
file.setUnreadCommentsCount(remote.getUnreadCommentsCount());
|
||||
file.setOwnerId(remote.getOwnerId());
|
||||
file.setOwnerDisplayName(remote.getOwnerDisplayName());
|
||||
file.setNote(remote.getNote());
|
||||
|
||||
return file;
|
||||
}
|
||||
|
@ -441,7 +442,7 @@ public final class FileStorageUtils {
|
|||
* Taken from https://github.com/TeamAmaze/AmazeFileManager/blob/54652548223d151f089bdc6fc868b13ca5ab20a9/app/src
|
||||
* /main/java/com/amaze/filemanager/activities/MainActivity.java#L620 on 14.02.2019
|
||||
*/
|
||||
@SuppressFBWarnings(value = "DMI_HARDCODED_ABSOLUTE_FILENAME",
|
||||
@SuppressFBWarnings(value = "DMI_HARDCODED_ABSOLUTE_FILENAME",
|
||||
justification = "Default Android fallback storage path")
|
||||
public static List<String> getStorageDirectories(Activity activity) {
|
||||
// Final set of paths
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/shareContainer"
|
||||
|
@ -31,15 +31,15 @@
|
|||
android:paddingTop="@dimen/standard_eigth_padding">
|
||||
|
||||
<androidx.appcompat.widget.SearchView
|
||||
android:id="@+id/searchView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/searchView"
|
||||
android:layout_marginStart="@dimen/standard_eighth_margin"
|
||||
android:layout_marginLeft="@dimen/standard_eighth_margin"
|
||||
android:layout_marginEnd="@dimen/standard_margin"
|
||||
android:layout_marginRight="@dimen/standard_margin"
|
||||
style="@style/ownCloud.SearchView"
|
||||
android:hint="@string/share_search"/>
|
||||
android:hint="@string/share_search"
|
||||
style="@style/ownCloud.SearchView"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/shared_with_you_container"
|
||||
|
@ -72,6 +72,16 @@
|
|||
android:paddingRight="@dimen/standard_padding"
|
||||
android:text="@string/shared_with_you_by"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/shared_with_you_note"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/standard_padding"
|
||||
android:paddingTop="@dimen/standard_half_padding"
|
||||
android:paddingRight="@dimen/standard_padding"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -99,7 +109,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/share_via_link_section_title" />
|
||||
android:text="@string/share_via_link_section_title"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/share_link_copy_icon"
|
||||
|
@ -115,7 +125,7 @@
|
|||
android:paddingRight="@dimen/standard_eighth_margin"
|
||||
android:paddingBottom="@dimen/standard_quarter_margin"
|
||||
android:scaleType="fitStart"
|
||||
android:src="@drawable/ic_content_copy" />
|
||||
android:src="@drawable/ic_content_copy"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatCheckBox
|
||||
android:id="@+id/share_by_link_allow_editing"
|
||||
|
@ -124,7 +134,7 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:ellipsize="middle"
|
||||
android:text="@string/edit_permission_label"
|
||||
android:textSize="16sp" />
|
||||
android:textSize="16sp"/>
|
||||
</com.google.android.flexbox.FlexboxLayout>
|
||||
|
||||
<ImageView
|
||||
|
|
|
@ -875,4 +875,5 @@
|
|||
<string name="authentication_exception">Authentication Exception</string>
|
||||
<string name="shared_avatar_desc">Avatar from shared user</string>
|
||||
<string name="shared_with_you_by">Shared with you by %1$s</string>
|
||||
<string name="reshare_not_allowed">Resharing is not allowed</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue