@@ -25,6 +25,7 @@ import androidx.compose.ui.graphics.Color
2525import androidx.compose.ui.graphics.RectangleShape
2626import androidx.compose.ui.unit.dp
2727import co.stonephone.stonecamera.StoneCameraViewModel
28+ import co.stonephone.stonecamera.ui.ResponsiveOrientation
2829
2930class VideoModePlugin : IPlugin {
3031 override val id: String = " videoMode"
@@ -62,79 +63,85 @@ class VideoModePlugin : IPlugin {
6263 ) {
6364 // Camera Switcher Button
6465 if (isRecording) {
65- IconButton (
66- onClick = {
66+ ResponsiveOrientation {
67+ IconButton (
68+ onClick = {
69+ if (isPaused) {
70+ viewModel.resumeRecording()
71+ } else {
72+ viewModel.pauseRecording()
73+ }
74+ },
75+ modifier = Modifier
76+ .size(48 .dp)
77+ .padding(8 .dp)
78+ .border(1 .dp, Color .White , CircleShape )
79+ .background(Color .White .copy(alpha = 0.1f ), shape = CircleShape )
80+ ) {
6781 if (isPaused) {
68- viewModel.resumeRecording()
82+ Icon (
83+ imageVector = Icons .Filled .PlayArrow ,
84+ contentDescription = " Resume Recording" ,
85+ tint = Color .White ,
86+ modifier = Modifier .fillMaxSize()
87+ )
6988 } else {
70- viewModel.pauseRecording()
89+ Icon (
90+ imageVector = Icons .Filled .Pause ,
91+ contentDescription = " Pause Recording" ,
92+ tint = Color .White ,
93+ modifier = Modifier .fillMaxSize()
94+ )
7195 }
72- },
73- modifier = Modifier
74- .size(48 .dp)
75- .padding(8 .dp)
76- .border(1 .dp, Color .White , CircleShape )
77- .background(Color .White .copy(alpha = 0.1f ), shape = CircleShape )
78- ) {
79- if (isPaused) {
80- Icon (
81- imageVector = Icons .Filled .PlayArrow ,
82- contentDescription = " Resume Recording" ,
83- tint = Color .White ,
84- modifier = Modifier .fillMaxSize()
85- )
86- } else {
87- Icon (
88- imageVector = Icons .Filled .Pause ,
89- contentDescription = " Pause Recording" ,
90- tint = Color .White ,
91- modifier = Modifier .fillMaxSize()
92- )
9396 }
9497 }
9598 } else {
96- Box (
97- modifier = Modifier
98- .size(48 .dp)
99- .background(Color .Transparent , shape = CircleShape )
100- .clickable {
101- viewModel.toggleCameraFacing()
102- }, contentAlignment = Alignment .Center
103- ) {
99+ ResponsiveOrientation {
100+ Box (
101+ modifier = Modifier
102+ .size(48 .dp)
103+ .background(Color .Transparent , shape = CircleShape )
104+ .clickable {
105+ viewModel.toggleCameraFacing()
106+ }, contentAlignment = Alignment .Center
107+ ) {
104108
109+ }
105110 }
106111 }
107-
108- Box (
109- modifier = Modifier
110- .size(60 .dp)
111- .border(1 .dp, Color .White , CircleShape )
112- .padding(4 .dp), contentAlignment = Alignment .Center
113- ) {
114- Box (contentAlignment = Alignment .Center , modifier = Modifier
115- .background(
116- Color .Red , shape = if (! isRecording) CircleShape else RectangleShape
117- )
118- .fillMaxSize(if (! isRecording) 1f else 0.5f )
119- .clickable {
120- if (! isRecording) {
121- // Start recording
122- viewModel.startRecording(
123- viewModel.videoCapture
124- ) { uri ->
125- Log .d(
126- " StoneCameraApp" , " Video saved to: $uri "
127- )
112+ ResponsiveOrientation {
113+ Box (
114+ modifier = Modifier
115+ .size(60 .dp)
116+ .border(1 .dp, Color .White , CircleShape )
117+ .padding(4 .dp), contentAlignment = Alignment .Center
118+ ) {
119+ Box (contentAlignment = Alignment .Center , modifier = Modifier
120+ .background(
121+ Color .Red ,
122+ shape = if (! isRecording) CircleShape else RectangleShape
123+ )
124+ .fillMaxSize(if (! isRecording) 1f else 0.5f )
125+ .clickable {
126+ if (! isRecording) {
127+ // Start recording
128+ viewModel.startRecording(
129+ viewModel.videoCapture
130+ ) { uri ->
131+ Log .d(
132+ " StoneCameraApp" , " Video saved to: $uri "
133+ )
134+ }
135+ } else {
136+ // Stop recording
137+ viewModel.stopRecording()
128138 }
129- } else {
130- // Stop recording
131- viewModel.stopRecording()
132- }
133139
134- }
140+ }
135141
136142
137- ) {}
143+ ) {}
144+ }
138145 }
139146
140147 if (isRecording) {
@@ -160,20 +167,22 @@ class VideoModePlugin : IPlugin {
160167 }) {}
161168 }
162169 } else {
163- // Camera Switcher Button
164- IconButton (
165- onClick = { viewModel.toggleCameraFacing() },
166- modifier = Modifier
167- .size(48 .dp)
168- .padding(8 .dp)
169- .background(Color .White .copy(alpha = 0.1f ), shape = CircleShape )
170- ) {
171- Icon (
172- imageVector = Icons .Filled .FlipCameraAndroid , // Use FlipCameraAndroid if preferred
173- contentDescription = " Flip Camera" ,
174- tint = Color .White , // Customize the color if needed
175- modifier = Modifier .fillMaxSize()
176- )
170+ ResponsiveOrientation {
171+ // Camera Switcher Button
172+ IconButton (
173+ onClick = { viewModel.toggleCameraFacing() },
174+ modifier = Modifier
175+ .size(48 .dp)
176+ .padding(8 .dp)
177+ .background(Color .White .copy(alpha = 0.1f ), shape = CircleShape )
178+ ) {
179+ Icon (
180+ imageVector = Icons .Filled .FlipCameraAndroid , // Use FlipCameraAndroid if preferred
181+ contentDescription = " Flip Camera" ,
182+ tint = Color .White , // Customize the color if needed
183+ modifier = Modifier .fillMaxSize()
184+ )
185+ }
177186 }
178187 }
179188 }
0 commit comments