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 #4495, part of #3088, #4467, #4505, #4266, #4446: Miscellaneous alpha MR5 fixes #4506

Merged
merged 11 commits into from
Aug 19, 2022
19 changes: 19 additions & 0 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,24 @@ jobs:
run: |
bazel build --compilation_mode=opt -- //:oppia_alpha_kitkat

# Note that caching only works on non-forks.
- name: Build Oppia alpha Kenya-specific AAB (with caching, non-fork only)
if: ${{ env.ENABLE_CACHING == 'true' && github.event.pull_request.head.repo.full_name == 'oppia/oppia-android' }}
env:
BAZEL_REMOTE_CACHE_URL: ${{ secrets.BAZEL_REMOTE_CACHE_URL }}
run: |
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

- name: Build Oppia alpha Kenya-specific AAB (without caching, or on a fork)
if: ${{ env.ENABLE_CACHING == 'false' || github.event.pull_request.head.repo.full_name != 'oppia/oppia-android' }}
run: |
bazel build --compilation_mode=opt -- //:oppia_alpha_kenya

- name: Copy Oppia alpha AABs for uploading
run: |
cp $GITHUB_WORKSPACE/bazel-bin/oppia_alpha.aab /home/runner/work/oppia-android/oppia-android/
cp $GITHUB_WORKSPACE/bazel-bin/oppia_alpha_kitkat.aab /home/runner/work/oppia-android/oppia-android/
cp $GITHUB_WORKSPACE/bazel-bin/oppia_alpha_kenya.aab /home/runner/work/oppia-android/oppia-android/

- uses: actions/upload-artifact@v2
with:
Expand All @@ -457,3 +471,8 @@ jobs:
with:
name: oppia_alpha_kitkat.aab
path: /home/runner/work/oppia-android/oppia-android/oppia_alpha_kitkat.aab

- uses: actions/upload-artifact@v2
with:
name: oppia_alpha_kenya.aab
path: /home/runner/work/oppia-android/oppia-android/oppia_alpha_kenya.aab
4 changes: 2 additions & 2 deletions app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,15 @@ VIEW_MODELS_WITH_RESOURCE_IMPORTS = [
"src/main/java/org/oppia/android/app/parser/FractionParsingUiError.kt",
"src/main/java/org/oppia/android/app/parser/StringToNumberParser.kt",
"src/main/java/org/oppia/android/app/parser/StringToRatioParser.kt",
"src/main/java/org/oppia/android/app/player/audio/AudioViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/DragDropInteractionContentViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/FractionInteractionViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/ImageRegionSelectionInteractionViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/MathExpressionInteractionsViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/PreviousResponsesHeaderViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/RatioExpressionInputInteractionViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/SubmittedAnswerViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/TextInputViewModel.kt",
"src/main/java/org/oppia/android/app/profile/AddProfileViewModel.kt",
"src/main/java/org/oppia/android/app/profile/PinPasswordViewModel.kt",
"src/main/java/org/oppia/android/app/profile/ResetPinViewModel.kt",
Expand Down Expand Up @@ -296,7 +298,6 @@ VIEW_MODELS = [
"src/main/java/org/oppia/android/app/options/OptionsItemViewModel.kt",
"src/main/java/org/oppia/android/app/options/OptionsReadingTextSizeViewModel.kt",
"src/main/java/org/oppia/android/app/options/ReadingTextSizeSelectionViewModel.kt",
"src/main/java/org/oppia/android/app/player/audio/AudioViewModel.kt",
"src/main/java/org/oppia/android/app/player/exploration/ExplorationViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/ContentViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/ContinueInteractionViewModel.kt",
Expand All @@ -312,7 +313,6 @@ VIEW_MODELS = [
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/SelectionInteractionViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/StateItemViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/SubmitButtonViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/TextInputViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/StateViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/testing/StateFragmentTestViewModel.kt",
"src/main/java/org/oppia/android/app/profile/AdminAuthViewModel.kt",
Expand Down
1 change: 0 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def filesToExclude = [
'**/*AppLanguageLocaleHandlerTest*.kt',
'**/*AppLanguageResourceHandlerTest*.kt',
'**/*AppLanguageWatcherMixinTest*.kt',
'**/alphakenya/*.kt',
]
_excludeSourceFiles(filesToExclude)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ import javax.inject.Singleton
LoggingIdentifierModule::class, ApplicationLifecycleModule::class,
NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class,
SyncStatusModule::class, LogReportingModule::class, NetworkConnectionUtilProdModule::class,
HintsAndSolutionProdModule::class, AlphaKenyaBuildFlavorModule::class
HintsAndSolutionProdModule::class
]
)
interface AlphaKenyaApplicationComponent : ApplicationComponent {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ kt_android_library(
name = "alpha_kenya_application",
srcs = [
"AlphaKenyaApplicationComponent.kt",
"AlphaKenyaBuildFlavorModule.kt",
"AlphaKenyaOppiaApplication.kt",
],
visibility = ["//:oppia_binary_visibility"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,25 @@ class FractionInputInteractionView @JvmOverloads constructor(

init {
onFocusChangeListener = this
// Assume multi-line for the purpose of properly showing long hints.
setSingleLine(hint != null)
hintText = (hint ?: "")
stateKeyboardButtonListener = context as StateKeyboardButtonListener
}

override fun onFocusChange(v: View, hasFocus: Boolean) = if (hasFocus) {
hint = ""
typeface = Typeface.DEFAULT
hideHint()
showSoftKeyboard(v, context)
} else {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
restoreHint()
hideSoftKeyboard(v, context)
}

override fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean {
if (event.keyCode == KEYCODE_BACK && event.action == ACTION_UP)
this.clearFocus()
if (event.keyCode == KEYCODE_BACK && event.action == ACTION_UP) {
clearFocus()
restoreHint()
}
return super.onKeyPreIme(keyCode, event)
}

Expand All @@ -59,4 +61,16 @@ class FractionInputInteractionView @JvmOverloads constructor(
}
super.onEditorAction(actionCode)
}

private fun hideHint() {
hint = ""
typeface = Typeface.DEFAULT
setSingleLine(true)
}

private fun restoreHint() {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
setSingleLine(false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,24 @@ class MathExpressionInteractionsView @JvmOverloads constructor(

init {
onFocusChangeListener = this
// Assume multi-line for the purpose of properly showing long hints.
setSingleLine(hint != null)
hintText = (hint ?: "")
stateKeyboardButtonListener = context as StateKeyboardButtonListener
}

override fun onFocusChange(v: View, hasFocus: Boolean) = if (hasFocus) {
hint = ""
typeface = Typeface.DEFAULT
hideHint()
showSoftKeyboard(v, context)
} else {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
restoreHint()
hideSoftKeyboard(v, context)
}

override fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean {
if (event.keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP) {
clearFocus()
restoreHint()
}
return super.onKeyPreIme(keyCode, event)
}
Expand All @@ -73,4 +74,16 @@ class MathExpressionInteractionsView @JvmOverloads constructor(
hint = placeholderText
}
}

private fun hideHint() {
hint = ""
typeface = Typeface.DEFAULT
setSingleLine(true)
}

private fun restoreHint() {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
setSingleLine(false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,25 @@ class NumericInputInteractionView @JvmOverloads constructor(

init {
onFocusChangeListener = this
// Assume multi-line for the purpose of properly showing long hints.
setSingleLine(hint != null)
hintText = (hint ?: "")
stateKeyboardButtonListener = context as StateKeyboardButtonListener
}

override fun onFocusChange(v: View, hasFocus: Boolean) = if (hasFocus) {
hint = ""
typeface = Typeface.DEFAULT
hideHint()
showSoftKeyboard(v, context)
} else {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
restoreHint()
hideSoftKeyboard(v, context)
}

override fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean {
if (event.keyCode == KEYCODE_BACK && event.action == ACTION_UP)
this.clearFocus()
if (event.keyCode == KEYCODE_BACK && event.action == ACTION_UP) {
clearFocus()
restoreHint()
}
return super.onKeyPreIme(keyCode, event)
}

Expand All @@ -57,4 +59,16 @@ class NumericInputInteractionView @JvmOverloads constructor(
}
super.onEditorAction(actionCode)
}

private fun hideHint() {
hint = ""
typeface = Typeface.DEFAULT
setSingleLine(true)
}

private fun restoreHint() {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
setSingleLine(false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,25 @@ class RatioInputInteractionView @JvmOverloads constructor(

init {
onFocusChangeListener = this
// Assume multi-line for the purpose of properly showing long hints.
setSingleLine(hint != null)
hintText = (hint ?: "")
stateKeyboardButtonListener = context as StateKeyboardButtonListener
}

override fun onFocusChange(v: View, hasFocus: Boolean) = if (hasFocus) {
hint = ""
typeface = Typeface.DEFAULT
hideHint()
KeyboardHelper.showSoftKeyboard(v, context)
} else {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
restoreHint()
KeyboardHelper.hideSoftKeyboard(v, context)
}

override fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean {
if (event.keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP)
this.clearFocus()
if (event.keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP) {
clearFocus()
restoreHint()
}
return super.onKeyPreIme(keyCode, event)
}

Expand All @@ -47,4 +49,16 @@ class RatioInputInteractionView @JvmOverloads constructor(
}
super.onEditorAction(actionCode)
}

private fun hideHint() {
hint = ""
typeface = Typeface.DEFAULT
setSingleLine(true)
}

private fun restoreHint() {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
setSingleLine(false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,25 @@ class TextInputInteractionView @JvmOverloads constructor(

init {
onFocusChangeListener = this
// Assume multi-line for the purpose of properly showing long hints.
setSingleLine(hint != null)
hintText = (hint ?: "")
stateKeyboardButtonListener = context as StateKeyboardButtonListener
}

override fun onFocusChange(v: View, hasFocus: Boolean) = if (hasFocus) {
hint = ""
typeface = Typeface.DEFAULT
hideHint()
showSoftKeyboard(v, context)
} else {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
restoreHint()
hideSoftKeyboard(v, context)
}

override fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean {
if (event.keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP)
this.clearFocus()
if (event.keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP) {
clearFocus()
restoreHint()
}
return super.onKeyPreIme(keyCode, event)
}

Expand All @@ -54,4 +56,16 @@ class TextInputInteractionView @JvmOverloads constructor(
}
super.onEditorAction(actionCode)
}

private fun hideHint() {
hint = ""
typeface = Typeface.DEFAULT
setSingleLine(true)
}

private fun restoreHint() {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
setSingleLine(false)
}
}
Loading