diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 5ce2925a7..b22e38f40 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -94,7 +94,7 @@ android { compose = true } composeOptions { - kotlinCompilerExtensionVersion = "1.4.7" + kotlinCompilerExtensionVersion = "1.5.1" } } @@ -121,7 +121,7 @@ dependencies { implementation("com.google.accompanist:accompanist-systemuicontroller:$accompanistVersion") // LiveData - implementation("androidx.compose.runtime:runtime-livedata:1.4.3") + implementation("androidx.compose.runtime:runtime-livedata:1.5.0") implementation("androidx.lifecycle:lifecycle-runtime-compose:2.6.1") // Images @@ -151,19 +151,19 @@ dependencies { // optional - Paging 3 Integration implementation("androidx.room:room-paging:2.5.2") - implementation("io.arrow-kt:arrow-core:1.1.5") + implementation("io.arrow-kt:arrow-core:1.2.0") // Unfortunately, ui tooling, and the markdown thing, still brings in the other material2 dependencies implementation("androidx.compose.material3:material3:1.1.1") implementation("androidx.compose.material3:material3-window-size-class:1.1.1") implementation("org.ocpsoft.prettytime:prettytime:5.0.6.Final") - implementation("androidx.navigation:navigation-compose:2.7.0-rc01") - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.1") + implementation("androidx.navigation:navigation-compose:2.7.0") + testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3") testImplementation("androidx.arch.core:core-testing:2.2.0") implementation("com.squareup.retrofit2:retrofit:2.9.0") implementation("com.squareup.retrofit2:converter-gson:2.9.0") - val composeVersion = "1.5.0-rc01" + val composeVersion = "1.5.0" implementation("androidx.compose.ui:ui:$composeVersion") implementation("androidx.compose.ui:ui-tooling-preview:$composeVersion") androidTestImplementation("androidx.compose.ui:ui-test-junit4:$composeVersion") @@ -177,9 +177,9 @@ dependencies { androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") testImplementation("org.mockito:mockito-core:5.4.0") - testImplementation("org.mockito.kotlin:mockito-kotlin:5.0.0") + testImplementation("org.mockito.kotlin:mockito-kotlin:5.1.0") - implementation("androidx.browser:browser:1.5.0") + implementation("androidx.browser:browser:1.6.0") implementation("androidx.profileinstaller:profileinstaller:1.3.1") baselineProfile(project(":benchmarks")) diff --git a/app/schemas/com.jerboa.db.AppDB/25.json b/app/schemas/com.jerboa.db.AppDB/25.json new file mode 100644 index 000000000..8792ec6b1 --- /dev/null +++ b/app/schemas/com.jerboa.db.AppDB/25.json @@ -0,0 +1,246 @@ +{ + "formatVersion": 1, + "database": { + "version": 25, + "identityHash": "e7e957b63c2297483c5e9aeb1e263a1f", + "entities": [ + { + "tableName": "Account", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `current` INTEGER NOT NULL, `instance` TEXT NOT NULL, `name` TEXT NOT NULL, `jwt` TEXT NOT NULL, `default_listing_type` INTEGER NOT NULL DEFAULT 0, `default_sort_type` INTEGER NOT NULL DEFAULT 0, `verification_state` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`id`))", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "current", + "columnName": "current", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "instance", + "columnName": "instance", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "jwt", + "columnName": "jwt", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "defaultListingType", + "columnName": "default_listing_type", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "defaultSortType", + "columnName": "default_sort_type", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "verificationState", + "columnName": "verification_state", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "id" + ] + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "AppSettings", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `font_size` INTEGER NOT NULL DEFAULT 16, `theme` INTEGER NOT NULL DEFAULT 0, `theme_color` INTEGER NOT NULL DEFAULT 0, `viewed_changelog` INTEGER NOT NULL DEFAULT 0, `post_view_mode` INTEGER NOT NULL DEFAULT 0, `show_bottom_nav` INTEGER NOT NULL DEFAULT 1, `show_collapsed_comment_content` INTEGER NOT NULL DEFAULT 0, `show_comment_action_bar_by_default` INTEGER NOT NULL DEFAULT 1, `show_voting_arrows_in_list_view` INTEGER NOT NULL DEFAULT 1, `show_parent_comment_navigation_buttons` INTEGER NOT NULL DEFAULT 0, `navigate_parent_comments_with_volume_buttons` INTEGER NOT NULL DEFAULT 0, `use_custom_tabs` INTEGER NOT NULL DEFAULT 1, `use_private_tabs` INTEGER NOT NULL DEFAULT 0, `secure_window` INTEGER NOT NULL DEFAULT 0, `blur_nsfw` INTEGER NOT NULL DEFAULT 1, `show_text_descriptions_in_navbar` INTEGER NOT NULL DEFAULT 1, `markAsReadOnScroll` INTEGER NOT NULL DEFAULT 0, `backConfirmationMode` INTEGER NOT NULL DEFAULT 1, `show_post_link_previews` INTEGER NOT NULL DEFAULT 1, `post_actionbar_mode` INTEGER NOT NULL DEFAULT 0, `auto_play_gifs` INTEGER NOT NULL DEFAULT 0)", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "fontSize", + "columnName": "font_size", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "16" + }, + { + "fieldPath": "theme", + "columnName": "theme", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "themeColor", + "columnName": "theme_color", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "viewedChangelog", + "columnName": "viewed_changelog", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "postViewMode", + "columnName": "post_view_mode", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "showBottomNav", + "columnName": "show_bottom_nav", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "1" + }, + { + "fieldPath": "showCollapsedCommentContent", + "columnName": "show_collapsed_comment_content", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "showCommentActionBarByDefault", + "columnName": "show_comment_action_bar_by_default", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "1" + }, + { + "fieldPath": "showVotingArrowsInListView", + "columnName": "show_voting_arrows_in_list_view", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "1" + }, + { + "fieldPath": "showParentCommentNavigationButtons", + "columnName": "show_parent_comment_navigation_buttons", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "navigateParentCommentsWithVolumeButtons", + "columnName": "navigate_parent_comments_with_volume_buttons", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "useCustomTabs", + "columnName": "use_custom_tabs", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "1" + }, + { + "fieldPath": "usePrivateTabs", + "columnName": "use_private_tabs", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "secureWindow", + "columnName": "secure_window", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "blurNSFW", + "columnName": "blur_nsfw", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "1" + }, + { + "fieldPath": "showTextDescriptionsInNavbar", + "columnName": "show_text_descriptions_in_navbar", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "1" + }, + { + "fieldPath": "markAsReadOnScroll", + "columnName": "markAsReadOnScroll", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "backConfirmationMode", + "columnName": "backConfirmationMode", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "1" + }, + { + "fieldPath": "showPostLinkPreviews", + "columnName": "show_post_link_previews", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "1" + }, + { + "fieldPath": "postActionbarMode", + "columnName": "post_actionbar_mode", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "autoPlayGifs", + "columnName": "auto_play_gifs", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "id" + ] + }, + "indices": [], + "foreignKeys": [] + } + ], + "views": [], + "setupQueries": [ + "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'e7e957b63c2297483c5e9aeb1e263a1f')" + ] + } +} \ No newline at end of file diff --git a/app/src/main/java/com/jerboa/JerboaApplication.kt b/app/src/main/java/com/jerboa/JerboaApplication.kt index 6eaabf2f7..1d74b6f44 100644 --- a/app/src/main/java/com/jerboa/JerboaApplication.kt +++ b/app/src/main/java/com/jerboa/JerboaApplication.kt @@ -13,8 +13,9 @@ import com.jerboa.util.downloadprogress.DownloadProgress class JerboaApplication : Application(), ImageLoaderFactory { lateinit var container: AppDBContainer - lateinit var imageViewLoader: ImageLoader + lateinit var imageViewerLoader: ImageLoader lateinit var imageLoader: ImageLoader + lateinit var imageGifLoader: ImageLoader override fun onCreate() { super.onCreate() container = AppDBContainer(this) @@ -28,8 +29,7 @@ class JerboaApplication : Application(), ImageLoaderFactory { } .build() - imageViewLoader = imageLoader.newBuilder() - .okHttpClient(DownloadProgress.downloadProgressHttpClient) + imageGifLoader = imageLoader.newBuilder() .components { if (Build.VERSION.SDK_INT >= 28) { add(ImageDecoderDecoder.Factory()) @@ -38,6 +38,10 @@ class JerboaApplication : Application(), ImageLoaderFactory { } } .build() + + imageViewerLoader = imageGifLoader.newBuilder() + .okHttpClient(DownloadProgress.downloadProgressHttpClient) + .build() } override fun newImageLoader(): ImageLoader = imageLoader diff --git a/app/src/main/java/com/jerboa/MainActivity.kt b/app/src/main/java/com/jerboa/MainActivity.kt index 211a46aed..cfd7c1c24 100644 --- a/app/src/main/java/com/jerboa/MainActivity.kt +++ b/app/src/main/java/com/jerboa/MainActivity.kt @@ -30,6 +30,7 @@ import androidx.navigation.navArgument import androidx.navigation.navDeepLink import androidx.navigation.navigation import arrow.core.Either +import coil.Coil import com.jerboa.api.API import com.jerboa.api.ApiState import com.jerboa.api.MINIMUM_API_VERSION @@ -120,6 +121,12 @@ class MainActivity : AppCompatActivity() { triggerRebirth(ctx) } + if (appSettings.autoPlayGifs) { + Coil.setImageLoader((ctx.applicationContext as JerboaApplication).imageGifLoader) + } else { + Coil.setImageLoader(ctx.applicationContext as JerboaApplication) + } + JerboaTheme( appSettings = appSettings, ) { @@ -132,7 +139,7 @@ class MainActivity : AppCompatActivity() { } DisposableEffect(appSettings.backConfirmationMode) { - when (BackConfirmationMode.values()[appSettings.backConfirmationMode]) { + when (BackConfirmationMode.entries[appSettings.backConfirmationMode]) { BackConfirmationMode.Toast -> { this@MainActivity.addConfirmationToast(appState.navController, ctx) } diff --git a/app/src/main/java/com/jerboa/db/AppDB.kt b/app/src/main/java/com/jerboa/db/AppDB.kt index a14a88821..ef3d30cfe 100644 --- a/app/src/main/java/com/jerboa/db/AppDB.kt +++ b/app/src/main/java/com/jerboa/db/AppDB.kt @@ -37,10 +37,11 @@ val APP_SETTINGS_DEFAULT = AppSettings( markAsReadOnScroll = false, showPostLinkPreviews = true, postActionbarMode = 0, + autoPlayGifs = false, ) @Database( - version = 24, + version = 25, entities = [Account::class, AppSettings::class], exportSchema = true, ) diff --git a/app/src/main/java/com/jerboa/db/AppDBMigrations.kt b/app/src/main/java/com/jerboa/db/AppDBMigrations.kt index 30e67d488..3a190e38e 100644 --- a/app/src/main/java/com/jerboa/db/AppDBMigrations.kt +++ b/app/src/main/java/com/jerboa/db/AppDBMigrations.kt @@ -321,6 +321,23 @@ val MIGRATION_24_23 = object : Migration(24, 23) { } } +val MIGRATION_24_25 = object : Migration(24, 25) { + override fun migrate(database: SupportSQLiteDatabase) { + database.execSQL(UPDATE_APP_CHANGELOG_UNVIEWED) + database.execSQL( + "ALTER TABLE AppSettings ADD COLUMN auto_play_gifs INTEGER NOT NULL DEFAULT 0", + ) + } +} + +val MIGRATION_25_24 = object : Migration(25, 24) { + override fun migrate(database: SupportSQLiteDatabase) { + database.execSQL( + "ALTER TABLE AppSettings DROP COLUMN auto_play_gifs", + ) + } +} + // Don't forget to test your migration with `./gradlew app:connectAndroidTest` val MIGRATIONS_LIST = arrayOf( MIGRATION_1_2, @@ -349,4 +366,6 @@ val MIGRATIONS_LIST = arrayOf( MIGRATION_23_22, MIGRATION_23_24, MIGRATION_24_23, + MIGRATION_24_25, + MIGRATION_25_24, ) diff --git a/app/src/main/java/com/jerboa/db/entity/AppSettings.kt b/app/src/main/java/com/jerboa/db/entity/AppSettings.kt index 138ee58e2..a716a77f6 100644 --- a/app/src/main/java/com/jerboa/db/entity/AppSettings.kt +++ b/app/src/main/java/com/jerboa/db/entity/AppSettings.kt @@ -108,4 +108,9 @@ data class AppSettings( defaultValue = "0", ) val postActionbarMode: Int, + @ColumnInfo( + name = "auto_play_gifs", + defaultValue = "0", + ) + val autoPlayGifs: Boolean, ) diff --git a/app/src/main/java/com/jerboa/feat/AccountVerificationState.kt b/app/src/main/java/com/jerboa/feat/AccountVerificationState.kt index 62fe40a92..b864b28c1 100644 --- a/app/src/main/java/com/jerboa/feat/AccountVerificationState.kt +++ b/app/src/main/java/com/jerboa/feat/AccountVerificationState.kt @@ -82,7 +82,7 @@ enum class AccountVerificationState { ; companion object { - val size = values().size + val size = entries.size } } diff --git a/app/src/main/java/com/jerboa/model/HomeViewModel.kt b/app/src/main/java/com/jerboa/model/HomeViewModel.kt index 863a51ec6..532254a9b 100644 --- a/app/src/main/java/com/jerboa/model/HomeViewModel.kt +++ b/app/src/main/java/com/jerboa/model/HomeViewModel.kt @@ -197,9 +197,9 @@ class HomeViewModel : ViewModel(), Initializable { } fun updateFromAccount(account: Account) { - updateSortType(SortType.values().getOrElse(account.defaultSortType) { sortType }) + updateSortType(SortType.entries.getOrElse(account.defaultSortType) { sortType }) updateListingType( - ListingType.values().getOrElse(account.defaultListingType) { listingType }, + ListingType.entries.getOrElse(account.defaultListingType) { listingType }, ) } diff --git a/app/src/main/java/com/jerboa/model/SiteViewModel.kt b/app/src/main/java/com/jerboa/model/SiteViewModel.kt index 65ee5c577..9605de3d6 100644 --- a/app/src/main/java/com/jerboa/model/SiteViewModel.kt +++ b/app/src/main/java/com/jerboa/model/SiteViewModel.kt @@ -43,8 +43,8 @@ class SiteViewModel : ViewModel() { } fun updateFromAccount(account: Account) { - updateSortType(SortType.values().getOrElse(account.defaultSortType) { sortType }) - updateListingType(ListingType.values().getOrElse(account.defaultListingType) { listingType }) + updateSortType(SortType.entries.getOrElse(account.defaultSortType) { sortType }) + updateListingType(ListingType.entries.getOrElse(account.defaultListingType) { listingType }) } fun getSite( diff --git a/app/src/main/java/com/jerboa/ui/components/common/AppBars.kt b/app/src/main/java/com/jerboa/ui/components/common/AppBars.kt index 58f7bed1e..d452364bb 100644 --- a/app/src/main/java/com/jerboa/ui/components/common/AppBars.kt +++ b/app/src/main/java/com/jerboa/ui/components/common/AppBars.kt @@ -114,7 +114,7 @@ fun BottomAppBarAll( } NavigationBar { - for (tab in NavTab.values()) { + for (tab in NavTab.entries) { val selected = tab == selectedTab NavigationBarItem( icon = { diff --git a/app/src/main/java/com/jerboa/ui/components/common/Dialogs.kt b/app/src/main/java/com/jerboa/ui/components/common/Dialogs.kt index 8715694d3..b97d1d440 100644 --- a/app/src/main/java/com/jerboa/ui/components/common/Dialogs.kt +++ b/app/src/main/java/com/jerboa/ui/components/common/Dialogs.kt @@ -52,7 +52,7 @@ val DONATION_MARKDOWN = """ """.trimIndent() -val topSortTypes = SortType.values().filter { it.name.startsWith("Top") } +val topSortTypes = SortType.entries.filter { it.name.startsWith("Top") } @Composable fun SortTopOptionsDialog( @@ -214,7 +214,7 @@ fun PostViewModeDialog( onDismissRequest = onDismissRequest, text = { Column { - PostViewMode.values().map { + PostViewMode.entries.map { IconAndTextDrawerItem( text = stringResource(it.mode), onClick = { onClickPostViewMode(it) }, diff --git a/app/src/main/java/com/jerboa/ui/components/community/CommunityActivity.kt b/app/src/main/java/com/jerboa/ui/components/community/CommunityActivity.kt index 7afa9386c..dcdb4d0a2 100644 --- a/app/src/main/java/com/jerboa/ui/components/community/CommunityActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/community/CommunityActivity.kt @@ -119,7 +119,7 @@ fun CommunityActivity( communityViewModel.resetPage() if (account.isAnon()) { - communityViewModel.updateSortType(SortType.values().getOrElse(account.defaultSortType) { siteViewModel.sortType }) + communityViewModel.updateSortType(SortType.entries.getOrElse(account.defaultSortType) { siteViewModel.sortType }) } communityViewModel.getCommunity( diff --git a/app/src/main/java/com/jerboa/ui/components/drawer/Drawer.kt b/app/src/main/java/com/jerboa/ui/components/drawer/Drawer.kt index 6746c47d3..363e5dce3 100644 --- a/app/src/main/java/com/jerboa/ui/components/drawer/Drawer.kt +++ b/app/src/main/java/com/jerboa/ui/components/drawer/Drawer.kt @@ -14,6 +14,8 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.rememberLazyListState +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.Add import androidx.compose.material.icons.outlined.Bookmarks @@ -226,7 +228,7 @@ fun DrawerItemsMain( } if (!showBottomNav) { - items(NavTab.values()) { + items(NavTab.entries) { IconAndTextDrawerItem( text = stringResource(it.textId), icon = it.iconOutlined, @@ -311,33 +313,34 @@ fun DrawerAddAccountMode( accountsWithoutCurrent?.remove(currentAccount) - Column { - IconAndTextDrawerItem( - text = stringResource(R.string.home_add_account), - icon = Icons.Outlined.Add, - onClick = onAddAccount, - ) - accountsWithoutCurrent?.forEach { + Column(Modifier.verticalScroll(rememberScrollState())) { + if (!currentAccount.isAnon()) { IconAndTextDrawerItem( - text = stringResource(R.string.home_switch_to, it.name, it.instance), - icon = Icons.Outlined.Login, - onClick = { onSwitchAccountClick(it) }, + text = stringResource(R.string.home_sign_out), + icon = Icons.Outlined.Close, + onClick = onSignOutClick, ) - } - if (!currentAccount.isAnon()) { IconAndTextDrawerItem( text = stringResource(R.string.home_switch_anon), icon = Icons.Outlined.Login, onClick = onSwitchAnon, ) + } + accountsWithoutCurrent?.forEach { IconAndTextDrawerItem( - text = stringResource(R.string.home_sign_out), - icon = Icons.Outlined.Close, - onClick = onSignOutClick, + text = stringResource(R.string.home_switch_to, it.name, it.instance), + icon = Icons.Outlined.Login, + onClick = { onSwitchAccountClick(it) }, ) } + + IconAndTextDrawerItem( + text = stringResource(R.string.home_add_account), + icon = Icons.Outlined.Add, + onClick = onAddAccount, + ) } } @@ -387,7 +390,9 @@ fun DrawerHeader( ) { if (showWarningIcon) { Icon( - modifier = Modifier.weight(0.1f).padding(end = SMALL_PADDING), + modifier = Modifier + .weight(0.1f) + .padding(end = SMALL_PADDING), imageVector = Icons.Outlined.WarningAmber, contentDescription = stringResource(R.string.warning), tint = MaterialTheme.colorScheme.error, diff --git a/app/src/main/java/com/jerboa/ui/components/imageviewer/ImageViewerActivity.kt b/app/src/main/java/com/jerboa/ui/components/imageviewer/ImageViewerActivity.kt index 1167cae0b..9c54eb963 100644 --- a/app/src/main/java/com/jerboa/ui/components/imageviewer/ImageViewerActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/imageviewer/ImageViewerActivity.kt @@ -73,7 +73,7 @@ fun ImageViewer(url: String, appState: JerboaAppState) { val backColor = MaterialTheme.colorScheme.scrim var showTopBar by remember { mutableStateOf(true) } - val imageGifLoader = (ctx.applicationContext as JerboaApplication).imageViewLoader + val imageGifLoader = (ctx.applicationContext as JerboaApplication).imageViewerLoader var debounce by remember { mutableStateOf(false) } diff --git a/app/src/main/java/com/jerboa/ui/components/inbox/InboxActivity.kt b/app/src/main/java/com/jerboa/ui/components/inbox/InboxActivity.kt index 916bf241d..00f9a57a3 100644 --- a/app/src/main/java/com/jerboa/ui/components/inbox/InboxActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/inbox/InboxActivity.kt @@ -227,7 +227,7 @@ fun InboxTabs( val transferPrivateMessageDepsViaRoot = appState.rootChannel() val transferCommentReplyDepsViaRoot = appState.rootChannel() - val tabTitles = InboxTab.values().map { getLocalizedStringForInboxTab(ctx, it) } + val tabTitles = InboxTab.entries.map { getLocalizedStringForInboxTab(ctx, it) } val pagerState = rememberPagerState { tabTitles.size } Column( diff --git a/app/src/main/java/com/jerboa/ui/components/person/PersonProfileActivity.kt b/app/src/main/java/com/jerboa/ui/components/person/PersonProfileActivity.kt index dc54eca2f..ad4cdadb7 100644 --- a/app/src/main/java/com/jerboa/ui/components/person/PersonProfileActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/person/PersonProfileActivity.kt @@ -338,7 +338,7 @@ fun UserTabs( getLocalizedStringForUserTab(ctx, UserTab.Comments), ) } else { - UserTab.values().map { getLocalizedStringForUserTab(ctx, it) } + UserTab.entries.map { getLocalizedStringForUserTab(ctx, it) } } val pagerState = rememberPagerState { tabTitles.size } diff --git a/app/src/main/java/com/jerboa/ui/components/settings/account/AccountSettings.kt b/app/src/main/java/com/jerboa/ui/components/settings/account/AccountSettings.kt index 0aaba4ea1..cfc4d72ae 100644 --- a/app/src/main/java/com/jerboa/ui/components/settings/account/AccountSettings.kt +++ b/app/src/main/java/com/jerboa/ui/components/settings/account/AccountSettings.kt @@ -152,12 +152,12 @@ fun SettingsForm( matrix_user_id = matrixUserId, interface_language = interfaceLang, bot_account = botAccount.value, - default_sort_type = SortType.values()[defaultSortType.value], + default_sort_type = SortType.entries[defaultSortType.value], send_notifications_to_email = sendNotificationsToEmail.value, show_avatars = showAvatars.value, show_bot_accounts = showBotAccount.value, show_nsfw = showNsfw.value, - default_listing_type = ListingType.values()[defaultListingType.value], + default_listing_type = ListingType.entries[defaultListingType.value], show_new_post_notifs = showNewPostNotifs.value, show_read_posts = showReadPosts.value, theme = theme, diff --git a/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt b/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt index e70b8b1f8..a1b192633 100644 --- a/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt @@ -96,6 +96,7 @@ fun LookAndFeelActivity( val scrollState = rememberScrollState() val markAsReadOnScroll = rememberBooleanSettingState(settings.markAsReadOnScroll) + val autoPlayGifs = rememberBooleanSettingState(settings.autoPlayGifs) fun updateAppSettings() { appSettingsViewModel.update( @@ -121,6 +122,7 @@ fun LookAndFeelActivity( showPostLinkPreviews = showPostLinkPreviewMode.value, markAsReadOnScroll = markAsReadOnScroll.value, postActionbarMode = postActionbarMode.value, + autoPlayGifs = autoPlayGifs.value, ), ) } @@ -176,7 +178,7 @@ fun LookAndFeelActivity( ) SettingsList( state = themeState, - items = ThemeMode.values().map { stringResource(it.mode) }, + items = ThemeMode.entries.map { stringResource(it.mode) }, icon = { Icon( imageVector = Icons.Outlined.Palette, @@ -193,7 +195,7 @@ fun LookAndFeelActivity( ) SettingsList( state = themeColorState, - items = ThemeColor.values().map { stringResource(it.mode) }, + items = ThemeColor.entries.map { stringResource(it.mode) }, icon = { Icon( imageVector = Icons.Outlined.Colorize, @@ -210,7 +212,7 @@ fun LookAndFeelActivity( ) SettingsList( state = postViewModeState, - items = PostViewMode.values().map { stringResource(it.mode) }, + items = PostViewMode.entries.map { stringResource(it.mode) }, icon = { Icon( imageVector = Icons.Outlined.ViewList, @@ -230,7 +232,7 @@ fun LookAndFeelActivity( Text(text = stringResource(R.string.confirm_exit)) }, state = backConfirmationMode, - items = BackConfirmationMode.values().map { stringResource(it.resId) }, + items = BackConfirmationMode.entries.map { stringResource(it.resId) }, onItemSelected = { i, _ -> backConfirmationMode.value = i updateAppSettings() @@ -247,7 +249,7 @@ fun LookAndFeelActivity( Text(text = stringResource(R.string.post_actionbar)) }, state = postActionbarMode, - items = PostActionbarMode.values().map { stringResource(it.resId) }, + items = PostActionbarMode.entries.map { stringResource(it.resId) }, onItemSelected = { i, _ -> postActionbarMode.value = i updateAppSettings() @@ -351,6 +353,13 @@ fun LookAndFeelActivity( }, onCheckedChange = { updateAppSettings() }, ) + SettingsCheckbox( + state = autoPlayGifs, + title = { + Text(stringResource(id = R.string.settings_autoplaygifs)) + }, + onCheckedChange = { updateAppSettings() }, + ) } }, ) diff --git a/app/src/main/java/com/jerboa/ui/theme/Theme.kt b/app/src/main/java/com/jerboa/ui/theme/Theme.kt index 2be783999..60edb8a07 100644 --- a/app/src/main/java/com/jerboa/ui/theme/Theme.kt +++ b/app/src/main/java/com/jerboa/ui/theme/Theme.kt @@ -31,8 +31,8 @@ fun JerboaTheme( appSettings: AppSettings, content: @Composable () -> Unit, ) { - val themeMode = ThemeMode.values()[appSettings.theme] - val themeColor = ThemeColor.values()[appSettings.themeColor] + val themeMode = ThemeMode.entries[appSettings.theme] + val themeColor = ThemeColor.entries[appSettings.themeColor] val fontSize = appSettings.fontSize.sp val ctx = LocalContext.current diff --git a/app/src/main/res/values-nn/strings.xml b/app/src/main/res/values-nn/strings.xml index 547f7177c..49155a3b5 100644 --- a/app/src/main/res/values-nn/strings.xml +++ b/app/src/main/res/values-nn/strings.xml @@ -3,10 +3,10 @@ %1$s kommentarar Oppretta %1$s innlegg - %1$s brukarar / 6 månadar - %1$s brukarar / dag - %1$s brukarar / månad - %1$s brukarar / veke + %1$s brukarar/halvår + %1$s brukarar/dag + %1$s brukarar/månad + %1$s brukarar/veke Sosiale medium Konto­innstillingar Alle @@ -26,7 +26,7 @@ Vis avatarar Vis bot-kontoar Vis varslingar for nye innlegg - Vis NSFW/vakseninnhald + Vis NSFW-/vakseninnhald Vis lesne innlegg Vis poeng Abonnement @@ -93,7 +93,7 @@ Blokker fellesskap Fellesskapsinfo Fellesskapsikon - Vart med + Abonnerer %1$s brukarar/månad Søk … Ventar @@ -110,7 +110,7 @@ Fellesskap Kopier tittel frå nettsida: %1$s Skriv innlegg - Merk som NSFW/vakseninnhald + Merk som NSFW-/vakseninnhald Tilbake Rapporter Skriv inn grunngjeving @@ -131,6 +131,7 @@ På topp siste månad På topp siste veke På topp siste år + På topp nokosinne Gamle Ulesne Versjonen av tenaren (%1$s) er eldre enn den eldste støtta versjonen (%2$s).\n\nMeld frå til administratoren din og logg på ein annan instans, eller logg ut og bruk standardinstansen. @@ -147,7 +148,7 @@ Innstillingar Logg ut Nettstad­info - Abonnerer + Abonnement Abonnement Byt til %1$s\@%2$s Filter @@ -178,7 +179,7 @@ Forhindra taking av skjermbilete Vis som standard handlings­linje for kommentarar Vis navigasjonslinje - Vis tekst­skildringar i navigasjonslinja + Vis tekst på navigasjonslinja Vis røystepiler i listevising Vis navigasjonsknappar for forelderkommentarar Bla mellom forelder­kommentarar med lydstyrke-knappane @@ -296,12 +297,18 @@ NyeKommentarar Gamle ToppAlle - ToppSisteDogn - ToppSisteManad - ToppSisteVeke - ToppSisteAar + ToppDøgn + ToppMånad + ToppVeke + ToppÅr %1$s %2$s sidan + Tittel + Tittelen kan ikkje vera på meir enn 200 teikn + Tittelen må ha minst tre teikn + Tittel er obligatorisk Tilbake + Nettadresse + Ugyldig nettadresse Logg inn først Røyst opp Røyst ned @@ -320,12 +327,12 @@ Lastar Vis NSFW-bilete som uklare Førehandsvis lenkjer i innlegg - ToppSisteTime - ToppSisteSeksTimar - ToppSisteTolvTimar - ToppSisteTreManadar - ToppSisteSeksManadar - ToppSisteNiManadar + ToppTime + Topp6Timar + Topp12Timar + Topp3Månadar + Topp6Månadar + Topp9Månadar På topp siste time På topp siste seks timar På topp siste tolv timar @@ -344,5 +351,42 @@ Er du sikker på at du vil avslutta? Klarte ikkje lagra biletet Byt til anonym - Du er alt pålogga med denne kontoen + Du er alt innlogga med denne kontoen + Merk som lesne ved rulling + %1$s\@%2$s-info + Send ei melding + Feil ved sending av melding. Prøver på nytt … + Skriv meldinga her + Melding send + Feil ved innlasting av bilete. Trykk for å prøva på nytt. + Ikonet viser eit feilsymbol – eit utropsteikn inni ein sirkel. + Prøv på nytt + Manglar nettverkstilkopling + Klarte ikkje kopla til instansen (%s) + Det kan vera at kontoen din er sletta + Klarte ikkje henta profilen din + JWT-polletten din er utgått på tid + Logg inn på nytt + Klarte ikkje stadfesta JWT-pollett + Klarte ikkje henta nettstad-info + Denne handlinga krev brukarkonto + Slett kontoen din + Kontoen er ikkje klar enno. + Kontoen (%s) er ikkje stadfesta enno + Åtvaring + E-postadressa til kontoen er ikkje stadfesta enno. Sjå i innboksen. + Feil ved innlogging + Søknaden din om registrering vart avvist + Ventar på godkjenning av registrerings­søknaden + TOTP-pollett manglar + Ugyldig TOTP-pollett oppgjeven + Instansen (%s) opplever interne tenarfeil + Kontoen din er utestengd fram til %s + Del + Bruk tofaktor­autentisering + Opna 2FA-lenkje + Lang handlingslinje for innlegg + Kort venstre handlingslinje for innlegg + Kort høgre handlingslinje for innlegg + Handlingslinje-modus for innlegg diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5954366aa..ac9c7527f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -390,4 +390,5 @@ Short lefthand post actionbar Short righthand post actionbar Post actionbar mode + Auto play GIFs diff --git a/benchmarks/build.gradle.kts b/benchmarks/build.gradle.kts index f2c41a104..c83f5cc24 100644 --- a/benchmarks/build.gradle.kts +++ b/benchmarks/build.gradle.kts @@ -62,6 +62,6 @@ baselineProfile { dependencies { implementation("androidx.test.ext:junit:1.1.5") implementation("androidx.test.espresso:espresso-core:3.5.1") - implementation("androidx.test.uiautomator:uiautomator:2.3.0-alpha03") - implementation("androidx.benchmark:benchmark-macro-junit4:1.2.0-beta01") + implementation("androidx.test.uiautomator:uiautomator:2.3.0-alpha04") + implementation("androidx.benchmark:benchmark-macro-junit4:1.2.0-beta03") } diff --git a/build.gradle.kts b/build.gradle.kts index 960630da6..3affe9099 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,12 +3,12 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { id("com.android.application") version "8.1.0" apply false id("com.android.library") version "8.1.0" apply false - id("org.jetbrains.kotlin.android") version "1.8.20" apply false + id("org.jetbrains.kotlin.android") version "1.9.0" apply false id("com.github.ben-manes.versions") version "0.42.0" id("org.jmailen.kotlinter") version "3.15.0" apply false - id("com.google.devtools.ksp") version "1.8.21-1.0.11" apply false - id( "com.android.test") version "8.1.0" apply false - id( "androidx.baselineprofile") version "1.2.0-alpha13" apply false + id("com.google.devtools.ksp") version "1.9.0-1.0.13" apply false + id("com.android.test") version "8.1.0" apply false + id("androidx.baselineprofile") version "1.2.0-alpha13" apply false } subprojects {