mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-12 03:58:56 +01:00
Migrate More screen to Compose (#6990)
This commit is contained in:
32
app/src/main/java/eu/kanade/presentation/util/Resources.kt
Normal file
32
app/src/main/java/eu/kanade/presentation/util/Resources.kt
Normal file
@@ -0,0 +1,32 @@
|
||||
package eu.kanade.presentation.util
|
||||
|
||||
import androidx.annotation.PluralsRes
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
|
||||
/**
|
||||
* Load a quantity string resource.
|
||||
*
|
||||
* @param id the resource identifier
|
||||
* @param quantity The number used to get the string for the current language's plural rules.
|
||||
* @return the string data associated with the resource
|
||||
*/
|
||||
@Composable
|
||||
fun quantityStringResource(@PluralsRes id: Int, quantity: Int): String {
|
||||
val context = LocalContext.current
|
||||
return context.resources.getQuantityString(id, quantity, quantity)
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a quantity string resource with formatting.
|
||||
*
|
||||
* @param id the resource identifier
|
||||
* @param quantity The number used to get the string for the current language's plural rules.
|
||||
* @param formatArgs the format arguments
|
||||
* @return the string data associated with the resource
|
||||
*/
|
||||
@Composable
|
||||
fun quantityStringResource(@PluralsRes id: Int, quantity: Int, vararg formatArgs: Any): String {
|
||||
val context = LocalContext.current
|
||||
return context.resources.getQuantityString(id, quantity, *formatArgs)
|
||||
}
|
||||
Reference in New Issue
Block a user