mirror of
https://github.com/nextcloud/android.git
synced 2024-12-21 08:24:08 +03:00
use api
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
9aa94c9086
commit
4b1a30a148
5 changed files with 17 additions and 4 deletions
|
@ -17,6 +17,9 @@ interface FileDao {
|
|||
@Query("SELECT * FROM filelist WHERE _id = :id LIMIT 1")
|
||||
fun getFileById(id: Long): FileEntity?
|
||||
|
||||
@Query("SELECT * FROM filelist WHERE local_id = :localId LIMIT 1")
|
||||
fun getFileByLocalId(localId: Long): FileEntity?
|
||||
|
||||
@Query("SELECT * FROM filelist WHERE path = :path AND file_owner = :fileOwner LIMIT 1")
|
||||
fun getFileByEncryptedRemotePath(path: String, fileOwner: String): FileEntity?
|
||||
|
||||
|
|
|
@ -345,6 +345,15 @@ public class FileDataStorageManager {
|
|||
return null;
|
||||
}
|
||||
|
||||
public @Nullable
|
||||
OCFile getFileByLocalId(long localId) {
|
||||
FileEntity fileEntity = fileDao.getFileByLocalId(localId);
|
||||
if (fileEntity != null) {
|
||||
return createFileInstance(fileEntity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public @Nullable
|
||||
OCFile getFileByLocalPath(String path) {
|
||||
FileEntity fileEntity = fileDao.getFileByLocalPath(path, user.getAccountName());
|
||||
|
|
|
@ -781,7 +781,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!recommendedFiles.isEmpty()) {
|
||||
if (!recommendedFiles.isEmpty() && currentDirectory.isRootDirectory()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class RecommendedFilesAdapter(
|
|||
name.text = item.name
|
||||
timestamp.text = DisplayUtils.getRelativeTimestamp(context, item.timestamp)
|
||||
|
||||
val file = storageManager.getFileById(item.id) ?: return
|
||||
val file = storageManager.getFileByLocalId(item.id) ?: return
|
||||
|
||||
delegate.setThumbnail(thumbnail, shimmerThumbnail, file)
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
|||
protected MenuItemAddRemove menuItemAddRemoveValue = MenuItemAddRemove.ADD_GRID_AND_SORT_WITH_SEARCH;
|
||||
|
||||
private List<MenuItem> mOriginalMenuItems = new ArrayList<>();
|
||||
private ArrayList<Recommendation> recommendedFiles = new ArrayList<>();
|
||||
private final ArrayList<Recommendation> recommendedFiles = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -443,7 +443,8 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
|||
final var client = OwnCloudClientFactory.createNextcloudClient(user.toPlatformAccount(), requireActivity());
|
||||
final var result = new GetRecommendationsRemoteOperation().execute(client);
|
||||
if (result.isSuccess()) {
|
||||
recommendedFiles.addAll(result.getResultData().getRecommendations());
|
||||
final var recommendations = result.getResultData().getRecommendations();
|
||||
recommendedFiles.addAll(recommendations);
|
||||
requireActivity().runOnUiThread(new Runnable() {
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue