Navigation Menu

Skip to content

Commit

Permalink
Data disclosure form work
Browse files Browse the repository at this point in the history
  • Loading branch information
audaciouscode committed Jan 8, 2017
1 parent b26d339 commit e07ab9b
Show file tree
Hide file tree
Showing 24 changed files with 913 additions and 8 deletions.
6 changes: 5 additions & 1 deletion AndroidManifest.xml
Expand Up @@ -5,10 +5,14 @@
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.READ_SMS" />
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme">
<application android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:theme="@style/AppTheme">
<activity android:name="com.audacious_software.passive_data_kit.activities.generators.MicrosoftBandAuthActivity" android:label="@string/app_name" />
<activity android:name="com.audacious_software.passive_data_kit.activities.generators.RequestPermissionActivity" android:label="@string/app_name" />
<activity android:name="com.audacious_software.passive_data_kit.activities.DiagnosticsActivity" android:label="@string/app_name" />
<activity android:name="com.audacious_software.passive_data_kit.activities.DataStreamActivity" android:label="@string/app_name" />
<activity android:name="com.audacious_software.passive_data_kit.activities.DataDisclosureActivity" android:label="@string/app_name" />
<activity android:name="com.audacious_software.passive_data_kit.activities.DataDisclosureDetailActivity" android:label="@string/app_name" />
</application>
</manifest>
26 changes: 26 additions & 0 deletions assets/html/passive_data_kit/generator_location_disclosure.html
@@ -0,0 +1,26 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<style type="text/css">
body,
* {
font-family:-apple-system,Helvetica Neue;
font-size: 16px;
}

body {
background-color: F5F5F5;
}
</style>

</head>
<body>
<p>
<em>TODO: Write disclosure for use of location data...</em>
</p>

<p>
Place completed file in <code>assets/html/passive_data_kit/generator_location_disclosure.html</code> in your project to override this placeholder.
</p>
</body>
</html>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions res/layout/dialog_location_randomized.xml
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:text="@string/message_location_accuracy_randomized"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp" />

<EditText android:id="@+id/random_range"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:inputType="number"/>
</LinearLayout>
18 changes: 18 additions & 0 deletions res/layout/dialog_location_user.xml
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:text="@string/message_location_accuracy_user"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp" />

<EditText android:id="@+id/user_location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:inputType="textCapWords" />
</LinearLayout>
19 changes: 19 additions & 0 deletions res/layout/layout_data_disclosure_detail_pdk.xml
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout android:id="@+id/data_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
</FrameLayout>
<View android:id="@+id/splitter"
android:layout_width="match_parent"
android:layout_height="8dp"
android:background="@color/colorPrimary" />
<ListView android:id="@+id/disclosure_actions"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
31 changes: 31 additions & 0 deletions res/layout/layout_data_disclosure_pdk.xml
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout android:id="@+id/data_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView android:text="@string/pdk_message_select_disclosure"
android:gravity="center"
android:padding="32dp"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
<View android:id="@+id/splitter"
android:layout_width="match_parent"
android:layout_height="8dp"
android:background="@color/colorPrimary" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<android.support.v7.widget.RecyclerView
android:id="@+id/list_view"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"/>
</FrameLayout>
</LinearLayout>
19 changes: 19 additions & 0 deletions res/layout/row_disclosure_action_pdk.xml
@@ -0,0 +1,19 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:id="@+id/data_collection_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<TextView android:id="@+id/action_title"
android:textSize="16sp"
android:textStyle="bold"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView android:id="@+id/action_description"
android:textSize="14sp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
26 changes: 26 additions & 0 deletions res/layout/row_disclosure_location_accuracy_pdk.xml
@@ -0,0 +1,26 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<LinearLayout android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView android:id="@+id/action_title"
android:textSize="16sp"
android:textStyle="bold"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView android:id="@+id/action_description"
android:textSize="14sp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<CheckBox android:id="@+id/action_checked"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
25 changes: 25 additions & 0 deletions res/layout/row_generator_disclosure_generic.xml
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:background="#ffffff">
<TextView android:id="@+id/label_generator"
android:gravity="center_vertical"
android:textSize="20sp"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"/>
<ImageView android:id="@+id/button_disclosure_item"
android:src="@drawable/ic_button_disclosure_setting"
android:layout_width="48dp"
android:layout_height="48dp" />
</LinearLayout>
<View android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#e0e0e0" />
</LinearLayout>
27 changes: 27 additions & 0 deletions res/values/generators.xml
Expand Up @@ -43,6 +43,33 @@
<!-- Location Resources -->
<string name="generator_location">Device Location</string>
<string name="generator_location_value">Coordinates: %1$.4f, %2$.4f</string>
<string name="label_data_collection_location_accuracy">Location Accuracy</string>
<string name="label_data_collection_location_accuracy_more">Tap here to update the accuracy of your data.</string>

