Compare commits

...
Author SHA1 Message Date
tobiasKaminsky e1d64f2a7d see favorite in shared view
allow to favorite/unfavorite it

Signed-off-by: tobiasKaminsky <[email protected]>
2022-09-22 09:58:55 +02:00
4 changed files with 7 additions and 8 deletions

No files matched your search

@@ -217,9 +217,9 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
return position;
}
public void setFavoriteAttributeForItemID(String fileId, boolean favorite, boolean removeFromList) {
public void setFavoriteAttributeForItemID(String remotePath, boolean favorite, boolean removeFromList) {
for (OCFile file : mFiles) {
if (file.getRemoteId().equals(fileId)) {
if (file.getRemotePath().equals(remotePath)) {
file.setFavorite(favorite);
if (removeFromList) {
@@ -231,7 +231,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
}
for (OCFile file : mFilesAll) {
if (file.getRemoteId().equals(fileId)) {
if (file.getRemoteId().equals(remotePath)) {
file.setFavorite(favorite);
mStorageManager.saveFile(file);
@@ -55,8 +55,8 @@ object OCShareToOCFileConverter {
isPreviewAvailable = firstShare.isHasPreview
mimeType = firstShare.mimetype
note = firstShare.note
fileId = firstShare.fileSource
remoteId = firstShare.remoteId.toString()
remoteId = firstShare.fileSource.toString()
isFavorite = firstShare.isFavorite
// use first share timestamp as timestamp
firstShareTimestamp = shares.minOf { it.sharedDate * MILLIS_PER_SECOND }
// don't have file length or mod timestamp
@@ -43,7 +43,6 @@ import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.Toast;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.behavior.HideBottomViewOnScrollBehavior;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
@@ -1583,7 +1582,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
if (remoteOperationResult.isSuccess()) {
boolean removeFromList = currentSearchType == SearchType.FAVORITE_SEARCH && !event.shouldFavorite;
mAdapter.setFavoriteAttributeForItemID(event.remoteId, event.shouldFavorite, removeFromList);
mAdapter.setFavoriteAttributeForItemID(event.remotePath, event.shouldFavorite, removeFromList);
}
} catch (ClientFactory.CreationException e) {
+1 -1
View File
@@ -6,7 +6,7 @@ buildscript {
daggerVersion = "2.43.2"
markwonVersion = "4.6.2"
prismVersion = "2.0.0"
androidLibraryVersion = "master-SNAPSHOT"
androidLibraryVersion = "shareAPIfavorite-SNAPSHOT"
mockitoVersion = "4.8.0"
mockitoKotlinVersion = "4.0.0"
mockkVersion = "1.12.5"