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 5d717873b..1430d9166 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -10,7 +10,6 @@ import android.os.Bundle import android.provider.MediaStore import android.support.design.widget.Snackbar import android.support.v4.app.ActivityCompat -import android.support.v4.widget.SwipeRefreshLayout import android.view.Menu import android.view.MenuItem import android.view.MotionEvent @@ -27,7 +26,7 @@ import kotlinx.android.synthetic.main.activity_main.* import java.io.File import java.util.* -class MainActivity : SimpleActivity(), SwipeRefreshLayout.OnRefreshListener, GetDirectoriesAsynctask.GetDirectoriesListener, View.OnTouchListener, DirectoryAdapter.DirOperationsListener { +class MainActivity : SimpleActivity(), GetDirectoriesAsynctask.GetDirectoriesListener, View.OnTouchListener, DirectoryAdapter.DirOperationsListener { companion object { private val STORAGE_PERMISSION = 1 private val PICK_MEDIA = 2 @@ -62,7 +61,7 @@ class MainActivity : SimpleActivity(), SwipeRefreshLayout.OnRefreshListener, Get mIsGetAnyContentIntent || mIsSetWallpaperIntent mToBeDeleted = ArrayList() - directories_holder.setOnRefreshListener(this) + directories_holder.setOnRefreshListener({ getDirectories() }) mDirs = ArrayList() } @@ -287,12 +286,8 @@ class MainActivity : SimpleActivity(), SwipeRefreshLayout.OnRefreshListener, Get } } - override fun onRefresh() { - getDirectories() - directories_holder.isRefreshing = false - } - override fun gotDirectories(dirs: ArrayList) { + directories_holder.isRefreshing = false mIsGettingDirs = false if (dirs.toString() == mDirs.toString()) { return 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 6848d88bb..f7c0aa43a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -10,7 +10,6 @@ import android.net.Uri import android.os.Bundle import android.provider.MediaStore import android.support.design.widget.Snackbar -import android.support.v4.widget.SwipeRefreshLayout import android.util.Log import android.view.Menu import android.view.MenuItem @@ -32,7 +31,7 @@ import java.io.IOException import java.util.* import java.util.regex.Pattern -class MediaActivity : SimpleActivity(), View.OnTouchListener, SwipeRefreshLayout.OnRefreshListener, MediaAdapter.MediaOperationsListener { +class MediaActivity : SimpleActivity(), View.OnTouchListener, MediaAdapter.MediaOperationsListener { companion object { private val TAG = MediaActivity::class.java.simpleName @@ -57,7 +56,7 @@ class MediaActivity : SimpleActivity(), View.OnTouchListener, SwipeRefreshLayout mIsGetAnyIntent = getBooleanExtra(Constants.GET_ANY_INTENT, false) } - media_holder.setOnRefreshListener(this) + media_holder.setOnRefreshListener({ refreshDir() }) mPath = intent.getStringExtra(Constants.DIRECTORY) mToBeDeleted = ArrayList() mMedia = ArrayList() @@ -363,10 +362,6 @@ class MediaActivity : SimpleActivity(), View.OnTouchListener, SwipeRefreshLayout refreshDir() } - override fun onRefresh() { - refreshDir() - } - private fun refreshDir() { val dir = File(mPath) if (dir.isDirectory) {