Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(YouTube - Swipe controls): Adjust the overlay text size #4503

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import kotlin.math.min
import kotlin.math.round

/**
* Main overlay layout for displaying volume and brightness level with both circular and rectangular progress bars.
* Main overlay layout for displaying volume and brightness level with both circular and horizontal progress bars.
*/
class SwipeControlsOverlayLayout(
context: Context,
Expand Down Expand Up @@ -69,7 +69,7 @@ class SwipeControlsOverlayLayout(
}
addView(circularProgressView)

// Initialize rectangular progress bar
// Initialize horizontal progress bar
val screenWidth = resources.displayMetrics.widthPixels
val layoutWidth = (screenWidth * 2 / 3).toInt() // 2/3 of screen width
horizontalProgressView = HorizontalProgressView(
Expand Down Expand Up @@ -152,10 +152,7 @@ class SwipeControlsOverlayLayout(
}

/**
* Abstract base class for progress views to reduce code duplication.
*/
/**
* Abstract base class for progress views to reduce code duplication.
* Abstract base class for progress views.
*/
abstract class AbstractProgressView(
context: Context,
Expand Down Expand Up @@ -183,10 +180,9 @@ abstract class AbstractProgressView(
public val textPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
color = overlayTextColor
textAlign = Paint.Align.CENTER
textSize = 30f // Can adjust based on need
textSize = 40f // Can adjust based on need
}


protected var progress = 0
protected var maxProgress = 100
protected var displayText: String = "0"
Expand All @@ -211,7 +207,7 @@ abstract class AbstractProgressView(
}

/**
* Custom view for rendering a circular progress indicator with text and icon.
* Custom view for rendering a circular progress indicator with icons and text.
*/
class CircularProgressView(
context: Context,
Expand All @@ -235,7 +231,7 @@ class CircularProgressView(
private val rectF = RectF()

init {
textPaint.textSize = 40f // Override default text size for horizontal view
textPaint.textSize = 40f // Override default text size for circular view
progressPaint.strokeWidth = 20f
fillBackgroundPaint.strokeWidth = 20f
progressPaint.strokeCap = Paint.Cap.ROUND
Expand Down Expand Up @@ -266,7 +262,7 @@ class CircularProgressView(
it.draw(canvas)
}

// If not in icon-only mode, draw the text inside the ring.
// If not a minimal style mode, draw the text inside the ring.
if (!overlayShowOverlayMinimalStyle) {
canvas.drawText(displayText, width / 2f, height / 2f + 60f, textPaint)
}
Expand Down Expand Up @@ -300,7 +296,7 @@ class HorizontalProgressView(
private val padding = 40f

init {
textPaint.textSize = 30f // Override default text size for horizontal view
textPaint.textSize = 36f // Override default text size for horizontal view
progressPaint.strokeWidth = 0f
progressPaint.strokeCap = Paint.Cap.BUTT
progressPaint.style = Paint.Style.FILL
Expand Down