diff --git a/app/build.gradle b/app/build.gradle index 1ea9edf043..5fa1bb7b94 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -281,6 +281,8 @@ dependencies { implementation "com.google.android.exoplayer:exoplayer:$exoplayerVersion" implementation "com.google.android.exoplayer:extension-okhttp:$exoplayerVersion" + implementation 'com.simplecityapps:recyclerview-fastscroll:2.0.1' + // Shimmer animation implementation 'com.elyeproj.libraries:loaderviewlibrary:2.0.0' diff --git a/app/src/androidTest/java/com/owncloud/android/ui/activity/UploadFilesActivityIT.kt b/app/src/androidTest/java/com/owncloud/android/ui/activity/UploadFilesActivityIT.kt index 245852530f..49d3b54774 100644 --- a/app/src/androidTest/java/com/owncloud/android/ui/activity/UploadFilesActivityIT.kt +++ b/app/src/androidTest/java/com/owncloud/android/ui/activity/UploadFilesActivityIT.kt @@ -70,6 +70,7 @@ class UploadFilesActivityIT : AbstractIT() { } waitForIdleSync() + shortSleep() screenshot(sut) } diff --git a/app/src/main/java/com/owncloud/android/ui/EmptyRecyclerView.java b/app/src/main/java/com/owncloud/android/ui/EmptyRecyclerView.java index 6b0e747845..b45b5355c5 100644 --- a/app/src/main/java/com/owncloud/android/ui/EmptyRecyclerView.java +++ b/app/src/main/java/com/owncloud/android/ui/EmptyRecyclerView.java @@ -25,14 +25,14 @@ import android.content.Context; import android.util.AttributeSet; import android.view.View; +import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView; + import androidx.annotation.Nullable; -import androidx.recyclerview.widget.RecyclerView; /** - * Extends RecyclerView to show a custom view if no data is available - * Inspired by http://alexzh.com/tutorials/how-to-setemptyview-to-recyclerview + * Extends RecyclerView to show a custom view if no data is available Inspired by http://alexzh.com/tutorials/how-to-setemptyview-to-recyclerview */ -public class EmptyRecyclerView extends RecyclerView { +public class EmptyRecyclerView extends FastScrollRecyclerView { private View mEmptyView; private boolean hasFooter = false; diff --git a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java index be8d922e90..0a2372502d 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -485,7 +485,7 @@ public class FileDisplayActivity extends FileActivity SearchEvent searchEvent = intent.getParcelableExtra(OCFileListFragment.SEARCH_EVENT); if (searchEvent != null) { - if (SearchRemoteOperation.SearchType.PHOTO_SEARCH.equals(searchEvent.getSearchType())) { + if (SearchRemoteOperation.SearchType.PHOTO_SEARCH == searchEvent.getSearchType()) { Log_OC.d(this, "Switch to photo search fragment"); GalleryFragment photoFragment = new GalleryFragment(); @@ -493,7 +493,7 @@ public class FileDisplayActivity extends FileActivity bundle.putParcelable(OCFileListFragment.SEARCH_EVENT, searchEvent); photoFragment.setArguments(bundle); setLeftFragment(photoFragment); - } else if (searchEvent.getSearchType().equals(SearchRemoteOperation.SearchType.SHARED_FILTER)) { + } else if (searchEvent.getSearchType() == SearchRemoteOperation.SearchType.SHARED_FILTER) { Log_OC.d(this, "Switch to shared fragment"); SharedListFragment sharedListFragment = new SharedListFragment(); Bundle bundle = new Bundle(); diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java index e9dd7217f0..33a271976e 100644 --- a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java +++ b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java @@ -84,10 +84,13 @@ import com.owncloud.android.utils.MimeTypeUtil; import com.owncloud.android.utils.theme.CapabilityUtils; import com.owncloud.android.utils.theme.ThemeColorUtils; import com.owncloud.android.utils.theme.ThemeDrawableUtils; +import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView; import java.io.File; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; +import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Locale; @@ -104,7 +107,7 @@ import androidx.recyclerview.widget.RecyclerView; * This Adapter populates a RecyclerView with all files and folders in a Nextcloud instance. */ public class OCFileListAdapter extends RecyclerView.Adapter - implements DisplayUtils.AvatarGenerationListener { + implements DisplayUtils.AvatarGenerationListener, FastScrollRecyclerView.SectionedAdapter { private static final int showFilenameColumnThreshold = 4; private final ComponentsGetter transferServiceGetter; @@ -137,6 +140,9 @@ public class OCFileListAdapter extends RecyclerView.Adapter 0) { newPosition = position - 1; } + if (newPosition >= mFiles.size()) { + return null; + } + return mFiles.get(newPosition); } @@ -812,7 +828,12 @@ public class OCFileListAdapter extends RecyclerView.Adapter getCheckedItems() { @@ -1149,7 +1172,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter): List { return files } + + open fun getType(): SortType { + return when (name) { + sort_z_to_a_id, + sort_a_to_z_id -> SortType.ALPHABET + + sort_small_to_big_id, + sort_big_to_small_id -> SortType.SIZE + + sort_new_to_old_id, + sort_old_to_new_id -> SortType.DATE + + else -> SortType.ALPHABET + } + } } diff --git a/app/src/main/res/layout/list_fragment.xml b/app/src/main/res/layout/list_fragment.xml index 6a32d7e597..a45d7ddbc6 100644 --- a/app/src/main/res/layout/list_fragment.xml +++ b/app/src/main/res/layout/list_fragment.xml @@ -33,7 +33,12 @@ + android:layout_height="match_parent" + app:fastScrollPopupBgColor="@color/color_accent" + app:fastScrollPopupTextColor="@color/login_text_color" + app:fastScrollThumbColor="@color/color_accent" + app:fastScrollAutoHide="true" + app:fastScrollAutoHideDelay="1500" />