sunnnl

원격 잠금 해제 기록 퍼블리싱

package com.sunnni.smartdoorlock.data;
public class RemoteRecord {
public String deviceName;
public String remoteDate;
public RemoteRecord(String name, String date){
this.deviceName = name;
this.remoteDate = date;
}
}
......@@ -96,13 +96,14 @@ public class DeviceManagerActivity extends AppCompatActivity {
mList.add(temp = new Device("0047617826460", "2020.10.08 17:21:30"));
mList.add(temp = new Device("0047617826460", "2020.10.08 17:21:30"));
mList.add(temp = new Device("0047617826460", "2020.10.08 17:21:30"));
mAdapter.notifyDataSetChanged();
}
private void remoteControlDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.AlertDialogTheme);
builder.setTitle(getString(R.string.device_manager_add_device))
.setMessage(getString(R.string.device_alert_message));
.setMessage(getString(R.string.alert_message_device));
builder.setPositiveButton("추가", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
......
......@@ -83,8 +83,4 @@ public class DeviceRecyclerViewAdapter extends RecyclerView.Adapter<DeviceRecycl
public int getItemCount() {
return mList.size();
}
public void addDevice(Device device) {
mList.add(device);
}
}
......
......@@ -3,17 +3,28 @@ package com.sunnni.smartdoorlock.ui;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.cardview.widget.CardView;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.Toast;
import com.sunnni.smartdoorlock.R;
import com.sunnni.smartdoorlock.data.Device;
import com.sunnni.smartdoorlock.data.RemoteRecord;
import java.util.ArrayList;
import java.util.Objects;
public class RemoteControlRecordActivity extends AppCompatActivity {
ArrayList<RemoteRecord> mRecordList = new ArrayList<RemoteRecord>();
RecyclerView mRecyclerView;
RemoteRecordRvAdapter mAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -21,6 +32,11 @@ public class RemoteControlRecordActivity extends AppCompatActivity {
Toolbar mToolbar = findViewById(R.id.toolbar_remote_control_record);
setToolbar(mToolbar);
setRecyclerView();
setRecordList();
init();
}
private void setToolbar(Toolbar toolbar){
......@@ -37,4 +53,37 @@ public class RemoteControlRecordActivity extends AppCompatActivity {
}
});
}
private void init(){
NestedScrollView nestedScrollView = findViewById(R.id.scroll_remote_record);
nestedScrollView.getParent().requestChildFocus(nestedScrollView, nestedScrollView);
}
private void setRecyclerView(){
mRecyclerView = findViewById(R.id.rv_remote_record_list);
LinearLayoutManager manager = new LinearLayoutManager(this);
mAdapter = new RemoteRecordRvAdapter(mRecordList);
mRecyclerView.setLayoutManager(manager);
mRecyclerView.setAdapter(mAdapter);
}
private void setRecordList(){
RemoteRecord temp;
mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00"));
mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00"));
mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00"));
mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00"));
mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00"));
mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00"));
mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00"));
mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00"));
mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00"));
mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00"));
mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00"));
mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00"));
mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00"));
mRecordList.add(temp = new RemoteRecord("Galaxy Note 10", "2020.10.07(수) 17:50:00"));
mAdapter.notifyDataSetChanged();
}
}
......
package com.sunnni.smartdoorlock.ui;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.sunnni.smartdoorlock.R;
import com.sunnni.smartdoorlock.data.Device;
import com.sunnni.smartdoorlock.data.RemoteRecord;
import java.util.ArrayList;
public class RemoteRecordRvAdapter extends RecyclerView.Adapter<RemoteRecordRvAdapter.RemoteRecordViewHolder> {
ArrayList<RemoteRecord> recordList;
static class RemoteRecordViewHolder extends RecyclerView.ViewHolder{
TextView mTvDeviceName, mTvRemoteDate;
RemoteRecordViewHolder(View v){
super(v);
this.mTvDeviceName = v.findViewById(R.id.tv_device_name);
this.mTvRemoteDate = v.findViewById(R.id.tv_remote_date);
}
void bind(RemoteRecord record){
mTvDeviceName.setText(record.deviceName);
mTvRemoteDate.setText(record.remoteDate);
}
}
public RemoteRecordRvAdapter(ArrayList<RemoteRecord> list) {
this.recordList = list;
}
@NonNull
@Override
public RemoteRecordViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.rv_item_remote_record, parent, false);
return new RemoteRecordViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull RemoteRecordViewHolder holder, int position) {
holder.bind(recordList.get(position));
}
@Override
public int getItemCount() {
return recordList.size();
}
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/colorAccent" />
<corners android:radius="2dp" />
<stroke
android:width="1dp"
android:color="@color/colorLine" />
</shape>
\ No newline at end of file
......@@ -2,7 +2,8 @@
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroll_remote_record"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent"
android:background="@color/colorAccent">
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
......@@ -73,5 +74,26 @@
app:layout_constraintStart_toEndOf="@id/img_icon_list"
app:layout_constraintTop_toTopOf="@+id/img_icon_list" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="75dp"
android:background="@drawable/bg_white_radius1_line"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/gl_end"
app:layout_constraintStart_toStartOf="@id/gl_start"
app:layout_constraintTop_toBottomOf="@+id/img_icon_list">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_remote_record_list"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
\ No newline at end of file
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="0dp"
android:layout_height="0.5dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:background="@color/colorLine"
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
android:id="@+id/tv_device_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginVertical="16dp"
android:layout_marginStart="20dp"
android:fontFamily="@font/g_market_sans_ttf_medium"
android:text="@string/sample_device_name"
android:textColor="#111111"
android:textSize="13sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_remote_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:fontFamily="@font/g_market_sans_ttf_medium"
android:text="@string/sample_remote_date"
android:textColor="#90a4ae"
android:textSize="11sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -16,12 +16,14 @@
<string name="tag_status_on_detail">초 후 꺼짐</string>
<string name="alert_message">버튼을 클릭하시면 원격으로 도어락을 열 수 있습니다.\n\n정말 도어락을 여시겠습니까?\n\n</string>
<string name="alert_message_device">버튼을 누르신 후 기기를 도어락에 태그하시면 추가됩니다.\n\n</string>
<string name="alert_message_delete">정말 삭제하시겠습니까?\n\n</string>
<string name="device_manager_add_device">기기 추가</string>
<string name="device_manager_device_list">기기 목록</string>
<string name="sample_device_number">0047617826460</string>
<string name="sample_date">2020.10.08 17:21:30</string>
<string name="device_alert_message">버튼을 누르신 후 기기를 도어락에 태그하시면 추가됩니다.\n\n</string>
<string name="alert_message_delete">정말 삭제하시겠습니까?\n\n</string>
<string name="sample_device_name">Galaxy Note 10</string>
<string name="sample_remote_date">2020.10.07(수) 17:50:00</string>
</resources>
......