Skip to content

Commit

Permalink
Fix oppia#572: Keyboard visible by default in Admin Pin (oppia#573)
Browse files Browse the repository at this point in the history
* By default keyboard visibility issue in Admin Pin is resolved

* Created a test case to check about Keyboard visibility by default in Admin Pin.

* Test is modified with the suggested changes
  • Loading branch information
Luffy18346 authored and PrarabdhGarg committed Feb 12, 2020
1 parent 043184f commit 52e1eb4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<activity
android:name=".profile.PinPasswordActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".profile.ProfileActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class PinPasswordActivityPresenter @Inject constructor(
pinViewModel.showPassword.set(!pinViewModel.showPassword.get()!!)
}

binding.inputPin.requestFocus()
binding.inputPin.addTextChangedListener(object: TextWatcher {
var wrong = false
override fun onTextChanged(pin: CharSequence?, start: Int, before: Int, count: Int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.intent.Intents
import androidx.test.espresso.intent.Intents.intended
import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent
import androidx.test.espresso.matcher.ViewMatchers.hasFocus
import androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
Expand Down Expand Up @@ -77,6 +78,13 @@ class PinPasswordActivityTest {
.inject(this)
}

@Test
fun testPinPasswordActivityWithAdmin_checkKeyboardIsVisibleByDefault() {
ActivityScenario.launch<PinPasswordActivity>(PinPasswordActivity.createPinPasswordActivityIntent(context, adminPin, adminId)).use {
onView(withId(R.id.input_pin)).check(matches(hasFocus()))
}
}

@Test
fun testPinPasswordActivityWithAdmin_inputCorrectPin_checkOpensHomeActivity() {
ActivityScenario.launch<PinPasswordActivity>(PinPasswordActivity.createPinPasswordActivityIntent(context, adminPin, adminId)).use {
Expand Down

0 comments on commit 52e1eb4

Please sign in to comment.