Skip to content

Commit ca0b0af

Browse files
authored
Merge branch 'SimpleMobileTools:main' into add_languages
2 parents 9e0a9ba + 12d9588 commit ca0b0af

Some content is hidden

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

50 files changed

+184
-77
lines changed

app/src/main/kotlin/com/simplemobiletools/keyboard/activities/SettingsActivity.kt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class SettingsActivity : SimpleActivity() {
3131
setupVibrateOnKeypress()
3232
setupShowPopupOnKeypress()
3333
setupKeyboardLanguage()
34+
setupKeyboardHeightMultiplier()
3435

3536
updateTextColors(settings_nested_scrollview)
3637

@@ -145,4 +146,29 @@ class SettingsActivity : SimpleActivity() {
145146
else -> "${getString(R.string.translation_english)} (QWERTY)"
146147
}
147148
}
149+
150+
private fun setupKeyboardHeightMultiplier() {
151+
settings_keyboard_height_multiplier.text = getKeyboardHeightMultiplierText(config.keyboardHeightMultiplier)
152+
settings_keyboard_height_multiplier_holder.setOnClickListener {
153+
val items = arrayListOf(
154+
RadioItem(KEYBOARD_HEIGHT_MULTIPLIER_SMALL, getKeyboardHeightMultiplierText(KEYBOARD_HEIGHT_MULTIPLIER_SMALL)),
155+
RadioItem(KEYBOARD_HEIGHT_MULTIPLIER_MEDIUM, getKeyboardHeightMultiplierText(KEYBOARD_HEIGHT_MULTIPLIER_MEDIUM)),
156+
RadioItem(KEYBOARD_HEIGHT_MULTIPLIER_LARGE, getKeyboardHeightMultiplierText(KEYBOARD_HEIGHT_MULTIPLIER_LARGE)),
157+
)
158+
159+
RadioGroupDialog(this@SettingsActivity, items, config.keyboardHeightMultiplier) {
160+
config.keyboardHeightMultiplier = it as Int
161+
settings_keyboard_height_multiplier.text = getKeyboardHeightMultiplierText(config.keyboardHeightMultiplier)
162+
}
163+
}
164+
}
165+
166+
private fun getKeyboardHeightMultiplierText(multiplier: Int): String {
167+
return when (multiplier) {
168+
KEYBOARD_HEIGHT_MULTIPLIER_SMALL -> getString(R.string.small)
169+
KEYBOARD_HEIGHT_MULTIPLIER_MEDIUM -> getString(R.string.medium)
170+
KEYBOARD_HEIGHT_MULTIPLIER_LARGE -> getString(R.string.large)
171+
else -> getString(R.string.small)
172+
}
173+
}
148174
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ class Config(context: Context) : BaseConfig(context) {
2525
get() = prefs.getInt(KEYBOARD_LANGUAGE, getDefaultLanguage())
2626
set(keyboardLanguage) = prefs.edit().putInt(KEYBOARD_LANGUAGE, keyboardLanguage).apply()
2727

28+
var keyboardHeightMultiplier: Int
29+
get() = prefs.getInt(HEIGHT_MULTIPLIER, 1)
30+
set(keyboardHeightMultiplier) = prefs.edit().putInt(HEIGHT_MULTIPLIER, keyboardHeightMultiplier).apply()
31+
32+
2833
private fun getDefaultLanguage(): Int {
2934
val conf = context.resources.configuration
3035
return if (conf.locale.toString().toLowerCase(Locale.getDefault()).startsWith("ru_")) {

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const val VIBRATE_ON_KEYPRESS = "vibrate_on_keypress"
1212
const val SHOW_POPUP_ON_KEYPRESS = "show_popup_on_keypress"
1313
const val LAST_EXPORTED_CLIPS_FOLDER = "last_exported_clips_folder"
1414
const val KEYBOARD_LANGUAGE = "keyboard_language"
15+
const val HEIGHT_MULTIPLIER = "height_multiplier"
1516

1617
// differentiate current and pinned clips at the keyboards' Clipboard section
1718
const val ITEM_SECTION_LABEL = 0
@@ -31,5 +32,9 @@ const val LANGUAGE_TURKISH_Q = 10
3132
const val LANGUAGE_LITHUANIAN = 11
3233
const val LANGUAGE_BENGALI = 12
3334

35+
// keyboard height multiplier options
36+
const val KEYBOARD_HEIGHT_MULTIPLIER_SMALL = 1
37+
const val KEYBOARD_HEIGHT_MULTIPLIER_MEDIUM = 2
38+
const val KEYBOARD_HEIGHT_MULTIPLIER_LARGE = 3
3439

3540
const val EMOJI_SPEC_FILE_PATH = "media/emoji_spec.txt"

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import android.view.inputmethod.EditorInfo
1212
import android.view.inputmethod.EditorInfo.IME_ACTION_NONE
1313
import androidx.annotation.XmlRes
1414
import com.simplemobiletools.keyboard.R
15+
import com.simplemobiletools.keyboard.extensions.config
16+
import kotlin.math.roundToInt
1517

1618
/**
1719
* Loads an XML description of a keyboard and stores the attributes of the keys. A keyboard consists of rows of keys.
@@ -28,6 +30,9 @@ class MyKeyboard {
2830
/** Default key height */
2931
private var mDefaultHeight = 0
3032

33+
/** Multiplier for the keyboard height */
34+
var mKeyboardHeightMultiplier: Float = 1F
35+
3136
/** Is the keyboard in the shifted state */
3237
var mShiftState = SHIFT_OFF
3338

@@ -100,7 +105,7 @@ class MyKeyboard {
100105
this.parent = parent
101106
val a = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.MyKeyboard)
102107
defaultWidth = getDimensionOrFraction(a, R.styleable.MyKeyboard_keyWidth, parent.mDisplayWidth, parent.mDefaultWidth)
103-
defaultHeight = res.getDimension(R.dimen.key_height).toInt()
108+
defaultHeight = (res.getDimension(R.dimen.key_height) * this.parent.mKeyboardHeightMultiplier).roundToInt()
104109
defaultHorizontalGap = getDimensionOrFraction(a, R.styleable.MyKeyboard_horizontalGap, parent.mDisplayWidth, parent.mDefaultHorizontalGap)
105110
a.recycle()
106111
}
@@ -244,6 +249,7 @@ class MyKeyboard {
244249
mDefaultHorizontalGap = 0
245250
mDefaultWidth = mDisplayWidth / 10
246251
mDefaultHeight = mDefaultWidth
252+
mKeyboardHeightMultiplier = getKeyboardHeightMultiplier(context.config.keyboardHeightMultiplier);
247253
mKeys = ArrayList()
248254
mEnterKeyType = enterKeyType
249255
loadKeyboard(context, context.resources.getXml(xmlLayoutResId))
@@ -267,6 +273,7 @@ class MyKeyboard {
267273
row.defaultHeight = mDefaultHeight
268274
row.defaultWidth = keyWidth
269275
row.defaultHorizontalGap = mDefaultHorizontalGap
276+
mKeyboardHeightMultiplier = getKeyboardHeightMultiplier(context.config.keyboardHeightMultiplier);
270277

271278
characters.forEachIndexed { index, character ->
272279
val key = Key(row)
@@ -377,4 +384,13 @@ class MyKeyboard {
377384
mDefaultHorizontalGap = getDimensionOrFraction(a, R.styleable.MyKeyboard_horizontalGap, mDisplayWidth, 0)
378385
a.recycle()
379386
}
387+
388+
private fun getKeyboardHeightMultiplier(multiplierType: Int): Float {
389+
return when(multiplierType) {
390+
KEYBOARD_HEIGHT_MULTIPLIER_SMALL -> 1.0F
391+
KEYBOARD_HEIGHT_MULTIPLIER_MEDIUM -> 1.2F
392+
KEYBOARD_HEIGHT_MULTIPLIER_LARGE -> 1.4F
393+
else -> 1.0F
394+
}
395+
}
380396
}

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

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
style="@style/SettingsHolderTextViewStyle"
168168
android:layout_width="match_parent"
169169
android:layout_height="wrap_content"
170-
android:background="@drawable/ripple_bottom_corners">
170+
android:background="@drawable/ripple_background">
171171

172172
<com.simplemobiletools.commons.views.MyTextView
173173
android:id="@+id/settings_keyboard_language_label"
@@ -185,6 +185,30 @@
185185
tools:text="@string/translation_english" />
186186

187187
</RelativeLayout>
188+
189+
<RelativeLayout
190+
android:id="@+id/settings_keyboard_height_multiplier_holder"
191+
style="@style/SettingsHolderTextViewStyle"
192+
android:layout_width="match_parent"
193+
android:layout_height="wrap_content"
194+
android:background="@drawable/ripple_bottom_corners">
195+
196+
<com.simplemobiletools.commons.views.MyTextView
197+
android:id="@+id/settings_keyboard_height_multiplier_label"
198+
style="@style/SettingsTextLabelStyle"
199+
android:layout_width="wrap_content"
200+
android:layout_height="wrap_content"
201+
android:text="@string/keyboard_height" />
202+
203+
<com.simplemobiletools.commons.views.MyTextView
204+
android:id="@+id/settings_keyboard_height_multiplier"
205+
style="@style/SettingsTextValueStyle"
206+
android:layout_width="match_parent"
207+
android:layout_height="wrap_content"
208+
android:layout_below="@+id/settings_keyboard_height_multiplier_label"
209+
tools:text="@string/small" />
210+
</RelativeLayout>
211+
188212
</LinearLayout>
189213
</LinearLayout>
190214
</androidx.core.widget.NestedScrollView>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@
3838
Haven't found some strings? There's more at
3939
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
4040
-->
41-
</resources>
41+
</resources>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<string name="clipboard_recent">Недавнее</string>
1515
<string name="clipboard_current">Текущее</string>
1616
<string name="clipboard_pinned">Закреплено</string>
17-
<string name="add_new_item">Добавить новый элемент</string>
17+
<string name="add_new_item">Добавить</string>
1818
<string name="manage_clips">Здесь вы можете изменять или добавлять данные для быстрого доступа.</string>
1919
<string name="clip_text">Выбрать текст</string>
2020
<string name="pin_text">Закрепить текст</string>
@@ -25,10 +25,10 @@
2525
<string name="keycode_delete">Удалить</string>
2626
<string name="keycode_mode_change">Изменить тип клавиатуры</string>
2727
<string name="keycode_shift">Shift</string>
28-
<string name="keycode_enter">Войти</string>
28+
<string name="keycode_enter">Enter</string>
2929
<!-- Settings -->
3030
<string name="show_clipboard_content">Показывать содержимое буфера обмена при наличии</string>
31-
<string name="show_popup">Показывать всплывающее окно при нажатии клавиши</string>
31+
<string name="show_popup">Показ ввода по нажатию</string>
3232
<string name="vibrate_on_keypress">Вибрация по нажатию</string>
3333
<string name="keyboard_language">Язык клавиатуры</string>
3434
<string name="keyboard_height">Высота клавиатуры</string>

fastlane/metadata/android/bg/full_description.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
A lightweight keyboard app that helps chatting with your friends, or inserting any other texts, numbers or symbols. You can choose from multiple different languages and layouts.
1+
Леко приложение с клавиатура, което ви помага да чатите с приятелите си или да вмъквате други текстове, цифри или символи. Можете да избирате от няколко различни езика и оформления.
22

3-
You can create handy clips and pin frequently used ones for easy access. You can toggle vibrations, popups on keypresses or select your language from the list of supported ones.
3+
Можете да създавате удобни клипове и да закачате често използвани такива за лесен достъп. Можете да превключвате вибрациите и изскачащите прозорци при натискане на клавишите или да изберете езика си от списъка с поддържани такива.
44

5-
It comes with material design and dark theme by default, provides great user experience for easy usage. The lack of internet access gives you more privacy, security and stability than other apps.
5+
Можете да избирате и от огромно разнообразие от налични емотикони.
66

7-
Contains no ads or unnecessary permissions. It is fully opensource, provides customizable colors.
7+
По подразбиране се предлага с Material Design и тъмна тема, което осигурява страхотно потребителско изживяване за лесно използване. Липсата на достъп до интернет ви осигурява повече неприкосновеност на личния живот, сигурност и стабилност в сравнение с други приложения.
88

9-
Check out the full suite of Simple Tools here:
9+
Не съдържа реклами или ненужни разрешения. Напълно е с отворен код и предоставя възможност за персонализиране на цветовете.
10+
11+
Разгледайте пълния набор от прости инструменти тук:
1012
https://www.simplemobiletools.com
1113

1214
Facebook:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Easy keyboard for inserting all kinds of texts, special characters and numbers
1+
Easy keyboard for inserting all kinds of texts, special characters and numbers
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Обикновена Клавиатура
1+
Обикновена Клавиатура

0 commit comments

Comments
 (0)