From 463c0ed719486ad5c4fd6b268ef33c18f73e24a5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 7 Mar 2021 22:59:57 +0100 Subject: [PATCH] add animations to listviews --- .../gallery/pro/activities/MainActivity.kt | 4 ++++ .../gallery/pro/activities/MediaActivity.kt | 6 ++++++ app/src/main/res/layout/activity_main.xml | 1 + app/src/main/res/layout/activity_media.xml | 1 + 4 files changed, 12 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index b8b6e0266..a04df1ac7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -1206,6 +1206,10 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { runOnUiThread { directories_grid.adapter = this setupScrollDirection() + + if (config.viewTypeFolders == VIEW_TYPE_LIST) { + directories_grid.scheduleLayoutAnimation() + } } } measureRecyclerViewContent(dirsToShow) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt index c13654404..a49dd6bbf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt @@ -420,6 +420,12 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { setupZoomListener(mZoomListener) media_grid.adapter = this } + + val viewType = config.getFolderViewType(if (mShowAll) SHOW_ALL else mPath) + if (viewType == VIEW_TYPE_LIST) { + media_grid.scheduleLayoutAnimation() + } + setupLayoutManager() handleGridSpacing() measureRecyclerViewContent(mMedia) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 3756cbb82..905823c41 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -52,6 +52,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/directories_switch_searching" + android:layoutAnimation="@anim/layout_animation" android:scrollbars="none" app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager" app:spanCount="@integer/directory_columns_vertical_scroll" /> diff --git a/app/src/main/res/layout/activity_media.xml b/app/src/main/res/layout/activity_media.xml index c157f234b..c17033620 100644 --- a/app/src/main/res/layout/activity_media.xml +++ b/app/src/main/res/layout/activity_media.xml @@ -40,6 +40,7 @@ android:id="@+id/media_grid" android:layout_width="match_parent" android:layout_height="match_parent" + android:layoutAnimation="@anim/layout_animation" android:scrollbars="none" app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager" app:spanCount="@integer/media_columns_vertical_scroll" />