Created
November 22, 2023 10:39
-
-
Save yongjhih/0d3107babe812dfce87b87ff3c8ee493 to your computer and use it in GitHub Desktop.
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
import android.os.Build | |
import androidx.annotation.RequiresApi | |
import java.text.BreakIterator | |
import java.text.CharacterIterator | |
interface IBreakIterator { | |
fun first(): Int | |
fun last(): Int | |
fun next(): Int | |
fun next(value: Int): Int | |
fun previous(): Int | |
fun following(offset: Int): Int | |
fun current(): Int | |
var text: CharacterIterator? | |
fun setText(newText: String) | |
fun setText(newText: CharSequence) | |
} | |
@RequiresApi(Build.VERSION_CODES.Q) | |
class CharacterBreakIterator29(private val iterator: android.icu.text.BreakIterator) : IBreakIterator { | |
override fun first(): Int = | |
iterator.first() | |
override fun last(): Int = iterator.last() | |
override fun next(): Int = iterator.next() | |
override fun next(value: Int): Int = iterator.next(value) | |
override fun previous(): Int = iterator.previous() | |
override fun following(offset: Int): Int = iterator.following(offset) | |
override fun current(): Int = iterator.current() | |
override var text: CharacterIterator? | |
get() = iterator.text | |
set(value) { iterator.text = value } | |
override fun setText(newText: String) = iterator.setText(newText) | |
override fun setText(newText: CharSequence) = iterator.setText(newText) | |
} | |
@RequiresApi(Build.VERSION_CODES.N) | |
class CharacterBreakIterator24(private val iterator: android.icu.text.BreakIterator) : IBreakIterator { | |
override fun first(): Int = | |
iterator.first() | |
override fun last(): Int = iterator.last() | |
override fun next(): Int = iterator.next() | |
override fun next(value: Int): Int = iterator.next(value) | |
override fun previous(): Int = iterator.previous() | |
override fun following(offset: Int): Int = iterator.following(offset) | |
override fun current(): Int = iterator.current() | |
override var text: CharacterIterator? | |
get() = iterator.text | |
set(value) { iterator.text = value } | |
override fun setText(newText: String) = iterator.setText(newText) | |
override fun setText(newText: CharSequence) = iterator.setText(newText.toString()) | |
} | |
class CharacterBreakIterator21(private val iterator: BreakIterator) : IBreakIterator { | |
override fun first(): Int = | |
iterator.first() | |
override fun last(): Int = iterator.last() | |
override fun next(): Int = iterator.next() | |
override fun next(value: Int): Int = iterator.next(value) | |
override fun previous(): Int = iterator.previous() | |
override fun following(offset: Int): Int = iterator.following(offset) | |
override fun current(): Int = iterator.current() | |
override var text: CharacterIterator? | |
get() = iterator.text | |
set(value) { iterator.text = value } | |
override fun setText(newText: String) = iterator.setText(newText) | |
override fun setText(newText: CharSequence) = iterator.setText(newText.toString()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment