Add a warning if the user didn't enter any spaces
Still need translations
This commit is contained in:
parent
cb72fb0d5a
commit
c6b9a8b266
4 changed files with 39 additions and 11 deletions
|
@ -4,8 +4,10 @@ import android.content.Intent
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.core.text.HtmlCompat
|
import androidx.core.text.HtmlCompat
|
||||||
|
import androidx.core.view.isVisible
|
||||||
|
|
||||||
class TrainingResultsActivity : AppCompatActivity() {
|
class TrainingResultsActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
@ -68,6 +70,10 @@ class TrainingResultsActivity : AppCompatActivity() {
|
||||||
|
|
||||||
findViewById<TextView>(R.id.resultSummary).text = getString(R.string.training_results_summary, percentCorrect, editDistance)
|
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)
|
var detailContainer = findViewById<TextView>(R.id.resultDetails)
|
||||||
detailContainer.text = HtmlCompat.fromHtml(formatEditDetails(comparisonResult.mEdits), 0)
|
detailContainer.text = HtmlCompat.fromHtml(formatEditDetails(comparisonResult.mEdits), 0)
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,36 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="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
|
<TextView
|
||||||
android:id="@+id/resultDetails"
|
android:id="@+id/resultDetails"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -32,7 +62,7 @@
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
app:layout_constraintStart_toEndOf="parent"
|
app:layout_constraintStart_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/resultSummary" />
|
app:layout_constraintTop_toBottomOf="@+id/spacesHelpContainer" />
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
@ -64,11 +94,6 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/button">
|
app:layout_constraintTop_toBottomOf="@+id/button">
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:minHeight="4dp" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView"
|
android:id="@+id/textView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -110,11 +135,6 @@
|
||||||
android:textSize="24sp" />
|
android:textSize="24sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:minHeight="4dp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
scored. Once you can reliably identify 90% of the characters in a lesson, it might be time
|
scored. Once you can reliably identify 90% of the characters in a lesson, it might be time
|
||||||
to move on to the next character.
|
to move on to the next character.
|
||||||
</string>
|
</string>
|
||||||
|
<string name="add_spaces_tip">Be sure to add spaces between the words!</string>
|
||||||
|
|
||||||
<string-array name="tone_frequency_strings">
|
<string-array name="tone_frequency_strings">
|
||||||
<item>400Hz</item>
|
<item>400Hz</item>
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
Fixed bug where duration of lessons was too long
|
Fixed bug where duration of lessons was too long
|
||||||
|
Added tip if users didn't add spaces to lesson input
|
||||||
|
|
Loading…
Reference in a new issue