Toggle navigation
Toggle navigation
This project
Loading...
Sign in
cse437_e
/
smartdoorlock-frontend
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
sunnnl
2020-11-18 12:28:14 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
612dd4ef4531514dfa1c5a4c581855e8ab103076
612dd4ef
1 parent
4520023d
setting 페이지 퍼블리싱, 메인 화면 수정
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
205 additions
and
31 deletions
app/src/main/java/com/sunnni/smartdoorlock/ui/SettingActivity.java
app/src/main/res/drawable/baseline_ondemand_video_24.xml
app/src/main/res/drawable/bg_btn_logout.xml
app/src/main/res/drawable/bg_white_radius10_line.xml
app/src/main/res/layout/activity_main.xml
app/src/main/res/layout/activity_setting.xml
app/src/main/res/values/strings.xml
app/src/main/java/com/sunnni/smartdoorlock/ui/SettingActivity.java
View file @
612dd4e
package
com
.
sunnni
.
smartdoorlock
.
ui
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.os.Bundle
;
...
...
@@ -13,25 +14,31 @@ import com.sunnni.smartdoorlock.R;
import
com.sunnni.smartdoorlock.api.Api
;
import
com.sunnni.smartdoorlock.api.Setting
;
import
androidx.appcompat.app.AlertDialog
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.widget.Toolbar
;
import
java.util.Objects
;
public
class
SettingActivity
extends
AppCompatActivity
{
private
Switch
swcRecording
;
private
Button
btnLogout
;
AlertDialog
alertDialog
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_setting
);
Toolbar
mToolbar
=
findViewById
(
R
.
id
.
toolbar_settings
);
setToolbar
(
mToolbar
);
btnLogout
=
(
Button
)
findViewById
(
R
.
id
.
btn_logout
);
btnLogout
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
SharedPreferences
pref
=
getSharedPreferences
(
"gateway"
,
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
pref
.
edit
();
editor
.
remove
(
"accessToken"
);
editor
.
commit
();
startActivity
(
new
Intent
(
SettingActivity
.
this
,
SplashActivity
.
class
));
logoutDialog
();
}
});
...
...
@@ -42,8 +49,8 @@ public class SettingActivity extends AppCompatActivity {
Api
.
setSetting
(
new
Setting
(
true
),
new
Api
.
Callback
()
{
@Override
public
void
callbackMethod
(
Object
obj
)
{
if
(
obj
==
null
)
{
Toast
.
makeText
(
getApplicationContext
(),
"연결 상태가 불안정합니다."
,
Toast
.
LENGTH_SHORT
).
show
();
if
(
obj
==
null
)
{
Toast
.
makeText
(
getApplicationContext
(),
"연결 상태가 불안정합니다."
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
});
...
...
@@ -54,8 +61,8 @@ public class SettingActivity extends AppCompatActivity {
@Override
public
void
callbackMethod
(
Object
obj
)
{
Setting
setting
=
(
Setting
)
obj
;
if
(
setting
==
null
)
{
Toast
.
makeText
(
getApplicationContext
(),
"연결 상태가 불안정합니다."
,
Toast
.
LENGTH_SHORT
).
show
();
if
(
setting
==
null
)
{
Toast
.
makeText
(
getApplicationContext
(),
"연결 상태가 불안정합니다."
,
Toast
.
LENGTH_SHORT
).
show
();
return
;
}
...
...
@@ -63,4 +70,44 @@ public class SettingActivity extends AppCompatActivity {
}
});
}
private
void
setToolbar
(
Toolbar
toolbar
)
{
setSupportActionBar
(
toolbar
);
Objects
.
requireNonNull
(
getSupportActionBar
()).
setDisplayShowCustomEnabled
(
true
);
getSupportActionBar
().
setDisplayShowTitleEnabled
(
false
);
getSupportActionBar
().
setDisplayHomeAsUpEnabled
(
true
);
getSupportActionBar
().
setHomeAsUpIndicator
(
R
.
drawable
.
round_chevron_left_white_24
);
toolbar
.
setNavigationOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
finish
();
}
});
}
private
void
logoutDialog
()
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
this
,
R
.
style
.
AlertDialogTheme
);
builder
.
setTitle
(
getString
(
R
.
string
.
logout_dialog_title
))
.
setMessage
(
getString
(
R
.
string
.
logout_dialog
));
builder
.
setPositiveButton
(
"로그아웃"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
SharedPreferences
pref
=
getSharedPreferences
(
"gateway"
,
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
pref
.
edit
();
editor
.
remove
(
"accessToken"
);
editor
.
commit
();
startActivity
(
new
Intent
(
SettingActivity
.
this
,
SplashActivity
.
class
));
finish
();
}
});
builder
.
setNegativeButton
(
"취소"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
}
});
alertDialog
=
builder
.
create
();
alertDialog
.
show
();
}
}
...
...
app/src/main/res/drawable/baseline_ondemand_video_24.xml
View file @
612dd4e
...
...
@@ -3,7 +3,7 @@
android:height=
"24dp"
android:viewportWidth=
"24"
android:viewportHeight=
"24"
android:tint=
"
?attr/colorControlNormal
"
>
android:tint=
"
#111111
"
>
<path
android:fillColor=
"@android:color/white"
android:pathData=
"M21,3L3,3c-1.11,0 -2,0.89 -2,2v12c0,1.1 0.89,2 2,2h5v2h8v-2h5c1.1,0 1.99,-0.9 1.99,-2L23,5c0,-1.11 -0.9,-2 -2,-2zM21,17L3,17L3,5h18v12zM16,11l-7,4L9,7z"
/>
...
...
app/src/main/res/drawable/bg_btn_logout.xml
0 → 100644
View file @
612dd4e
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"#ff1744"
/>
<corners
android:radius=
"10dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/bg_white_radius10_line.xml
0 → 100644
View file @
612dd4e
<?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=
"10dp"
/>
<stroke
android:width=
"1dp"
android:color=
"@color/colorLine"
/>
</shape>
\ No newline at end of file
app/src/main/res/layout/activity_main.xml
View file @
612dd4e
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/drawer_main"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
...
...
@@ -243,8 +243,8 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/container_device_button"
android:layout_width=
"
wrap_content
"
android:layout_height=
"
wrap_content
"
android:layout_width=
"
0dp
"
android:layout_height=
"
0dp
"
android:background=
"@color/colorAccent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/line_vertical"
...
...
@@ -257,9 +257,11 @@
android:layout_width=
"48dp"
android:layout_height=
"48dp"
android:background=
"@drawable/bg_btn_circle_main"
app:layout_constraintBottom_toTopOf=
"@+id/tv_device"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_chainStyle=
"packed"
/>
<ImageView
android:layout_width=
"wrap_content"
...
...
@@ -271,6 +273,7 @@
app:layout_constraintTop_toTopOf=
"@id/btn_back_3"
/>
<TextView
android:id=
"@+id/tv_device"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
...
...
@@ -278,16 +281,18 @@
android:text=
"@string/menu_device_manager"
android:textColor=
"@color/colorBackground"
android:textSize=
"15sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/btn_back_3"
/>
app:layout_constraintTop_toBottomOf=
"@id/btn_back_3"
app:layout_constraintVertical_chainStyle=
"packed"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/container_video_button"
android:layout_width=
"
wrap_content
"
android:layout_height=
"
wrap_content
"
android:layout_width=
"
0dp
"
android:layout_height=
"
0dp
"
android:background=
"@color/colorAccent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
...
...
@@ -300,9 +305,11 @@
android:layout_width=
"48dp"
android:layout_height=
"48dp"
android:background=
"@drawable/bg_btn_circle_main"
app:layout_constraintBottom_toTopOf=
"@+id/tv_video"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_chainStyle=
"packed"
/>
<ImageView
android:layout_width=
"wrap_content"
...
...
@@ -314,6 +321,7 @@
app:layout_constraintTop_toTopOf=
"@id/btn_back_4"
/>
<TextView
android:id=
"@+id/tv_video"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
...
...
@@ -321,9 +329,11 @@
android:text=
"@string/menu_video_check"
android:textColor=
"@color/colorBackground"
android:textSize=
"15sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/btn_back_4"
/>
app:layout_constraintTop_toBottomOf=
"@id/btn_back_4"
app:layout_constraintVertical_chainStyle=
"packed"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
...
...
app/src/main/res/layout/activity_setting.xml
View file @
612dd4e
...
...
@@ -5,23 +5,111 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<Button
android:id=
"@+id/btn_logout"
<androidx.appcompat.widget.Toolbar
android:id=
"@+id/toolbar_settings"
android:layout_width=
"0dp"
android:layout_height=
"?attr/actionBarSize"
android:background=
"@color/colorBackground"
android:elevation=
"7dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:fontFamily=
"@font/g_market_sans_ttf_medium"
android:text=
"@string/menu_settings"
android:textColor=
"@color/colorMainText"
android:textSize=
"15sp"
/>
</androidx.appcompat.widget.Toolbar>
<androidx.constraintlayout.widget.Guideline
android:id=
"@+id/gl_start"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintGuide_percent=
"0.05"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<androidx.constraintlayout.widget.Guideline
android:id=
"@+id/gl_end"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintGuide_percent=
"0.95"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<ImageView
android:id=
"@+id/img_icon_settings"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"22dp"
android:layout_marginTop=
"9dp"
android:text=
"btn_logout"
app:layout_constraintStart_toStartOf=
"@+id/swc_recording"
app:layout_constraintTop_toBottomOf=
"@+id/swc_recording"
/>
android:layout_marginTop=
"20dp"
android:src=
"@drawable/baseline_ondemand_video_24"
app:layout_constraintStart_toStartOf=
"@id/gl_start"
app:layout_constraintTop_toBottomOf=
"@+id/toolbar_settings"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"3dp"
android:fontFamily=
"@font/g_market_sans_ttf_medium"
android:text=
"@string/video_settings"
android:textColor=
"#111111"
android:textSize=
"17sp"
app:layout_constraintBottom_toBottomOf=
"@id/img_icon_settings"
app:layout_constraintStart_toEndOf=
"@id/img_icon_settings"
app:layout_constraintTop_toTopOf=
"@+id/img_icon_settings"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_auto_recording"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:background=
"@drawable/bg_white_radius10_line"
app:layout_constraintEnd_toEndOf=
"@id/gl_end"
app:layout_constraintStart_toStartOf=
"@id/gl_start"
app:layout_constraintTop_toBottomOf=
"@+id/img_icon_settings"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginVertical=
"15dp"
android:layout_marginStart=
"13dp"
android:text=
"@string/video_auto_record"
android:textColor=
"#111111"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<Switch
android:id=
"@+id/swc_recording"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"117dp"
android:layout_marginTop=
"151dp"
android:text=
"swc_recording"
android:layout_marginEnd=
"20dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<Button
android:id=
"@+id/btn_logout"
style=
"?android:attr/borderlessButtonStyle"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"40dp"
android:background=
"@drawable/bg_btn_logout"
android:text=
"@string/logout"
android:textColor=
"@color/colorAccent"
android:textStyle=
"bold"
app:layout_constraintEnd_toEndOf=
"@id/gl_end"
app:layout_constraintStart_toStartOf=
"@id/gl_start"
app:layout_constraintTop_toBottomOf=
"@+id/cl_auto_recording"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...
...
app/src/main/res/values/strings.xml
View file @
612dd4e
...
...
@@ -6,6 +6,7 @@
<string
name=
"menu_remote_control_record"
>
원격 잠금해제 기록
</string>
<string
name=
"menu_device_manager"
>
기기 관리
</string>
<string
name=
"menu_video_check"
>
비디오 확인
</string>
<string
name=
"menu_settings"
>
설정
</string>
<string
name=
"button_on"
>
ON
</string>
<string
name=
"button_off"
>
OFF
</string>
...
...
@@ -26,4 +27,13 @@
<string
name=
"sample_device_name"
>
Galaxy Note 10
</string>
<string
name=
"sample_remote_date"
>
2020.10.07(수) 17:50:00
</string>
<string
name=
"video_settings"
>
비디오 설정
</string>
<string
name=
"video_auto_record"
>
비디오 자동 녹화
</string>
<string
name=
"logout"
>
로그아웃
</string>
<string
name=
"logout_dialog_title"
>
확인
</string>
<string
name=
"logout_dialog"
>
정말 로그아웃하시겠습니까?\n\n
</string>
</resources>
...
...
Please
register
or
login
to post a comment