Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand All @@ -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()
Expand Down