Skip to content

Commit 091b45a

Browse files
authored
Fix #4495, part of #3088, #4467, #4505, #4266, #4446: Miscellaneous alpha MR5 fixes (#4506)
## Explanation Fixes #4495 Fixes part of #3088 Fixes #4467 Fixes #4505 Fixes #4266 Fixes #4446 This PR fixes a number of key blockers for the upcoming Alpha MR5 release of the app. In particular: - It fixes #4266 by reformatting one XML file that Rajat left a comment for during his post-merge reviews of Alpha MR4 PRs. - It mitigates #4495 by introducing a banner for when correct audio can't be played (I did run into an actual bug where the wrong audio played once, but I couldn't repro it--most of the time the app will stop autoplaying if it can't find the correct language). This also fixes part of #3088 since the mitigation will help make that situation better. - It addresses #4467 by logging stringified versions of all supported answer types upon answer submission (rather than just whether the answer is correct). - It addresses #4446 by (1) introducing a new default hint text for text input, and (2) by ensuring hint text is fully readable by wrapping it when it extends to more than one line. However, another issue was discovered which would be really nice to fix (but is not feasible given the amount of time available for this PR). #4509 is tracking this future work. - It addresses #4505 by disabling profile name verification when the learner study is enabled (as a stop-gap). Note that there are no new tests being added in this PR since the fixes are mostly trivial and have been manually verified during development. #4510 is tracking adding automated tests for long-term app health. Furthermore, AudioViewModel was allow-listed to reference Locale directly so that it can it include a localized language name in the fail-to-play audio notice. #3791 will fix this in the long-term. This PR also includes version code & minor version bumps to prepare for the upcoming release. It also fixes the Kenya-specific alpha build flavor (which was unfortunately checked in as broken in #4507), and adds it to CI since the assumption in #4507 that it doesn't need to be covered is incorrect. The Gradle workaround for the new flavor was removed since it was a legitimate failure that wasn't being picked up by Bazel builds in CI. ## Essential Checklist - [x] The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".) - [x] Any changes to [scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets) files have their rationale included in the PR explanation. - [x] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)). ## For UI-specific PRs only Creating profile names with normally forbidden characters (in this case, numbers): https://user-images.githubusercontent.com/12983742/185594638-3bd653a4-916a-4471-963a-d00ab987f378.mp4 Demonstrating when English audio is sometimes unavailable & the new notice to make this clearer: https://user-images.githubusercontent.com/12983742/185594719-896e428c-96b8-42f3-b53f-721352a90f14.mp4 Audio not being available can occur in all languages, not just English: ![audio_unavailable](https://user-images.githubusercontent.com/12983742/185594834-6f6127db-e54b-4a23-a734-7b3a6b849184.png) Text input hints can now be multi-line to ensure that they're not cut off: ![oppia_multiline_text_input_hint](https://user-images.githubusercontent.com/12983742/185594908-4b4a07f3-cff7-44f7-a2c9-8dfb7a8ca784.png) Commits: * Address #4274 (comment). This is part of addressing #4266. * Add audio notice for when language is missing. * Disable invalid profile name rules for studies. * Add analytics logging for submitted answers. * Code health fixes. * Add hint wrapping, and default text input hint. * Fix broken tests. * Test fixes. * Fix broken Kenya-specific alpha build. Also, bump version codes & minor versions in preparation for the release.
1 parent 6bab482 commit 091b45a

File tree

28 files changed

+402
-130
lines changed

28 files changed

+402
-130
lines changed

.github/workflows/build_tests.yml

