Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #4739 Talkback does not read the expected text #5152

Merged
merged 41 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d426901
talkbackissuefixed
Vishwajith-Shettigar Sep 15, 2023
c78554c
talkbackissuefixed
Vishwajith-Shettigar Sep 15, 2023
25fc0b9
talkbackissuefixed
Vishwajith-Shettigar Sep 16, 2023
964536a
talkbackissuefixedd
Vishwajith-Shettigar Sep 17, 2023
51231df
talkbackissuefixedd
Vishwajith-Shettigar Sep 17, 2023
d8cb87a
talkbackissuefixedd
Vishwajith-Shettigar Sep 17, 2023
9108e3b
talkbackissuefixedtest
Vishwajith-Shettigar Sep 17, 2023
43bf81e
talkbackisssuecommit8
Vishwajith-Shettigar Sep 19, 2023
3db71d1
talkbackisssuecommit9
Vishwajith-Shettigar Sep 20, 2023
83b5d03
Merge branch 'develop' into talkbackissue
Vishwajith-Shettigar Sep 20, 2023
42a6fd7
talkbackisssuecommit10
Vishwajith-Shettigar Sep 20, 2023
0d3b01b
talkbackisssuecommit10
Vishwajith-Shettigar Sep 20, 2023
34bef63
talkbackisssuecommit12
Vishwajith-Shettigar Sep 20, 2023
7495b1e
talkbackisssuecommit12
Vishwajith-Shettigar Sep 20, 2023
baa0f5a
Merge branch 'oppia:develop' into talkbackissue
Vishwajith-Shettigar Sep 24, 2023
ce69fe8
fixed talkback directly focusing edittext
Vishwajith-Shettigar Sep 28, 2023
ebcbbba
Merge branch 'oppia:develop' into talkbackissue
Vishwajith-Shettigar Sep 28, 2023
6bc8004
fixed talkback directly focusing edittext
Vishwajith-Shettigar Sep 29, 2023
8ad29a3
fixed talkback directly focusing edittext
Vishwajith-Shettigar Sep 29, 2023
8107759
fixed talkback directly focusing edittext
Vishwajith-Shettigar Sep 29, 2023
a44f146
Merge branch 'talkbackissue' of https://github.com/Vishwajith-Shettig…
Vishwajith-Shettigar Sep 29, 2023
2ac91ea
fixed talkback directly focusing edittext
Vishwajith-Shettigar Sep 29, 2023
d4db9e3
fixed talkback directly focusing edittext
Vishwajith-Shettigar Sep 29, 2023
deb0615
fixed talkback directly focusing edittext
Vishwajith-Shettigar Sep 29, 2023
294c2b5
fixed talkback directly focusing edittext
Vishwajith-Shettigar Sep 29, 2023
2f3992b
Merge branch 'develop' into talkbackissue
Vishwajith-Shettigar Oct 13, 2023
6322214
Merge branch 'oppia:develop' into talkbackissue
Vishwajith-Shettigar Oct 14, 2023
267e53b
fixing talkback issue
Vishwajith-Shettigar Oct 16, 2023
8ff3f42
fixing talkback issue
Vishwajith-Shettigar Oct 16, 2023
a03d7cf
talkback issue fix
Vishwajith-Shettigar Oct 17, 2023
211cf28
talkback issue fix
Vishwajith-Shettigar Oct 17, 2023
78e5b5a
fixed talkback issue
Vishwajith-Shettigar Oct 18, 2023
4932ee5
fixed talkback issue
Vishwajith-Shettigar Oct 18, 2023
48e4801
added tests
Vishwajith-Shettigar Oct 18, 2023
96359b0
added tests
Vishwajith-Shettigar Oct 18, 2023
02e03f2
added comment
Vishwajith-Shettigar Oct 18, 2023
e0a971a
added comment
Vishwajith-Shettigar Oct 18, 2023
01457ba
Merge branch 'develop' into talkbackissue
Vishwajith-Shettigar Oct 19, 2023
0f7961a
Merge branch 'develop' into talkbackissue
Vishwajith-Shettigar Oct 19, 2023
c0242aa
fixed talkback issue
Vishwajith-Shettigar Oct 19, 2023
f9e96f2
fixed talkback issue
Vishwajith-Shettigar Oct 19, 2023
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 @@ -15,6 +15,7 @@ import org.oppia.android.app.utility.lifecycle.LifecycleSafeTimerFactory
import org.oppia.android.app.viewmodel.ViewModelProvider
import org.oppia.android.databinding.PinPasswordActivityBinding
import org.oppia.android.domain.profile.ProfileManagementController
import org.oppia.android.util.accessibility.AccessibilityService
import org.oppia.android.util.data.AsyncResult
import org.oppia.android.util.data.DataProviders.Companion.toLiveData
import javax.inject.Inject
Expand All @@ -31,6 +32,7 @@ class PinPasswordActivityPresenter @Inject constructor(
private val viewModelProvider: ViewModelProvider<PinPasswordViewModel>,
private val resourceHandler: AppLanguageResourceHandler
) {
@Inject lateinit var accessibilityService: AccessibilityService
private val pinViewModel by lazy {
getPinPasswordViewModel()
}
Expand Down Expand Up @@ -69,7 +71,13 @@ class PinPasswordActivityPresenter @Inject constructor(
)
}
}
binding.pinPasswordInputPinEditText.requestFocus()

