Skip to content

Commit

Permalink
braille-systems#278 add text on braille dots
Browse files Browse the repository at this point in the history
  • Loading branch information
zuevval committed Oct 3, 2020
1 parent fc8e555 commit ca257c4
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 25 deletions.
1 change: 1 addition & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -117,27 +117,27 @@ class BrailleDotsView : ConstraintLayout, KoinComponent {
}

private fun setDescriptionMode(mode: BrailleDotsViewMode) {
when (mode) {
Writing -> forEach(
dotButton4 to R.string.braille_dot_1,
dotButton5 to R.string.braille_dot_2,
dotButton6 to R.string.braille_dot_3,
dotButton1 to R.string.braille_dot_4,
dotButton2 to R.string.braille_dot_5,
dotButton3 to R.string.braille_dot_6
) { (dotButton, id) ->
dotButton.contentDescription = context.getString(id)
}
Reading -> forEach(
dotButton1 to R.string.braille_dot_1,
dotButton2 to R.string.braille_dot_2,
dotButton3 to R.string.braille_dot_3,
dotButton4 to R.string.braille_dot_4,
dotButton5 to R.string.braille_dot_5,
dotButton6 to R.string.braille_dot_6
) { (dotButton, id) ->
dotButton.contentDescription = context.getString(id)
}
val dotsMapping = when (mode) {
Writing -> listOf(
Triple(dotButton4, R.string.braille_dot_1, R.string.braille_dot_1_text),
Triple(dotButton5, R.string.braille_dot_2, R.string.braille_dot_2_text),
Triple(dotButton6, R.string.braille_dot_3, R.string.braille_dot_3_text),
Triple(dotButton1, R.string.braille_dot_4, R.string.braille_dot_4_text),
Triple(dotButton2, R.string.braille_dot_5, R.string.braille_dot_5_text),
Triple(dotButton3, R.string.braille_dot_6, R.string.braille_dot_6_text)
)
Reading -> listOf(
Triple(dotButton1, R.string.braille_dot_1, R.string.braille_dot_1_text),
Triple(dotButton2, R.string.braille_dot_2, R.string.braille_dot_2_text),
Triple(dotButton3, R.string.braille_dot_3, R.string.braille_dot_3_text),
Triple(dotButton4, R.string.braille_dot_4, R.string.braille_dot_4_text),
Triple(dotButton5, R.string.braille_dot_5, R.string.braille_dot_5_text),
Triple(dotButton6, R.string.braille_dot_6, R.string.braille_dot_6_text)
)
}
dotsMapping.forEach{ (dotButton, desc_id, caption_id) ->
dotButton.contentDescription = context.getString(desc_id)
dotButton.text = context.getString(caption_id)
}
}

Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/drawable/round_checkbox.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/checked_round_checkbox" android:state_checked="true" />
<item android:drawable="@drawable/checked_round_checkbox" android:state_pressed="true" />
<item android:drawable="@drawable/unchecked_round_checkbox" android:state_pressed="false" />
<item android:color="@color/colorBackground" android:drawable="@drawable/checked_round_checkbox" android:state_checked="true" />
<item android:color="@color/colorBackground" android:drawable="@drawable/checked_round_checkbox" android:state_pressed="true" />
<item android:color="@color/colorPrimary" android:drawable="@drawable/unchecked_round_checkbox" android:state_pressed="false" />
</selector>
6 changes: 6 additions & 0 deletions app/src/main/res/layout/braille_dots_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
android:layout_marginEnd="@dimen/braille_dots_inner_horizontal_margin"
android:layout_marginBottom="@dimen/braille_dots_inner_vertical_margin"
android:contentDescription="@string/braille_dot_1"
android:text="@string/braille_dot_1_text"
app:layout_constraintBottom_toTopOf="@+id/dotButton2"
app:layout_constraintEnd_toStartOf="@+id/dotButton4"
app:layout_constraintHorizontal_bias="0.5"
Expand All @@ -30,6 +31,7 @@
android:layout_marginEnd="@dimen/braille_dots_outer_horizontal_margin"
android:layout_marginBottom="@dimen/braille_dots_inner_vertical_margin"
android:contentDescription="@string/braille_dot_2"
android:text="@string/braille_dot_2_text"
app:layout_constraintBottom_toTopOf="@+id/dotButton3"
app:layout_constraintEnd_toStartOf="@+id/dotButton5"
app:layout_constraintHorizontal_bias="0.5"
Expand All @@ -44,6 +46,7 @@
android:layout_marginEnd="@dimen/braille_dots_outer_horizontal_margin"
android:layout_marginBottom="@dimen/braille_dots_outer_vertical_margin"
android:contentDescription="@string/braille_dot_3"
android:text="@string/braille_dot_3_text"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/dotButton6"
app:layout_constraintHorizontal_bias="0.5"
Expand All @@ -58,6 +61,7 @@
android:layout_marginEnd="@dimen/braille_dots_outer_horizontal_margin"
android:layout_marginBottom="@dimen/braille_dots_inner_vertical_margin"
android:contentDescription="@string/braille_dot_4"
android:text="@string/braille_dot_4_text"
app:layout_constraintBottom_toTopOf="@+id/dotButton5"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
Expand All @@ -72,6 +76,7 @@
android:layout_marginEnd="@dimen/braille_dots_outer_horizontal_margin"
android:layout_marginBottom="@dimen/braille_dots_inner_vertical_margin"
android:contentDescription="@string/braille_dot_5"
android:text="@string/braille_dot_5_text"
app:layout_constraintBottom_toTopOf="@+id/dotButton6"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
Expand All @@ -86,6 +91,7 @@
android:layout_marginEnd="@dimen/braille_dots_outer_horizontal_margin"
android:layout_marginBottom="@dimen/braille_dots_outer_vertical_margin"
android:contentDescription="@string/braille_dot_6"
android:text="@string/braille_dot_6_text"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,13 @@
<string name="braille_dot_5">точка пять</string>
<string name="braille_dot_6">точка шесть</string>

<string name="braille_dot_1_text">1</string>
<string name="braille_dot_2_text">2</string>
<string name="braille_dot_3_text">3</string>
<string name="braille_dot_4_text">4</string>
<string name="braille_dot_5_text">5</string>
<string name="braille_dot_6_text">6</string>

<!-- Action menu-->

<string name="menu_title_help">Справка</string>
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@
<item name="android:layout_height">wrap_content</item>
<item name="android:scaleX">@dimen/braille_dots_scale_of_one_dot</item>
<item name="android:scaleY">@dimen/braille_dots_scale_of_one_dot</item>
<item name="android:button">@drawable/round_checkbox</item>
<item name="android:button">@null</item>
<item name="android:background">@drawable/round_checkbox</item>
<item name="android:gravity">center</item>
<item name="android:textColor">@drawable/round_checkbox</item>
</style>

<style name="bigLetterStyle">
Expand Down

0 comments on commit ca257c4

Please sign in to comment.