Commit 9c755131 authored by DESKTOP-NFGF3PG\zxa01's avatar DESKTOP-NFGF3PG\zxa01

commit recycle view of privacy report

parent 6913b966
......@@ -38,7 +38,7 @@
android:screenOrientation="portrait"></activity>
<activity
android:name=".privacy.PrivacyActivity"
android:name=".privacy.view.PrivacyActivity"
android:label="@string/title_privacy"
android:screenOrientation="portrait" />
</application>
......
......@@ -35,12 +35,20 @@ public class Api {
}
public interface ApiInterface {
@GET("/api/breeds/list/all")
Call<Object> getDevices();
@POST("/api/breeds/list/all")
Call<Object> login();
@GET("/api/breeds/list/all")
Call<Object> getDevices();
@GET("/api/breeds/list/all")
Call<Object> getDevice();
@GET("/api/breeds/list/all")
Call<Object> getPrivacyPolicyReport();
// @GET("/api/breed/{breed}/images")
// Call<DogBreedImages> getImagesByBreed(@Path("breed") String breed);
......
package com.example.zxa01.iotclient.detail.model;
import android.databinding.BaseObservable;
import android.databinding.ObservableField;
import android.util.Log;
import com.example.zxa01.iotclient.common.http.Api;
import com.example.zxa01.iotclient.common.pojo.device.Device;
import com.example.zxa01.iotclient.common.pojo.device.Manufacturer;
import com.example.zxa01.iotclient.common.pojo.device.Model;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class DetailModel extends BaseObservable {
private ObservableField<Device> device;
public DetailModel() {
device = new ObservableField<>();
}
public ObservableField<Device> getDevice(){
return device;
}
public void fetchDevice() {
Callback<Object> callback = new Callback<Object>() {
@Override
public void onResponse(Call<Object> call, Response<Object> response) {
// TODO transfer response
Log.i("Test", response.message());
device.set(new Device()
.setUDN("a1252c49-4188-4e6d-a32e-66604c664fb8")
.setName("指尖式血氧機")
.setType(Device.Type.Sensor)
.setManufacturer(new Manufacturer()
.setName("Facelake")
.setSerialNumber("3176927193")
.setUrl("http://facelake.com"))
.setModel(new Model()
.setName("指尖式血氧機")
.setDescription("本設備是為符合不同領域及照護應用而設計,並把這些特色融入小如指節的分析儀中,可在數秒內量測出準確可靠的血氧及心跳值。")
.setUrl("https://www.amazon.com/Pulse-Oximeter-Blood-Oxygen-Monitor/dp/B00HXXO332"))
.setUPC("B00HXXO332")
.setLocation("25.013068, 121.541651")
.setStatus(Device.Status.Disconnected));
}
@Override
public void onFailure(Call<Object> call, Throwable t) {
Log.e("fetchDevice - onFailure()", t.getMessage(), t);
}
};
Api.getApi().getDevice().enqueue(callback);
}
}
......@@ -8,17 +8,26 @@ import android.widget.Toolbar;
import com.example.zxa01.iotclient.R;
import com.example.zxa01.iotclient.databinding.ActivityDetailBinding;
import com.example.zxa01.iotclient.detail.viewModel.DetailViewModel;
public class DetailActivity extends AppCompatActivity {
private ActivityDetailBinding binding;
private DetailViewModel viewModel;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_detail);
viewModel = new DetailViewModel(binding.getRoot().getContext());
binding.setViewModel(viewModel);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
init();
}
public void init(){
viewModel.fetchDevice();
}
@Override
......
package com.example.zxa01.iotclient.detail.viewModel;
import com.example.zxa01.iotclient.common.pojo.device.Device;
import com.example.zxa01.iotclient.detail.model.DetailModel;
import com.example.zxa01.iotclient.privacy.view.PrivacyActivity;
import android.arch.lifecycle.ViewModel;
import android.content.Context;
import android.content.Intent;
import android.databinding.ObservableBoolean;
import android.databinding.ObservableField;
public class DetailViewModel extends ViewModel {
public ObservableBoolean isLoading = new ObservableBoolean(true);
public ObservableField<Device> device = new ObservableField<>();
private DetailModel detailModel = new DetailModel();
private Context context;
public DetailViewModel(Context context) {
this.device.set(new Device());
this.context = context;
}
public void fetchDevice() {
detailModel.fetchDevice();
}
public ObservableField<Device> getDevice() {
isLoading.set(false);
return detailModel.getDevice();
}
public void setDevice(Device device) {
this.device.set(device);
}
public void settingPrivacy() {
context.startActivity(
new Intent(context, PrivacyActivity.class)
.putExtra("udn", device.get().getUDN()));
}
public void downloadPrivacyReport() {
// TODO download
}
}
......@@ -32,7 +32,6 @@ public class HomeActivity extends AppCompatActivity implements
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_home);
setupFragment(binding.navigation);
showFragment(mDeviceFragment);
}
......@@ -80,7 +79,7 @@ public class HomeActivity extends AppCompatActivity implements
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (resultCode == RESULT_OK) {
new DeviceViewModel().createDevice(intent.getStringExtra("SCAN_RESULT"));
// new DeviceViewModel().createDevice(intent.getStringExtra("SCAN_RESULT"));
} else {
new AlertDialog.Builder(this)
.setMessage(R.string.qrcode_error)
......
package com.example.zxa01.iotclient.home.device.model;
import com.example.zxa01.iotclient.common.http.Api;
import com.example.zxa01.iotclient.common.pojo.device.Device;
import com.example.zxa01.iotclient.common.pojo.device.Manufacturer;
import com.example.zxa01.iotclient.common.pojo.device.Model;
import android.arch.lifecycle.MutableLiveData;
import android.databinding.BaseObservable;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class DeviceModel extends BaseObservable {
private String status;
private List<Device> deviceList;
private MutableLiveData<List<Device>> devices;
......@@ -59,11 +54,9 @@ public class DeviceModel extends BaseObservable {
public void onResponse(Call<Object> call, Response<Object> response) {
// TODO transfer response
Log.i("Test", response.message());
DeviceModel deviceModel = new DeviceModel();
deviceModel.addDevice(oxygenDevice);
deviceModel.addDevice(oxygenDevice);
devices.setValue(deviceModel.deviceList);
status = "success";
addDevice(oxygenDevice);
addDevice(oxygenDevice);
devices.setValue(deviceList);
}
@Override
......@@ -80,11 +73,4 @@ public class DeviceModel extends BaseObservable {
// TODO api post-createDevice & update
}
public String getStatus() {
return status;
}
public void setStatus(String statue) {
this.status = statue;
}
}
......@@ -23,6 +23,8 @@ public class DeviceCreateFragment extends DialogFragment {
private static final String QRCODE_CODE_MODE = "QR_CODE_MODE";
private static final int QRCODE_REQUEST_CODE = 0;
private DeviceViewModel viewModel;
private FragmentDeviceCreateBinding binding;
......@@ -37,7 +39,7 @@ public class DeviceCreateFragment extends DialogFragment {
(dialog, whichButton) -> qrcodeIntent()
)
.setPositiveButton(R.string.button_correct,
(dialog, whichButton) -> new DeviceViewModel().createDevice("address")
(dialog, whichButton) -> viewModel.createDevice("address")
)
.setNegativeButton(R.string.button_cancel, (dialog, whichButton) -> {
})
......@@ -53,6 +55,8 @@ public class DeviceCreateFragment extends DialogFragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
binding = DataBindingUtil.inflate(inflater, R.layout.fragment_device_create, container, false);
viewModel = new DeviceViewModel(binding.getRoot().getContext());
binding.setViewModel(viewModel);
return binding.getRoot();
}
......
......@@ -16,20 +16,14 @@ import java.util.List;
public class DeviceViewModel extends ViewModel {
public ObservableBoolean isLoading = new ObservableBoolean(true);
private Context context;
private DeviceModel deviceModel = new DeviceModel();
private DeviceAdapter adapter = new DeviceAdapter(R.layout.recycler_view_device, this);
private Context context;
public DeviceViewModel(Context context) {
this.context = context;
}
public DeviceViewModel() {
}
/**
* model
*/
......@@ -44,7 +38,7 @@ public class DeviceViewModel extends ViewModel {
public void createDevice(String address) {
deviceModel.createDevice(address);
this.refreshDevices();
refreshDevices();
}
/**
......
......@@ -16,8 +16,6 @@ public class LoginModel extends BaseObservable {
return isAuthorized;
}
public void login(@NonNull LoginMessage message) {
isAuthorized.setValue(true);
// Callback<Object> callback = new Callback<Object>() {
......
......@@ -16,7 +16,7 @@ public class LoginViewModel extends ViewModel {
private LoginModel loginModel = new LoginModel();
public LoginViewModel(Context context) {
this.loginMessage.set(new LoginMessage());
loginMessage.set(new LoginMessage());
this.context = context;
}
......
package com.example.zxa01.iotclient.privacy;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class PrivacyActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_privacy);
}
}
package com.example.zxa01.iotclient.privacy.model;
import android.arch.lifecycle.MutableLiveData;
import android.databinding.BaseObservable;
import android.util.Log;
import com.example.zxa01.iotclient.common.http.Api;
import com.example.zxa01.iotclient.common.pojo.device.Device;
import com.example.zxa01.iotclient.common.pojo.device.Manufacturer;
import com.example.zxa01.iotclient.common.pojo.device.Model;
import com.example.zxa01.iotclient.common.pojo.privacy.PrivacyPolicy;
import com.example.zxa01.iotclient.common.pojo.privacy.PrivacyPolicyReport;
import com.example.zxa01.iotclient.common.pojo.privacy.p3p.Access;
import com.example.zxa01.iotclient.common.pojo.privacy.p3p.Collector;
import com.example.zxa01.iotclient.common.pojo.privacy.p3p.Datum;
import com.example.zxa01.iotclient.common.pojo.privacy.p3p.Dispute;
import com.example.zxa01.iotclient.common.pojo.privacy.p3p.Purpose;
import com.example.zxa01.iotclient.common.pojo.privacy.p3p.Recipient;
import com.example.zxa01.iotclient.common.pojo.privacy.p3p.Remedy;
import com.example.zxa01.iotclient.common.pojo.privacy.p3p.Retention;
import com.example.zxa01.iotclient.common.pojo.privacy.p3p.Statement;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class PrivacyModel extends BaseObservable {
private MutableLiveData<PrivacyPolicyReport> privacyPolicyReport;
// fake p3p
private Device oxygenDevice = new Device()
.setUDN("a1252c49-4188-4e6d-a32e-66604c664fb8")
.setName("指尖式血氧機")
.setType(Device.Type.Sensor)
.setManufacturer(new Manufacturer()
.setName("Facelake")
.setSerialNumber("3176927193")
.setUrl("http://facelake.com"))
.setModel(new Model()
.setName("指尖式血氧機")
.setDescription("本設備是為符合不同領域及照護應用而設計,並把這些特色融入小如指節的分析儀中,可在數秒內量測出準確可靠的血氧及心跳值。")
.setUrl("https://www.amazon.com/Pulse-Oximeter-Blood-Oxygen-Monitor/dp/B00HXXO332"))
.setUPC("B00HXXO332")
.setLocation("25.013068, 121.541651")
.setStatus(Device.Status.Disconnected);
private PrivacyPolicyReport oxygenPrivacyPolicyReport = new PrivacyPolicyReport()
.setId("0cfb6be3-6f0f-4e63-85b8-e9c936707c0b")
.setVersion("1.0")
.setDescription("為提供您最佳的互動照護服務,本APP部分服務內容可能會請您提供心跳資訊及血氧飽和度資訊,以作為持續自動追蹤心率的技術,提供整日健康狀況的深入分析以及運動強度的資訊。")
.setDevice(oxygenDevice)
.addPrivacyPolicy(new PrivacyPolicy()
.setId("119df569-06b1-4d63-84cd-bde7c9e4ab7e")
.setDescription("為提供您最佳的互動照護服務,本APP部分服務內容可能會請您提供血氧飽和度資訊,以作為呼吸系統疾病、循環系統疾病、其它治療、檢查引起的損傷之遠端醫療照護分析資料。")
.setCollector(new Collector()
.setName("健康促進中心")
.setEmail("[email protected]")
.setPhone("0988415875"))
.setAccess(Access.OTHER_IDENT)
.setDispute(new Dispute()
.setRelatedOrganization("地方法院")
.setType(Dispute.Type.LAW))
.addRemedy(new Remedy()
.setType(Remedy.Type.LAW))
.addStatement(new Statement()
.setConsequence("a1252c49-4188-4e6d-a32e-66604c664fb9")
.addPurpose(new Purpose()
.setType(Purpose.Type.PSEUDO_ANALYSIS)
.setDescription("本APP會使用者蒐集血氧飽和度資訊作為呼吸系統疾病、循環系統疾病、其它治療、檢查引起的損傷之遠端醫療照護分析資料。"))
.addDatum(new Datum()
.setType(Datum.Type.HEALTH)
.setDescription("血氧飽和度資訊"))
.addRecipient(new Recipient()
.setEntity("健康促進中心")
.setType(Recipient.Type.OURS))
.setRetention(Retention.STATED_PURPOSE)))
.addPrivacyPolicy(new PrivacyPolicy()
.setId("abe5ca7b-780e-4857-87e6-014870fe0a3f")
.setDescription("為提供您最佳的互動照護服務,本APP會蒐集使用者心跳資訊,作為持續自動追蹤心率的技術,提供整日健康狀況的深入分析以及運動強度的資訊。")
.setCollector(new Collector()
.setName("健康促進中心")
.setEmail("[email protected]")
.setPhone("0988415875"))
.setAccess(Access.OTHER_IDENT)
.setDispute(new Dispute()
.setRelatedOrganization("地方法院")
.setType(Dispute.Type.LAW))
.addRemedy(new Remedy()
.setType(Remedy.Type.CORRECT))
.addRemedy(new Remedy()
.setType(Remedy.Type.LAW))
.addRemedy(new Remedy()
.setType(Remedy.Type.MONEY))
.addStatement(new Statement()
.setConsequence("a1252c49-4188-4e6d-a32e-66604c664fba")
.addPurpose(new Purpose()
.setType(Purpose.Type.INDIVIDUAL_ANALYSIS)
.setDescription("本APP會蒐集使用者心跳資訊,作為持續自動追蹤心率的技術,提供整日健康狀況的深入分析以及運動強度的資訊。"))
.addDatum(new Datum()
.setType(Datum.Type.HEALTH)
.setDescription("心跳資訊"))
.addRecipient(new Recipient()
.setEntity("健康促進中心")
.setType(Recipient.Type.OURS))
.setRetention(Retention.STATED_PURPOSE)));
public PrivacyModel() {
privacyPolicyReport = new MutableLiveData<>();
}
public MutableLiveData<PrivacyPolicyReport> getPrivacyPolicyReport() {
return privacyPolicyReport;
}
public void fetchPrivacyPolicyReport() {
Callback<Object> callback = new Callback<Object>() {
@Override
public void onResponse(Call<Object> call, Response<Object> response) {
// TODO transfer response
Log.i("Test", response.message());
privacyPolicyReport.setValue(oxygenPrivacyPolicyReport);
}
@Override
public void onFailure(Call<Object> call, Throwable t) {
Log.e("fetchPrivacyPolicyReport - onFailure()", t.getMessage(), t);
}
};
Api.getApi().getPrivacyPolicyReport().enqueue(callback);
}
public void updatePP(String privacyId,boolean consent) {
// TODO update 偏好
}
}
package com.example.zxa01.iotclient.privacy.view;
import android.databinding.DataBindingUtil;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
import com.example.zxa01.iotclient.R;
import com.example.zxa01.iotclient.databinding.ActivityPrivacyBinding;
import com.example.zxa01.iotclient.detail.viewModel.DetailViewModel;
import com.example.zxa01.iotclient.privacy.viewModel.PrivacyViewModel;
public class PrivacyActivity extends AppCompatActivity {
private ActivityPrivacyBinding binding;
private PrivacyViewModel viewModel;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_privacy);
viewModel = new PrivacyViewModel(binding.getRoot().getContext());
binding.setViewModel(viewModel);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
init();
}
private void init() {
viewModel.fetchPrivacyPolicyReport();
viewModel.getPrivacyPolicyReport().observe(this,
privacyPolicies -> viewModel.setAdapter(privacyPolicies.getPolicies()));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
}
return super.onOptionsItemSelected(item);
}
}
package com.example.zxa01.iotclient.privacy.view;
import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.example.zxa01.iotclient.BR;
import com.example.zxa01.iotclient.common.pojo.device.Device;
import com.example.zxa01.iotclient.common.pojo.privacy.PrivacyPolicy;
import com.example.zxa01.iotclient.home.device.viewModel.DeviceViewModel;
import com.example.zxa01.iotclient.privacy.viewModel.PrivacyViewModel;
import java.util.List;
public class PrivacyAdapter extends RecyclerView.Adapter<PrivacyAdapter.MyViewHolder> {
private int layoutId;
private List<PrivacyPolicy> privacyPolicyList;
private PrivacyViewModel viewModel;
public PrivacyAdapter(@LayoutRes int layoutId, PrivacyViewModel viewModel) {
this.layoutId = layoutId;
this.viewModel = viewModel;
}
private int getLayoutIdForPosition(int position) {
return layoutId;
}
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new MyViewHolder(DataBindingUtil.inflate(
LayoutInflater.from(parent.getContext()), viewType, parent, false));
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
holder.bind(viewModel, position);
}
@Override
public int getItemCount() {
return privacyPolicyList == null ? 0 : privacyPolicyList.size();
}
@Override
public int getItemViewType(int position) {
return getLayoutIdForPosition(position);
}
public void setDevices(List<PrivacyPolicy> privacyPolicyList) {
this.privacyPolicyList = privacyPolicyList;
}
class MyViewHolder extends RecyclerView.ViewHolder {
final ViewDataBinding binding;
MyViewHolder(ViewDataBinding binding) {
super(binding.getRoot());
this.binding = binding;
}
void bind(PrivacyViewModel viewModel, Integer position) {
viewModel.getPrivacyAt(position);
binding.setVariable(BR.viewModel, viewModel);
binding.setVariable(BR.position, position);
binding.executePendingBindings();
}
}
}
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<layout 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"
tools:context=".privacy.PrivacyActivity">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Privacy"
tools:layout_editor_absoluteX="193dp"
tools:layout_editor_absoluteY="197dp" />
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
xmlns:tools="http://schemas.android.com/tools">
<data>
<import type="android.view.View" />
<variable
name="viewModel"
type="com.example.zxa01.iotclient.privacy.viewModel.PrivacyViewModel" />
</data>
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorWhite"
tools:context=".privacy.view.PrivacyActivity">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/margin_lg"
android:background="@drawable/border_bottom_xl"
android:orientation="horizontal"
android:padding="@dimen/padding_sm">
<TextView
android:id="@+id/textViewTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="隱私政策報告"
android:textColor="@color/colorAccent"
android:textSize="@dimen/font_lg" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="版本 1.0"
android:textAlignment="textEnd" />
</LinearLayout>
<TextView
android:id="@+id/textViewDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin_lg"
android:layout_marginTop="@dimen/margin_sm"
android:layout_marginRight="@dimen/margin_lg"
android:background="@drawable/border_bottom"
android:padding="@dimen/padding_sm"
android:text="描述" />
<TextView
android:id="@+id/textViewDescription2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin_lg"
android:layout_marginTop="@dimen/margin_sm"
android:layout_marginRight="@dimen/margin_lg"
android:padding="@dimen/padding_sm"
android:text="我們會依照下列政策收集相關資料" />
<android.support.v7.widget.RecyclerView
android:id="@+id/privacy_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingTop="@dimen/padding"
app:setAdapter="@{viewModel.getAdapter()}"
tools:listitem="@layout/recycler_view_privacy" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
</layout>
\ No newline at end of file
......@@ -17,10 +17,9 @@
android:layout_height="match_parent"
tools:context=".home.device.view.DeviceFragment">
<android.support.v7.widget.RecyclerView
android:id="@+id/device_recycler_view"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingTop="@dimen/padding"
......@@ -46,7 +45,6 @@
android:src="@drawable/ic_add_black_24dp"
app:backgroundTint="@color/colorPrimary" />
</FrameLayout>
</layout>
......@@ -2,6 +2,12 @@
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="viewModel"
type="com.example.zxa01.iotclient.home.device.viewModel.DeviceViewModel" />
</data>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<layout 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">
<data>
<variable
name="position"
type="java.lang.Integer" />
<variable
name="viewModel"
type="com.example.zxa01.iotclient.privacy.viewModel.PrivacyViewModel" />
</data>
<android.support.constraint.ConstraintLayout
android:id="@+id/privacy_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_sm"
android:background="@drawable/shadow"
android:elevation="2dp"
android:onClick="@{()->viewModel.onChangeClick(position)}"
android:padding="@dimen/margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/textViewPrivacy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="隱私政策 1"
android:textColor="@color/colorGray"
android:textSize="@dimen/font" />
<Switch
android:id="@+id/switch1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="拒絕/同意 "
android:onClick="@{()->viewModel.onChangeClick(position)}"
android:textAlignment="textEnd"
android:thumbTextPadding="@dimen/padding_lg" />
</LinearLayout>
<TextView
android:id="@+id/textView7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{viewModel.getPrivacyAt(position).description}" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
</layout>
\ No newline at end of file
......@@ -16,4 +16,6 @@
<dimen name="font">18sp</dimen>
<dimen name="font_sm">12sp</dimen>
<dimen name="layout_width">120dp</dimen>
</resources>
......@@ -2,7 +2,7 @@
<!--Title-->
<string name="title_detail">裝置資訊</string>
<string name="title_privacy">隱私政策</string>
<string name="title_privacy">隱私偏好設定</string>
<string name="title_setting">設定</string>
<string name="title_device_create">新增裝置</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