// If the screen reader is off, the EditText will receive focus.
// If the screen reader is on, the EditText won't receive focus.
// This is needed because requesting focus on the EditText when the screen reader is on gives TalkBack priority over other views in the screen, ignoring view hierachy.
if (!accessibilityService.isScreenReaderEnabled())
binding.pinPasswordInputPinEditText.requestFocus()

// [onTextChanged] is a extension function defined at [TextInputEditTextHelper]
binding.pinPasswordInputPinEditText.onTextChanged { pin ->
pin?.let { inputtedPin ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ import org.oppia.android.testing.threading.TestCoroutineDispatchers
import org.oppia.android.testing.threading.TestDispatcherModule
import org.oppia.android.testing.time.FakeOppiaClockModule
import org.oppia.android.util.accessibility.AccessibilityTestModule
import org.oppia.android.util.accessibility.FakeAccessibilityService
import org.oppia.android.util.caching.AssetModule
import org.oppia.android.util.caching.testing.CachingTestModule
import org.oppia.android.util.gcsresource.GcsResourceModule
Expand Down Expand Up @@ -147,6 +148,9 @@ class PinPasswordActivityTest {
@Inject
lateinit var editTextInputAction: EditTextInputAction

@Inject
lateinit var fakeAccessibilityService: FakeAccessibilityService

private val adminPin = "12345"
private val adminId = 0
private val userId = 1
Expand Down Expand Up @@ -181,7 +185,8 @@ class PinPasswordActivityTest {
}

@Test
fun testPinPassword_withAdmin_keyboardIsVisibleByDefault() {
fun testPinPassword_withAdmin_screenReaderOff_keyboardIsVisible() {
fakeAccessibilityService.setScreenReaderEnabled(false)
ActivityScenario.launch<PinPasswordActivity>(
PinPasswordActivity.createPinPasswordActivityIntent(
context = context,
Expand All @@ -193,6 +198,20 @@ class PinPasswordActivityTest {
}
}

@Test
fun testPinPassword_withAdmin_screenReaderOn_keyboardIsNotVisible() {
fakeAccessibilityService.setScreenReaderEnabled(true)
ActivityScenario.launch<PinPasswordActivity>(
PinPasswordActivity.createPinPasswordActivityIntent(
context = context,
adminPin = adminPin,
profileId = adminId
)
).use {
onView(withId(R.id.pin_password_input_pin_edit_text)).check(matches(not(hasFocus())))
}
}

@Test
fun testPinPassword_withAdmin_inputCorrectPin_opensHomeActivity() {
ActivityScenario.launch<PinPasswordActivity>(
Expand Down
Loading