-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dialog with prominent disclosure to request location
Adds an interstitial dialog to explain why and how the app uses location data. #136
- Loading branch information
Showing
25 changed files
with
372 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/main/java/org/medicmobile/webapp/mobile/RequestPermissionActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.medicmobile.webapp.mobile; | ||
|
||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.view.Window; | ||
import android.widget.TextView; | ||
|
||
import static org.medicmobile.webapp.mobile.MedicLog.trace; | ||
|
||
/** | ||
* Shows a confirmation view that displays a "prominent" disclosure about how | ||
* the user geolocation data is used, asking to confirm whether to allow the app to | ||
* access the location or not. | ||
* | ||
* If the user accepts, a request to the API to access the location is made by the main activity, | ||
* but Android will show another confirmation dialog. If the user decline the first | ||
* confirmation, the request to the API is omitted and the decision recorded to avoid | ||
* requesting the same next time. | ||
*/ | ||
public class RequestPermissionActivity extends LockableActivity { | ||
|
||
@Override public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
this.requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
setContentView(R.layout.request_permission); | ||
String message = getResources().getString(R.string.locRequestMessage); | ||
String appName = getResources().getString(R.string.app_name); | ||
TextView field = (TextView) findViewById(R.id.locMessageText); | ||
field.setText(String.format(message, appName)); | ||
} | ||
|
||
public void onClickOk(View view) { | ||
trace(this, "onClickOk() :: user accepted to share the location"); | ||
setResult(RESULT_OK); | ||
finish(); | ||
} | ||
|
||
public void onClickNegative(View view) { | ||
trace(this, ":: onClickNegative() :: user denied to share the location"); | ||
setResult(RESULT_CANCELED); | ||
finish(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical" | ||
android:paddingLeft="16dp" | ||
android:paddingRight="16dp"> | ||
|
||
<ImageView | ||
android:id="@+id/locIcon" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="80dp" | ||
android:contentDescription="@string/locRequestIconDescription" | ||
android:scaleType="center" | ||
android:src="@drawable/location_pin" /> | ||
|
||
<TextView | ||
android:id="@+id/locTitleText" | ||
style="@android:style/Widget.DeviceDefault.Light.TextView" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@+id/locIcon" | ||
android:layout_marginTop="8dp" | ||
android:gravity="center" | ||
android:padding="10dp" | ||
android:text="@string/locRequestTitle" | ||
android:textSize="18sp" | ||
android:textStyle="bold" /> | ||
|
||
<TextView | ||
android:id="@+id/locMessageText" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@+id/locTitleText" | ||
android:layout_marginTop="10dp" | ||
android:gravity="center" | ||
android:padding="20dp" | ||
android:text="@string/locRequestMessage" | ||
android:textSize="18sp" /> | ||
|
||
<LinearLayout | ||
android:id="@+id/locButtons" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentEnd="true" | ||
android:layout_alignParentBottom="true" | ||
android:paddingLeft="20dp" | ||
android:paddingRight="20dp" | ||
android:paddingBottom="20dp"> | ||
|
||
<Button | ||
android:id="@+id/locNegativeButton" | ||
style="@style/Widget.AppCompat.Button.Borderless.Blue" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:onClick="onClickNegative" | ||
android:text="@string/locRequestDenyButton" | ||
tools:ignore="OnClick" /> | ||
|
||
<View | ||
android:layout_width="0dp" | ||
android:layout_height="0dp" | ||
android:layout_weight="1" /> | ||
|
||
<Button | ||
android:id="@+id/locOkButton" | ||
style="@style/Widget.AppCompat.Button.Borderless.Blue" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:onClick="onClickOk" | ||
android:text="@string/locRequestOkButton" | ||
tools:ignore="OnClick" /> | ||
</LinearLayout> | ||
|
||
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="locRequestTitle">I bɛ yɔrɔ min na</string> | ||
<string name="locRequestMessage">%s b\'a fɛ ka dɔn aw bɛ yɔrɔ min na walasa ka aw dɛmɛ kɛnɛya sabatili baraw la. I bolo da Awɔ kan ɲɛfɛ.</string> | ||
<string name="locRequestOkButton">Awɔ</string> | ||
<string name="locRequestDenyButton">Ayi man sɔn</string> | ||
<string name="locRequestIconDescription">Icône de mon emplacement</string> <!-- leave it in fr, not relevant --> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="locRequestTitle">Acceso a la ubicación</string> | ||
<string name="locRequestMessage">%s recolecta información de la ubicación para analizar y mejorar resultados de salud en tu área. Para permitir el acceso a la ubicación selecciona \"Activar\", y luego confirma en el próximo diálogo.</string> | ||
<string name="locRequestOkButton">Activar</string> | ||
<string name="locRequestDenyButton">No gracias</string> | ||
<string name="locRequestIconDescription">Ícono de mi ubicación</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="locRequestTitle">Accès à la position</string> | ||
<string name="locRequestMessage">%s collecte votre position pour analyser et améliorer les services de santé dans votre région. Pour permettre l\'accès aux données de position, sélectionnez \"Activer\" et confirmez à l\'écran qui suivra.</string> | ||
<string name="locRequestOkButton">Activer</string> | ||
<string name="locRequestDenyButton">Non merci</string> | ||
<string name="locRequestIconDescription">Icône de mon emplacement</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="locRequestTitle">स्थान का उपयोग</string> | ||
<string name="locRequestMessage">यह ऐप आपके क्षेत्र में स्वास्थ्य परिणामों का विश्लेषण और सुधार करने के लिए स्थान डेटा एकत्र करता है। स्थान पहुंच की अनुमति देने के लिए "चालू करें" चुनें, और फिर अगले संकेत की पुष्टि करें।</string> | ||
<string name="locRequestOkButton">चालू करो</string> | ||
<string name="locRequestDenyButton">जी नहीं, धन्यवाद</string> | ||
<string name="locRequestIconDescription">मेरा स्थान आइकन</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="locRequestTitle">Akses lokasi</string> | ||
<string name="locRequestMessage">%s mengumpulkan data lokasi untuk menganalisis dan meningkatkan hasil kesehatan di wilayah Anda. Untuk mengizinkan akses lokasi, pilih \"Nyalakan\", lalu konfirmasikan permintaan berikutnya.</string> | ||
<string name="locRequestOkButton">Nyalakan</string> | ||
<string name="locRequestDenyButton">Tidak, terima kasih</string> | ||
<string name="locRequestIconDescription">Ikon lokasiku</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="locRequestTitle">स्थान पहुँच</string> | ||
<string name="locRequestMessage">यो अनुप्रयोगले विश्लेषण गर्दछ र तपाईंको क्षेत्रमा स्वास्थ्य परिणामहरू सुधार गर्न स्थान डाटा संकलन गर्दछ। स्थान पहुँचलाई अनुमति दिन "खोल्नुहोस्" चयन गर्नुहोस्, र त्यसपछि अर्को प्रॉम्प्ट पुष्टि गर्नुहोस्।</string> | ||
<string name="locRequestOkButton">खोल्नुहोस्</string> | ||
<string name="locRequestDenyButton">धन्यबाद</string> | ||
<string name="locRequestIconDescription">मेरो स्थान आइकन</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.