Skip to content

Commit

Permalink
Localization of the location dialog (default only)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsarm committed Dec 18, 2020
1 parent fee7034 commit 5bdabf6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,22 @@ public static void show(final EmbeddedBrowserActivity activity, final int reques
activity.locationRequestResolved();
return;
}
String message = activity.getResources().getString(R.string.locRequest_message);
String appName = activity.getResources().getString(R.string.app_name);
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
// TODO Define the final message and localize
AlertDialog alert = builder
.setTitle("Use your location")
.setTitle(R.string.locRequest_title)
.setIcon(android.R.drawable.ic_menu_mylocation)
.setMessage("This app collects location data to enable [feature], [feature], ...")
.setMessage(String.format(message, appName))
.setCancelable(true)
.setPositiveButton("Turn on", new DialogInterface.OnClickListener() {
.setPositiveButton(R.string.locRequest_okButton, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
trace(activity, "RequestPermissionDialog.show() :: " +
"user accepted to share the location");
ActivityCompat.requestPermissions(activity, LOCATION_PERMISSIONS, requestCode);
}
})
.setNegativeButton("No thanks", new DialogInterface.OnClickListener() {
.setNegativeButton(R.string.locRequest_denyButton, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
trace(activity, "RequestPermissionDialog.show() :: " +
"user denied to share the location");
Expand Down
5 changes: 5 additions & 0 deletions src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,9 @@
<string name="promptChooseImage">Choose image</string>

<string name="spnCompressingImage">Compressing image…</string>

<string name="locRequest_title">Location Access</string>
<string name="locRequest_message">%s collects location data when you submit a form to analyze and improve health outcomes in your area. Select \"Allow while using the app\" on the next screen to turn on your location access.</string>
<string name="locRequest_okButton">OK</string>
<string name="locRequest_denyButton">No thanks</string>
</resources>

0 comments on commit 5bdabf6

Please sign in to comment.