Skip to content

Commit

Permalink
fixed accessibility and scroll issue (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-alfresco authored Apr 11, 2023
1 parent 4af4db8 commit d3a706d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import com.alfresco.content.data.AnalyticsManager
import com.alfresco.content.data.Entry
import com.alfresco.content.mimetype.MimeType
import com.alfresco.ui.BottomSheetDialogFragment
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog

class ContextualActionsSheet : BottomSheetDialogFragment(), MavericksView {
private val viewModel: ContextualActionsViewModel by fragmentViewModel()
Expand All @@ -29,6 +31,21 @@ class ContextualActionsSheet : BottomSheetDialogFragment(), MavericksView {
return binding.root
}

override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
dialog?.window?.decorView?.importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO
view?.viewTreeObserver?.addOnGlobalLayoutListener {
val bottomSheet =
(dialog as BottomSheetDialog).findViewById<View>(com.google.android.material.R.id.design_bottom_sheet)
bottomSheet?.let {
BottomSheetBehavior.from<View>(it).apply {
val peekAmount = 1.0
peekHeight = ((it.parent as View).height * peekAmount).toInt()
}
}
}
}

override fun invalidate() = withState(viewModel) { state ->
val type = when (state.entry.type) {
Entry.Type.SITE -> MimeType.LIBRARY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import com.airbnb.mvrx.withState
import com.alfresco.content.actions.databinding.SheetActionListBinding
import com.alfresco.content.data.Entry
import com.alfresco.ui.BottomSheetDialogFragment
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog

/**
* Marked as ProcessDefinitionsSheet
Expand All @@ -31,6 +33,22 @@ class ProcessDefinitionsSheet : BottomSheetDialogFragment(), MavericksView {
return binding.root
}

override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
dialog?.window?.setTitle(" ")
dialog?.window?.decorView?.importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO
view?.viewTreeObserver?.addOnGlobalLayoutListener {
val bottomSheet =
(dialog as BottomSheetDialog).findViewById<View>(com.google.android.material.R.id.design_bottom_sheet)
bottomSheet?.let {
BottomSheetBehavior.from<View>(it).apply {
val peekAmount = 1.0
peekHeight = ((it.parent as View).height * peekAmount).toInt()
}
}
}
}

override fun invalidate() = withState(viewModel) { state ->
binding.header.apply {
parentTitle.contentDescription = getString(R.string.title_select_workflow)
Expand Down

0 comments on commit d3a706d

Please sign in to comment.