Skip to content

Commit

Permalink
Merge pull request #302 from WinLin97/main
Browse files Browse the repository at this point in the history
Continuation of polish translation
  • Loading branch information
Fabi019 authored Oct 13, 2024
2 parents 344db63 + 1d79f1a commit 23327d7
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 12 deletions.
92 changes: 92 additions & 0 deletions app/src/main/assets/keymaps/pl.layout
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
## Keymap overlay for a Polish Programmer keyboard

## -------------------------
## SOME USEFUL INFORMATIONS
## -------------------------
## ... for everyone who, just like me (winlin97), had no idea how it works, and want to make a custom keyboard layout.
## -------------------------
## The PC (thanks to the HID interface) see this application just like the physical keyboard.
## Application does not know the actual layout of the keyboard in the system.
## We must to call the language-appropriate characters just as if we were typing them on a physical keyboard with this layout.
## -------------------------
## This file contains a table of key mapping.
## Column order in the table: CHAR <-SPACE-> HID_KEY_SCANCODE <-SPACE-> MODIFIERS
## -------------------------
## <-SPACE-> is only a representation for spacebar (" " char), which is used by the program to separate individual values from every line in the table.
## -------------------------
## CHAR is just the letter, number or character, which we have to send to the computer.
## -------------------------
## HID_KEY_SCANCODE is a byte value, which corresponds to every key on the keyboard.
## Firstly you can look at "base.layout" file to see what scancode is e.g. for "numbers and letters"
## Important: "base.layout" is used with every custom layout. We don't have to add the chars to our table that this file already contains.
## More scancodes -> https://source.android.com/docs/core/interaction/input/keyboard-devices#hid-keyboard-and-keypad-page-0x07
## -------------------------
## MODIFIERS such as LCTRL, LSHIFT, LALT, etc. can be combined using the “or” (|) bit operation.
## The modifier value is stored using 1 byte [8 bits] - that allows to combine modifiers, setting the corresponding bits to 1.
## Each modifier corresponds to one bit in the byte, so no bits overlap.
## 00: none [bit: 0000 0000] // DEFAULT VALUE - all modifiers is off
## 01: LCTRL [bit: 0000 0001]
## 02: LSHIFT [bit: 0000 0010]
## 04: LALT [bit: 0000 0100]
## 08: LMETA [bit: 0000 1000]
## 10: RCTRL [bit: 0001 0000]
## 20: RSHIFT [bit: 0010 0000]
## 40: RALT [bit: 0100 0000] // "ALTGR" in polish programmers layout -> https://kbdlayout.info/KBDPL1/
## 80: RMETA [bit: 1000 0000]
## So, to get RALT and LSHIFT in the same time we have: 0x40 | 0x02 -> [bit: 0100 0010] -> 0x42
## -------------------------
## More info -> https://source.android.com/docs/core/interaction/input/keyboard-devices
## -------------------------

## START OF THE RIGHT TABLE:
ą 04 40
ć 06 40
ę 08 40
ł 0F 40
ń 11 40
ó 12 40
ś 16 40
ź 1B 40
ż 1D 40

Ą 04 42
Ć 06 42
Ę 08 42
Ł 0F 42
Ń 11 42
Ó 12 42
Ś 16 42
Ź 1B 42
Ż 1D 42

| 31 02
? 38 02
< 36 02
> 37 02
: 33 02
" 34 02
{ 2F 02
} 30 02

\ 31 00
/ 38 00
, 36 00
. 37 00
; 33 00
' 34 00
[ 2F 00
] 30 00

