-
-
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.
Location disclosure refactor: change dialog by an activity / layout
- Loading branch information
Showing
14 changed files
with
207 additions
and
74 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
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.locRequest_message); | ||
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(); | ||
} | ||
} |
67 changes: 0 additions & 67 deletions
67
src/main/java/org/medicmobile/webapp/mobile/RequestPermissionDialog.java
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24" | ||
android:tint="#63A2C6" | ||
android:alpha="0.8"> | ||
<path | ||
android:fillColor="@android:color/white" | ||
android:pathData="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.87 -3.13,-7 -7,-7zM12,11.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z"/> | ||
</vector> |
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,79 @@ | ||
<?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="128dp" | ||
android:contentDescription="@string/locRequest_IconDescription" | ||
android:scaleType="center" | ||
android:scaleX="2" | ||
android:scaleY="2" | ||
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="10dp" | ||
android:gravity="center" | ||
android:padding="10dp" | ||
android:text="@string/locRequest_title" | ||
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/locRequest_message" | ||
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/locRequest_denyButton" | ||
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/locRequest_okButton" | ||
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
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