diff --git a/apps/teacher/src/androidTest/java/com/instructure/teacher/ui/pages/ModulesPage.kt b/apps/teacher/src/androidTest/java/com/instructure/teacher/ui/pages/ModulesPage.kt index 2c612a6799..5bf9682bad 100644 --- a/apps/teacher/src/androidTest/java/com/instructure/teacher/ui/pages/ModulesPage.kt +++ b/apps/teacher/src/androidTest/java/com/instructure/teacher/ui/pages/ModulesPage.kt @@ -40,8 +40,8 @@ class ModulesPage : BasePage() { } fun assertModuleNotPublished(moduleTitle: String) { - onView(withId(R.id.unpublishedIcon) + hasSibling(withId(R.id.moduleName) + withText(moduleTitle))).assertDisplayed() - onView(withId(R.id.publishedIcon) + hasSibling(withId(R.id.moduleName) + withText(moduleTitle))).assertNotDisplayed() + onView(withId(R.id.unpublishedIcon) + withParent(hasSibling(withId(R.id.moduleName) + withText(moduleTitle)))).assertDisplayed() + onView(withId(R.id.publishedIcon) + withParent(hasSibling(withId(R.id.moduleName) + withText(moduleTitle)))).assertNotDisplayed() } /** @@ -53,8 +53,8 @@ class ModulesPage : BasePage() { } fun assertModuleIsPublished(moduleTitle: String) { - onView(withId(R.id.unpublishedIcon) + hasSibling(withId(R.id.moduleName) + withText(moduleTitle))).assertNotDisplayed() - onView(withId(R.id.publishedIcon) + hasSibling(withId(R.id.moduleName) + withText(moduleTitle))).assertDisplayed() + onView(withId(R.id.unpublishedIcon) + withParent(hasSibling(withId(R.id.moduleName) + withText(moduleTitle)))).assertNotDisplayed() + onView(withId(R.id.publishedIcon) + withParent(hasSibling(withId(R.id.moduleName) + withText(moduleTitle)))).assertDisplayed() } /** @@ -142,7 +142,7 @@ class ModulesPage : BasePage() { } fun clickItemOverflow(itemName: String) { - onView(withParent(withChild(withText(itemName))) + withId(R.id.overflow)).scrollTo().click() + onView(withParent(withChild(withText(itemName))) + withId(R.id.publishActions)).scrollTo().click() } fun assertModuleMenuItems() { diff --git a/apps/teacher/src/main/java/com/instructure/teacher/features/modules/list/ui/binders/ModuleListItemBinder.kt b/apps/teacher/src/main/java/com/instructure/teacher/features/modules/list/ui/binders/ModuleListItemBinder.kt index c82d59cdec..754a9a8b8c 100644 --- a/apps/teacher/src/main/java/com/instructure/teacher/features/modules/list/ui/binders/ModuleListItemBinder.kt +++ b/apps/teacher/src/main/java/com/instructure/teacher/features/modules/list/ui/binders/ModuleListItemBinder.kt @@ -67,7 +67,7 @@ class ModuleListItemBinder : } moduleItemLoadingView.setVisible(item.isLoading) - overflow.onClickWithRequireNetwork { + publishActions.onClickWithRequireNetwork { if (item.type == ModuleItem.Type.File) { item.contentId?.let { callback.updateFileModuleItem( diff --git a/apps/teacher/src/main/java/com/instructure/teacher/features/modules/list/ui/binders/ModuleListModuleBinder.kt b/apps/teacher/src/main/java/com/instructure/teacher/features/modules/list/ui/binders/ModuleListModuleBinder.kt index bfbb353c73..b55752d97e 100644 --- a/apps/teacher/src/main/java/com/instructure/teacher/features/modules/list/ui/binders/ModuleListModuleBinder.kt +++ b/apps/teacher/src/main/java/com/instructure/teacher/features/modules/list/ui/binders/ModuleListModuleBinder.kt @@ -44,7 +44,7 @@ class ModuleListModuleBinder : ListItemBinder menu.add(0, 0, 0, R.string.unpublish) - false -> menu.add(0, 0, 0, R.string.publish) + false -> menu.add(0, 1, 1, R.string.publish) else -> { menu.add(0, 0, 0, R.string.unpublish) menu.add(0, 1, 1, R.string.publish) } } - overflow.contentDescription = it.context.getString(R.string.a11y_contentDescription_moduleOptions, item.title) + popup.setOnMenuItemClickListener { menuItem -> + when (menuItem.itemId) { + 0 -> { + callback.updateModuleItem(item.id, false) + true + } + + 1 -> { + callback.updateModuleItem(item.id, true) + true + } + + else -> false + } + } + + publishActions.contentDescription = it.context.getString(R.string.a11y_contentDescription_moduleOptions, item.title) popup.show() } } diff --git a/apps/teacher/src/main/res/layout/adapter_module.xml b/apps/teacher/src/main/res/layout/adapter_module.xml index 74c226b877..971fdaf629 100644 --- a/apps/teacher/src/main/res/layout/adapter_module.xml +++ b/apps/teacher/src/main/res/layout/adapter_module.xml @@ -57,46 +57,55 @@ android:textStyle="bold" tools:text="This is for week 1: Origin of the Earth and the Problem with Complexity and Diversity" /> - + - + - + - + + + + diff --git a/apps/teacher/src/main/res/layout/adapter_module_item.xml b/apps/teacher/src/main/res/layout/adapter_module_item.xml index 58589b3f0d..1ec6800135 100644 --- a/apps/teacher/src/main/res/layout/adapter_module_item.xml +++ b/apps/teacher/src/main/res/layout/adapter_module_item.xml @@ -58,7 +58,7 @@ android:textColor="@color/textDarkest" android:textSize="16sp" app:layout_constraintBottom_toTopOf="@+id/moduleItemSubtitle" - app:layout_constraintEnd_toStartOf="@+id/statusWrapper" + app:layout_constraintEnd_toStartOf="@+id/publishActions" app:layout_constraintStart_toEndOf="@id/moduleItemIcon" app:layout_constraintTop_toTopOf="parent" tools:text="General Questions & Answers" /> @@ -72,7 +72,7 @@ android:maxLines="1" android:textColor="@color/textDark" app:layout_constraintBottom_toTopOf="@+id/moduleItemSubtitle2" - app:layout_constraintEnd_toStartOf="@+id/statusWrapper" + app:layout_constraintEnd_toStartOf="@+id/publishActions" app:layout_constraintStart_toEndOf="@id/moduleItemIcon" app:layout_constraintTop_toBottomOf="@id/moduleItemTitle" tools:text="Due Apr 25 at 11:59pm" /> @@ -86,18 +86,23 @@ android:maxLines="1" android:textColor="@color/textDark" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toStartOf="@+id/statusWrapper" + app:layout_constraintEnd_toStartOf="@+id/publishActions" app:layout_constraintStart_toEndOf="@id/moduleItemIcon" app:layout_constraintTop_toBottomOf="@id/moduleItemSubtitle" tools:text="100 pts" /> - + - + diff --git a/apps/teacher/src/main/res/layout/adapter_module_sub_header.xml b/apps/teacher/src/main/res/layout/adapter_module_sub_header.xml index ab3f7db8a1..c862cae2c0 100644 --- a/apps/teacher/src/main/res/layout/adapter_module_sub_header.xml +++ b/apps/teacher/src/main/res/layout/adapter_module_sub_header.xml @@ -43,7 +43,7 @@ android:maxLines="1" android:textColor="@color/textDark" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toStartOf="@+id/statusWrapper" + app:layout_constraintEnd_toStartOf="@+id/publishActions" app:layout_constraintStart_toEndOf="@id/moduleItemIndent" app:layout_constraintTop_toTopOf="parent" tools:text="SubHeader title" /> @@ -53,10 +53,15 @@ - + - + \ No newline at end of file