diff --git a/src/main/java/org/medicmobile/webapp/mobile/EmbeddedBrowserActivity.java b/src/main/java/org/medicmobile/webapp/mobile/EmbeddedBrowserActivity.java index dafa0975..8705f831 100644 --- a/src/main/java/org/medicmobile/webapp/mobile/EmbeddedBrowserActivity.java +++ b/src/main/java/org/medicmobile/webapp/mobile/EmbeddedBrowserActivity.java @@ -60,6 +60,16 @@ public void onReceiveValue(String result) { } }; + private void setBackground(int background) { + View webviewContainer = findViewById(R.id.lytWebView); + webviewContainer.setPadding(10, 10, 10, 10); + webviewContainer.setBackgroundResource(background); + } + + private boolean isProduction(String appUrl) { + return appUrl != null && appUrl.contains("app.medicmobile.org"); + } + //> ACTIVITY LIFECYCLE METHODS @SuppressLint("ClickableViewAccessibility") @@ -84,12 +94,10 @@ public void onReceiveValue(String result) { this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); - // Add an alarming red border if using configurable (i.e. dev) - // app with a medic production server. - if (settings.allowsConfiguration() && appUrl != null && appUrl.contains("app.medicmobile.org")) { - View webviewContainer = findViewById(R.id.lytWebView); - webviewContainer.setPadding(10, 10, 10, 10); - webviewContainer.setBackgroundResource(R.drawable.warning_background); + if (settings.allowsConfiguration() && isProduction(appUrl)) { + setBackground(R.drawable.warning_background); + } else if (BuildConfig.IS_TRAINING_APP) { + setBackground(R.drawable.training_background); } // Add a noticeable border to easily identify a training app @@ -99,6 +107,14 @@ public void onReceiveValue(String result) { webviewContainer.setBackgroundResource(R.drawable.training_background); } + // Add an alarming red border if using configurable (i.e. dev) + // app with a medic production server. + if (settings.allowsConfiguration() && appUrl != null && appUrl.contains("app.medicmobile.org")) { + View webviewContainer = findViewById(R.id.lytWebView); + webviewContainer.setPadding(10, 10, 10, 10); + webviewContainer.setBackgroundResource(R.drawable.warning_background); + } + container = findViewById(R.id.wbvMain); getFragmentManager() .beginTransaction()