Migrate More screen to Compose (#6990)

This commit is contained in:
arkon
2022-04-23 15:51:50 -04:00
committed by GitHub
parent 8933b41937
commit c25cffafc6
7 changed files with 341 additions and 175 deletions

View 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)
}