Skip to content

Commit cde3863

Browse files
committed
refactor(*): rename preview view to camera preview view
1 parent 9aae8cc commit cde3863

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

demos/camera/src/main/java/io/github/thibaultbee/streampack/app/ui/main/PreviewFragment.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import io.github.thibaultbee.streampack.app.R
3434
import io.github.thibaultbee.streampack.app.databinding.MainFragmentBinding
3535
import io.github.thibaultbee.streampack.app.utils.DialogUtils
3636
import io.github.thibaultbee.streampack.app.utils.PermissionManager
37-
import io.github.thibaultbee.streampack.ui.views.PreviewView
37+
import io.github.thibaultbee.streampack.ui.views.CameraPreviewView
3838
import kotlinx.coroutines.launch
3939

4040
class PreviewFragment : Fragment(R.layout.main_fragment) {
@@ -151,7 +151,7 @@ class PreviewFragment : Fragment(R.layout.main_fragment) {
151151
private fun inflateStreamerPreview() {
152152
val preview = binding.preview
153153
// Set camera settings button when camera is started
154-
preview.listener = object : PreviewView.Listener {
154+
preview.listener = object : CameraPreviewView.Listener {
155155
override fun onPreviewStarted() {
156156
previewViewModel.onPreviewStarted()
157157
}

demos/camera/src/main/java/io/github/thibaultbee/streampack/app/ui/main/PreviewViewModel.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import io.github.thibaultbee.streampack.core.streamers.observers.StreamerViewMod
4949
import io.github.thibaultbee.streampack.core.utils.extensions.isClosedException
5050
import io.github.thibaultbee.streampack.core.utils.extensions.isFrameRateSupported
5151
import io.github.thibaultbee.streampack.ext.srt.regulator.controllers.DefaultSrtBitrateRegulatorController
52-
import io.github.thibaultbee.streampack.ui.views.PreviewView
52+
import io.github.thibaultbee.streampack.ui.views.CameraPreviewView
5353
import kotlinx.coroutines.flow.combine
5454
import kotlinx.coroutines.flow.filter
5555
import kotlinx.coroutines.flow.filterNotNull
@@ -165,7 +165,7 @@ class PreviewViewModel(private val application: Application) : ObservableViewMod
165165
}
166166
}
167167

168-
fun setStreamerView(view: PreviewView) {
168+
fun setStreamerView(view: CameraPreviewView) {
169169
if (streamer is ICameraStreamer) {
170170
view.streamer = streamer as ICameraStreamer
171171
}

demos/camera/src/main/res/layout/main_fragment.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
android:layout_height="match_parent"
1616
android:keepScreenOn="true">
1717

18-
<io.github.thibaultbee.streampack.ui.views.PreviewView
18+
<io.github.thibaultbee.streampack.ui.views.CameraPreviewView
1919
android:id="@+id/preview"
2020
android:layout_width="match_parent"
2121
android:layout_height="match_parent"

ui/src/main/java/io/github/thibaultbee/streampack/ui/views/PreviewView.kt renamed to ui/src/main/java/io/github/thibaultbee/streampack/ui/views/CameraPreviewView.kt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ import java.util.concurrent.CancellationException
5353
*
5454
* In the case, you are using it, do not call [ICameraCoroutineStreamer.startPreview] (or
5555
* [ICameraCallbackStreamer.stopPreview]) and [ICameraCoroutineStreamer.stopPreview] on application
56-
* side. It will be handled by the [PreviewView].
56+
* side. It will be handled by the [CameraPreviewView].
5757
*
5858
* The [Manifest.permission.CAMERA] permission must be granted before using this view.
5959
*/
60-
class PreviewView @JvmOverloads constructor(
60+
class CameraPreviewView @JvmOverloads constructor(
6161
context: Context, attrs: AttributeSet? = null, defStyle: Int = 0
6262
) : FrameLayout(context, attrs, defStyle) {
6363
private val cameraViewfinder = CameraViewfinder(context, attrs, defStyle)
@@ -103,7 +103,7 @@ class PreviewView @JvmOverloads constructor(
103103
}
104104

105105
/**
106-
* The position of the [PreviewView] within its container.
106+
* The position of the [CameraPreviewView] within its container.
107107
*/
108108
var position: Position
109109
get() = getPosition(cameraViewfinder.scaleType)
@@ -112,7 +112,7 @@ class PreviewView @JvmOverloads constructor(
112112
}
113113

114114
/**
115-
* The scale mode of the [PreviewView] within its container.
115+
* The scale mode of the [CameraPreviewView] within its container.
116116
*/
117117
var scaleMode: ScaleMode
118118
get() = getScaleMode(cameraViewfinder.scaleType)
@@ -428,7 +428,7 @@ class PreviewView @JvmOverloads constructor(
428428

429429

430430
/**
431-
* A listener for the [PreviewView].
431+
* A listener for the [CameraPreviewView].
432432
*/
433433
interface Listener {
434434
/**
@@ -449,21 +449,21 @@ class PreviewView @JvmOverloads constructor(
449449
}
450450

451451
/**
452-
* Options for the position of the [PreviewView] within its container.
452+
* Options for the position of the [CameraPreviewView] within its container.
453453
*/
454454
enum class Position(val value: Int) {
455455
/**
456-
* The [PreviewView] is positioned at the top of its container.
456+
* The [CameraPreviewView] is positioned at the top of its container.
457457
*/
458458
START(0),
459459

460460
/**
461-
* The [PreviewView] is positioned in the center of its container.
461+
* The [CameraPreviewView] is positioned in the center of its container.
462462
*/
463463
CENTER(1),
464464

465465
/**
466-
* The [PreviewView] is positioned in the bottom of its container.
466+
* The [CameraPreviewView] is positioned in the bottom of its container.
467467
*/
468468
END(2);
469469

@@ -476,24 +476,24 @@ class PreviewView @JvmOverloads constructor(
476476
}
477477

478478
/**
479-
* Options for scaling the [PreviewView] within its container.
479+
* Options for scaling the [CameraPreviewView] within its container.
480480
*/
481481
enum class ScaleMode(val value: Int) {
482482
/**
483-
* Scale the [PreviewView], maintaining the source aspect ratio, so it fills the entire
483+
* Scale the [CameraPreviewView], maintaining the source aspect ratio, so it fills the entire
484484
* parent.
485485
*
486-
* This may cause the [PreviewView] to be cropped.
486+
* This may cause the [CameraPreviewView] to be cropped.
487487
*/
488488
FILL(0),
489489

490490
/**
491-
* Scale the [PreviewView], maintaining the source aspect ratio, so it is entirely contained
491+
* Scale the [CameraPreviewView], maintaining the source aspect ratio, so it is entirely contained
492492
* within the parent. The background area not covered by the viewfinder stream will be black
493-
* or the background of the [PreviewView].
493+
* or the background of the [CameraPreviewView].
494494
*
495495
*
496-
* Both dimensions of the [PreviewView] will be equal or less than the corresponding
496+
* Both dimensions of the [CameraPreviewView] will be equal or less than the corresponding
497497
* dimensions of its parent.
498498
*/
499499
FIT(1);

0 commit comments

Comments
 (0)