From ea52c9bd5b032c297b7230ae484672089b3431b5 Mon Sep 17 00:00:00 2001 From: Patryk Kaczmarkiewicz Date: Wed, 18 Apr 2018 13:33:03 -0600 Subject: [PATCH 01/10] Add short app name --- app/src/main/AndroidManifest.xml | 2 +- .../main/res/drawable/ic_file_download_notification.xml | 9 +++++++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable/ic_file_download_notification.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6151f78..d4166e8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,10 +15,10 @@ android:theme="@style/AppTheme"> - diff --git a/app/src/main/res/drawable/ic_file_download_notification.xml b/app/src/main/res/drawable/ic_file_download_notification.xml new file mode 100644 index 0000000..492b41d --- /dev/null +++ b/app/src/main/res/drawable/ic_file_download_notification.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a29448a..234e797 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,5 +1,6 @@ Rclone Explorer + Rclone Ex MainActivity Open navigation drawer From f74a85d5e4be983a237ff86706f01eff51ec6baa Mon Sep 17 00:00:00 2001 From: Patryk Kaczmarkiewicz Date: Wed, 18 Apr 2018 14:34:10 -0600 Subject: [PATCH 02/10] Fix About page not able to scroll --- app/src/main/res/layout/content_about.xml | 451 +++++++++++----------- 1 file changed, 229 insertions(+), 222 deletions(-) diff --git a/app/src/main/res/layout/content_about.xml b/app/src/main/res/layout/content_about.xml index 2a797ad..3f7082d 100644 --- a/app/src/main/res/layout/content_about.xml +++ b/app/src/main/res/layout/content_about.xml @@ -1,5 +1,5 @@ - - + android:orientation="vertical" + android:paddingBottom="16dp"> - + android:layout_height="wrap_content" + android:layout_marginTop="16dp" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" + card_view:cardCornerRadius="4dp" + card_view:contentPadding="16dp" > + + android:layout_height="match_parent" + android:orientation="vertical"> + - + + + + + + + - + + - + + + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingStart="32dp" + android:paddingEnd="0dp"> + + + + + + - - + + android:clickable="true" + android:focusable="true"> - - + android:src="@drawable/ic_changelog" + android:contentDescription="@string/changelog" /> + + android:layout_height="wrap_content" + android:paddingStart="32dp" + android:paddingEnd="0dp" + android:text="@string/changelog" + android:textStyle="bold"/> - - - - - - - - - - - - - - + - + - - + + - + - + - - + + - + - + - + + - - + - - - - + android:layout_height="wrap_content" + android:layout_marginTop="16dp" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" + card_view:cardCornerRadius="4dp" + card_view:contentPadding="16dp" > - - + android:layout_height="match_parent" + android:orientation="vertical"> - + android:text="@string/author" + android:paddingBottom="16dp" /> - + - - + + + + + + + + + - - - \ No newline at end of file + + + \ No newline at end of file From 3b37b008e29dd0883cb3e0dd5ec49365c876b160 Mon Sep 17 00:00:00 2001 From: Patryk Kaczmarkiewicz Date: Wed, 18 Apr 2018 14:47:01 -0600 Subject: [PATCH 03/10] Clear adapter before fetching new data --- .../ca/pkay/rcloneexplorer/Fragments/FileExplorerFragment.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/ca/pkay/rcloneexplorer/Fragments/FileExplorerFragment.java b/app/src/main/java/ca/pkay/rcloneexplorer/Fragments/FileExplorerFragment.java index 6223c36..0d258db 100644 --- a/app/src/main/java/ca/pkay/rcloneexplorer/Fragments/FileExplorerFragment.java +++ b/app/src/main/java/ca/pkay/rcloneexplorer/Fragments/FileExplorerFragment.java @@ -482,6 +482,7 @@ public boolean onBackButtonPressed() { fetchDirectoryTask.cancel(true); breadcrumbView.removeLastCrumb(); path = pathStack.pop(); + recyclerViewAdapter.clear(); if (directoryCache.containsKey(path)) { directoryContent = directoryCache.get(path); recyclerViewAdapter.newData(directoryContent); @@ -574,6 +575,7 @@ public void onBreadCrumbClicked(String path) { // pop stack until we find path } breadcrumbView.removeCrumbsUpTo(path); + recyclerViewAdapter.clear(); if (directoryCache.containsKey(path)) { directoryContent = directoryCache.get(path); recyclerViewAdapter.newData(directoryContent); From 3daf3a81b2f20f85e9b8ea44e5d5a1d22ef49938 Mon Sep 17 00:00:00 2001 From: Patryk Kaczmarkiewicz Date: Wed, 18 Apr 2018 14:47:37 -0600 Subject: [PATCH 04/10] Remove unused libraries --- README.md | 1 - .../values/about_libraries_game_building_tools.xml | 13 ------------- 2 files changed, 14 deletions(-) delete mode 100644 app/src/main/res/values/about_libraries_game_building_tools.xml diff --git a/README.md b/README.md index 37c74f5..207b8a6 100644 --- a/README.md +++ b/README.md @@ -37,4 +37,3 @@ Credits/Libraries - [Material Dialogs](https://github.com/afollestad/material-dialogs) - A beautiful, fluid, and customizable dialogs API - [rclone](https://github.com/ncw/rclone) - "rsync for cloud storage" - Icon made by [Smashicons](https://www.flaticon.com/authors/smashicons) from [Flaticon](https://www.flaticon.com) -- Graphics from [Game Building Tools](http://www.gamebuildingtools.com) diff --git a/app/src/main/res/values/about_libraries_game_building_tools.xml b/app/src/main/res/values/about_libraries_game_building_tools.xml deleted file mode 100644 index 5ecdbaa..0000000 --- a/app/src/main/res/values/about_libraries_game_building_tools.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - Game Building Tools - http://www.gamebuildingtools.com/ - Game Building Tools - GameBuildingTools.com was built by a game developer for the community. Grab graphics, audio, and more for your next project. - - http://www.gamebuildingtools.com/product/desert-parallax-background/ - Attribution 4.0 International (CC BY 4.0) - true - http://www.gamebuildingtools.com/product/desert-parallax-background/ - \ No newline at end of file From 4b72fead0c8bd44100e649e6f70b2f38bf56b015 Mon Sep 17 00:00:00 2001 From: Patryk Kaczmarkiewicz Date: Wed, 18 Apr 2018 14:54:18 -0600 Subject: [PATCH 05/10] Fix sorting --- app/src/main/java/ca/pkay/rcloneexplorer/FileComparators.java | 4 ++-- .../java/ca/pkay/rcloneexplorer/Services/DownloadService.java | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/ca/pkay/rcloneexplorer/FileComparators.java b/app/src/main/java/ca/pkay/rcloneexplorer/FileComparators.java index 5b353d2..5bb8914 100644 --- a/app/src/main/java/ca/pkay/rcloneexplorer/FileComparators.java +++ b/app/src/main/java/ca/pkay/rcloneexplorer/FileComparators.java @@ -16,7 +16,7 @@ public int compare(FileItem fileItem, FileItem t1) { return 1; } - return fileItem.getName().compareTo(t1.getName()); + return fileItem.getName().toLowerCase().compareTo(t1.getName().toLowerCase()); } } @@ -30,7 +30,7 @@ public int compare(FileItem fileItem, FileItem t1) { return 1; } - return t1.getName().compareTo(fileItem.getName()); + return t1.getName().toLowerCase().compareTo(fileItem.getName().toLowerCase()); } } diff --git a/app/src/main/java/ca/pkay/rcloneexplorer/Services/DownloadService.java b/app/src/main/java/ca/pkay/rcloneexplorer/Services/DownloadService.java index a37f17f..d25c253 100644 --- a/app/src/main/java/ca/pkay/rcloneexplorer/Services/DownloadService.java +++ b/app/src/main/java/ca/pkay/rcloneexplorer/Services/DownloadService.java @@ -106,7 +106,9 @@ private void setNotificationChannel() { channel.setDescription(getString(R.string.download_service_notification_description)); // Register the channel with the system NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - notificationManager.createNotificationChannel(channel); + if (notificationManager != null) { + notificationManager.createNotificationChannel(channel); + } } } } From 3836838c1fe4879b03e7d16bc8515f2c5d4e9036 Mon Sep 17 00:00:00 2001 From: Patryk Kaczmarkiewicz Date: Wed, 18 Apr 2018 16:11:11 -0600 Subject: [PATCH 06/10] Fix wrong notification shown on canceled download --- .../Services/DownloadService.java | 32 +++++++++++++++---- app/src/main/res/values/strings.xml | 1 + 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/ca/pkay/rcloneexplorer/Services/DownloadService.java b/app/src/main/java/ca/pkay/rcloneexplorer/Services/DownloadService.java index d25c253..ca79ce7 100644 --- a/app/src/main/java/ca/pkay/rcloneexplorer/Services/DownloadService.java +++ b/app/src/main/java/ca/pkay/rcloneexplorer/Services/DownloadService.java @@ -27,6 +27,7 @@ public class DownloadService extends IntentService { public static final String REMOTE_ARG = "ca.pkay.rcexplorer.download_service.arg3"; private Rclone rclone; private List runningProcesses; + private Boolean aProcessFailed; /** * Creates an IntentService. Invoked by your subclass's constructor.* @@ -72,6 +73,10 @@ protected void onHandleIntent(@Nullable Intent intent) { for (Process process : runningProcesses) { try { process.waitFor(); + if (process.exitValue() != 0) { + aProcessFailed = true; + } + } catch (InterruptedException e) { e.printStackTrace(); } @@ -79,14 +84,27 @@ protected void onHandleIntent(@Nullable Intent intent) { stopForeground(true); - NotificationCompat.Builder builder1 = new NotificationCompat.Builder(this, CHANNEL_ID) - .setSmallIcon(android.R.drawable.stat_sys_download_done) - .setContentTitle(getString(R.string.download_complete)) - .setPriority(NotificationCompat.PRIORITY_DEFAULT); + NotificationCompat.Builder builder1; + if (aProcessFailed) { + builder1 = new NotificationCompat.Builder(this, CHANNEL_ID) + .setSmallIcon(android.R.drawable.stat_sys_warning) + .setContentTitle(getString(R.string.download_cancelled)) + .setPriority(NotificationCompat.PRIORITY_DEFAULT); + + NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + if (notificationManager != null) { + notificationManager.notify(2, builder1.build()); + } + } else { + builder1 = new NotificationCompat.Builder(this, CHANNEL_ID) + .setSmallIcon(android.R.drawable.stat_sys_download_done) + .setContentTitle(getString(R.string.download_complete)) + .setPriority(NotificationCompat.PRIORITY_DEFAULT); - NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - if (notificationManager != null) { - notificationManager.notify(2, builder1.build()); + NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + if (notificationManager != null) { + notificationManager.notify(3, builder1.build()); + } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 234e797..38ec2fd 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -73,4 +73,5 @@ Please type new folder name Loading file Please wait + Download cancelled From 7d8c16b56ce1fb113e14e4a7312147c234db81df Mon Sep 17 00:00:00 2001 From: Patryk Kaczmarkiewicz Date: Wed, 18 Apr 2018 16:17:52 -0600 Subject: [PATCH 07/10] Fix wrong notification shown on upload cancelled --- .../Services/UploadService.java | 31 ++++++++++++++----- app/src/main/res/values/strings.xml | 1 + 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/ca/pkay/rcloneexplorer/Services/UploadService.java b/app/src/main/java/ca/pkay/rcloneexplorer/Services/UploadService.java index 99cd56c..01cd2dd 100644 --- a/app/src/main/java/ca/pkay/rcloneexplorer/Services/UploadService.java +++ b/app/src/main/java/ca/pkay/rcloneexplorer/Services/UploadService.java @@ -28,6 +28,7 @@ public class UploadService extends IntentService { public static final String REMOTE_ARG = "ca.pkay.rcexplorer.upload_service.arg3"; private Rclone rclone; private List runningProcesses; + private Boolean aProcessFailed; /** * Creates an IntentService. Invoked by your subclass's constructor.* @@ -72,6 +73,9 @@ protected void onHandleIntent(@Nullable Intent intent) { for (Process process : runningProcesses) { try { process.waitFor(); + if (process.exitValue() != 0) { + aProcessFailed = true; + } } catch (InterruptedException e) { e.printStackTrace(); } @@ -80,14 +84,27 @@ protected void onHandleIntent(@Nullable Intent intent) { stopForeground(true); - NotificationCompat.Builder builder1 = new NotificationCompat.Builder(this, CHANNEL_ID) - .setSmallIcon(android.R.drawable.stat_sys_upload_done) - .setContentTitle(getString(R.string.upload_complete)) - .setPriority(NotificationCompat.PRIORITY_DEFAULT); + NotificationCompat.Builder builder1; + if (aProcessFailed) { + builder1 = new NotificationCompat.Builder(this, CHANNEL_ID) + .setSmallIcon(android.R.drawable.stat_sys_warning) + .setContentTitle(getString(R.string.upload_cancelled)) + .setPriority(NotificationCompat.PRIORITY_DEFAULT); - NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - if (notificationManager != null) { - notificationManager.notify(20, builder1.build()); + NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + if (notificationManager != null) { + notificationManager.notify(21, builder1.build()); + } + } else { + builder1 = new NotificationCompat.Builder(this, CHANNEL_ID) + .setSmallIcon(android.R.drawable.stat_sys_upload_done) + .setContentTitle(getString(R.string.upload_complete)) + .setPriority(NotificationCompat.PRIORITY_DEFAULT); + + NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + if (notificationManager != null) { + notificationManager.notify(20, builder1.build()); + } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 38ec2fd..f6331ca 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -74,4 +74,5 @@ Loading file Please wait Download cancelled + Upload cancelled From 29d3b88caedbfe173e76fb3866573c2231f57ebd Mon Sep 17 00:00:00 2001 From: Patryk Kaczmarkiewicz Date: Thu, 19 Apr 2018 16:27:17 -0600 Subject: [PATCH 08/10] Make temp files read only --- .idea/misc.xml | 2 +- app/src/main/assets/changelog.md | 8 ++++++++ .../rcloneexplorer/Fragments/FileExplorerFragment.java | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 9d6c50a..2827fab 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -25,7 +25,7 @@ - + diff --git a/app/src/main/assets/changelog.md b/app/src/main/assets/changelog.md index 506cd7d..022ba42 100644 --- a/app/src/main/assets/changelog.md +++ b/app/src/main/assets/changelog.md @@ -1,3 +1,11 @@ +### 1.0.1-beta +* **New:** Short app name in the launcher +* **Fix:** Scrolling in About page +* **Fix:** File Explorer not getting cleared when loading +* **Fix:** Sorting +* **Fix:** Canceled notification posted on download/upload cancel +* **Fix:** Make temporary files read-only + ### 1.0.0-beta *** First beta release! diff --git a/app/src/main/java/ca/pkay/rcloneexplorer/Fragments/FileExplorerFragment.java b/app/src/main/java/ca/pkay/rcloneexplorer/Fragments/FileExplorerFragment.java index 0d258db..d616fbe 100644 --- a/app/src/main/java/ca/pkay/rcloneexplorer/Fragments/FileExplorerFragment.java +++ b/app/src/main/java/ca/pkay/rcloneexplorer/Fragments/FileExplorerFragment.java @@ -945,6 +945,12 @@ protected Boolean doInBackground(FileItem... fileItems) { e.printStackTrace(); return false; } + + if (process.exitValue() == 0) { + File savedFile = new File(fileLocation); + savedFile.setReadOnly(); + } + return process.exitValue() == 0; } From 51b827b2c80454cd3ada1678aa84221c0e6dcae7 Mon Sep 17 00:00:00 2001 From: Patryk Kaczmarkiewicz Date: Thu, 19 Apr 2018 21:23:32 -0600 Subject: [PATCH 09/10] Better way of implementing divider between items --- .../FileExplorerRecyclerViewAdapter.java | 6 +++--- app/src/main/res/layout/fragment_file_explorer_item.xml | 9 ++------- app/src/main/res/layout/fragment_file_explorer_list.xml | 6 ++---- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/ca/pkay/rcloneexplorer/RecyclerViewAdapters/FileExplorerRecyclerViewAdapter.java b/app/src/main/java/ca/pkay/rcloneexplorer/RecyclerViewAdapters/FileExplorerRecyclerViewAdapter.java index fdf3f46..ce11804 100644 --- a/app/src/main/java/ca/pkay/rcloneexplorer/RecyclerViewAdapters/FileExplorerRecyclerViewAdapter.java +++ b/app/src/main/java/ca/pkay/rcloneexplorer/RecyclerViewAdapters/FileExplorerRecyclerViewAdapter.java @@ -67,10 +67,10 @@ public void onBindViewHolder(@NonNull final ViewHolder holder, int position) { if (selectedItems.contains(item)) { holder.view.setBackgroundColor(holder.view.getResources().getColor(R.color.colorPrimaryLight)); } else { - holder.view.setBackgroundColor(0x00000000); + holder.view.setBackgroundColor(holder.view.getResources().getColor(R.color.white)); } } else { - holder.view.setBackgroundColor(0x00000000); + holder.view.setBackgroundColor(holder.view.getResources().getColor(R.color.white)); } if (isInMoveMode) { if (item.isDir()) { @@ -206,7 +206,7 @@ public void cancelSelection() { private void onLongClickAction(FileItem item, ViewHolder holder) { if (selectedItems.contains(item)) { selectedItems.remove(item); - holder.view.setBackgroundColor(0x00000000); + holder.view.setBackgroundColor(holder.view.getResources().getColor(R.color.white)); if (selectedItems.size() == 0) { isInSelectMode = false; listener.onFilesSelected(false); diff --git a/app/src/main/res/layout/fragment_file_explorer_item.xml b/app/src/main/res/layout/fragment_file_explorer_item.xml index 891a351..bd880f0 100644 --- a/app/src/main/res/layout/fragment_file_explorer_item.xml +++ b/app/src/main/res/layout/fragment_file_explorer_item.xml @@ -6,7 +6,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="76dp" - android:background="?selectableItemBackground" > + android:background="?selectableItemBackground" + android:layout_marginBottom="1dp"> - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_file_explorer_list.xml b/app/src/main/res/layout/fragment_file_explorer_list.xml index dab4705..356074d 100644 --- a/app/src/main/res/layout/fragment_file_explorer_list.xml +++ b/app/src/main/res/layout/fragment_file_explorer_list.xml @@ -6,10 +6,8 @@ android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" - android:orientation="vertical"> - - + android:orientation="vertical" + android:background="@color/grey" > From cd30f2becd4d11bbcf0d83f72658a393c8dd9b8c Mon Sep 17 00:00:00 2001 From: Patryk Kaczmarkiewicz Date: Thu, 19 Apr 2018 22:58:34 -0600 Subject: [PATCH 10/10] RecyclerView Animations --- .idea/caches/build_file_checksums.ser | Bin 535 -> 535 bytes .idea/misc.xml | 2 +- app/build.gradle | 5 ++-- app/src/main/assets/changelog.md | 14 +++------- .../Fragments/FileExplorerFragment.java | 3 +++ .../FileExplorerRecyclerViewAdapter.java | 25 +++++++++++++----- 6 files changed, 29 insertions(+), 20 deletions(-) diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 8f779fce4c3de78e6058e08f1a7327a19037599d..c5a3beefbf91dc5e61a51010e0762e3d5304fc90 100644 GIT binary patch delta 33 rcmV++0N($X1eXMmm;~=!>FTkZY5@`337hCaAv@r5aBvs7zi&Nw0_hJk delta 33 pcmbQvGM#0@43=AxN2E8-$zl}z%a-cgk!sp^SK`UZTqcP{6#(G_4V(Y~ diff --git a/.idea/misc.xml b/.idea/misc.xml index 2827fab..9d6c50a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -25,7 +25,7 @@ - + diff --git a/app/build.gradle b/app/build.gradle index 37a43fb..37c68bb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "ca.pkay.rcloneexplorer" minSdkVersion 21 targetSdkVersion 27 - versionCode 4 - versionName "1.0.0-beta" + versionCode 5 + versionName "1.0.1-beta" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { @@ -39,6 +39,7 @@ dependencies { implementation 'com.mikepenz:octicons-typeface:3.2.0.4@aar' implementation "com.mikepenz:aboutlibraries:6.0.8" implementation 'us.feras.mdv:markdownview:1.1.0' + implementation 'jp.wasabeef:recyclerview-animators:2.3.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' diff --git a/app/src/main/assets/changelog.md b/app/src/main/assets/changelog.md index 022ba42..6c77fcc 100644 --- a/app/src/main/assets/changelog.md +++ b/app/src/main/assets/changelog.md @@ -1,27 +1,19 @@ ### 1.0.1-beta * **New:** Short app name in the launcher +* **New:** Animations * **Fix:** Scrolling in About page * **Fix:** File Explorer not getting cleared when loading * **Fix:** Sorting * **Fix:** Canceled notification posted on download/upload cancel * **Fix:** Make temporary files read-only - +---- ### 1.0.0-beta -*** First beta release! * Code refactoring - -*** - - +----- ### 0.3.0-alpha -*** - * **New:** Changelog added under About screen * **New:** Clicking on File/Folder icon will select it * **New:** App icon * **Fix:** Status bar color - -*** - diff --git a/app/src/main/java/ca/pkay/rcloneexplorer/Fragments/FileExplorerFragment.java b/app/src/main/java/ca/pkay/rcloneexplorer/Fragments/FileExplorerFragment.java index d616fbe..cf1676f 100644 --- a/app/src/main/java/ca/pkay/rcloneexplorer/Fragments/FileExplorerFragment.java +++ b/app/src/main/java/ca/pkay/rcloneexplorer/Fragments/FileExplorerFragment.java @@ -51,6 +51,8 @@ import ca.pkay.rcloneexplorer.Services.DownloadService; import ca.pkay.rcloneexplorer.Services.StreamingService; import ca.pkay.rcloneexplorer.Services.UploadService; +import jp.wasabeef.recyclerview.animators.LandingAnimator; +import jp.wasabeef.recyclerview.animators.SlideInLeftAnimator; import ru.bartwell.exfilepicker.ExFilePicker; import ru.bartwell.exfilepicker.data.ExFilePickerResult; @@ -165,6 +167,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c Context context = view.getContext(); RecyclerView recyclerView = view.findViewById(R.id.file_explorer_list); + recyclerView.setItemAnimator(new LandingAnimator()); recyclerView.setLayoutManager(new LinearLayoutManager(context)); recyclerViewAdapter = new FileExplorerRecyclerViewAdapter(directoryContent, view.findViewById(R.id.empty_folder_view), this); recyclerView.setAdapter(recyclerViewAdapter); diff --git a/app/src/main/java/ca/pkay/rcloneexplorer/RecyclerViewAdapters/FileExplorerRecyclerViewAdapter.java b/app/src/main/java/ca/pkay/rcloneexplorer/RecyclerViewAdapters/FileExplorerRecyclerViewAdapter.java index ce11804..8813b0f 100644 --- a/app/src/main/java/ca/pkay/rcloneexplorer/RecyclerViewAdapters/FileExplorerRecyclerViewAdapter.java +++ b/app/src/main/java/ca/pkay/rcloneexplorer/RecyclerViewAdapters/FileExplorerRecyclerViewAdapter.java @@ -121,15 +121,20 @@ public int getItemCount() { } public void clear() { + if (files == null) { + return; + } + int count = files.size(); files.clear(); isInSelectMode = false; selectedItems.clear(); listener.onFilesSelected(false); - notifyDataSetChanged(); + notifyItemRangeRemoved(0, count); } public void newData(List data) { - files = data; + this.clear(); + files = new ArrayList<>(data); isInSelectMode = false; selectedItems.clear(); listener.onFilesSelected(false); @@ -138,18 +143,26 @@ public void newData(List data) { } else { emptyView.setVisibility(View.INVISIBLE); } - notifyDataSetChanged(); + if (isInMoveMode) { + notifyDataSetChanged(); + } else { + notifyItemRangeInserted(0, files.size()); + } } public void updateData(List data) { - files = data; + this.clear(); + files = new ArrayList<>(data); if (files.isEmpty()) { emptyView.setVisibility(View.VISIBLE); } else { emptyView.setVisibility(View.INVISIBLE); } - notifyDataSetChanged(); - } + if (isInMoveMode) { + notifyDataSetChanged(); + } else { + notifyItemRangeInserted(0, files.size()); + } } public void refreshData() { notifyDataSetChanged();