Format round 2

This commit is contained in:
Syer10
2023-03-26 16:32:53 -04:00
parent fbf3ac9a58
commit 684b0f68ed
342 changed files with 2101 additions and 2095 deletions

View File

@@ -42,7 +42,7 @@ class App : Application(), DefaultLifecycleObserver {
ThemeMode.System -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
ThemeMode.Light -> AppCompatDelegate.MODE_NIGHT_NO
ThemeMode.Dark -> AppCompatDelegate.MODE_NIGHT_YES
}
},
)
}
.launchIn(ProcessLifecycleOwner.get().lifecycleScope)
@@ -65,8 +65,8 @@ class App : Application(), DefaultLifecycleObserver {
AppCompatDelegate.setApplicationLocales(
LocaleListCompat.create(
Locale.forLanguageTag(it),
Locale.forLanguageTag("en")
)
Locale.forLanguageTag("en"),
),
)
} else if (
AppCompatDelegate.getApplicationLocales().isEmpty.not() &&

View File

@@ -21,7 +21,7 @@ import me.tatarka.inject.annotations.Provides
abstract class AppComponent(
@get:AppScope
@get:Provides
val context: Context
val context: Context,
) : ViewModelComponent, DataComponent, DomainComponent, UiComponent {
abstract val appMigrations: AppMigrations

View File

@@ -13,7 +13,7 @@ import me.tatarka.inject.annotations.Inject
class AppMigrations @Inject constructor(
private val migrationPreferences: MigrationPreferences,
private val contextWrapper: ContextWrapper
private val contextWrapper: ContextWrapper,
) {
fun runMigrations(): Boolean {

View File

@@ -58,12 +58,12 @@ class MainActivity : AppCompatActivity() {
DisposableEffect(systemUiController, useDarkIcons, primaryColor) {
systemUiController.setStatusBarColor(
color = primaryColor,
darkIcons = useDarkIcons
darkIcons = useDarkIcons,
)
systemUiController.setNavigationBarColor(
color = Color.Transparent,
darkIcons = useDarkIcons,
navigationBarContrastEnforced = false
navigationBarContrastEnforced = false,
)
onDispose {}

View File

@@ -44,7 +44,7 @@ class ReaderActivity : AppCompatActivity() {
ReaderMenu(
chapterIndex = chapterIndex,
mangaId = mangaId,
onCloseRequest = onBackPressedDispatcher::onBackPressed
onCloseRequest = onBackPressedDispatcher::onBackPressed,
)
}
}

View File

@@ -115,7 +115,8 @@ class AndroidDownloadService : Service() {
log.info { "using an intent with action $action" }
when (action) {
Actions.START.name,
Actions.RESTART.name -> startWebsocket()
Actions.RESTART.name,
-> startWebsocket()
Actions.STOP.name -> stopSelf()
else -> log.info { "This should never happen. No action in the received intent" }
}
@@ -158,7 +159,7 @@ class AndroidDownloadService : Service() {
if (serverUrl.protocol == URLProtocol.HTTPS) {
url.protocol = URLProtocol.WSS
}
}
},
) {
errorConnectionCount = 0
status.value = Status.RUNNING
@@ -208,14 +209,14 @@ class AndroidDownloadService : Service() {
MR.strings.chapter_downloading_progress
.format(
current,
max
max,
)
.toString(this@AndroidDownloadService)
.toString(this@AndroidDownloadService),
)
}.build()
notificationManager.notify(
Notifications.ID_DOWNLOADER_DOWNLOADING,
notification
notification,
)
} else {
notificationManager.cancel(Notifications.ID_DOWNLOADER_DOWNLOADING)

View File

@@ -115,7 +115,8 @@ class AndroidLibraryService : Service() {
log.info { "using an intent with action $action" }
when (action) {
Actions.START.name,
Actions.RESTART.name -> startWebsocket()
Actions.RESTART.name,
-> startWebsocket()
Actions.STOP.name -> stopSelf()
else -> log.info { "This should never happen. No action in the received intent" }
}
@@ -158,7 +159,7 @@ class AndroidLibraryService : Service() {
if (serverUrl.protocol == URLProtocol.HTTPS) {
url.protocol = URLProtocol.WSS
}
}
},
) {
errorConnectionCount = 0
status.value = Status.RUNNING
@@ -205,14 +206,14 @@ class AndroidLibraryService : Service() {
setContentTitle(
MR.strings.notification_updating
.format(current, total)
.toString(this@AndroidLibraryService)
.toString(this@AndroidLibraryService),
)
setStyle(NotificationCompat.BigTextStyle().bigText(updatingText))
setProgress(total, current, false)
}.build()
notificationManager.notify(
Notifications.ID_LIBRARY_PROGRESS,
notification
notification,
)
} else {
notificationManager.cancel(Notifications.ID_LIBRARY_PROGRESS)

View File

@@ -55,15 +55,15 @@ object Notifications {
},
buildNotificationChannelGroup(GROUP_APK_UPDATES) {
setName(MR.strings.group_updates.desc().toString(context))
}
)
},
),
)
notificationService.createNotificationChannelsCompat(
listOf(
buildNotificationChannel(
CHANNEL_DOWNLOADER_RUNNING,
NotificationManagerCompat.IMPORTANCE_LOW
NotificationManagerCompat.IMPORTANCE_LOW,
) {
setName(MR.strings.channel_active.desc().toString(context))
setGroup(GROUP_DOWNLOADER)
@@ -71,7 +71,7 @@ object Notifications {
},
buildNotificationChannel(
CHANNEL_DOWNLOADER_DOWNLOADING,
NotificationManagerCompat.IMPORTANCE_LOW
NotificationManagerCompat.IMPORTANCE_LOW,
) {
setName(MR.strings.channel_progress.desc().toString(context))
setGroup(GROUP_DOWNLOADER)
@@ -79,7 +79,7 @@ object Notifications {
},
buildNotificationChannel(
CHANNEL_LIBRARY_UPDATES,
NotificationManagerCompat.IMPORTANCE_LOW
NotificationManagerCompat.IMPORTANCE_LOW,
) {
setName(MR.strings.channel_active.desc().toString(context))
setGroup(GROUP_LIBRARY)
@@ -87,7 +87,7 @@ object Notifications {
},
buildNotificationChannel(
CHANNEL_LIBRARY_PROGRESS,
NotificationManagerCompat.IMPORTANCE_LOW
NotificationManagerCompat.IMPORTANCE_LOW,
) {
setName(MR.strings.channel_progress.desc().toString(context))
setGroup(GROUP_LIBRARY)
@@ -95,19 +95,19 @@ object Notifications {
},
buildNotificationChannel(
CHANNEL_APP_UPDATE,
NotificationManagerCompat.IMPORTANCE_DEFAULT
NotificationManagerCompat.IMPORTANCE_DEFAULT,
) {
setGroup(GROUP_APK_UPDATES)
setName(MR.strings.group_updates_channel_app.desc().toString(context))
},
buildNotificationChannel(
CHANNEL_EXTENSIONS_UPDATE,
NotificationManagerCompat.IMPORTANCE_DEFAULT
NotificationManagerCompat.IMPORTANCE_DEFAULT,
) {
setGroup(GROUP_APK_UPDATES)
setName(MR.strings.group_updates_channel_ext.desc().toString(context))
}
)
},
),
)
}
}

View File

@@ -62,7 +62,7 @@ class UpdateCheckWorker(private val context: Context, workerParams: WorkerParame
7,
TimeUnit.DAYS,
3,
TimeUnit.HOURS
TimeUnit.HOURS,
)
.addTag(TAG)
.setConstraints(constraints)

View File

@@ -20,7 +20,7 @@ import androidx.core.app.NotificationChannelGroupCompat
*/
fun buildNotificationChannelGroup(
channelId: String,
block: (NotificationChannelGroupCompat.Builder.() -> Unit)
block: (NotificationChannelGroupCompat.Builder.() -> Unit),
): NotificationChannelGroupCompat {
val builder = NotificationChannelGroupCompat.Builder(channelId)
builder.block()
@@ -38,7 +38,7 @@ fun buildNotificationChannelGroup(
fun buildNotificationChannel(
channelId: String,
channelImportance: Int,
block: (NotificationChannelCompat.Builder.() -> Unit)
block: (NotificationChannelCompat.Builder.() -> Unit),
): NotificationChannelCompat {
val builder = NotificationChannelCompat.Builder(channelId, channelImportance)
builder.block()