1
0
Fork 0

Add a warning if the user didn't enter any spaces

Still need translations
This commit is contained in:
Eoin Mcloughlin 2022-08-28 11:23:54 +01:00
parent cb72fb0d5a
commit c6b9a8b266
4 changed files with 39 additions and 11 deletions

View File

@ -4,8 +4,10 @@ import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.LinearLayout
import android.widget.TextView
import androidx.core.text.HtmlCompat
import androidx.core.view.isVisible
class TrainingResultsActivity : AppCompatActivity() {
@ -68,6 +70,10 @@ class TrainingResultsActivity : AppCompatActivity() {
findViewById<TextView>(R.id.resultSummary).text = getString(R.string.training_results_summary, percentCorrect, editDistance)
// Add extra feedback if the user didn't add any spaces
var userAddedSpaces = userInputText.indexOf(' ') != -1
findViewById<LinearLayout>(R.id.spacesHelpContainer).isVisible = !userAddedSpaces
var detailContainer = findViewById<TextView>(R.id.resultDetails)
detailContainer.text = HtmlCompat.fromHtml(formatEditDetails(comparisonResult.mEdits), 0)
}

View File

@ -21,6 +21,36 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/spacesHelpContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="@android:drawable/editbox_background"
android:backgroundTint="?attr/colorError"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingTop="6dp"
android:paddingRight="16dp"
android:paddingBottom="6dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/resultSummary">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:text="⚠"
android:textSize="30sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/add_spaces_tip"
android:textSize="24sp" />
</LinearLayout>
<TextView
android:id="@+id/resultDetails"
android:layout_width="match_parent"
@ -32,7 +62,7 @@
android:textSize="20sp"
app:layout_constraintStart_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/resultSummary" />
app:layout_constraintTop_toBottomOf="@+id/spacesHelpContainer" />
<Button
@ -64,11 +94,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button">
<Space
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="4dp" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
@ -110,11 +135,6 @@
android:textSize="24sp" />
</LinearLayout>
<Space
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="4dp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -54,6 +54,7 @@
scored. Once you can reliably identify 90% of the characters in a lesson, it might be time
to move on to the next character.
</string>
<string name="add_spaces_tip">Be sure to add spaces between the words!</string>
<string-array name="tone_frequency_strings">
<item>400Hz</item>

View File

@ -1 +1,2 @@
Fixed bug where duration of lessons was too long
Added tip if users didn't add spaces to lesson input