diff --git a/app/src/main/java/org/oppia/android/app/customview/interaction/FractionInputInteractionView.kt b/app/src/main/java/org/oppia/android/app/customview/interaction/FractionInputInteractionView.kt index d8ea04584ed..6209a6c269e 100644 --- a/app/src/main/java/org/oppia/android/app/customview/interaction/FractionInputInteractionView.kt +++ b/app/src/main/java/org/oppia/android/app/customview/interaction/FractionInputInteractionView.kt @@ -16,7 +16,7 @@ import org.oppia.android.app.utility.KeyboardHelper.Companion.showSoftKeyboard // TODO(#249): These are the attributes which should be defined in XML, that are required for this interaction view to work correctly // digits="0123456789/-" // hint="Write fraction here." -// inputType="date" +// inputType="text" // background="@drawable/edit_text_background" // maxLength="200". diff --git a/app/src/main/res/layout-land/fraction_interaction_item.xml b/app/src/main/res/layout-land/fraction_interaction_item.xml index 5eeb801f244..b51ac1a5904 100644 --- a/app/src/main/res/layout-land/fraction_interaction_item.xml +++ b/app/src/main/res/layout-land/fraction_interaction_item.xml @@ -28,11 +28,10 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/edit_text_background" - android:digits="0123456789/- " android:fontFamily="sans-serif" android:hint="@{viewModel.hintText}" android:imeOptions="actionDone" - android:inputType="date" + android:inputType="text" android:longClickable="false" android:maxLength="200" android:minHeight="48dp" diff --git a/app/src/main/res/layout-sw600dp-land/fraction_interaction_item.xml b/app/src/main/res/layout-sw600dp-land/fraction_interaction_item.xml index 5eeb801f244..b51ac1a5904 100644 --- a/app/src/main/res/layout-sw600dp-land/fraction_interaction_item.xml +++ b/app/src/main/res/layout-sw600dp-land/fraction_interaction_item.xml @@ -28,11 +28,10 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/edit_text_background" - android:digits="0123456789/- " android:fontFamily="sans-serif" android:hint="@{viewModel.hintText}" android:imeOptions="actionDone" - android:inputType="date" + android:inputType="text" android:longClickable="false" android:maxLength="200" android:minHeight="48dp" diff --git a/app/src/main/res/layout-sw600dp-port/fraction_interaction_item.xml b/app/src/main/res/layout-sw600dp-port/fraction_interaction_item.xml index 5eeb801f244..b51ac1a5904 100644 --- a/app/src/main/res/layout-sw600dp-port/fraction_interaction_item.xml +++ b/app/src/main/res/layout-sw600dp-port/fraction_interaction_item.xml @@ -28,11 +28,10 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/edit_text_background" - android:digits="0123456789/- " android:fontFamily="sans-serif" android:hint="@{viewModel.hintText}" android:imeOptions="actionDone" - android:inputType="date" + android:inputType="text" android:longClickable="false" android:maxLength="200" android:minHeight="48dp" diff --git a/app/src/main/res/layout/fraction_interaction_item.xml b/app/src/main/res/layout/fraction_interaction_item.xml index 5eeb801f244..b51ac1a5904 100644 --- a/app/src/main/res/layout/fraction_interaction_item.xml +++ b/app/src/main/res/layout/fraction_interaction_item.xml @@ -28,11 +28,10 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/edit_text_background" - android:digits="0123456789/- " android:fontFamily="sans-serif" android:hint="@{viewModel.hintText}" android:imeOptions="actionDone" - android:inputType="date" + android:inputType="text" android:longClickable="false" android:maxLength="200" android:minHeight="48dp" diff --git a/app/src/main/res/layout/ratio_input_interaction_item.xml b/app/src/main/res/layout/ratio_input_interaction_item.xml index fd17d2a3cb5..8c44335adc2 100644 --- a/app/src/main/res/layout/ratio_input_interaction_item.xml +++ b/app/src/main/res/layout/ratio_input_interaction_item.xml @@ -28,11 +28,10 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/edit_text_background" - android:digits="0123456789: " android:fontFamily="sans-serif" android:hint="@{viewModel.hintText}" android:imeOptions="actionDone" - android:inputType="time" + android:inputType="text" android:longClickable="false" android:maxLength="200" android:minHeight="48dp" diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/state/StateFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/player/state/StateFragmentTest.kt index e80674b97a3..e6621151a44 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/player/state/StateFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/player/state/StateFragmentTest.kt @@ -2,6 +2,7 @@ package org.oppia.android.app.player.state import android.app.Application import android.content.Context +import android.text.InputType import android.text.Spannable import android.text.style.ClickableSpan import android.view.View @@ -38,6 +39,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import com.bumptech.glide.Glide import com.bumptech.glide.GlideBuilder import com.bumptech.glide.load.engine.executor.MockGlideExecutor +import com.google.common.truth.Truth.assertThat import dagger.BindsInstance import dagger.Component import dagger.Module @@ -1197,6 +1199,43 @@ class StateFragmentTest { } } + @Test + fun testStateFragment_fractionInput_textViewwHasTextInputType() { + launchForExploration(TEST_EXPLORATION_ID_2).use { scenario -> + startPlayingExploration() + + // Play to state 2 to access the fraction input interaction. + playThroughPrototypeState1() + + // Verify that fraction input uses the standard text software keyboard. + scenario.onActivity { activity -> + val textView: TextView = activity.findViewById(R.id.fraction_input_interaction_view) + assertThat(textView.inputType).isEqualTo(InputType.TYPE_CLASS_TEXT) + } + } + } + + @Test + fun testStateFragment_ratioInput_textViewHasTextInputType() { + launchForExploration(TEST_EXPLORATION_ID_2).use { scenario -> + startPlayingExploration() + playThroughPrototypeState1() + playThroughPrototypeState2() + playThroughPrototypeState3() + playThroughPrototypeState4() + playThroughPrototypeState5() + + // Play to state 7 to access the ratio input interaction. + playThroughPrototypeState6() + + // Verify that ratio input uses the standard text software keyboard. + scenario.onActivity { activity -> + val textView: TextView = activity.findViewById(R.id.ratio_input_interaction_view) + assertThat(textView.inputType).isEqualTo(InputType.TYPE_CLASS_TEXT) + } + } + } + private fun addShadowMediaPlayerException(dataSource: Any, exception: Exception) { val classLoader = StateFragmentTest::class.java.classLoader!! val shadowMediaPlayerClass = classLoader.loadClass("org.robolectric.shadows.ShadowMediaPlayer")