Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change order of checks for adding the border color #286

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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