<string name="label_data_collection_location_accuracy_best">Best Accuracy</string>
<string name="label_data_collection_location_accuracy_best_more">Best Available Data From Location Hardware</string>

<string name="label_data_collection_location_accuracy_randomized">Locally Randomized</string>
<string name="label_data_collection_location_accuracy_randomized_more">Location Combined With Random Noise</string>

<string name="label_data_collection_location_accuracy_user">User Provided</string>
<string name="label_data_collection_location_accuracy_user_more">Static Location Provided By User</string>

<string name="label_data_collection_location_accuracy_disabled">Disabled</string>
<string name="label_data_collection_location_accuracy_disabled_more">App Does Not Use Location Data</string>

<string name="title_location_accuracy_best">Best Accuracy</string>
<string name="message_location_accuracy_best">This app will use the location hardware on this device to obtain the most accurate location readings.</string>

<string name="title_location_accuracy_disabled">Location Disabled</string>
<string name="message_location_accuracy_disabled">This app will not use your location, but use an placeholder instead.</string>

<string name="title_location_accuracy_randomized">Locally Randomized</string>
<string name="message_location_accuracy_randomized">Please enter the random distance (miles/kilometers)to use to obfuscate your exact location:</string>

<string name="title_location_accuracy_user">User Provided</string>
<string name="message_location_accuracy_user">Please enter a postal code or city and province to use as your location:</string>
<string name="toast_location_lookup_failed">Unable to find your location. Please enter your location another way and try again.</string>

<!-- Screen State Resources -->
<string name="generator_screen_state">Screen State</string>
Expand Down
7 changes: 7 additions & 0 deletions res/values/strings.xml
Expand Up @@ -4,6 +4,7 @@
<string name="pdk_version">0.0.1</string>
<string name="unknown_version">Unknown Version</string>
<string name="activity_data_stream">Data Stream</string>
<string name="action_continue">Continue</string>

<plurals name="activity_data_stream_subtitle">
<item quantity="one">%d generator</item>
Expand All @@ -20,5 +21,11 @@
<string name="title_pdk_diagnostics">Diagnostics</string>

<string name="message_no_diagnostic_actions">The app is set up correctly.\n\nNo further actions are needed.</string>

<string name="title_data_disclosure">Passive Data Disclosure</string>
<string name="pdk_message_select_disclosure">Select a disclosure item for more information&#8230;</string>

<string name="label_data_collection_description">Data Collection Description</string>
<string name="label_data_collection_description_more">Tap here to learn how this app uses your data.</string>
</resources>

@@ -0,0 +1,44 @@
package com.audacious_software.passive_data_kit.activities;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.MenuItem;
import android.widget.FrameLayout;

import com.audacious_software.passive_data_kit.activities.generators.GeneratorsAdapter;
import com.audacious_software.pdk.passivedatakit.R;

public class DataDisclosureActivity extends AppCompatActivity {
private GeneratorsAdapter mAdapter = null;

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.layout_data_disclosure_pdk);
this.getSupportActionBar().setTitle(R.string.title_data_disclosure);
this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);

FrameLayout dataView = (FrameLayout) this.findViewById(R.id.data_view);

this.mAdapter = new GeneratorsAdapter();
this.mAdapter.setContext(this.getApplicationContext());
this.mAdapter.setDataView(dataView);

RecyclerView listView = (RecyclerView) this.findViewById(R.id.list_view);

listView.setLayoutManager(new LinearLayoutManager(this));

listView.setAdapter(this.mAdapter);
}

public boolean onOptionsItemSelected(MenuItem item)
{
if (item.getItemId() == android.R.id.home)
{
this.finish();
}

return true;
}
}

0 comments on commit e07ab9b

Please sign in to comment.