From 72bf1634c52e63dc129a4a68394f22bd420e419a Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Mon, 23 Nov 2020 10:18:51 +0700 Subject: [PATCH 1/5] fix(android/oem): Check keyboard selected before allowing setup --- .../com/firstvoices/keyboards/MainActivity.java | 13 ++++++++++--- .../android/app/src/main/res/values/strings.xml | 3 +++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/oem/firstvoices/android/app/src/main/java/com/firstvoices/keyboards/MainActivity.java b/oem/firstvoices/android/app/src/main/java/com/firstvoices/keyboards/MainActivity.java index 904180db53..6618af44d9 100644 --- a/oem/firstvoices/android/app/src/main/java/com/firstvoices/keyboards/MainActivity.java +++ b/oem/firstvoices/android/app/src/main/java/com/firstvoices/keyboards/MainActivity.java @@ -10,6 +10,8 @@ import android.webkit.JavascriptInterface; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; +import android.widget.Toast; + import androidx.appcompat.app.AppCompatActivity; import io.sentry.android.core.SentryAndroid; @@ -184,8 +186,13 @@ public class MainActivity extends AppCompatActivity { @SuppressWarnings("unused") @JavascriptInterface public void showSetup() { - Intent setupIntent = new Intent(context, SetupActivity.class); - context.startActivity(setupIntent); + // Ensure a keyboard has been selected first + if (didCompleteSelectKeyboard()) { + Intent setupIntent = new Intent(context, SetupActivity.class); + context.startActivity(setupIntent); + } else { + Toast.makeText(context, context.getString(R.string.select_keyboard_first), Toast.LENGTH_SHORT).show(); + } } @SuppressWarnings("unused") @@ -197,7 +204,7 @@ public class MainActivity extends AppCompatActivity { } } - private boolean didCompleteSelectKeyboard() { + private static boolean didCompleteSelectKeyboard() { return FVShared.getInstance().activeKeyboardCount() > 0; } diff --git a/oem/firstvoices/android/app/src/main/res/values/strings.xml b/oem/firstvoices/android/app/src/main/res/values/strings.xml index 1a5df18dbb..8cd2fca2e6 100644 --- a/oem/firstvoices/android/app/src/main/res/values/strings.xml +++ b/oem/firstvoices/android/app/src/main/res/values/strings.xml @@ -4,4 +4,7 @@ Setup Regions Keyboards + + + Select Keyboard first From 6bccea9303a9ef9500c36c43c67ce00fbe99399f Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Mon, 23 Nov 2020 14:36:56 +0700 Subject: [PATCH 2/5] fix(android/oem): Disable setup until language chosen Also fix css --- oem/firstvoices/android/.editorconfig | 8 + .../assets/setup/android-instructions.css | 6 +- .../app/src/main/assets/setup/main.html | 155 ++++++++++-------- .../firstvoices/keyboards/MainActivity.java | 10 +- .../app/src/main/res/values/strings.xml | 3 - 5 files changed, 99 insertions(+), 83 deletions(-) create mode 100644 oem/firstvoices/android/.editorconfig diff --git a/oem/firstvoices/android/.editorconfig b/oem/firstvoices/android/.editorconfig new file mode 100644 index 0000000000..3d06afcbda --- /dev/null +++ b/oem/firstvoices/android/.editorconfig @@ -0,0 +1,8 @@ +root = true + +; applies to all files +[*] +indent_style = space + +[*.{java, sh, css, html, xml}] +indent_size = 4 diff --git a/oem/firstvoices/android/app/src/main/assets/setup/android-instructions.css b/oem/firstvoices/android/app/src/main/assets/setup/android-instructions.css index 5634bca7b7..22906c3e98 100644 --- a/oem/firstvoices/android/app/src/main/assets/setup/android-instructions.css +++ b/oem/firstvoices/android/app/src/main/assets/setup/android-instructions.css @@ -110,7 +110,7 @@ h2{ .step-number span { display: block; height: 30px; - line-height: 30px; + line-height: 15px; margin: 15px auto; width: 30px; -webkit-filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.2)); @@ -123,7 +123,7 @@ h2{ color: white; text-align: center; font-family: 'Nunito'; - font-size: 1.5em; + font-size: 1.0em; font-weight: bold; } @@ -155,7 +155,7 @@ h2{ height: 30px; line-height: 30px; text-transform: uppercase; - width: 150px; + width: 180px; } #supporters{ diff --git a/oem/firstvoices/android/app/src/main/assets/setup/main.html b/oem/firstvoices/android/app/src/main/assets/setup/main.html index e57b951577..04e2dbaba5 100644 --- a/oem/firstvoices/android/app/src/main/assets/setup/main.html +++ b/oem/firstvoices/android/app/src/main/assets/setup/main.html @@ -1,61 +1,77 @@ - - FirstVoices Keyboards installation - - - - - + disableButton2(); + } - + function disableButton2() { + var button2 = document.getElementById("button2"); + button2.disabled = true; + window.console.log("Disabling button2"); + } -
- + function enableButton2() { + var button2 = document.getElementById("button2"); + button2.disabled = false; + window.console.log("Enabling button2"); + } + + function setCheckBox2On() { + var checkbox2 = document.getElementById("checkbox2"); + if (checkbox2.src != "check-on.png") { + checkbox2.src = "check-on.png"; + checkbox2.style.opacity = 1.0; + } + } + + function setCheckBox2Off() { + var checkbox2 = document.getElementById("checkbox2"); + if (checkbox2.src != "check-off.png") { + checkbox2.src = "check-off.png"; + checkbox2.style.opacity = 0.25; + } + } + + + + + +
+

Installation instructions

@@ -68,32 +84,33 @@
2
-

CheckBox

+

+ CheckBox

-

To use FirstVoices Keyboards

-

After completing these steps above, selected FirstVoices keyboards will be available on your Android device.

-
+

To use FirstVoices Keyboards

+

After completing these steps above, selected FirstVoices keyboards will be available on your Android device.

+
-
-

FirstVoices gratefully acknowledges the following supporters of this project:

- - - -
+
+

FirstVoices gratefully acknowledges the following supporters of this project:

+ + + +
-
-

If you like this app please consider supporting FirstVoices by donating to the First Peoples' Cultural Foundation

-

Donate

-
+
+

If you like this app please consider supporting FirstVoices by donating to the First Peoples' Cultural Foundation

+

Donate

+
- + - + \ No newline at end of file diff --git a/oem/firstvoices/android/app/src/main/java/com/firstvoices/keyboards/MainActivity.java b/oem/firstvoices/android/app/src/main/java/com/firstvoices/keyboards/MainActivity.java index 6618af44d9..c717c5e7f0 100644 --- a/oem/firstvoices/android/app/src/main/java/com/firstvoices/keyboards/MainActivity.java +++ b/oem/firstvoices/android/app/src/main/java/com/firstvoices/keyboards/MainActivity.java @@ -10,7 +10,6 @@ import android.webkit.JavascriptInterface; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; -import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; @@ -186,13 +185,8 @@ public class MainActivity extends AppCompatActivity { @SuppressWarnings("unused") @JavascriptInterface public void showSetup() { - // Ensure a keyboard has been selected first - if (didCompleteSelectKeyboard()) { - Intent setupIntent = new Intent(context, SetupActivity.class); - context.startActivity(setupIntent); - } else { - Toast.makeText(context, context.getString(R.string.select_keyboard_first), Toast.LENGTH_SHORT).show(); - } + Intent setupIntent = new Intent(context, SetupActivity.class); + context.startActivity(setupIntent); } @SuppressWarnings("unused") diff --git a/oem/firstvoices/android/app/src/main/res/values/strings.xml b/oem/firstvoices/android/app/src/main/res/values/strings.xml index 8cd2fca2e6..1a5df18dbb 100644 --- a/oem/firstvoices/android/app/src/main/res/values/strings.xml +++ b/oem/firstvoices/android/app/src/main/res/values/strings.xml @@ -4,7 +4,4 @@ Setup Regions Keyboards - - - Select Keyboard first From 46c8436d3749ee1737ad8d504debd3de775c68fc Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Mon, 23 Nov 2020 14:46:01 +0700 Subject: [PATCH 3/5] fix(android/oem): Visually disable button2 --- oem/firstvoices/android/app/src/main/assets/setup/main.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oem/firstvoices/android/app/src/main/assets/setup/main.html b/oem/firstvoices/android/app/src/main/assets/setup/main.html index 04e2dbaba5..aaa0a487d9 100644 --- a/oem/firstvoices/android/app/src/main/assets/setup/main.html +++ b/oem/firstvoices/android/app/src/main/assets/setup/main.html @@ -38,13 +38,13 @@ function disableButton2() { var button2 = document.getElementById("button2"); button2.disabled = true; - window.console.log("Disabling button2"); + button2.style.opacity = 0.25; } function enableButton2() { var button2 = document.getElementById("button2"); button2.disabled = false; - window.console.log("Enabling button2"); + button2.style.opacity = 1.0; } function setCheckBox2On() { From 752b5e98f8a3a8456e9c7e2091f247041aba61f1 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Tue, 24 Nov 2020 10:04:09 +0700 Subject: [PATCH 4/5] fix(android/oem): Cleanup CSS Per review comments: * Don't upper-case button text * Fix vertical alignment * Use CSS to toggle opacity --- .../assets/setup/android-instructions.css | 137 ++++++++++-------- .../app/src/main/assets/setup/main.html | 60 ++++---- .../firstvoices/keyboards/MainActivity.java | 16 +- 3 files changed, 109 insertions(+), 104 deletions(-) diff --git a/oem/firstvoices/android/app/src/main/assets/setup/android-instructions.css b/oem/firstvoices/android/app/src/main/assets/setup/android-instructions.css index 22906c3e98..7098b794e7 100644 --- a/oem/firstvoices/android/app/src/main/assets/setup/android-instructions.css +++ b/oem/firstvoices/android/app/src/main/assets/setup/android-instructions.css @@ -17,19 +17,19 @@ } html, body{ - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - padding: 0; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + padding: 0; } html{ - margin: 0; - min-height: 100%; - position: relative; + margin: 0; + min-height: 100%; + position: relative; } body{ - background: #f7511e; + background: #f7511e; background: -moz-linear-gradient(25deg, #f7511e 0%, #aa1225 55%, #9f031f 100%); background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,#f7511e), color-stop(55%,#aa1225), color-stop(100%,#9f031f)); background: -webkit-linear-gradient(25deg, #f7511e 0%,#aa1225 55%,#9f031f 100%); @@ -37,19 +37,19 @@ body{ background: -ms-linear-gradient(25deg, #f7511e 0%,#aa1225 55%,#9f031f 100%); /*background: linear-gradient(25deg, #f7511e 0%,#aa1225 55%,#9f031f 100%);*/ - color: #fff; - font-family: 'Open Sans'; - margin: 0 0 200px 0; + color: #fff; + font-family: 'Open Sans'; + margin: 0 0 200px 0; } #instructions{ - padding: 0 30px 10px; - width: calc(100% - 60px); + padding: 0 30px 10px; + width: calc(100% - 60px); } #instructions p{ - font-size: 0.875em; - margin: 15px 0; + font-size: 0.875em; + margin: 15px 0; } #logo { @@ -59,8 +59,8 @@ body{ } #logo img{ - max-width: 400px; - width: 100%; + max-width: 400px; + width: 100%; } #logo p{ @@ -73,44 +73,44 @@ body{ } h2{ - color: #ffd988; - font-family: 'Nunito'; - font-size: 1.25em; - font-weight: normal; + color: #ffd988; + font-family: 'Nunito'; + font-size: 1.25em; + font-weight: normal; } .steps{ - display: table; - width: 100%; + display: table; + width: 100%; } .step{ - display: table-row; + display: table-row; } .step-number, .step-instruction{ - border-bottom: 1px solid #A0BC76; - display: table-cell; - vertical-align: top; + border-bottom: 1px solid #A0BC76; + display: table-cell; + vertical-align: top; } .step-number{ - width: 80px; + width: 80px; } .step-number img{ - display: block; - height: 30px; - margin: 15px auto; - width: 30px; - -webkit-filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.2)); - filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.2)); + display: block; + height: 30px; + margin: 15px auto; + width: 30px; + -webkit-filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.2)); + filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.2)); } .step-number span { display: block; height: 30px; - line-height: 15px; + line-height: 25px; margin: 15px auto; width: 30px; -webkit-filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.2)); @@ -128,34 +128,49 @@ h2{ } .steps.use .step-number, .steps.use .step-instruction{ - border-bottom: 0 none; + border-bottom: 0 none; } .step-instruction{ - margin-top: 10px; + margin-top: 10px; } .step-instruction img{ - -webkit-filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.1)); - filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.1)); - height: 30px; - margin-right: 5px; - vertical-align: top; - width: 30px; - opacity: 0.25; + -webkit-filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.1)); + filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.1)); + height: 30px; + margin-right: 5px; + vertical-align: top; + width: 30px; + opacity: 0.25; } .step-instruction input[type="button"]{ - background-color: #DDDDDD; - border: 0 none; - border-radius: 5px; - color: #333; - -webkit-filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.1)); - filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.1)); - height: 30px; - line-height: 30px; - text-transform: uppercase; - width: 180px; + background-color: #DDDDDD; + border: 0 none; + border-radius: 5px; + color: #333; + -webkit-filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.1)); + filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.1)); + height: 30px; + line-height: 30px; + width: 150px; +} + +.checkIconOff { + alt: 'CheckBoxOff'; + background: url('check-off.png'); + opacity: 0.25; +} + +.checkIconOn { + alt: 'CheckBoxOn'; + background: url('check-on.png'); + opacity: 1.0; +} + +#button2:disabled { + opacity: 0.25; } #supporters{ @@ -207,9 +222,9 @@ h2{ } #footer{ - background-color: #605E4B; - color: #CFCEC8; - height: 200px; + background-color: #605E4B; + color: #CFCEC8; + height: 200px; bottom: 0; left: 0; position: absolute; @@ -218,15 +233,15 @@ h2{ } #footer h2, #footer a{ - color: #CFCEC8; + color: #CFCEC8; } #footer p{ - font-size: 0.875em; - margin: 5px 0; + font-size: 0.875em; + margin: 5px 0; } #footer img{ - height: auto; - width: 50px; + height: auto; + width: 50px; } \ No newline at end of file diff --git a/oem/firstvoices/android/app/src/main/assets/setup/main.html b/oem/firstvoices/android/app/src/main/assets/setup/main.html index aaa0a487d9..536338998c 100644 --- a/oem/firstvoices/android/app/src/main/assets/setup/main.html +++ b/oem/firstvoices/android/app/src/main/assets/setup/main.html @@ -15,52 +15,40 @@ window.jsInterface.showRegionList(); } - function setCheckBox1On() { - var checkbox1 = document.getElementById("checkbox1"); - if (checkbox1.src != "check-on.png") { - checkbox1.src = "check-on.png"; - checkbox1.style.opacity = 1.0; - } + function setCheckBoxOn(id) { + var checkbox = document.getElementById(id); + if (checkbox) { + if (checkbox.className != "checkIconOn") { + checkbox.className = "checkIconOn"; + } - enableButton2(); + if (id == "checkbox1") { + enableButton2(); + } + } } - function setCheckBox1Off() { - var checkbox1 = document.getElementById("checkbox1"); - if (checkbox1.src != "check-off.png") { - checkbox1.src = "check-off.png"; - checkbox1.style.opacity = 0.25; - } + function setCheckBoxOff(id) { + var checkbox = document.getElementById(id); + if (checkbox) { + if (checkbox.className != "checkIconOff") { + checkbox.className = "checkIconOff"; + } - disableButton2(); + if (id == "checkbox1") { + disableButton2(); + } + } } function disableButton2() { var button2 = document.getElementById("button2"); button2.disabled = true; - button2.style.opacity = 0.25; } function enableButton2() { var button2 = document.getElementById("button2"); button2.disabled = false; - button2.style.opacity = 1.0; - } - - function setCheckBox2On() { - var checkbox2 = document.getElementById("checkbox2"); - if (checkbox2.src != "check-on.png") { - checkbox2.src = "check-on.png"; - checkbox2.style.opacity = 1.0; - } - } - - function setCheckBox2Off() { - var checkbox2 = document.getElementById("checkbox2"); - if (checkbox2.src != "check-off.png") { - checkbox2.src = "check-off.png"; - checkbox2.style.opacity = 0.25; - } } @@ -78,14 +66,16 @@
1
-

CheckBox

+

+

2
+

- CheckBox

+

@@ -109,7 +99,7 @@

Developed by

SIL International

-

www.keyman.com

+

www.keyman.com

diff --git a/oem/firstvoices/android/app/src/main/java/com/firstvoices/keyboards/MainActivity.java b/oem/firstvoices/android/app/src/main/java/com/firstvoices/keyboards/MainActivity.java index c717c5e7f0..4e254c74a1 100644 --- a/oem/firstvoices/android/app/src/main/java/com/firstvoices/keyboards/MainActivity.java +++ b/oem/firstvoices/android/app/src/main/java/com/firstvoices/keyboards/MainActivity.java @@ -121,14 +121,14 @@ public class MainActivity extends AppCompatActivity { @Override public void onPageFinished(WebView view, String url) { if (didCompleteSelectKeyboard()) - view.loadUrl("javascript:setCheckBox1On();"); + view.loadUrl("javascript:setCheckBoxOn('checkbox1');"); else - view.loadUrl("javascript:setCheckBox1Off();"); + view.loadUrl("javascript:setCheckBoxOff('checkbox1');"); if (didCompleteSetup()) - view.loadUrl("javascript:setCheckBox2On();"); + view.loadUrl("javascript:setCheckBoxOn('checkbox2');"); else - view.loadUrl("javascript:setCheckBox2Off();"); + view.loadUrl("javascript:setCheckBoxOff('checkbox2');"); } }); @@ -142,14 +142,14 @@ public class MainActivity extends AppCompatActivity { WebView webView = findViewById(R.id.webView); if (webView != null) { if (didCompleteSelectKeyboard()) - webView.loadUrl("javascript:setCheckBox1On();"); + webView.loadUrl("javascript:setCheckBoxOn('checkbox1');"); else - webView.loadUrl("javascript:setCheckBox1Off();"); + webView.loadUrl("javascript:setCheckBoxOff('checkbox1');"); if (didCompleteSetup()) - webView.loadUrl("javascript:setCheckBox2On();"); + webView.loadUrl("javascript:setCheckBoxOn('checkbox2');"); else - webView.loadUrl("javascript:setCheckBox2Off();"); + webView.loadUrl("javascript:setCheckBoxOff('checkbox2');"); } } From 59aa301ea4b8e32b913c410882c055cb094709de Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Thu, 26 Nov 2020 10:48:10 +1100 Subject: [PATCH 5/5] fix(oem/fv/android): tweaked check boxes I opted to make the checkbox invisible when the step has not been completed. This seemed to look a little clearer when I tried it. --- .../main/assets/setup/android-instructions.css | 16 +++++++++------- .../android/app/src/main/assets/setup/main.html | 6 +++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/oem/firstvoices/android/app/src/main/assets/setup/android-instructions.css b/oem/firstvoices/android/app/src/main/assets/setup/android-instructions.css index 7098b794e7..947b2e3020 100644 --- a/oem/firstvoices/android/app/src/main/assets/setup/android-instructions.css +++ b/oem/firstvoices/android/app/src/main/assets/setup/android-instructions.css @@ -1,17 +1,17 @@ @font-face { font-family: "Nunito"; - src: url("nunito-regular-webfont.eot"); + src: url("nunito-regular-webfont.eot"); src: url("nunito-regular-webfont.ttf") format("truetype"), - url("nunito-regular-webfont.otf") format("opentype"), + url("nunito-regular-webfont.otf") format("opentype"), url("nunito-regular-webfont.woff") format("woff"), url("nunito-regular-webfont.svg#nunitoregular") format("svg"); } @font-face { font-family: "Open Sans"; - src: url("opensans-regular-webfont.eot"); + src: url("opensans-regular-webfont.eot"); src: url("opensans-regular-webfont.ttf") format("truetype"), - url("opensans-regular-webfont.otf") format("opentype"), + url("opensans-regular-webfont.otf") format("opentype"), url("opensans-regular-webfont.woff") format("woff"), url("opensans-regular-webfont.svg#open_sansregular") format("svg"); } @@ -135,14 +135,14 @@ h2{ margin-top: 10px; } -.step-instruction img{ +.step-instruction span{ + display: inline-block; -webkit-filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.1)); filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.1)); height: 30px; margin-right: 5px; vertical-align: top; width: 30px; - opacity: 0.25; } .step-instruction input[type="button"]{ @@ -160,12 +160,14 @@ h2{ .checkIconOff { alt: 'CheckBoxOff'; background: url('check-off.png'); - opacity: 0.25; + background-size: contain; + opacity: 0; } .checkIconOn { alt: 'CheckBoxOn'; background: url('check-on.png'); + background-size: contain; opacity: 1.0; } diff --git a/oem/firstvoices/android/app/src/main/assets/setup/main.html b/oem/firstvoices/android/app/src/main/assets/setup/main.html index 536338998c..7972ba9128 100644 --- a/oem/firstvoices/android/app/src/main/assets/setup/main.html +++ b/oem/firstvoices/android/app/src/main/assets/setup/main.html @@ -66,8 +66,8 @@
1
-

-

+

+

@@ -75,7 +75,7 @@

-

+