Showing
9 changed files
with
200 additions
and
8 deletions
... | @@ -96,13 +96,14 @@ public class DeviceManagerActivity extends AppCompatActivity { | ... | @@ -96,13 +96,14 @@ public class DeviceManagerActivity extends AppCompatActivity { |
96 | mList.add(temp = new Device("0047617826460", "2020.10.08 17:21:30")); | 96 | mList.add(temp = new Device("0047617826460", "2020.10.08 17:21:30")); |
97 | mList.add(temp = new Device("0047617826460", "2020.10.08 17:21:30")); | 97 | mList.add(temp = new Device("0047617826460", "2020.10.08 17:21:30")); |
98 | mList.add(temp = new Device("0047617826460", "2020.10.08 17:21:30")); | 98 | mList.add(temp = new Device("0047617826460", "2020.10.08 17:21:30")); |
99 | + | ||
99 | mAdapter.notifyDataSetChanged(); | 100 | mAdapter.notifyDataSetChanged(); |
100 | } | 101 | } |
101 | 102 | ||
102 | private void remoteControlDialog() { | 103 | private void remoteControlDialog() { |
103 | AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.AlertDialogTheme); | 104 | AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.AlertDialogTheme); |
104 | builder.setTitle(getString(R.string.device_manager_add_device)) | 105 | builder.setTitle(getString(R.string.device_manager_add_device)) |
105 | - .setMessage(getString(R.string.device_alert_message)); | 106 | + .setMessage(getString(R.string.alert_message_device)); |
106 | builder.setPositiveButton("추가", new DialogInterface.OnClickListener() { | 107 | builder.setPositiveButton("추가", new DialogInterface.OnClickListener() { |
107 | @Override | 108 | @Override |
108 | public void onClick(DialogInterface dialog, int which) { | 109 | public void onClick(DialogInterface dialog, int which) { | ... | ... |
... | @@ -83,8 +83,4 @@ public class DeviceRecyclerViewAdapter extends RecyclerView.Adapter<DeviceRecycl | ... | @@ -83,8 +83,4 @@ public class DeviceRecyclerViewAdapter extends RecyclerView.Adapter<DeviceRecycl |
83 | public int getItemCount() { | 83 | public int getItemCount() { |
84 | return mList.size(); | 84 | return mList.size(); |
85 | } | 85 | } |
86 | - | ||
87 | - public void addDevice(Device device) { | ||
88 | - mList.add(device); | ||
89 | - } | ||
90 | } | 86 | } | ... | ... |
... | @@ -3,17 +3,28 @@ package com.sunnni.smartdoorlock.ui; | ... | @@ -3,17 +3,28 @@ package com.sunnni.smartdoorlock.ui; |
3 | import androidx.appcompat.app.AppCompatActivity; | 3 | import androidx.appcompat.app.AppCompatActivity; |
4 | import androidx.appcompat.widget.Toolbar; | 4 | import androidx.appcompat.widget.Toolbar; |
5 | import androidx.cardview.widget.CardView; | 5 | import androidx.cardview.widget.CardView; |
6 | +import androidx.core.widget.NestedScrollView; | ||
7 | +import androidx.recyclerview.widget.LinearLayoutManager; | ||
8 | +import androidx.recyclerview.widget.RecyclerView; | ||
6 | 9 | ||
7 | import android.os.Bundle; | 10 | import android.os.Bundle; |
8 | import android.view.View; | 11 | import android.view.View; |
12 | +import android.widget.LinearLayout; | ||
9 | import android.widget.Toast; | 13 | import android.widget.Toast; |
10 | 14 | ||
11 | import com.sunnni.smartdoorlock.R; | 15 | import com.sunnni.smartdoorlock.R; |
16 | +import com.sunnni.smartdoorlock.data.Device; | ||
17 | +import com.sunnni.smartdoorlock.data.RemoteRecord; | ||
12 | 18 | ||
19 | +import java.util.ArrayList; | ||
13 | import java.util.Objects; | 20 | import java.util.Objects; |
14 | 21 | ||
15 | public class RemoteControlRecordActivity extends AppCompatActivity { | 22 | public class RemoteControlRecordActivity extends AppCompatActivity { |
16 | 23 | ||
24 | + ArrayList<RemoteRecord> mRecordList = new ArrayList<RemoteRecord>(); | ||
25 | + RecyclerView mRecyclerView; | ||
26 | + RemoteRecordRvAdapter mAdapter; | ||
27 | + | ||
17 | @Override | 28 | @Override |
18 | protected void onCreate(Bundle savedInstanceState) { | 29 | protected void onCreate(Bundle savedInstanceState) { |
19 | super.onCreate(savedInstanceState); | 30 | super.onCreate(savedInstanceState); |
... | @@ -21,6 +32,11 @@ public class RemoteControlRecordActivity extends AppCompatActivity { | ... | @@ -21,6 +32,11 @@ public class RemoteControlRecordActivity extends AppCompatActivity { |
21 | 32 | ||
22 | Toolbar mToolbar = findViewById(R.id.toolbar_remote_control_record); | 33 | Toolbar mToolbar = findViewById(R.id.toolbar_remote_control_record); |
23 | setToolbar(mToolbar); | 34 | setToolbar(mToolbar); |
35 | + | ||
36 | + setRecyclerView(); | ||
37 | + setRecordList(); | ||
38 | + | ||
39 | + init(); | ||
24 | } | 40 | } |
25 | 41 | ||
26 | private void setToolbar(Toolbar toolbar){ | 42 | private void setToolbar(Toolbar toolbar){ |
... | @@ -37,4 +53,37 @@ public class RemoteControlRecordActivity extends AppCompatActivity { | ... | @@ -37,4 +53,37 @@ public class RemoteControlRecordActivity extends AppCompatActivity { |
37 | } | 53 | } |
38 | }); | 54 | }); |
39 | } | 55 | } |
56 | + | ||
57 | + private void init(){ | ||
58 | + NestedScrollView nestedScrollView = findViewById(R.id.scroll_remote_record); | ||
59 | + nestedScrollView.getParent().requestChildFocus(nestedScrollView, nestedScrollView); | ||
60 | + } | ||
61 | + | ||
62 | + private void setRecyclerView(){ | ||
63 | + mRecyclerView = findViewById(R.id.rv_remote_record_list); | ||
64 | + LinearLayoutManager manager = new LinearLayoutManager(this); | ||
65 | + mAdapter = new RemoteRecordRvAdapter(mRecordList); | ||
66 | + mRecyclerView.setLayoutManager(manager); | ||
67 | + mRecyclerView.setAdapter(mAdapter); | ||
68 | + } | ||
69 | + | ||
70 | + private void setRecordList(){ | ||
71 | + RemoteRecord temp; | ||
72 | + mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00")); | ||
73 | + mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00")); | ||
74 | + mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00")); | ||
75 | + mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00")); | ||
76 | + mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00")); | ||
77 | + mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00")); | ||
78 | + mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00")); | ||
79 | + mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00")); | ||
80 | + mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00")); | ||
81 | + mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00")); | ||
82 | + mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00")); | ||
83 | + mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00")); | ||
84 | + mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00")); | ||
85 | + mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00")); | ||
86 | + | ||
87 | + mAdapter.notifyDataSetChanged(); | ||
88 | + } | ||
40 | } | 89 | } | ... | ... |
1 | +package com.sunnni.smartdoorlock.ui; | ||
2 | + | ||
3 | +import android.view.LayoutInflater; | ||
4 | +import android.view.View; | ||
5 | +import android.view.ViewGroup; | ||
6 | +import android.widget.TextView; | ||
7 | + | ||
8 | +import androidx.annotation.NonNull; | ||
9 | +import androidx.recyclerview.widget.RecyclerView; | ||
10 | + | ||
11 | +import com.sunnni.smartdoorlock.R; | ||
12 | +import com.sunnni.smartdoorlock.data.Device; | ||
13 | +import com.sunnni.smartdoorlock.data.RemoteRecord; | ||
14 | + | ||
15 | +import java.util.ArrayList; | ||
16 | + | ||
17 | + | ||
18 | +public class RemoteRecordRvAdapter extends RecyclerView.Adapter<RemoteRecordRvAdapter.RemoteRecordViewHolder> { | ||
19 | + | ||
20 | + ArrayList<RemoteRecord> recordList; | ||
21 | + | ||
22 | + static class RemoteRecordViewHolder extends RecyclerView.ViewHolder{ | ||
23 | + TextView mTvDeviceName, mTvRemoteDate; | ||
24 | + | ||
25 | + RemoteRecordViewHolder(View v){ | ||
26 | + super(v); | ||
27 | + this.mTvDeviceName = v.findViewById(R.id.tv_device_name); | ||
28 | + this.mTvRemoteDate = v.findViewById(R.id.tv_remote_date); | ||
29 | + } | ||
30 | + | ||
31 | + void bind(RemoteRecord record){ | ||
32 | + mTvDeviceName.setText(record.deviceName); | ||
33 | + mTvRemoteDate.setText(record.remoteDate); | ||
34 | + } | ||
35 | + } | ||
36 | + | ||
37 | + public RemoteRecordRvAdapter(ArrayList<RemoteRecord> list) { | ||
38 | + this.recordList = list; | ||
39 | + } | ||
40 | + | ||
41 | + @NonNull | ||
42 | + @Override | ||
43 | + public RemoteRecordViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | ||
44 | + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.rv_item_remote_record, parent, false); | ||
45 | + | ||
46 | + return new RemoteRecordViewHolder(view); | ||
47 | + } | ||
48 | + | ||
49 | + @Override | ||
50 | + public void onBindViewHolder(@NonNull RemoteRecordViewHolder holder, int position) { | ||
51 | + holder.bind(recordList.get(position)); | ||
52 | + } | ||
53 | + | ||
54 | + @Override | ||
55 | + public int getItemCount() { | ||
56 | + return recordList.size(); | ||
57 | + } | ||
58 | +} |
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + android:shape="rectangle"> | ||
4 | + | ||
5 | + <solid android:color="@color/colorAccent" /> | ||
6 | + <corners android:radius="2dp" /> | ||
7 | + <stroke | ||
8 | + android:width="1dp" | ||
9 | + android:color="@color/colorLine" /> | ||
10 | + | ||
11 | +</shape> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -2,7 +2,8 @@ | ... | @@ -2,7 +2,8 @@ |
2 | <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:id="@+id/scroll_remote_record" | 3 | android:id="@+id/scroll_remote_record" |
4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
5 | - android:layout_height="wrap_content"> | 5 | + android:layout_height="match_parent" |
6 | + android:background="@color/colorAccent"> | ||
6 | 7 | ||
7 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | 8 | <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
8 | xmlns:app="http://schemas.android.com/apk/res-auto" | 9 | xmlns:app="http://schemas.android.com/apk/res-auto" |
... | @@ -73,5 +74,26 @@ | ... | @@ -73,5 +74,26 @@ |
73 | app:layout_constraintStart_toEndOf="@id/img_icon_list" | 74 | app:layout_constraintStart_toEndOf="@id/img_icon_list" |
74 | app:layout_constraintTop_toTopOf="@+id/img_icon_list" /> | 75 | app:layout_constraintTop_toTopOf="@+id/img_icon_list" /> |
75 | 76 | ||
77 | + <androidx.constraintlayout.widget.ConstraintLayout | ||
78 | + android:layout_width="0dp" | ||
79 | + android:layout_height="wrap_content" | ||
80 | + android:layout_marginTop="10dp" | ||
81 | + android:layout_marginBottom="75dp" | ||
82 | + android:background="@drawable/bg_white_radius1_line" | ||
83 | + app:layout_constraintBottom_toBottomOf="parent" | ||
84 | + app:layout_constraintEnd_toEndOf="@id/gl_end" | ||
85 | + app:layout_constraintStart_toStartOf="@id/gl_start" | ||
86 | + app:layout_constraintTop_toBottomOf="@+id/img_icon_list"> | ||
87 | + | ||
88 | + <androidx.recyclerview.widget.RecyclerView | ||
89 | + android:id="@+id/rv_remote_record_list" | ||
90 | + android:layout_width="0dp" | ||
91 | + android:layout_height="wrap_content" | ||
92 | + app:layout_constraintEnd_toEndOf="parent" | ||
93 | + app:layout_constraintStart_toStartOf="parent" | ||
94 | + app:layout_constraintTop_toTopOf="parent" /> | ||
95 | + | ||
96 | + </androidx.constraintlayout.widget.ConstraintLayout> | ||
97 | + | ||
76 | </androidx.constraintlayout.widget.ConstraintLayout> | 98 | </androidx.constraintlayout.widget.ConstraintLayout> |
77 | </androidx.core.widget.NestedScrollView> | 99 | </androidx.core.widget.NestedScrollView> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | + android:layout_width="match_parent" | ||
5 | + android:layout_height="wrap_content"> | ||
6 | + | ||
7 | + <LinearLayout | ||
8 | + android:layout_width="0dp" | ||
9 | + android:layout_height="0.5dp" | ||
10 | + app:layout_constraintStart_toStartOf="parent" | ||
11 | + app:layout_constraintEnd_toEndOf="parent" | ||
12 | + android:background="@color/colorLine" | ||
13 | + app:layout_constraintBottom_toBottomOf="parent"/> | ||
14 | + | ||
15 | + <TextView | ||
16 | + android:id="@+id/tv_device_name" | ||
17 | + android:layout_width="wrap_content" | ||
18 | + android:layout_height="wrap_content" | ||
19 | + android:layout_marginVertical="16dp" | ||
20 | + android:layout_marginStart="20dp" | ||
21 | + android:fontFamily="@font/g_market_sans_ttf_medium" | ||
22 | + android:text="@string/sample_device_name" | ||
23 | + android:textColor="#111111" | ||
24 | + android:textSize="13sp" | ||
25 | + app:layout_constraintBottom_toBottomOf="parent" | ||
26 | + app:layout_constraintStart_toStartOf="parent" | ||
27 | + app:layout_constraintTop_toTopOf="parent" /> | ||
28 | + | ||
29 | + <TextView | ||
30 | + android:id="@+id/tv_remote_date" | ||
31 | + android:layout_width="wrap_content" | ||
32 | + android:layout_height="wrap_content" | ||
33 | + android:layout_marginEnd="20dp" | ||
34 | + android:fontFamily="@font/g_market_sans_ttf_medium" | ||
35 | + android:text="@string/sample_remote_date" | ||
36 | + android:textColor="#90a4ae" | ||
37 | + android:textSize="11sp" | ||
38 | + app:layout_constraintBottom_toBottomOf="parent" | ||
39 | + app:layout_constraintEnd_toEndOf="parent" | ||
40 | + app:layout_constraintTop_toTopOf="parent" /> | ||
41 | + | ||
42 | +</androidx.constraintlayout.widget.ConstraintLayout> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -16,12 +16,14 @@ | ... | @@ -16,12 +16,14 @@ |
16 | <string name="tag_status_on_detail">초 후 꺼짐</string> | 16 | <string name="tag_status_on_detail">초 후 꺼짐</string> |
17 | 17 | ||
18 | <string name="alert_message">버튼을 클릭하시면 원격으로 도어락을 열 수 있습니다.\n\n정말 도어락을 여시겠습니까?\n\n</string> | 18 | <string name="alert_message">버튼을 클릭하시면 원격으로 도어락을 열 수 있습니다.\n\n정말 도어락을 여시겠습니까?\n\n</string> |
19 | + <string name="alert_message_device">버튼을 누르신 후 기기를 도어락에 태그하시면 추가됩니다.\n\n</string> | ||
20 | + <string name="alert_message_delete">정말 삭제하시겠습니까?\n\n</string> | ||
19 | 21 | ||
20 | <string name="device_manager_add_device">기기 추가</string> | 22 | <string name="device_manager_add_device">기기 추가</string> |
21 | <string name="device_manager_device_list">기기 목록</string> | 23 | <string name="device_manager_device_list">기기 목록</string> |
22 | <string name="sample_device_number">0047617826460</string> | 24 | <string name="sample_device_number">0047617826460</string> |
23 | <string name="sample_date">2020.10.08 17:21:30</string> | 25 | <string name="sample_date">2020.10.08 17:21:30</string> |
24 | - <string name="device_alert_message">버튼을 누르신 후 기기를 도어락에 태그하시면 추가됩니다.\n\n</string> | ||
25 | 26 | ||
26 | - <string name="alert_message_delete">정말 삭제하시겠습니까?\n\n</string> | 27 | + <string name="sample_device_name">Galaxy Note 10</string> |
28 | + <string name="sample_remote_date">2020.10.07(수) 17:50:00</string> | ||
27 | </resources> | 29 | </resources> | ... | ... |
-
Please register or login to post a comment