diff --git a/api/QCVOC.Api/Veterans/Data/DTO/VeteranEnrollRequest.cs b/api/QCVOC.Api/Veterans/Data/DTO/VeteranEnrollRequest.cs index 02073ab7..153357e4 100644 --- a/api/QCVOC.Api/Veterans/Data/DTO/VeteranEnrollRequest.cs +++ b/api/QCVOC.Api/Veterans/Data/DTO/VeteranEnrollRequest.cs @@ -49,7 +49,7 @@ public class VeteranEnrollRequest /// Gets or sets the primary phone number of the Veteran. /// [Required] - [Phone] + [RegularExpression(@"^[1-9][0-9]{9}$")] public string PrimaryPhone { get; set; } /// diff --git a/api/QCVOC.Api/Veterans/Data/DTO/VeteranUpdateRequest.cs b/api/QCVOC.Api/Veterans/Data/DTO/VeteranUpdateRequest.cs index 78b4ecc5..6d8254a4 100644 --- a/api/QCVOC.Api/Veterans/Data/DTO/VeteranUpdateRequest.cs +++ b/api/QCVOC.Api/Veterans/Data/DTO/VeteranUpdateRequest.cs @@ -49,7 +49,7 @@ public class VeteranUpdateRequest /// Gets or sets the primary phone number of the Veteran. /// [Required] - [Phone] + [RegularExpression(@"^[1-9][0-9]{9}$")] public string PrimaryPhone { get; set; } /// diff --git a/mobile-new/app/src/main/java/org/qccoders/qcvoc/MainActivity.java b/mobile-new/app/src/main/java/org/qccoders/qcvoc/MainActivity.java index ba46744a..9894cb50 100644 --- a/mobile-new/app/src/main/java/org/qccoders/qcvoc/MainActivity.java +++ b/mobile-new/app/src/main/java/org/qccoders/qcvoc/MainActivity.java @@ -6,32 +6,50 @@ package org.qccoders.qcvoc; import android.content.Intent; +import android.graphics.Bitmap; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; -import android.view.KeyCharacterMap; -import android.view.KeyEvent; +import android.view.View; import android.webkit.JavascriptInterface; import android.webkit.WebView; import android.webkit.WebViewClient; +import android.widget.ProgressBar; import com.google.android.gms.samples.vision.barcodereader.BarcodeCaptureActivity; import com.google.android.gms.vision.barcode.Barcode; public class MainActivity extends AppCompatActivity { private WebView webview; + private ProgressBar progressBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); + progressBar = findViewById(R.id.loading_spinner); + progressBar.setVisibility(View.GONE); + webview = findViewById(R.id.webView); + webview.setWebViewClient(new WebViewClient() { + @Override + public void onPageStarted(WebView view, String url, Bitmap favicon) { + super.onPageStarted(view, url, favicon); + progressBar.setVisibility(View.VISIBLE); + } + + @Override + public void onPageFinished(WebView view, String url) { + super.onPageFinished(view, url); + progressBar.setVisibility(View.GONE); + } + }); + webview.addJavascriptInterface(this, "Android"); - webview.setWebViewClient(new WebViewClient()); webview.getSettings().setJavaScriptEnabled(true); webview.getSettings().setDomStorageEnabled(true); - webview.loadUrl("http://dev.qcvoc.qccoders.org"); + webview.loadUrl("http://qcvoc-dev.s3-website-us-east-1.amazonaws.com"); } @JavascriptInterface @@ -45,17 +63,13 @@ public void scanBarcode() { @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (data != null) { - KeyCharacterMap keymap = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD); - Barcode barcode = data.getParcelableExtra(BarcodeCaptureActivity.BarcodeObject); - String outputString = "^" + barcode.displayValue + "$"; - KeyEvent[] outputKeyEvents = keymap.getEvents(outputString.toCharArray()); - Log.d("MainActivity", outputString); + Log.d("MainActivity", barcode.displayValue); - for (int i = 0; i < outputKeyEvents.length; i++) { - dispatchKeyEvent(outputKeyEvents[i]); - } + webview.evaluateJavascript( + "window.barcodeScanned(" + barcode.displayValue + ");", + null); } } } diff --git a/mobile-new/app/src/main/res/layout/activity_main.xml b/mobile-new/app/src/main/res/layout/activity_main.xml index 3638c91e..a2e17e87 100644 --- a/mobile-new/app/src/main/res/layout/activity_main.xml +++ b/mobile-new/app/src/main/res/layout/activity_main.xml @@ -11,4 +11,14 @@ android:layout_width="match_parent" android:layout_height="match_parent"/> + + \ No newline at end of file diff --git a/mobile-new/app/src/main/res/values/styles.xml b/mobile-new/app/src/main/res/values/styles.xml index 0eb88fe3..5e404d91 100644 --- a/mobile-new/app/src/main/res/values/styles.xml +++ b/mobile-new/app/src/main/res/values/styles.xml @@ -1,7 +1,7 @@ -