Code cleanups (#3264)

* Kotlin 1.8.10

https://github.com/JetBrains/kotlin/releases/tag/v1.8.10

* Migrate onActivityCreated to onViewCreated

* More final modifiers

* Java Cleanups

* Kotlin cleanups

* More final modifiers

* Const value TOOLBAR_HIDE_DELAY_MS

* Revert
This commit is contained in:
Goooler 2023-02-21 02:58:37 +08:00 committed by GitHub
commit cfea5700b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 123 additions and 133 deletions

View file

@ -44,7 +44,7 @@ class DraftsAlert @Inject constructor(db: AppDatabase) {
@Inject
lateinit var accountManager: AccountManager
public fun <T> observeInContext(context: T, showAlert: Boolean) where T : Context, T : LifecycleOwner {
fun <T> observeInContext(context: T, showAlert: Boolean) where T : Context, T : LifecycleOwner {
accountManager.activeAccount?.let { activeAccount ->
val coroutineScope = context.lifecycleScope
@ -63,7 +63,7 @@ class DraftsAlert @Inject constructor(db: AppDatabase) {
AlertDialog.Builder(context)
.setTitle(R.string.action_post_failed)
.setMessage(
context.getResources().getQuantityString(R.plurals.action_post_failed_detail, count)
context.resources.getQuantityString(R.plurals.action_post_failed_detail, count)
)
.setPositiveButton(R.string.action_post_failed_show_drafts) { _: DialogInterface?, _: Int ->
clearDraftsAlert(coroutineScope, activeAccountId) // User looked at drafts
@ -78,7 +78,7 @@ class DraftsAlert @Inject constructor(db: AppDatabase) {
}
}
} else {
draftsNeedUserAlert.observe(context) { _ ->
draftsNeedUserAlert.observe(context) {
Log.d(TAG, "User id $activeAccountId: Clean out notification-worthy drafts")
clearDraftsAlert(coroutineScope, activeAccountId)
}
@ -91,7 +91,7 @@ class DraftsAlert @Inject constructor(db: AppDatabase) {
/**
* Clear drafts alert for specified user
*/
fun clearDraftsAlert(coroutineScope: LifecycleCoroutineScope, id: Long) {
private fun clearDraftsAlert(coroutineScope: LifecycleCoroutineScope, id: Long) {
coroutineScope.launch {
draftDao.draftsClearNeedUserAlert(id)
}