Skip to content

Commit 8a5cd27

Browse files
committed
IDE-289 Fix import actor from local project
1 parent 6dc83b6 commit 8a5cd27

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/fragment/ProjectListFragment.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import android.view.MenuItem
3838
import android.view.View
3939
import androidx.annotation.PluralsRes
4040
import androidx.annotation.RequiresApi
41+
import kotlinx.coroutines.CoroutineDispatcher
4142
import kotlinx.coroutines.CoroutineScope
4243
import kotlinx.coroutines.Dispatchers
4344
import kotlinx.coroutines.launch
@@ -75,7 +76,9 @@ import java.io.IOException
7576
import java.util.concurrent.locks.ReentrantLock
7677

7778
@SuppressLint("NotifyDataSetChanged")
78-
class ProjectListFragment : RecyclerViewFragment<ProjectData?>(), ProjectLoadListener {
79+
class ProjectListFragment(
80+
private val mainDispatcher: CoroutineDispatcher = Dispatchers.Main
81+
) : RecyclerViewFragment<ProjectData?>(), ProjectLoadListener {
7982
private var items: MutableList<ProjectData> = ArrayList()
8083

8184
private var filesForUnzipAndImportTask: ArrayList<File>? = null
@@ -95,7 +98,9 @@ class ProjectListFragment : RecyclerViewFragment<ProjectData?>(), ProjectLoadLis
9598
importProject(requireArguments().getParcelable("intent"))
9699
}
97100
if (requireActivity().intent?.hasExtra(ProjectListActivity.IMPORT_LOCAL_INTENT) == true) {
98-
adapter.showSettings = false
101+
if (adapter != null) {
102+
adapter.showSettings = false
103+
}
99104
actionModeType = IMPORT_LOCAL
100105
}
101106
}
@@ -559,7 +564,7 @@ class ProjectListFragment : RecyclerViewFragment<ProjectData?>(), ProjectLoadLis
559564
items = newItems
560565
lock.unlock()
561566

562-
withContext(Dispatchers.Main) {
567+
withContext(mainDispatcher) {
563568
callback.onProjectsLoaded()
564569
}
565570
}

catroid/src/main/java/org/catrobat/catroid/ui/recyclerview/fragment/SpriteListFragment.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,6 @@ class SpriteListFragment : RecyclerViewFragment<Sprite?>() {
375375
}
376376
if (item !is GroupSprite) {
377377
popupMenu.menu.findItem(R.id.backpack).setTitle(R.string.pack)
378-
popupMenu.menu.removeItem(R.id.from_local)
379378
}
380379
popupMenu.show()
381380
}

0 commit comments

Comments
 (0)