Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import android.view.MenuItem
import android.view.View
import androidx.annotation.PluralsRes
import androidx.annotation.RequiresApi
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -75,7 +76,9 @@ import java.io.IOException
import java.util.concurrent.locks.ReentrantLock

@SuppressLint("NotifyDataSetChanged")
class ProjectListFragment : RecyclerViewFragment<ProjectData?>(), ProjectLoadListener {
class ProjectListFragment(
private val mainDispatcher: CoroutineDispatcher = Dispatchers.Main
) : RecyclerViewFragment<ProjectData?>(), ProjectLoadListener {
private var items: MutableList<ProjectData> = ArrayList()

private var filesForUnzipAndImportTask: ArrayList<File>? = null
Expand All @@ -95,7 +98,9 @@ class ProjectListFragment : RecyclerViewFragment<ProjectData?>(), ProjectLoadLis
importProject(requireArguments().getParcelable("intent"))
}
if (requireActivity().intent?.hasExtra(ProjectListActivity.IMPORT_LOCAL_INTENT) == true) {
adapter.showSettings = false
if (adapter != null) {
adapter.showSettings = false
}
actionModeType = IMPORT_LOCAL
}
}
Expand Down Expand Up @@ -559,7 +564,7 @@ class ProjectListFragment : RecyclerViewFragment<ProjectData?>(), ProjectLoadLis
items = newItems
lock.unlock()

withContext(Dispatchers.Main) {
withContext(mainDispatcher) {
callback.onProjectsLoaded()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ class SpriteListFragment : RecyclerViewFragment<Sprite?>() {
}
if (item !is GroupSprite) {
popupMenu.menu.findItem(R.id.backpack).setTitle(R.string.pack)
popupMenu.menu.removeItem(R.id.from_local)
}
popupMenu.show()
}
Expand Down