Skip to content

Commit 2ee8613

Browse files
authored
Merge branch 'main' into capitalizing_settings
2 parents 84e1b8b + 73b0017 commit 2ee8613

File tree

45 files changed

+76
-11
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+76
-11
lines changed

app/src/main/kotlin/com/simplemobiletools/keyboard/helpers/MyKeyboard.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,14 @@ class MyKeyboard {
201201

202202
a.recycle()
203203
a = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.MyKeyboard_Key)
204+
205+
label = a.getText(R.styleable.MyKeyboard_Key_keyLabel) ?: ""
204206
code = a.getInt(R.styleable.MyKeyboard_Key_code, 0)
205207

208+
if (label.isNotEmpty() && code == 0) {
209+
code = label[0].code
210+
}
211+
206212
popupCharacters = a.getText(R.styleable.MyKeyboard_Key_popupCharacters)
207213
popupResId = a.getResourceId(R.styleable.MyKeyboard_Key_popupKeyboard, 0)
208214
repeatable = a.getBoolean(R.styleable.MyKeyboard_Key_isRepeatable, false)
@@ -213,12 +219,9 @@ class MyKeyboard {
213219
secondaryIcon = a.getDrawable(R.styleable.MyKeyboard_Key_secondaryKeyIcon)
214220
secondaryIcon?.setBounds(0, 0, secondaryIcon!!.intrinsicWidth, secondaryIcon!!.intrinsicHeight)
215221

216-
label = a.getText(R.styleable.MyKeyboard_Key_keyLabel) ?: ""
217222
topSmallNumber = a.getString(R.styleable.MyKeyboard_Key_topSmallNumber) ?: ""
218223

219-
if (label.isNotEmpty() && code != KEYCODE_MODE_CHANGE && code != KEYCODE_SHIFT) {
220-
code = label[0].code
221-
}
224+
222225
a.recycle()
223226
}
224227

app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,8 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
569569
for (i in 0 until keyCount) {
570570
val key = keys[i]
571571
val code = key.code
572+
573+
// TODO: Space key background on a KEYBOARD_PHONE should not be applied
572574
setupKeyBackground(key, code, canvas)
573575

574576
// Switch the character to uppercase if shift is pressed
@@ -674,9 +676,9 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
674676
}
675677

676678
private fun setupKeyBackground(key: MyKeyboard.Key, keyCode: Int, canvas: Canvas) {
677-
val keyBackground = when (keyCode) {
678-
KEYCODE_SPACE -> getSpaceKeyBackground()
679-
KEYCODE_ENTER -> getEnterKeyBackground()
679+
val keyBackground = when {
680+
keyCode == KEYCODE_SPACE && key.label.isBlank() -> getSpaceKeyBackground()
681+
keyCode == KEYCODE_ENTER -> getEnterKeyBackground()
680682
else -> mKeyBackground
681683
}
682684

app/src/main/res/layout/activity_main.xml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,32 @@
4141

4242
</RelativeLayout>
4343

44-
<com.simplemobiletools.commons.views.MyEditText
45-
android:id="@+id/text_edittext"
44+
<LinearLayout
4645
android:layout_width="match_parent"
4746
android:layout_height="wrap_content"
4847
android:layout_below="@+id/change_keyboard_holder"
49-
android:layout_margin="@dimen/activity_margin" />
48+
android:orientation="vertical">
5049

50+
<com.simplemobiletools.commons.views.MyEditText
51+
android:id="@+id/text_edittext"
52+
android:layout_width="match_parent"
53+
android:layout_height="wrap_content"
54+
android:layout_marginStart="@dimen/activity_margin"
55+
android:layout_marginTop="@dimen/activity_margin"
56+
android:layout_marginEnd="@dimen/activity_margin"
57+
android:layout_marginBottom="@dimen/activity_margin" />
58+
59+
<com.simplemobiletools.commons.views.MyEditText
60+
android:id="@+id/text_editphone"
61+
android:layout_width="match_parent"
62+
android:layout_height="wrap_content"
63+
android:layout_marginStart="@dimen/activity_margin"
64+
android:layout_marginTop="@dimen/activity_margin"
65+
android:layout_marginEnd="@dimen/activity_margin"
66+
android:layout_marginBottom="@dimen/activity_margin"
67+
android:inputType="phone" />
68+
69+
</LinearLayout>
5170
</RelativeLayout>
5271
</androidx.core.widget.NestedScrollView>
5372
</androidx.coordinatorlayout.widget.CoordinatorLayout>

app/src/main/res/values-ar/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<string name="keyboard_height">ارتفاع لوحة المفاتيح</string>
3535
<string name="show_key_borders">إظهار حدود المفاتيح</string>
3636
<string name="show_numbers_row">إظهار الأرقام في صف منفصل</string>
37+
<string name="start_sentences_capitalised">Start sentences with a capital letter</string>
3738
<!-- Emojis -->
3839
<string name="emojis">الرموز التعبيرية</string>
3940
<!--

app/src/main/res/values-be/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<string name="keyboard_height">Вышыня клавіятуры</string>
3535
<string name="show_key_borders">Паказаць контуры клавіш</string>
3636
<string name="show_numbers_row">Паказаць лічбы ў асобным радку</string>
37+
<string name="start_sentences_capitalised">Start sentences with a capital letter</string>
3738
<!-- Emojis -->
3839
<string name="emojis">Эмодзі</string>
3940
<!--

app/src/main/res/values-bg/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<string name="keyboard_height">Височина на клавиатурата</string>
3535
<string name="show_key_borders">Show key borders</string>
3636
<string name="show_numbers_row">Show numbers on a separate row</string>
37+
<string name="start_sentences_capitalised">Start sentences with a capital letter</string>
3738
<!-- Emojis -->
3839
<string name="emojis">Емоджита</string>
3940
<!--

app/src/main/res/values-ca/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<string name="keyboard_height">Alçada del teclat</string>
3535
<string name="show_key_borders">Mostra les vores de les tecles</string>
3636
<string name="show_numbers_row">Mostra els números en una fila separada</string>
37+
<string name="start_sentences_capitalised">Start sentences with a capital letter</string>
3738
<!-- Emojis -->
3839
<string name="emojis">Emojis</string>
3940
<!--

app/src/main/res/values-ckb/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<string name="keyboard_height">قەبارەی تەختەکلیل</string>
3535
<string name="show_key_borders">لێواری دوگمەکان</string>
3636
<string name="show_numbers_row">پیشاندانی لیستی ژمارەکان بەجیا</string>
37+
<string name="start_sentences_capitalised">Start sentences with a capital letter</string>
3738
<!-- Emojis -->
3839
<string name="emojis">خەندەکان</string>
3940
</resources>

app/src/main/res/values-cs/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<string name="keyboard_height">Výška klávesnice</string>
3535
<string name="show_key_borders">Zobrazit ohraničení kláves</string>
3636
<string name="show_numbers_row">Zobrazit čísla na samostatném řádku</string>
37+
<string name="start_sentences_capitalised">Start sentences with a capital letter</string>
3738
<!-- Emojis -->
3839
<string name="emojis">Emotikony</string>
3940
<!--

app/src/main/res/values-da/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<string name="keyboard_height">Keyboard height</string>
3535
<string name="show_key_borders">Show key borders</string>
3636
<string name="show_numbers_row">Show numbers on a separate row</string>
37+
<string name="start_sentences_capitalised">Start sentences with a capital letter</string>
3738
<!-- Emojis -->
3839
<string name="emojis">Emojis</string>
3940
<!--

0 commit comments

Comments
 (0)