! 1E 02
@ 1F 02
# 20 02
$ 21 02
% 22 02
^ 23 02
& 24 02
* 25 02
( 26 02
) 27 02
_ 2D 02
+ 2E 02
~ 35 02
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ class BluetoothController(var context: Context) {
4 -> "es"
5 -> "it"
6 -> "tr"
7 -> "pl"
else -> "us"
},
template,
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/java/dev/fabik/bluetoothhid/bt/KeyTranslator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,24 @@ class KeyTranslator(context: Context) {
staticTemplates["DOWN"] = Key(0, 0x51)
staticTemplates["UP"] = Key(0, 0x52)

// winlin97: added unused function keys for special usage
// F1-F12 are binded in many Windows apps - also in Explorer
// Now You can write an external app that can recognize this keys
// as a triggers (StartKey -> Barcode -> StopKey),
// without any unexpected interactions with the system.
staticTemplates["F13"] = Key(0, 0x68)
staticTemplates["F14"] = Key(0, 0x69)
staticTemplates["F15"] = Key(0, 0x6a)
staticTemplates["F16"] = Key(0, 0x6b)
staticTemplates["F17"] = Key(0, 0x6c)
staticTemplates["F18"] = Key(0, 0x6d)
staticTemplates["F19"] = Key(0, 0x6e)
staticTemplates["F20"] = Key(0, 0x6f)
staticTemplates["F21"] = Key(0, 0x70)
staticTemplates["F22"] = Key(0, 0x71)
staticTemplates["F23"] = Key(0, 0x72)
staticTemplates["F24"] = Key(0, 0x73)

val dateFormat = DateFormat.getDateInstance(DateFormat.SHORT)
val timeFormat = DateFormat.getTimeInstance()

Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/values-de-rDE/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
<item>Spanisch (ES)</item>
<item>Italienisch (IT)</item>
<item>Türkisch Q (TR)</item>
<item>Polnische Programmierer (PL)</item>
</string-array>
<string-array name="highlight_values">
<item>Box</item>
Expand Down Expand Up @@ -191,7 +192,7 @@
<string name="custom_template">Eigenes Template</string>
<string name="custom_templ_desc">Erlaubt ein eigenes Template festzulegen</string>
<string name="custom_templ_desc_long">
Stellen Sie sicher, dass \'Extra Tasten\' auf \'Benutzerdefiniert\' eingestellt ist. Spezielle Platzhalter: {CODE}, {CODE_B64}, {CODE_HEX}, {F1–12}, {ENTER}, {ESC}, {TAB}, {BKSP}, {DATE}, {TIME}, {LEFT}, {RIGHT}, {UP}, {DOWN} (code ist erforderlich)\n
Stellen Sie sicher, dass \'Extra Tasten\' auf \'Benutzerdefiniert\' eingestellt ist. Spezielle Platzhalter: {CODE}, {CODE_B64}, {CODE_HEX}, {F1–24}, {ENTER}, {ESC}, {TAB}, {BKSP}, {DATE}, {TIME}, {LEFT}, {RIGHT}, {UP}, {DOWN} (code ist erforderlich)\n
Kombinationen können mit den folgenen Zeichen verwendet werden:\n
\t^: Shift\n
\t+: Ctrl\n
Expand Down Expand Up @@ -257,4 +258,4 @@
<string name="template_in_value_desc">Ersetzt Templates aus dem Code-Wert (Benötigt benutzerdefiniertes Template)</string>
<string name="error_connecting_to_device">Fehler bei der Verbindung mit dem Gerät! Starte service neu…</string>
<string name="developer_mode">Entwicklermodus</string>
</resources>
</resources>
17 changes: 9 additions & 8 deletions app/src/main/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
<string name="overlay_type_desc">Określ kształt ramki</string>
<string name="full_inside">Cały kod w ramce</string>
<string name="full_inside_desc">Kody kreskowe muszą być w pełni widoczne w obszarze ramki</string>
<string name="scan_freq">Częstotliwość skanowania</string>
<string name="scan_freq">Częstość skanowania</string>
<string name="scan_freq_desc">Interwał, w którym analizowany jest obraz. Wyższa częstotliwość = wyższe wykorzystanie procesora.</string>
<string name="scan_res">Rozdzielczość skanowania</string>
<string name="scan_res">Rozdzielczość skanera</string>
<string name="scan_res_desc">Rozdzielczość analizowanego obrazu. Wyższa rozdzielczość = dłuższy czas analizy.</string>
<string name="auto_send">Auto-wysyłanie</string>
<string name="auto_send_desc">Automatycznie wysyłaj wszystkie wykryte kody</string>
<string name="extra_keys">Extra klawisze</string>
<string name="extra_keys">Ekstra klawisze</string>
<string name="extra_keys_desc">Określa, który klawisz ma być dołączany na końcu każdego wysyłanego tekstu</string>
<string name="play_sound">Dźwięk skanowania</string>
<string name="play_sound_desc">Odtwórz dźwięk podczas skanowania kodu</string>
Expand Down Expand Up @@ -138,7 +138,7 @@
<string name="custom_template">Własny szablon</string>
<string name="custom_templ_desc">Umożliwia ustawienie niestandardowego szablonu</string>
<string name="custom_templ_desc_long">
Upewnij się, że ustawiłeś \'Ekstra klawisze\' na \'Własny szablon\'. Specjalne znaczniki: {CODE}, {CODE_B64}, {CODE_HEX}, {F1–12}, {ENTER}, {ESC}, {TAB}, {BKSP}, {DATE}, {TIME}, {LEFT}, {RIGHT}, {UP}, {DOWN} (znacznik CODE jest wymagany)\n
Upewnij się, że ustawiłeś \'Ekstra klawisze\' na \'Własny szablon\'. Specjalne znaczniki: {CODE}, {CODE_B64}, {CODE_HEX}, {F1–24}, {ENTER}, {ESC}, {TAB}, {BKSP}, {DATE}, {TIME}, {LEFT}, {RIGHT}, {UP}, {DOWN} (znacznik CODE jest wymagany)\n
Modyfikatory mogą być ustawione poprzez dodanie następujących znaków:\n
\t^: Shift\n
\t+: Ctrl\n
Expand Down Expand Up @@ -203,10 +203,10 @@
<item>Prostokątna (Kody kreskowe)</item>
</string-array>
<string-array name="scan_freq_values">
<item>Najszybsze</item>
<item>Szybkie (100ms)</item>
<item>Normalne (500ms)</item>
<item>Wolne (1s)</item>
<item>Najszybciej</item>
<item>Szybko (100ms)</item>
<item>Normalnie (500ms)</item>
<item>Wolno (1s)</item>
</string-array>
<string-array name="scan_res_values">
<item>SD (480P)</item>
Expand Down Expand Up @@ -244,6 +244,7 @@
<item>Hiszpański (ES)</item>
<item>Włoski (IT)</item>
<item>Turecki Q (TR)</item>
<item>Polski Programisty (PL)</item>
</string-array>
<string-array name="highlight_values">
<item>Ramka</item>
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
<string name="custom_template">Custom template</string>
<string name="custom_templ_desc">Allows you to set a custom template</string>
<string name="custom_templ_desc_long">
Make sure to set \'Extra keys\' to \'Custom\'. Special placeholders: {CODE}, {CODE_B64}, {CODE_HEX}, {F1–12}, {ENTER}, {ESC}, {TAB}, {BKSP}, {DATE}, {TIME}, {LEFT}, {RIGHT}, {UP}, {DOWN} (code is required)\n
Make sure to set \'Extra keys\' to \'Custom\'. Special placeholders: {CODE}, {CODE_B64}, {CODE_HEX}, {F1–24}, {ENTER}, {ESC}, {TAB}, {BKSP}, {DATE}, {TIME}, {LEFT}, {RIGHT}, {UP}, {DOWN} (code is required)\n
Modifiers can be set by prepending the following chars:\n
\t^: Shift\n
\t+: Ctrl\n
Expand Down Expand Up @@ -243,6 +243,7 @@
<item>Spanish (ES)</item>
<item>Italian (IT)</item>
<item>Turkish Q (TR)</item>
<item>Polish Programmer (PL)</item>
</string-array>
<string-array name="highlight_values">
<item>Box</item>
Expand All @@ -260,4 +261,4 @@
<item quantity="one">Export %1$d item</item>
<item quantity="other">Export %1$d items</item>
</plurals>
</resources>
</resources>

0 comments on commit 23327d7

Please sign in to comment.