-
-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add subtitles font size and background configurations
Added seekbar for choosing subtitles font size (18-38 range, keeping 28 by default) Added text outlining for better legibility and an option to disable the subtitles black background.
- Loading branch information
1 parent
6951a7f
commit 11cd2f1
Showing
5 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
app/src/main/java/org/jellyfin/androidtv/ui/shared/OutlineSpan.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.jellyfin.androidtv.ui.shared | ||
|
||
import android.graphics.Canvas | ||
import android.graphics.Color | ||
import android.graphics.Paint | ||
import android.text.style.ReplacementSpan | ||
|
||
/** | ||
* A class that draws the outlines of a text | ||
*/ | ||
class OutlineSpan( | ||
): ReplacementSpan() { | ||
|
||
override fun getSize( | ||
paint: Paint, | ||
text: CharSequence, | ||
start: Int, | ||
end: Int, | ||
fontMetrics: Paint.FontMetricsInt? | ||
): Int { | ||
return paint.measureText(text, start, end).toInt() | ||
} | ||
|
||
override fun draw( | ||
canvas: Canvas, | ||
text: CharSequence, | ||
start: Int, | ||
end: Int, | ||
x: Float, | ||
top: Int, | ||
y: Int, | ||
bottom: Int, | ||
paint: Paint | ||
) { | ||
val initialColor = paint.color | ||
|
||
paint.color = Color.BLACK | ||
paint.style = Paint.Style.STROKE | ||
paint.strokeWidth = 4f | ||
canvas.drawText(text, start, end, x, y.toFloat(), paint) | ||
|
||
paint.color = initialColor | ||
paint.style = Paint.Style.FILL | ||
canvas.drawText(text, start, end, x, y.toFloat(), paint) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters