sunnnl

스플래시 오류, 토글 커스텀 완료

...@@ -14,23 +14,21 @@ ...@@ -14,23 +14,21 @@
14 android:supportsRtl="true" 14 android:supportsRtl="true"
15 android:theme="@style/AppTheme" 15 android:theme="@style/AppTheme"
16 android:usesCleartextTraffic="true"> 16 android:usesCleartextTraffic="true">
17 - <activity android:name=".ui.VideoCheckActivity"></activity> 17 + <activity android:name=".ui.VideoPlayerActivity"></activity>
18 + <activity android:name=".ui.VideoCheckActivity" />
18 <activity android:name=".ui.DeviceManagerActivity" /> 19 <activity android:name=".ui.DeviceManagerActivity" />
19 <activity android:name=".ui.RemoteControlRecordActivity" /> 20 <activity android:name=".ui.RemoteControlRecordActivity" />
20 <activity 21 <activity
21 android:name=".ui.SplashActivity" 22 android:name=".ui.SplashActivity"
22 android:noHistory="true" 23 android:noHistory="true"
23 android:screenOrientation="fullSensor"> 24 android:screenOrientation="fullSensor">
24 -
25 <intent-filter> 25 <intent-filter>
26 <action android:name="android.intent.action.MAIN" /> 26 <action android:name="android.intent.action.MAIN" />
27 27
28 <category android:name="android.intent.category.LAUNCHER" /> 28 <category android:name="android.intent.category.LAUNCHER" />
29 </intent-filter> 29 </intent-filter>
30 </activity> 30 </activity>
31 - <activity android:name=".ui.MainActivity"> 31 + <activity android:name=".ui.MainActivity"></activity>
32 -
33 - </activity>
34 <activity android:name=".ui.SettingActivity" /> 32 <activity android:name=".ui.SettingActivity" />
35 </application> 33 </application>
36 34
......
...@@ -38,14 +38,14 @@ public class VideoCheckActivity extends AppCompatActivity { ...@@ -38,14 +38,14 @@ public class VideoCheckActivity extends AppCompatActivity {
38 Toolbar mToolbar = findViewById(R.id.toolbar_video_check); 38 Toolbar mToolbar = findViewById(R.id.toolbar_video_check);
39 setToolbar(mToolbar); 39 setToolbar(mToolbar);
40 40
41 - mBtnRemoveVideo = (Button) findViewById(R.id.btn_remove_video); 41 + // mBtnRemoveVideo = (Button) findViewById(R.id.btn_remove_video);
42 - mBtnViewVideo = (Button) findViewById(R.id.btn_view_video); 42 + // mBtnViewVideo = (Button) findViewById(R.id.btn_view_video);
43 43
44 getVideos(); 44 getVideos();
45 init(); 45 init();
46 setRecyclerView(); 46 setRecyclerView();
47 47
48 - mBtnRemoveVideo.setOnClickListener(new View.OnClickListener() { 48 + /*mBtnRemoveVideo.setOnClickListener(new View.OnClickListener() {
49 @Override 49 @Override
50 public void onClick(View view) { 50 public void onClick(View view) {
51 // TODO : 삭제 버튼이 클릭되었을 때 51 // TODO : 삭제 버튼이 클릭되었을 때
...@@ -93,7 +93,7 @@ public class VideoCheckActivity extends AppCompatActivity { ...@@ -93,7 +93,7 @@ public class VideoCheckActivity extends AppCompatActivity {
93 // TODO : 비디오 재생 코드 구현 (video.setS3link를 통해) 93 // TODO : 비디오 재생 코드 구현 (video.setS3link를 통해)
94 } 94 }
95 } 95 }
96 - }); 96 + });*/
97 } 97 }
98 98
99 private void setToolbar(Toolbar toolbar) { 99 private void setToolbar(Toolbar toolbar) {
......
1 +package com.sunnni.smartdoorlock.ui;
2 +
3 +import androidx.appcompat.app.AppCompatActivity;
4 +
5 +import android.media.MediaPlayer;
6 +import android.net.Uri;
7 +import android.os.Bundle;
8 +import android.widget.MediaController;
9 +import android.widget.Toast;
10 +import android.widget.VideoView;
11 +
12 +import com.sunnni.smartdoorlock.R;
13 +
14 +public class VideoPlayerActivity extends AppCompatActivity {
15 +
16 + VideoView mVideoView;
17 + Uri videoUri;
18 +
19 + @Override
20 + protected void onCreate(Bundle savedInstanceState) {
21 + super.onCreate(savedInstanceState);
22 + setContentView(R.layout.activity_video_player);
23 +
24 + mVideoView = findViewById(R.id.vv);
25 +
26 + if (getIntent().getStringExtra("video_url").isEmpty()){
27 + Toast.makeText(this, "링크 null", Toast.LENGTH_SHORT).show();
28 + } else{
29 + String url = getIntent().getStringExtra("video_url");
30 + videoUri = Uri.parse("android.resource://" + getPackageName() + "/" + url);
31 + playVideo();
32 + }
33 + }
34 +
35 + @Override
36 + protected void onPause() {
37 + super.onPause();
38 + if(mVideoView!=null && mVideoView.isPlaying()) mVideoView.pause();
39 + }
40 +
41 + @Override
42 + protected void onDestroy() {
43 + super.onDestroy();
44 + if(mVideoView!=null) mVideoView.stopPlayback();
45 + }
46 +
47 + private void playVideo(){
48 + mVideoView.setMediaController(new MediaController(this));
49 + mVideoView.setVideoURI(videoUri);
50 + mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
51 + @Override
52 + public void onPrepared(MediaPlayer mediaPlayer) {
53 + mVideoView.start();
54 + }
55 + });
56 + }
57 +}
...@@ -99,7 +99,10 @@ public class VideoRvAdapter extends RecyclerView.Adapter<VideoRvAdapter.VideoVie ...@@ -99,7 +99,10 @@ public class VideoRvAdapter extends RecyclerView.Adapter<VideoRvAdapter.VideoVie
99 } else { 99 } else {
100 String s3link = (String) obj; 100 String s3link = (String) obj;
101 video.setS3link(s3link); 101 video.setS3link(s3link);
102 - // TODO : 비디오 재생 코드 구현 (video.setS3link를 통해) 102 + // 비디오 플레이어 액티비티로 url 넘겨서 플레이
103 + Intent intent = new Intent(itemView.getContext(), VideoPlayerActivity.class);
104 + intent.putExtra("video_url", video.getS3link());
105 + itemView.getContext().startActivity(intent);
103 } 106 }
104 } 107 }
105 }); 108 });
......
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
3 + <item android:drawable="@drawable/bg_thumb_checked" android:state_checked="true" />
4 + <item android:drawable="@drawable/bg_thumb_normal" />
5 +</selector>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
3 + <item android:drawable="@drawable/bg_track_checked" android:state_checked="true" />
4 + <item android:drawable="@drawable/bg_track_normal" />
5 +</selector>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:shape="oval">
4 + <solid android:color="#5c6bc0" />
5 + <size
6 + android:width="20dp"
7 + android:height="20dp" />
8 +</shape>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:shape="oval">
4 + <solid android:color="#999999" />
5 + <size
6 + android:width="20dp"
7 + android:height="20dp" />
8 +</shape>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android">
3 + <solid android:color="#c5cae9" />
4 + <corners android:radius="10dp" />
5 + <size
6 + android:width="28dp"
7 + android:height="13dp" />
8 +</shape>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<shape xmlns:android="http://schemas.android.com/apk/res/android">
3 + <solid android:color="#c5cae9" />
4 + <corners android:radius="8.5dp" />
5 + <size
6 + android:width="28dp"
7 + android:height="16dp" />
8 +</shape>
...@@ -88,6 +88,8 @@ ...@@ -88,6 +88,8 @@
88 app:layout_constraintTop_toTopOf="parent" /> 88 app:layout_constraintTop_toTopOf="parent" />
89 89
90 <Switch 90 <Switch
91 + android:thumb="@drawable/bg_default_switch_thumb"
92 + android:track="@drawable/bg_default_switch_track"
91 android:id="@+id/swc_recording" 93 android:id="@+id/swc_recording"
92 android:layout_width="wrap_content" 94 android:layout_width="wrap_content"
93 android:layout_height="wrap_content" 95 android:layout_height="wrap_content"
......
...@@ -39,18 +39,20 @@ ...@@ -39,18 +39,20 @@
39 android:layout_width="0dp" 39 android:layout_width="0dp"
40 android:layout_height="0dp" 40 android:layout_height="0dp"
41 android:layout_marginTop="50dp" 41 android:layout_marginTop="50dp"
42 - android:hint="고유번호" 42 + android:layout_marginEnd="3dp"
43 + android:hint="고유번호 입력"
44 + android:textColorHint="@color/colorAccent"
45 + android:theme="@style/EditTextTheme"
43 android:visibility="invisible" 46 android:visibility="invisible"
44 app:boxStrokeColor="@color/colorMainText" 47 app:boxStrokeColor="@color/colorMainText"
45 app:boxStrokeWidth="1dp" 48 app:boxStrokeWidth="1dp"
46 app:hintTextColor="@color/colorMainText" 49 app:hintTextColor="@color/colorMainText"
47 app:layout_constraintDimensionRatio="75:35" 50 app:layout_constraintDimensionRatio="75:35"
48 - app:layout_constraintStart_toStartOf="parent"
49 app:layout_constraintEnd_toStartOf="@id/cl_enter" 51 app:layout_constraintEnd_toStartOf="@id/cl_enter"
50 app:layout_constraintHorizontal_chainStyle="packed" 52 app:layout_constraintHorizontal_chainStyle="packed"
53 + app:layout_constraintStart_toStartOf="parent"
51 app:layout_constraintTop_toBottomOf="@id/ll_logo" 54 app:layout_constraintTop_toBottomOf="@id/ll_logo"
52 app:layout_constraintWidth_default="percent" 55 app:layout_constraintWidth_default="percent"
53 - android:layout_marginEnd="3dp"
54 app:layout_constraintWidth_percent="0.4"> 56 app:layout_constraintWidth_percent="0.4">
55 57
56 <com.google.android.material.textfield.TextInputEditText 58 <com.google.android.material.textfield.TextInputEditText
...@@ -70,17 +72,17 @@ ...@@ -70,17 +72,17 @@
70 android:id="@+id/cl_enter" 72 android:id="@+id/cl_enter"
71 android:layout_width="0dp" 73 android:layout_width="0dp"
72 android:layout_height="0dp" 74 android:layout_height="0dp"
73 - app:layout_constraintWidth_default="percent"
74 - app:layout_constraintWidth_percent="0.15"
75 - app:layout_constraintDimensionRatio="52:36"
76 android:layout_marginStart="10dp" 75 android:layout_marginStart="10dp"
77 android:visibility="invisible" 76 android:visibility="invisible"
77 + app:layout_constraintBottom_toBottomOf="@id/til_super_key"
78 + app:layout_constraintDimensionRatio="52:36"
79 + app:layout_constraintEnd_toEndOf="parent"
78 app:layout_constraintHorizontal_chainStyle="packed" 80 app:layout_constraintHorizontal_chainStyle="packed"
79 - app:layout_goneMarginStart="3dp"
80 app:layout_constraintStart_toEndOf="@+id/til_super_key" 81 app:layout_constraintStart_toEndOf="@+id/til_super_key"
81 - app:layout_constraintEnd_toEndOf="parent"
82 app:layout_constraintTop_toTopOf="@+id/til_super_key" 82 app:layout_constraintTop_toTopOf="@+id/til_super_key"
83 - app:layout_constraintBottom_toBottomOf="@id/til_super_key"> 83 + app:layout_constraintWidth_default="percent"
84 + app:layout_constraintWidth_percent="0.15"
85 + app:layout_goneMarginStart="3dp">
84 86
85 <Button 87 <Button
86 android:id="@+id/btn_enter" 88 android:id="@+id/btn_enter"
......
...@@ -82,21 +82,5 @@ tools:context=".ui.VideoCheckActivity"> ...@@ -82,21 +82,5 @@ tools:context=".ui.VideoCheckActivity">
82 app:layout_constraintStart_toStartOf="@id/gl_start" 82 app:layout_constraintStart_toStartOf="@id/gl_start"
83 app:layout_constraintTop_toBottomOf="@+id/img_icon_list" /> 83 app:layout_constraintTop_toBottomOf="@+id/img_icon_list" />
84 84
85 -<Button
86 - android:id="@+id/btn_remove_video"
87 - android:layout_width="wrap_content"
88 - android:layout_height="wrap_content"
89 - android:text="btn_remove_video"
90 - app:layout_constraintBottom_toBottomOf="parent"
91 - app:layout_constraintStart_toStartOf="parent" />
92 -
93 -<Button
94 - android:id="@+id/btn_view_video"
95 - android:layout_width="wrap_content"
96 - android:layout_height="wrap_content"
97 - android:text="btn_view_video"
98 - app:layout_constraintBottom_toBottomOf="parent"
99 - app:layout_constraintEnd_toEndOf="parent" />
100 -
101 </androidx.constraintlayout.widget.ConstraintLayout> 85 </androidx.constraintlayout.widget.ConstraintLayout>
102 </androidx.core.widget.NestedScrollView> 86 </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 + xmlns:tools="http://schemas.android.com/tools"
5 + android:layout_width="match_parent"
6 + android:layout_height="match_parent"
7 + android:background="#000000"
8 + tools:context=".ui.VideoPlayerActivity">
9 +
10 + <VideoView
11 + android:id="@+id/vv"
12 + android:layout_width="0dp"
13 + android:layout_height="0dp"
14 + app:layout_constraintBottom_toBottomOf="parent"
15 + app:layout_constraintDimensionRatio="80:51"
16 + app:layout_constraintEnd_toEndOf="parent"
17 + app:layout_constraintStart_toStartOf="parent"
18 + app:layout_constraintTop_toTopOf="parent" />
19 +
20 +</androidx.constraintlayout.widget.ConstraintLayout>
...\ No newline at end of file ...\ No newline at end of file
...@@ -14,4 +14,10 @@ ...@@ -14,4 +14,10 @@
14 <item name="colorAccent">@color/colorPrimary</item> 14 <item name="colorAccent">@color/colorPrimary</item>
15 </style> 15 </style>
16 16
17 + <style name="EditTextTheme" parent="Widget.Design.TextInputLayout">
18 + <item name="colorControlNormal">@color/colorAccent</item>
19 + <item name="colorControlActivated">@color/colorAccent</item>
20 + <item name="colorControlHighlight">@color/colorAccent</item>
21 + </style>
22 +
17 </resources> 23 </resources>
......