Skip to content

Commit

Permalink
Fix bug with hex input
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgames13 authored and marcauberer committed Dec 27, 2019
1 parent ec527ce commit 4473060
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
applicationId "com.mrgames13.jimdo.colorconverter"
minSdkVersion 19
targetSdkVersion 29
versionCode 202
versionName "2.0.2"
versionCode 203
versionName "2.0.3"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,12 @@ class MainActivity : AppCompatActivity() {
// Prepare views
hexValue.addTextChangedListener(object : SimpleTextWatcher() {
override fun afterTextChanged(s: Editable?) {
if(!s.toString().startsWith("#")) {
val value = s.toString()
if(!value.startsWith("#")) {
hexValue.setText("#")
Selection.setSelection(hexValue.text, hexValue.text.length)
} else {
if(value.length > 1 && !value.matches("#[a-fA-F0-9]+".toRegex())) s?.delete(value.length -1, value.length)
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = s.toString().length == 7 || s.toString().length == 4
}
}
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/layout/dialog_edit_hex.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@
android:inputType="textCapCharacters"
android:hint="@string/hex_code"
android:maxLength="7"
android:importantForAutofill="no"
android:digits="0123456789ABCDEF"/>
android:importantForAutofill="no"/>
</FrameLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Release: Working copy
Locale: de, German
Exported by: M&R Games
Exported at: Mon, 23 Dec 2019 16:41:59 +0000
Exported at: Fri, 27 Dec 2019 20:40:20 +0000
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="close">schließen</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-de/strings_colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Release: Working copy
Locale: de, German
Exported by: M&R Games
Exported at: Mon, 23 Dec 2019 13:31:29 +0100
Exported at: Fri, 27 Dec 2019 20:40:20 +0000
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="color_alice_blue">Aliceblau</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Release: Working copy
Locale: es, Spanish
Exported by: M&R Games
Exported at: Mon, 23 Dec 2019 16:42:00 +0000
Exported at: Fri, 27 Dec 2019 20:40:20 +0000
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="close">cerrar</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-es/strings_colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Release: Working copy
Locale: es, Spanish
Exported by: M&R Games
Exported at: Mon, 23 Dec 2019 13:31:29 +0100
Exported at: Fri, 27 Dec 2019 20:40:20 +0000
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="color_alice_blue">Azul Alicia</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Release: Working copy
Locale: fr, French
Exported by: M&R Games
Exported at: Mon, 23 Dec 2019 16:41:59 +0000
Exported at: Fri, 27 Dec 2019 20:40:19 +0000
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="close">fermer</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-fr/strings_colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Release: Working copy
Locale: fr, French
Exported by: M&R Games
Exported at: Mon, 23 Dec 2019 13:31:28 +0100
Exported at: Fri, 27 Dec 2019 20:40:20 +0000
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="color_alice_blue">Bleu alice</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Release: Working copy
Locale: en, English
Exported by: M&R Games
Exported at: Mon, 23 Dec 2019 16:41:59 +0000
Exported at: Fri, 27 Dec 2019 20:40:19 +0000
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="close">close</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings_colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Release: Working copy
Locale: en, English
Exported by: M&R Games
Exported at: Mon, 23 Dec 2019 13:31:28 +0100
Exported at: Fri, 27 Dec 2019 20:40:19 +0000
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="color_alice_blue">Alice Blue</string>
Expand Down

0 comments on commit 4473060

Please sign in to comment.