+19
Original file line numberDiff line numberDiff line change
@@ -443,10 +443,24 @@ jobs:
443443
run: |
444444
bazel build --compilation_mode=opt -- //:oppia_alpha_kitkat
445445
446+
# Note that caching only works on non-forks.
447+
- name: Build Oppia alpha Kenya-specific AAB (with caching, non-fork only)
448+
if: ${{ env.ENABLE_CACHING == 'true' && github.event.pull_request.head.repo.full_name == 'oppia/oppia-android' }}
449+
env:
450+
BAZEL_REMOTE_CACHE_URL: ${{ secrets.BAZEL_REMOTE_CACHE_URL }}
451+
run: |
452+
bazel build --compilation_mode=opt --remote_http_cache=$BAZEL_REMOTE_CACHE_URL --google_credentials=./config/oppia-dev-workflow-remote-cache-credentials.json -- //:oppia_alpha_kenya
453+
454+
- name: Build Oppia alpha Kenya-specific AAB (without caching, or on a fork)
455+
if: ${{ env.ENABLE_CACHING == 'false' || github.event.pull_request.head.repo.full_name != 'oppia/oppia-android' }}
456+
run: |
457+
bazel build --compilation_mode=opt -- //:oppia_alpha_kenya
458+
446459
- name: Copy Oppia alpha AABs for uploading
447460
run: |
448461
cp $GITHUB_WORKSPACE/bazel-bin/oppia_alpha.aab /home/runner/work/oppia-android/oppia-android/
449462
cp $GITHUB_WORKSPACE/bazel-bin/oppia_alpha_kitkat.aab /home/runner/work/oppia-android/oppia-android/
463+
cp $GITHUB_WORKSPACE/bazel-bin/oppia_alpha_kenya.aab /home/runner/work/oppia-android/oppia-android/
450464
451465
- uses: actions/upload-artifact@v2
452466
with:
@@ -457,3 +471,8 @@ jobs:
457471
with:
458472
name: oppia_alpha_kitkat.aab
459473
path: /home/runner/work/oppia-android/oppia-android/oppia_alpha_kitkat.aab
474+
475+
- uses: actions/upload-artifact@v2
476+
with:
477+
name: oppia_alpha_kenya.aab
478+
path: /home/runner/work/oppia-android/oppia-android/oppia_alpha_kenya.aab

