From 77e32c2790731dc41ef109fe44f9b4b884e09154 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 7 Feb 2017 00:14:51 +0100 Subject: [PATCH] speed up checking if directories or images changed --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 5 +++-- .../simplemobiletools/gallery/activities/MediaActivity.kt | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 67643f652..4f0bae074 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -297,9 +297,10 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { fun gotDirectories(dirs: ArrayList) { directories_holder.isRefreshing = false mIsGettingDirs = false - if (dirs == mDirs) { + + if (dirs.hashCode() == mDirs.hashCode()) return - } + mDirs = dirs setupAdapter() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 75ea96574..ef3d285e6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -285,9 +285,9 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { fun gotMedia(media: ArrayList) { mIsGettingMedia = false media_holder.isRefreshing = false - if (media == mMedia) { + + if (media.hashCode() == mMedia.hashCode()) return - } mMedia = media initializeGallery()