mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-24 03:42:15 +00:00
Add: StringPref composable
This commit is contained in:
parent
12b17ad803
commit
2b6192d75d
@ -29,6 +29,7 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.machiav3lli.fdroid.content.BooleanPrefsMeta
|
import com.machiav3lli.fdroid.content.BooleanPrefsMeta
|
||||||
|
import com.machiav3lli.fdroid.content.NonBooleanPrefsMeta
|
||||||
import com.machiav3lli.fdroid.content.Preferences
|
import com.machiav3lli.fdroid.content.Preferences
|
||||||
import com.machiav3lli.fdroid.ui.compose.utils.addIf
|
import com.machiav3lli.fdroid.ui.compose.utils.addIf
|
||||||
|
|
||||||
@ -147,3 +148,23 @@ fun SwitchPreference(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun StringPreference(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
prefKey: Preferences.Key<String>,
|
||||||
|
index: Int = 1,
|
||||||
|
groupSize: Int = 1,
|
||||||
|
isEnabled: Boolean = true,
|
||||||
|
onClick: (() -> Unit) = {},
|
||||||
|
) {
|
||||||
|
BasePreference(
|
||||||
|
modifier = modifier,
|
||||||
|
titleId = NonBooleanPrefsMeta[prefKey] ?: -1,
|
||||||
|
summary = Preferences[prefKey],
|
||||||
|
index = index,
|
||||||
|
groupSize = groupSize,
|
||||||
|
isEnabled = isEnabled,
|
||||||
|
onClick = onClick
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user