app/BUILD.bazel

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,15 @@ VIEW_MODELS_WITH_RESOURCE_IMPORTS = [
211211
"src/main/java/org/oppia/android/app/parser/FractionParsingUiError.kt",
212212
"src/main/java/org/oppia/android/app/parser/StringToNumberParser.kt",
213213
"src/main/java/org/oppia/android/app/parser/StringToRatioParser.kt",
214+
"src/main/java/org/oppia/android/app/player/audio/AudioViewModel.kt",
214215
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/DragDropInteractionContentViewModel.kt",
215216
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/FractionInteractionViewModel.kt",
216217
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/ImageRegionSelectionInteractionViewModel.kt",
217218
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/MathExpressionInteractionsViewModel.kt",
218219
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/PreviousResponsesHeaderViewModel.kt",
219220
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/RatioExpressionInputInteractionViewModel.kt",
220221
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/SubmittedAnswerViewModel.kt",
222+
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/TextInputViewModel.kt",
221223
"src/main/java/org/oppia/android/app/profile/AddProfileViewModel.kt",
222224
"src/main/java/org/oppia/android/app/profile/PinPasswordViewModel.kt",
223225
"src/main/java/org/oppia/android/app/profile/ResetPinViewModel.kt",
@@ -296,7 +298,6 @@ VIEW_MODELS = [
296298
"src/main/java/org/oppia/android/app/options/OptionsItemViewModel.kt",
297299
"src/main/java/org/oppia/android/app/options/OptionsReadingTextSizeViewModel.kt",
298300
"src/main/java/org/oppia/android/app/options/ReadingTextSizeSelectionViewModel.kt",
299-
"src/main/java/org/oppia/android/app/player/audio/AudioViewModel.kt",
300301
"src/main/java/org/oppia/android/app/player/exploration/ExplorationViewModel.kt",
301302
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/ContentViewModel.kt",
302303
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/ContinueInteractionViewModel.kt",
@@ -312,7 +313,6 @@ VIEW_MODELS = [
312313
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/SelectionInteractionViewModel.kt",
313314
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/StateItemViewModel.kt",
314315
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/SubmitButtonViewModel.kt",
315-
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/TextInputViewModel.kt",
316316
"src/main/java/org/oppia/android/app/player/state/StateViewModel.kt",
317317
"src/main/java/org/oppia/android/app/player/state/testing/StateFragmentTestViewModel.kt",
318318
"src/main/java/org/oppia/android/app/profile/AdminAuthViewModel.kt",

app/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ def filesToExclude = [
9898
'**/*AppLanguageLocaleHandlerTest*.kt',
9999
'**/*AppLanguageResourceHandlerTest*.kt',
100100
'**/*AppLanguageWatcherMixinTest*.kt',
101-
'**/alphakenya/*.kt',
102101
]
103102
_excludeSourceFiles(filesToExclude)
104103

app/src/main/java/org/oppia/android/app/application/alphakenya/AlphaKenyaApplicationComponent.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ import javax.inject.Singleton
8989
LoggingIdentifierModule::class, ApplicationLifecycleModule::class,
9090
NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class,
9191
SyncStatusModule::class, LogReportingModule::class, NetworkConnectionUtilProdModule::class,
92-
HintsAndSolutionProdModule::class, AlphaKenyaBuildFlavorModule::class
92+
HintsAndSolutionProdModule::class
9393
]
9494
)
9595
interface AlphaKenyaApplicationComponent : ApplicationComponent {

app/src/main/java/org/oppia/android/app/application/alphakenya/AlphaKenyaBuildFlavorModule.kt

-14
This file was deleted.

app/src/main/java/org/oppia/android/app/application/alphakenya/BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ kt_android_library(
1010
name = "alpha_kenya_application",
1111
srcs = [
1212
"AlphaKenyaApplicationComponent.kt",
13-
"AlphaKenyaBuildFlavorModule.kt",
1413
"AlphaKenyaOppiaApplication.kt",
1514
],
1615
visibility = ["//:oppia_binary_visibility"],

app/src/main/java/org/oppia/android/app/customview/interaction/FractionInputInteractionView.kt

+20-6
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,25 @@ class FractionInputInteractionView @JvmOverloads constructor(
3333

3434
init {
3535
onFocusChangeListener = this
36+
// Assume multi-line for the purpose of properly showing long hints.
37+
setSingleLine(hint != null)
3638
hintText = (hint ?: "")
3739
stateKeyboardButtonListener = context as StateKeyboardButtonListener
3840
}
3941

4042
override fun onFocusChange(v: View, hasFocus: Boolean) = if (hasFocus) {
41-
hint = ""
42-
typeface = Typeface.DEFAULT
43+
hideHint()
4344
showSoftKeyboard(v, context)
4445
} else {
45-
hint = hintText
46-
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
46+
restoreHint()
4747
hideSoftKeyboard(v, context)
4848
}
4949

5050
override fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean {
51-
if (event.keyCode == KEYCODE_BACK && event.action == ACTION_UP)
52-
this.clearFocus()
51+
if (event.keyCode == KEYCODE_BACK && event.action == ACTION_UP) {
52+
clearFocus()
53+
restoreHint()
54+
}
5355
return super.onKeyPreIme(keyCode, event)
5456
}
5557

@@ -59,4 +61,16 @@ class FractionInputInteractionView @JvmOverloads constructor(
5961
}
6062
super.onEditorAction(actionCode)
6163
}
64+
65+
private fun hideHint() {
66+
hint = ""
67+
typeface = Typeface.DEFAULT
68+
setSingleLine(true)
69+
}
70+
71+
private fun restoreHint() {
72+
hint = hintText
73+
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
74+
setSingleLine(false)
75+
}
6276
}

app/src/main/java/org/oppia/android/app/customview/interaction/MathExpressionInteractionsView.kt

+17-4
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,24 @@ class MathExpressionInteractionsView @JvmOverloads constructor(
3434

3535
init {
3636
onFocusChangeListener = this
37+
// Assume multi-line for the purpose of properly showing long hints.
38+
setSingleLine(hint != null)
3739
hintText = (hint ?: "")
3840
stateKeyboardButtonListener = context as StateKeyboardButtonListener
3941
}
4042

4143
override fun onFocusChange(v: View, hasFocus: Boolean) = if (hasFocus) {
42-
hint = ""
43-
typeface = Typeface.DEFAULT
44+
hideHint()
4445
showSoftKeyboard(v, context)
4546
} else {
46-
hint = hintText
47-
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
47+
restoreHint()
4848
hideSoftKeyboard(v, context)
4949
}
5050

5151
override fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean {
5252
if (event.keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP) {
5353
clearFocus()
54+
restoreHint()
5455
}
5556
return super.onKeyPreIme(keyCode, event)
5657
}
@@ -73,4 +74,16 @@ class MathExpressionInteractionsView @JvmOverloads constructor(
7374
hint = placeholderText
7475
}
7576
}
77+
78+
private fun hideHint() {
79+
hint = ""
80+
typeface = Typeface.DEFAULT
81+
setSingleLine(true)
82+
}
83+
84+
private fun restoreHint() {
85+
hint = hintText
86+
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
87+
setSingleLine(false)
88+
}
7689
}

app/src/main/java/org/oppia/android/app/customview/interaction/NumericInputInteractionView.kt

+20-6
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,25 @@ class NumericInputInteractionView @JvmOverloads constructor(
3131

3232
init {
3333
onFocusChangeListener = this
34+
// Assume multi-line for the purpose of properly showing long hints.
35+
setSingleLine(hint != null)
3436
hintText = (hint ?: "")
3537
stateKeyboardButtonListener = context as StateKeyboardButtonListener
3638
}
3739

3840
override fun onFocusChange(v: View, hasFocus: Boolean) = if (hasFocus) {
39-
hint = ""
40-
typeface = Typeface.DEFAULT
41+
hideHint()
4142
showSoftKeyboard(v, context)
4243
} else {
43-
hint = hintText
44-
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
44+
restoreHint()
4545
hideSoftKeyboard(v, context)
4646
}
4747

4848
override fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean {
49-
if (event.keyCode == KEYCODE_BACK && event.action == ACTION_UP)
50-
this.clearFocus()
49+
if (event.keyCode == KEYCODE_BACK && event.action == ACTION_UP) {
50+
clearFocus()
51+
restoreHint()
52+
}
5153
return super.onKeyPreIme(keyCode, event)
5254
}
5355

@@ -57,4 +59,16 @@ class NumericInputInteractionView @JvmOverloads constructor(
5759
}
5860
super.onEditorAction(actionCode)
5961
}
62+
63+
private fun hideHint() {
64+
hint = ""
65+
typeface = Typeface.DEFAULT
66+
setSingleLine(true)
67+
}
68+
69+
private fun restoreHint() {
70+
hint = hintText
71+
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
72+
setSingleLine(false)
73+
}
6074
}

