Commit 9a0ab3b5 authored by idic's avatar idic

畫面&UUID Fix

parent 6b1953f0
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.prlab.idic.privacypolicy">
package="org.prlab.idic.privacypolicy">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:launchMode="singleTop">
android:name=".MainActivity"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ReportActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo"/>
android:name=".ReportActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme" />
<activity
android:name=".DialogPolicyDetailActivity"
android:theme="@android:style/Theme.Holo.Dialog"/>
android:name=".DialogPolicyDetailActivity"
android:theme="@style/AppTheme" />
<activity
android:name=".DialogDeviceInfoActivity"
android:label="@string/message_device_information"
android:theme="@android:style/Theme.Holo.Dialog"/>
android:name=".DialogDeviceInfoActivity"
android:label="@string/message_device_information"
android:theme="@style/AppTheme" />
<provider
android:name=".storage.PrivacyPolicyProvider"
android:authorities="@string/content_authority"
android:exported="true"/>
android:name=".storage.PrivacyPolicyProvider"
android:authorities="@string/content_authority"
android:exported="true" />
<activity
android:parentActivityName=".MainActivity"
android:name=".DeviceOperatorActivity"/>
android:name=".DeviceOperatorActivity"
android:parentActivityName=".MainActivity" />
</application>
......
......@@ -47,10 +47,10 @@ public class DeviceOperatorActivity extends AppCompatActivity {
private BroadcastReceiver mPairRequestReceiver;
private BroadcastReceiver mBondStateReceiver;
private final UUID PRIVACY_NEGOTIATION_UUID = UUID.fromString("22220000-2222-2222-2222-222222222222");
private final UUID PRIVACY_POLICY_UUID = UUID.fromString("2222aaaa-2222-2222-2222-222222222222");
private final UUID PRIVACY_ACTION_UUID = UUID.fromString("2222bbbb-2222-2222-2222-222222222222");
private final UUID PRIVACY_PREFERENCE_UUID = UUID.fromString("2222cccc-2222-2222-2222-222222222222");
private final UUID PRIVACY_NEGOTIATION_UUID = UUID.fromString("4ac42222-ca19-8f91-1b4e-9d988b87413a");
private final UUID PRIVACY_POLICY_UUID = UUID.fromString("4ac42223-ca19-8f91-1b4e-9d988b87413a");
private final UUID PRIVACY_ACTION_UUID = UUID.fromString("4ac42224-ca19-8f91-1b4e-9d988b87413a");
private final UUID PRIVACY_PREFERENCE_UUID = UUID.fromString("4ac42225-ca19-8f91-1b4e-9d988b87413a");
private final int BLE_POLICY_QUERY = 0x00;
private final int BLE_POLICY_ACCEPT = 0x01;
......@@ -91,9 +91,9 @@ public class DeviceOperatorActivity extends AppCompatActivity {
}
}
private final UUID ROOT_UUID = UUID.fromString("01122334-4556-6778-899a-abbccddeeff0");
private final UUID TEMPERATURE_UUID = UUID.fromString("01122335-4556-6778-899a-abbccddeeff0");
private final UUID AIR_UUID = UUID.fromString("01122336-4556-6778-899a-abbccddeeff0");
private final UUID ROOT_UUID = UUID.fromString("c0b72334-d6fb-a7a2-7942-e43d3db5fa8f");
private final UUID TEMPERATURE_UUID = UUID.fromString("c0b72335-d6fb-a7a2-7942-e43d3db5fa8f");
private final UUID AIR_UUID = UUID.fromString("c0b72336-d6fb-a7a2-7942-e43d3db5fa8f");
private final UUID CCCD_UUID = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb");
private View.OnClickListener mTemperatureClickedListener = new View.OnClickListener() {
......@@ -324,8 +324,8 @@ public class DeviceOperatorActivity extends AppCompatActivity {
if (PRIVACY_PREFERENCE_UUID.equals(characteristic.getUuid())) {
int action = BaseUtils.bytesToInt(values);
addMessage("Policy Setting",
"Policy " + target + " -> " +
(action == BLE_POLICY_ACCEPT ? " is accepted" : "declined") + ".");
"Policy " + target + " -> " + " is " +
(action == BLE_POLICY_ACCEPT ? "accepted" : "declined") + ".");
continueNegotiating();
} else if (AIR_UUID.equals(characteristic.getUuid())) {
resolveAirPurifier(BaseUtils.bytesToInt(values));
......
......@@ -57,6 +57,9 @@ public class DialogDeviceInfoActivity extends Activity {
items.add(new InfoItem()
.setKey(getString(R.string.device_model_description_key))
.setValue(mDevice.getModel().getDescription()));
items.add(new InfoItem()
.setKey(getString(R.string.device_model_location_key))
.setValue(mDevice.getLocation()));
items.add(new InfoItem()
.setKey(getString(R.string.device_upc_key))
.setValue(mDevice.getUPC()));
......
......@@ -7,6 +7,7 @@ import android.content.Intent;
import android.content.Loader;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
......@@ -159,6 +160,8 @@ public class ReportActivity extends Activity implements LoaderManager.LoaderCall
}
}
private long startTime;
@Override
public Loader<PrivacyPolicyReport> onCreateLoader(int id, Bundle args) {
return new AsyncTaskLoader<PrivacyPolicyReport>(this) {
......@@ -172,6 +175,7 @@ public class ReportActivity extends Activity implements LoaderManager.LoaderCall
@Override
public PrivacyPolicyReport loadInBackground() {
startTime = System.currentTimeMillis();
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url(getString(R.string.get_policy_url))
......@@ -192,6 +196,7 @@ public class ReportActivity extends Activity implements LoaderManager.LoaderCall
@Override
public void onLoadFinished(Loader<PrivacyPolicyReport> loader, PrivacyPolicyReport report) {
Log.i(TAG, String.valueOf(System.currentTimeMillis() - startTime));
if (null != report) {
mPrivacyPolicyReport = report;
mLayerIDs.add(report.getRoot().getUUID());
......
......@@ -32,7 +32,7 @@ public class StatementRecyclerViewAdapter extends RecyclerView.Adapter<Statement
private List<Statement> statements;
public StatementRecyclerViewAdapter(Resources resources, List<Statement> statements) {
CONSEQUENCE_TITLE = resources.getString(R.string.policy_statement_related_uuid_title);
CONSEQUENCE_TITLE = resources.getString(R.string.policy_statement_consequence_title);
PURPOSE_TYPE_TITLE = resources.getString(R.string.policy_statement_purpose_type);
PURPOSE_DESCRIPTION_TITLE = resources.getString(R.string.policy_statement_purpose_description);
......@@ -142,7 +142,7 @@ public class StatementRecyclerViewAdapter extends RecyclerView.Adapter<Statement
void bind(int listIndex) {
Statement statement = statements.get(listIndex);
bindRelatedUUID(statement.getRelatedUUID());
bindRelatedUUID(statement.getConsequence());
bindPurposes(statement.getPurposes());
bindData(statement.getData());
bindRemedies(statement.getRemedies());
......
......@@ -17,6 +17,7 @@ public class Device implements Parcelable {
private Manufacturer manufacturer;
private Model model;
private String UPC;
private String location;
private List<Icon> icons = new LinkedList<>();
public Device() {
......@@ -29,6 +30,7 @@ public class Device implements Parcelable {
manufacturer = in.readParcelable(Manufacturer.class.getClassLoader());
model = in.readParcelable(Model.class.getClassLoader());
UPC = in.readString();
location = in.readString();
icons = in.createTypedArrayList(Icon.CREATOR);
}
......@@ -40,6 +42,7 @@ public class Device implements Parcelable {
dest.writeParcelable(manufacturer, flags);
dest.writeParcelable(model, flags);
dest.writeString(UPC);
dest.writeString(location);
dest.writeTypedList(icons);
}
......@@ -128,6 +131,15 @@ public class Device implements Parcelable {
return this;
}
public String getLocation() {
return location;
}
public Device setLocation(String location) {
this.location = location;
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
......@@ -142,7 +154,10 @@ public class Device implements Parcelable {
return false;
if (model != null ? !model.equals(device.model) : device.model != null) return false;
if (UPC != null ? !UPC.equals(device.UPC) : device.UPC != null) return false;
if (location != null ? !location.equals(device.location) : device.location != null)
return false;
return icons != null ? icons.equals(device.icons) : device.icons == null;
}
@Override
......@@ -153,6 +168,7 @@ public class Device implements Parcelable {
result = 31 * result + (manufacturer != null ? manufacturer.hashCode() : 0);
result = 31 * result + (model != null ? model.hashCode() : 0);
result = 31 * result + (UPC != null ? UPC.hashCode() : 0);
result = 31 * result + (location != null ? location.hashCode() : 0);
result = 31 * result + (icons != null ? icons.hashCode() : 0);
return result;
}
......
......@@ -11,7 +11,7 @@ import java.util.List;
*/
public class Statement implements Parcelable {
private String relatedUUID;
private String consequence;
private List<Purpose> purposes = new LinkedList<>();
private List<Datum> data = new LinkedList<>();
private List<Recipient> recipients = new LinkedList<>();
......@@ -22,7 +22,7 @@ public class Statement implements Parcelable {
}
private Statement(Parcel in) {
relatedUUID = in.readString();
consequence = in.readString();
purposes = in.createTypedArrayList(Purpose.CREATOR);
data = in.createTypedArrayList(Datum.CREATOR);
recipients = in.createTypedArrayList(Recipient.CREATOR);
......@@ -49,7 +49,7 @@ public class Statement implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(relatedUUID);
dest.writeString(consequence);
dest.writeTypedList(purposes);
dest.writeTypedList(data);
dest.writeTypedList(recipients);
......@@ -57,12 +57,12 @@ public class Statement implements Parcelable {
dest.writeParcelable(retention, flags);
}
public String getRelatedUUID() {
return relatedUUID;
public String getConsequence() {
return consequence;
}
public Statement setRelatedUUID(String relatedUUID) {
this.relatedUUID = relatedUUID;
public Statement setConsequence(String consequence) {
this.consequence = consequence;
return this;
}
......@@ -138,7 +138,7 @@ public class Statement implements Parcelable {
Statement statement = (Statement) o;
if (relatedUUID != null ? !relatedUUID.equals(statement.relatedUUID) : statement.relatedUUID != null)
if (consequence != null ? !consequence.equals(statement.consequence) : statement.consequence != null)
return false;
if (purposes != null ? !purposes.equals(statement.purposes) : statement.purposes != null) return false;
if (data != null ? !data.equals(statement.data) : statement.data != null) return false;
......@@ -149,7 +149,7 @@ public class Statement implements Parcelable {
@Override
public int hashCode() {
int result = relatedUUID != null ? relatedUUID.hashCode() : 0;
int result = consequence != null ? consequence.hashCode() : 0;
result = 31 * result + (purposes != null ? purposes.hashCode() : 0);
result = 31 * result + (data != null ? data.hashCode() : 0);
result = 31 * result + (recipients != null ? recipients.hashCode() : 0);
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:id="@+id/button_device_back"
android:layout_width="@dimen/button_width_size"
android:layout_height="@dimen/item_size"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/median_size"
android:layout_marginTop="@dimen/median_size"
android:onClick="onBackButtonClick"
android:text="@string/message_back"
android:textSize="@dimen/font_bigger_size" />
<android.support.v7.widget.RecyclerView
tools:listitem="@layout/recycler_view_item_horizontally"
app:layoutManager="android.support.v7.widget.LinearLayoutManager"
android:id="@+id/layout_device_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<android.support.v7.widget.RecyclerView
android:visibility="gone"
tools:listitem="@layout/recycler_view_icon"
app:layoutManager="android.support.v7.widget.LinearLayoutManager"
android:id="@+id/layout_device_icon"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_above="@id/button_device_back"
android:id="@+id/layout_device_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="android.support.v7.widget.LinearLayoutManager"
tools:listitem="@layout/recycler_view_item_horizontally" />
<Button
android:layout_marginTop="@dimen/median_size"
android:layout_marginBottom="@dimen/median_size"
android:layout_gravity="center"
android:text="@string/message_back"
android:onClick="onBackButtonClick"
android:id="@+id/button_device_back"
android:textSize="@dimen/font_bigger_size"
android:layout_width="@dimen/button_width_size"
android:layout_height="@dimen/item_size"/>
<android.support.v7.widget.RecyclerView
android:layout_above="@id/button_device_back"
android:id="@+id/layout_device_icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
app:layoutManager="android.support.v7.widget.LinearLayoutManager"
tools:listitem="@layout/recycler_view_icon" />
</LinearLayout>
\ No newline at end of file
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
......@@ -7,7 +6,7 @@
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent">
<LinearLayout
android:layout_alignParentBottom="true"
......
......@@ -11,7 +11,7 @@
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:id="@+id/text_key"
android:textSize="@dimen/font_normal_size"
android:textSize="@dimen/font_middle_size"
android:minHeight="@dimen/small_item_size"
android:layout_width="@dimen/text_key_size"
android:layout_height="wrap_content"/>
......@@ -24,7 +24,7 @@
android:layout_marginStart="@dimen/median_size"
android:layout_toEndOf="@id/text_key"
android:layout_alignParentEnd="true"
android:textSize="@dimen/font_normal_size"
android:textSize="@dimen/font_middle_size"
android:minHeight="@dimen/small_item_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
......
......@@ -7,13 +7,11 @@
android:layout_height="wrap_content">
<Button
tools:text="111111111111-1111-1111-1111-11111111"
tools:text="111111111111-1111-1111-1111-111111111111111111"
android:gravity="center"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:id="@+id/button_item"
android:textSize="@dimen/font_middle_size"
android:layout_width="match_parent"
android:layout_height="@dimen/item_size"/>
android:layout_height="wrap_content"/>
</LinearLayout>
\ No newline at end of file
......@@ -14,7 +14,7 @@
android:layout_height="wrap_content">
<TextView
android:text="@string/policy_statement_related_uuid_title"
android:text="@string/policy_statement_consequence_title"
android:gravity="center_vertical"
android:textSize="@dimen/font_middle_size"
android:layout_width="match_parent"
......
......@@ -5,6 +5,7 @@
<dimen name="small_size">5dp</dimen>
<dimen name="median_size">8dp</dimen>
<dimen name="item_size">50sp</dimen>
<dimen name="item_double_size">60sp</dimen>
<dimen name="small_item_size">30sp</dimen>
<dimen name="font_bigger_size">20sp</dimen>
<dimen name="font_middle_size">16sp</dimen>
......
......@@ -66,6 +66,8 @@
translatable="false">Model Url</string>
<string name="device_model_description_key"
translatable="false">Model Description</string>
<string name="device_model_location_key"
translatable="false">Location</string>
<string name="device_upc_key"
translatable="false">UPC</string>
......@@ -91,7 +93,7 @@
<string name="policy_statement_dispute_related_organization">Organization</string>
<string name="policy_statement_dispute_resolution_type">Type</string>
<string name="policy_statement_related_uuid_title">RelatedUUID</string>
<string name="policy_statement_consequence_title">Consequence</string>
<string name="policy_statement_access_title">Access</string>
<string name="policy_statement_remedies">Remedies</string>
<string name="policy_statement_title">Statement</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment