174 lines
No EOL
5.4 KiB
PowerShell
174 lines
No EOL
5.4 KiB
PowerShell
$path = 'app\src\main\kotlin\com\bodycamera\twentyfoulabs\camera\M530CameraActivity.kt'
|
|
|
|
$c = Get-Content $path -Raw
|
|
|
|
# ---------------------------------------------------------
|
|
# Import para fondos redondeados
|
|
# ---------------------------------------------------------
|
|
if ($c -notmatch 'import android\.graphics\.drawable\.GradientDrawable') {
|
|
$c = $c.Replace(
|
|
'import android.graphics.Typeface',
|
|
"import android.graphics.Typeface`r`nimport android.graphics.drawable.GradientDrawable"
|
|
)
|
|
}
|
|
|
|
# ---------------------------------------------------------
|
|
# Boton CERRAR
|
|
# ---------------------------------------------------------
|
|
$oldClose = @'
|
|
closeButton = Button(this).apply {
|
|
text = "X"
|
|
gravity = Gravity.CENTER
|
|
setTextColor(Color.WHITE)
|
|
textSize = 25f
|
|
setTypeface(typeface, Typeface.BOLD)
|
|
minWidth = 0
|
|
minHeight = 0
|
|
setPadding(0, 0, 0, 0)
|
|
background = circleDrawable(0xB0000000.toInt(), Color.WHITE, dp(1))
|
|
isClickable = true
|
|
isFocusable = true
|
|
elevation = dp(12).toFloat()
|
|
setOnClickListener {
|
|
stopRecordingIfNeeded()
|
|
finish()
|
|
}
|
|
}
|
|
root.addView(
|
|
closeButton,
|
|
FrameLayout.LayoutParams(dp(54), dp(54), Gravity.TOP or Gravity.END).apply {
|
|
topMargin = dp(62)
|
|
rightMargin = dp(12)
|
|
}
|
|
)
|
|
'@
|
|
|
|
$newClose = @'
|
|
closeButton = Button(this).apply {
|
|
text = "X"
|
|
gravity = Gravity.CENTER
|
|
setTextColor(Color.WHITE)
|
|
textSize = 18f
|
|
setTypeface(typeface, Typeface.BOLD)
|
|
minWidth = 0
|
|
minHeight = 0
|
|
setPadding(0, 0, 0, 0)
|
|
|
|
background = GradientDrawable().apply {
|
|
shape = GradientDrawable.OVAL
|
|
setColor(0x99000000.toInt())
|
|
setStroke(dp(1), 0xCCFFFFFF.toInt())
|
|
}
|
|
|
|
isClickable = true
|
|
isFocusable = true
|
|
elevation = dp(8).toFloat()
|
|
contentDescription = "Cerrar"
|
|
|
|
setOnClickListener {
|
|
stopRecordingIfNeeded()
|
|
finish()
|
|
}
|
|
}
|
|
|
|
root.addView(
|
|
closeButton,
|
|
FrameLayout.LayoutParams(dp(44), dp(44), Gravity.TOP or Gravity.END).apply {
|
|
topMargin = dp(60)
|
|
rightMargin = dp(12)
|
|
}
|
|
)
|
|
'@
|
|
|
|
$c = $c.Replace($oldClose, $newClose)
|
|
|
|
# ---------------------------------------------------------
|
|
# Boton CAMBIAR CAMARA
|
|
# ---------------------------------------------------------
|
|
$oldSwitch = @'
|
|
switchCameraButton = Button(this).apply {
|
|
text = "CAMBIAR"
|
|
setTextColor(Color.WHITE)
|
|
textSize = 12f
|
|
setTypeface(typeface, Typeface.BOLD)
|
|
gravity = Gravity.CENTER
|
|
minWidth = 0
|
|
minHeight = 0
|
|
setPadding(dp(8), 0, dp(8), 0)
|
|
background = circleDrawable(0xB0000000.toInt(), Color.WHITE, dp(1))
|
|
visibility = if (mode == MODE_FRONT_PREVIEW) View.VISIBLE else View.GONE
|
|
elevation = dp(12).toFloat()
|
|
|
|
setOnClickListener {
|
|
if (mode == MODE_FRONT_PREVIEW) {
|
|
frontPreviewUsesFrontCamera = !frontPreviewUsesFrontCamera
|
|
startCamera()
|
|
}
|
|
}
|
|
}
|
|
|
|
root.addView(
|
|
switchCameraButton,
|
|
FrameLayout.LayoutParams(dp(110), dp(48), Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL).apply {
|
|
bottomMargin = dp(76)
|
|
}
|
|
)
|
|
'@
|
|
|
|
$newSwitch = @'
|
|
switchCameraButton = Button(this).apply {
|
|
text = "CAMARA POSTERIOR"
|
|
setTextColor(Color.WHITE)
|
|
textSize = 11f
|
|
setTypeface(typeface, Typeface.BOLD)
|
|
gravity = Gravity.CENTER
|
|
minWidth = 0
|
|
minHeight = 0
|
|
setPadding(dp(16), 0, dp(16), 0)
|
|
|
|
background = GradientDrawable().apply {
|
|
shape = GradientDrawable.RECTANGLE
|
|
cornerRadius = dp(24).toFloat()
|
|
setColor(0xB31A1A1A.toInt())
|
|
setStroke(dp(1), 0xCCFFFFFF.toInt())
|
|
}
|
|
|
|
visibility = if (mode == MODE_FRONT_PREVIEW) View.VISIBLE else View.GONE
|
|
elevation = dp(10).toFloat()
|
|
contentDescription = "Cambiar camara"
|
|
|
|
setOnClickListener {
|
|
if (mode == MODE_FRONT_PREVIEW) {
|
|
frontPreviewUsesFrontCamera = !frontPreviewUsesFrontCamera
|
|
|
|
text = if (frontPreviewUsesFrontCamera)
|
|
"CAMARA POSTERIOR"
|
|
else
|
|
"CAMARA FRONTAL"
|
|
|
|
startCamera()
|
|
}
|
|
}
|
|
}
|
|
|
|
root.addView(
|
|
switchCameraButton,
|
|
FrameLayout.LayoutParams(
|
|
dp(170),
|
|
dp(46),
|
|
Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL
|
|
).apply {
|
|
bottomMargin = dp(76)
|
|
}
|
|
)
|
|
'@
|
|
|
|
$c = $c.Replace($oldSwitch, $newSwitch)
|
|
|
|
Set-Content -Path $path -Value $c -Encoding UTF8
|
|
|
|
Write-Host ""
|
|
Write-Host "=========================================="
|
|
Write-Host "UI DE CAMARA ACTUALIZADA"
|
|
Write-Host "=========================================="
|
|
Write-Host "" |