app/src/main/java/org/oppia/android/app/customview/interaction/RatioInputInteractionView.kt

+20-6
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,25 @@ class RatioInputInteractionView @JvmOverloads constructor(
2121

2222
init {
2323
onFocusChangeListener = this
24+
// Assume multi-line for the purpose of properly showing long hints.
25+
setSingleLine(hint != null)
2426
hintText = (hint ?: "")
2527
stateKeyboardButtonListener = context as StateKeyboardButtonListener
2628
}
2729

2830
override fun onFocusChange(v: View, hasFocus: Boolean) = if (hasFocus) {
29-
hint = ""
30-
typeface = Typeface.DEFAULT
31+
hideHint()
3132
KeyboardHelper.showSoftKeyboard(v, context)
3233
} else {
33-
hint = hintText
34-
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
34+
restoreHint()
3535
KeyboardHelper.hideSoftKeyboard(v, context)
3636
}
3737

3838
override fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean {
39-
if (event.keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP)
40-
this.clearFocus()
39+
if (event.keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP) {
40+
clearFocus()
41+
restoreHint()
42+
}
4143
return super.onKeyPreIme(keyCode, event)
4244
}
4345

@@ -47,4 +49,16 @@ class RatioInputInteractionView @JvmOverloads constructor(
4749
}
4850
super.onEditorAction(actionCode)
4951
}
52+
53+
private fun hideHint() {
54+
hint = ""
55+
typeface = Typeface.DEFAULT
56+
setSingleLine(true)
57+
}
58+
59+
private fun restoreHint() {
60+
hint = hintText
61+
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
62+
setSingleLine(false)
63+
}
5064
}

app/src/main/java/org/oppia/android/app/customview/interaction/TextInputInteractionView.kt

+20-6
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,25 @@ class TextInputInteractionView @JvmOverloads constructor(
2828

2929
init {
3030
onFocusChangeListener = this
31+
// Assume multi-line for the purpose of properly showing long hints.
32+
setSingleLine(hint != null)
3133
hintText = (hint ?: "")
3234
stateKeyboardButtonListener = context as StateKeyboardButtonListener
3335
}
3436

3537
override fun onFocusChange(v: View, hasFocus: Boolean) = if (hasFocus) {
36-
hint = ""
37-
typeface = Typeface.DEFAULT
38+
hideHint()
3839
showSoftKeyboard(v, context)
3940
} else {
40-
hint = hintText
41-
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
41+
restoreHint()
4242
hideSoftKeyboard(v, context)
4343
}
4444

4545
override fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean {
46-
if (event.keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP)
47-
this.clearFocus()
46+
if (event.keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP) {
47+
clearFocus()
48+
restoreHint()
49+
}
4850
return super.onKeyPreIme(keyCode, event)
4951
}
5052

@@ -54,4 +56,16 @@ class TextInputInteractionView @JvmOverloads constructor(
5456
}
5557
super.onEditorAction(actionCode)
5658
}
59+
60+
private fun hideHint() {
61+
hint = ""
62+
typeface = Typeface.DEFAULT
63+
setSingleLine(true)
64+
}
65+
66+
private fun restoreHint() {
67+
hint = hintText
68+
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
69+
setSingleLine(false)
70+
}
5771
}

0 commit comments

Comments
 (0)