mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2025-12-10 06:42:05 +01:00
Fix formatting in a few more files
This commit is contained in:
@@ -10,18 +10,17 @@ import android.content.Context
|
||||
import com.russhwolf.settings.SharedPreferencesSettings
|
||||
import me.tatarka.inject.annotations.Inject
|
||||
|
||||
actual class PreferenceStoreFactory
|
||||
@Inject
|
||||
constructor(
|
||||
private val context: Context,
|
||||
) {
|
||||
actual fun create(vararg names: String): PreferenceStore =
|
||||
StandardPreferenceStore(
|
||||
SharedPreferencesSettings(
|
||||
context.getSharedPreferences(
|
||||
names.joinToString(separator = "_"),
|
||||
Context.MODE_PRIVATE,
|
||||
),
|
||||
@Inject
|
||||
actual class PreferenceStoreFactory(
|
||||
private val context: Context,
|
||||
) {
|
||||
actual fun create(vararg names: String): PreferenceStore =
|
||||
StandardPreferenceStore(
|
||||
SharedPreferencesSettings(
|
||||
context.getSharedPreferences(
|
||||
names.joinToString(separator = "_"),
|
||||
Context.MODE_PRIVATE,
|
||||
),
|
||||
)
|
||||
}
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -10,16 +10,15 @@ import com.russhwolf.settings.PreferencesSettings
|
||||
import me.tatarka.inject.annotations.Inject
|
||||
import java.util.prefs.Preferences
|
||||
|
||||
actual class PreferenceStoreFactory
|
||||
@Inject
|
||||
constructor() {
|
||||
private val rootNode: Preferences = Preferences.userRoot()
|
||||
.node("ca/gosyer/tachideskjui")
|
||||
@Inject
|
||||
actual class PreferenceStoreFactory() {
|
||||
private val rootNode: Preferences = Preferences.userRoot()
|
||||
.node("ca/gosyer/tachideskjui")
|
||||
|
||||
actual fun create(vararg names: String): PreferenceStore =
|
||||
StandardPreferenceStore(
|
||||
PreferencesSettings(
|
||||
rootNode.node(names.joinToString(separator = "/")),
|
||||
),
|
||||
)
|
||||
}
|
||||
actual fun create(vararg names: String): PreferenceStore =
|
||||
StandardPreferenceStore(
|
||||
PreferencesSettings(
|
||||
rootNode.node(names.joinToString(separator = "/")),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -10,13 +10,12 @@ import com.russhwolf.settings.NSUserDefaultsSettings
|
||||
import me.tatarka.inject.annotations.Inject
|
||||
import platform.Foundation.NSUserDefaults
|
||||
|
||||
actual class PreferenceStoreFactory
|
||||
@Inject
|
||||
constructor() {
|
||||
actual fun create(vararg names: String): PreferenceStore =
|
||||
StandardPreferenceStore(
|
||||
NSUserDefaultsSettings(
|
||||
NSUserDefaults.standardUserDefaults,
|
||||
),
|
||||
)
|
||||
}
|
||||
@Inject
|
||||
actual class PreferenceStoreFactory() {
|
||||
actual fun create(vararg names: String): PreferenceStore =
|
||||
StandardPreferenceStore(
|
||||
NSUserDefaultsSettings(
|
||||
NSUserDefaults.standardUserDefaults,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -5,48 +5,47 @@ import ca.gosyer.jui.core.lang.toPlatform
|
||||
import kotlinx.datetime.Instant
|
||||
import me.tatarka.inject.annotations.Inject
|
||||
|
||||
actual class DateHandler
|
||||
@Inject
|
||||
constructor() {
|
||||
actual val formatOptions by lazy {
|
||||
listOf(
|
||||
"",
|
||||
"MM/dd/yy",
|
||||
"dd/MM/yy",
|
||||
"yyyy-MM-dd",
|
||||
)
|
||||
@Inject
|
||||
actual class DateHandler() {
|
||||
actual val formatOptions by lazy {
|
||||
listOf(
|
||||
"",
|
||||
"MM/dd/yy",
|
||||
"dd/MM/yy",
|
||||
"yyyy-MM-dd",
|
||||
)
|
||||
}
|
||||
|
||||
actual fun getDateFormat(format: String): (Instant) -> String =
|
||||
when (format) {
|
||||
"" -> NSDateFormatter()
|
||||
.apply {
|
||||
setDateStyle(NSDateFormatterShortStyle)
|
||||
setTimeStyle(NSDateFormatterNoStyle)
|
||||
setLocale(Locale.current.toPlatform())
|
||||
}
|
||||
|
||||
else -> NSDateFormatter()
|
||||
.apply {
|
||||
setDateFormat(format)
|
||||
}
|
||||
}.let { formatter ->
|
||||
{
|
||||
formatter.stringFromDate(it.toNSDate())
|
||||
}
|
||||
}
|
||||
|
||||
actual fun getDateFormat(format: String): (Instant) -> String =
|
||||
when (format) {
|
||||
"" -> NSDateFormatter()
|
||||
.apply {
|
||||
setDateStyle(NSDateFormatterShortStyle)
|
||||
setTimeStyle(NSDateFormatterNoStyle)
|
||||
setLocale(Locale.current.toPlatform())
|
||||
}
|
||||
|
||||
else -> NSDateFormatter()
|
||||
.apply {
|
||||
setDateFormat(format)
|
||||
}
|
||||
}.let { formatter ->
|
||||
actual val dateTimeFormat: (Instant) -> String by lazy {
|
||||
NSDateFormatter()
|
||||
.apply {
|
||||
setDateStyle(NSDateFormatterShortStyle)
|
||||
setTimeStyle(NSDateFormatterShortStyle)
|
||||
setLocale(Locale.current.toPlatform())
|
||||
}
|
||||
.let { formatter ->
|
||||
{
|
||||
formatter.stringFromDate(it.toNSDate())
|
||||
}
|
||||
}
|
||||
|
||||
actual val dateTimeFormat: (Instant) -> String by lazy {
|
||||
NSDateFormatter()
|
||||
.apply {
|
||||
setDateStyle(NSDateFormatterShortStyle)
|
||||
setTimeStyle(NSDateFormatterShortStyle)
|
||||
setLocale(Locale.current.toPlatform())
|
||||
}
|
||||
.let { formatter ->
|
||||
{
|
||||
formatter.stringFromDate(it.toNSDate())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,40 +9,39 @@ import java.time.ZoneId
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.time.format.FormatStyle
|
||||
|
||||
actual class DateHandler
|
||||
@Inject
|
||||
constructor() {
|
||||
actual val formatOptions by lazy {
|
||||
listOf(
|
||||
"",
|
||||
"MM/dd/yy",
|
||||
"dd/MM/yy",
|
||||
"yyyy-MM-dd",
|
||||
)
|
||||
@Inject
|
||||
actual class DateHandler() {
|
||||
actual val formatOptions by lazy {
|
||||
listOf(
|
||||
"",
|
||||
"MM/dd/yy",
|
||||
"dd/MM/yy",
|
||||
"yyyy-MM-dd",
|
||||
)
|
||||
}
|
||||
|
||||
actual fun getDateFormat(format: String): (Instant) -> String =
|
||||
when (format) {
|
||||
"" -> DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT)
|
||||
.withLocale(Locale.current.toPlatform())
|
||||
.withZone(ZoneId.systemDefault())
|
||||
|
||||
else -> DateTimeFormatter.ofPattern(format)
|
||||
.withZone(ZoneId.systemDefault())
|
||||
}.let { formatter ->
|
||||
{
|
||||
formatter.format(it.toJavaInstant())
|
||||
}
|
||||
}
|
||||
|
||||
actual fun getDateFormat(format: String): (Instant) -> String =
|
||||
when (format) {
|
||||
"" -> DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT)
|
||||
.withLocale(Locale.current.toPlatform())
|
||||
.withZone(ZoneId.systemDefault())
|
||||
|
||||
else -> DateTimeFormatter.ofPattern(format)
|
||||
.withZone(ZoneId.systemDefault())
|
||||
}.let { formatter ->
|
||||
actual val dateTimeFormat: (Instant) -> String by lazy {
|
||||
DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT)
|
||||
.withLocale(Locale.current.toPlatform())
|
||||
.withZone(ZoneId.systemDefault())
|
||||
.let { formatter ->
|
||||
{
|
||||
formatter.format(it.toJavaInstant())
|
||||
}
|
||||
}
|
||||
|
||||
actual val dateTimeFormat: (Instant) -> String by lazy {
|
||||
DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT)
|
||||
.withLocale(Locale.current.toPlatform())
|
||||
.withZone(ZoneId.systemDefault())
|
||||
.let { formatter ->
|
||||
{
|
||||
formatter.format(it.toJavaInstant())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user