Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temp workaround for compose-settings height bug. #1345

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package com.jerboa.ui.components.settings

import android.util.Log
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Info
Expand All @@ -25,6 +26,7 @@ import com.jerboa.model.AccountViewModel
import com.jerboa.ui.components.common.JerboaSnackbarHost
import com.jerboa.ui.components.common.SimpleTopAppBar
import com.jerboa.ui.components.common.getCurrentAccount
import com.jerboa.ui.theme.SETTINGS_MENU_LINK_HEIGHT

@Composable
fun SettingsActivity(
Expand All @@ -47,6 +49,7 @@ fun SettingsActivity(
content = { padding ->
Column(modifier = Modifier.padding(padding)) {
SettingsMenuLink(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
title = { Text(stringResource(R.string.settings_activity_look_and_feel)) },
icon = {
Icon(
Expand All @@ -58,6 +61,7 @@ fun SettingsActivity(
)
if (!account.isAnon()) {
SettingsMenuLink(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
title = {
Text(
stringResource(
Expand All @@ -76,6 +80,7 @@ fun SettingsActivity(
)
}
SettingsMenuLink(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
title = { Text(stringResource(R.string.settings_activity_about)) },
icon = {
Icon(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.jerboa.ui.components.settings.about

import android.util.Log
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
Expand Down Expand Up @@ -29,6 +30,7 @@ import androidx.compose.ui.unit.dp
import com.alorma.compose.settings.ui.SettingsMenuLink
import com.jerboa.R
import com.jerboa.ui.components.common.SimpleTopAppBar
import com.jerboa.ui.theme.SETTINGS_MENU_LINK_HEIGHT

const val GITHUB_URL = "https://github.com/dessalines/jerboa"
const val JERBOA_MATRIX_CHAT = "https://matrix.to/#/#jerboa-dev:matrix.org"
Expand Down Expand Up @@ -73,6 +75,7 @@ fun AboutActivity(
.padding(padding),
) {
SettingsMenuLink(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
title = { Text(stringResource(R.string.settings_about_what_s_new)) },
subtitle = {
Text(
Expand All @@ -95,6 +98,7 @@ fun AboutActivity(
SettingsDivider()
SettingsHeader(text = stringResource(R.string.settings_about_support))
SettingsMenuLink(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
title = { Text(stringResource(R.string.settings_about_issue_tracker)) },
icon = {
Icon(
Expand All @@ -107,6 +111,7 @@ fun AboutActivity(
},
)
SettingsMenuLink(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
title = { Text(stringResource(R.string.crash_logs)) },
icon = {
Icon(
Expand All @@ -117,6 +122,7 @@ fun AboutActivity(
onClick = onClickCrashLogs,
)
SettingsMenuLink(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
title = { Text(stringResource(R.string.settings_about_developer_matrix_chatroom)) },
icon = {
Icon(
Expand All @@ -129,6 +135,7 @@ fun AboutActivity(
},
)
SettingsMenuLink(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
title = { Text(stringResource(R.string.settings_about_donate_to_jerboa_development)) },
icon = {
Icon(
Expand All @@ -143,6 +150,7 @@ fun AboutActivity(
SettingsDivider()
SettingsHeader(text = stringResource(R.string.about_social))
SettingsMenuLink(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
title = { Text(stringResource(R.string.settings_about_join_c_jerboa)) },
icon = {
Icon(
Expand All @@ -156,6 +164,7 @@ fun AboutActivity(
},
)
SettingsMenuLink(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
title = { Text(stringResource(R.string.settings_about_follow_on_mastodon)) },
icon = {
Icon(
Expand All @@ -170,7 +179,7 @@ fun AboutActivity(
SettingsDivider()
SettingsHeader(text = stringResource(R.string.settings_about_open_source))
SettingsMenuLink(
modifier = Modifier.padding(top = 20.dp),
modifier = Modifier.padding(top = 20.dp).height(SETTINGS_MENU_LINK_HEIGHT),
title = { Text(stringResource(R.string.settings_about_source_code)) },
subtitle = {
Text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
Expand Down Expand Up @@ -48,6 +49,7 @@ import com.jerboa.ui.components.common.MarkdownTextField
import com.jerboa.ui.components.common.PickImage
import com.jerboa.ui.components.common.PictrsBannerImage
import com.jerboa.ui.theme.MEDIUM_PADDING
import com.jerboa.ui.theme.SETTINGS_MENU_LINK_HEIGHT
import com.jerboa.ui.theme.muted
import it.vercruysse.lemmyapi.dto.ListingType
import it.vercruysse.lemmyapi.dto.SortType
Expand Down Expand Up @@ -254,6 +256,7 @@ fun SettingsForm(
}
}
SettingsListDropdown(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = defaultListingType,
title = { Text(text = stringResource(R.string.account_settings_default_listing_type)) },
items =
Expand All @@ -264,49 +267,57 @@ fun SettingsForm(
),
)
SettingsListDropdown(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = defaultSortType,
title = { Text(text = stringResource(R.string.account_settings_default_sort_type)) },
items = sortTypeNames,
)

SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = showNsfw,
title = {
Text(text = stringResource(R.string.account_settings_show_nsfw))
},
)
SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = showAvatars,
title = {
Text(text = stringResource(R.string.account_settings_show_avatars))
},
)
SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = showReadPosts,
title = {
Text(text = stringResource(R.string.account_settings_show_read_posts))
},
)

SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = botAccount,
title = {
Text(text = stringResource(R.string.account_settings_bot_account))
},
)
SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = showBotAccount,
title = {
Text(text = stringResource(R.string.account_settings_show_bot_accounts))
},
)
SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = showScores,
title = {
Text(text = stringResource(R.string.account_settings_show_scores))
},
)
SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
enabled = email.isNotEmpty(),
state = sendNotificationsToEmail,
title = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.jerboa.ui.components.settings.lookandfeel
import android.util.Log
import androidx.appcompat.app.AppCompatDelegate
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
Expand Down Expand Up @@ -50,6 +51,7 @@ import com.jerboa.matchLocale
import com.jerboa.model.AppSettingsViewModel
import com.jerboa.ui.components.common.JerboaSnackbarHost
import com.jerboa.ui.components.common.SimpleTopAppBar
import com.jerboa.ui.theme.SETTINGS_MENU_LINK_HEIGHT

@OptIn(ExperimentalMaterial3Api::class)
@Composable
Expand Down Expand Up @@ -150,6 +152,7 @@ fun LookAndFeelActivity(
.padding(padding),
) {
SettingsListDropdown(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
title = {
Text(text = stringResource(R.string.lang_language))
},
Expand All @@ -168,7 +171,7 @@ fun LookAndFeelActivity(
},
)
SettingsSlider(
modifier = Modifier.padding(top = 10.dp),
modifier = Modifier.padding(top = 10.dp).height(SETTINGS_MENU_LINK_HEIGHT),
valueRange = 8f..48f,
state = fontSizeState,
icon = {
Expand All @@ -189,6 +192,7 @@ fun LookAndFeelActivity(
onValueChangeFinished = { updateAppSettings() },
)
SettingsList(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = themeState,
items = ThemeMode.entries.map { stringResource(it.mode) },
icon = {
Expand All @@ -206,6 +210,7 @@ fun LookAndFeelActivity(
},
)
SettingsList(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = themeColorState,
items = ThemeColor.entries.map { stringResource(it.mode) },
icon = {
Expand All @@ -223,6 +228,7 @@ fun LookAndFeelActivity(
},
)
SettingsList(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = postViewModeState,
items = PostViewMode.entries.map { stringResource(it.mode) },
icon = {
Expand All @@ -240,6 +246,7 @@ fun LookAndFeelActivity(
},
)
SettingsList(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = postNavigationGestureModeState,
items = PostNavigationGestureMode.entries.map { stringResource(it.mode) },
icon = {
Expand All @@ -257,6 +264,7 @@ fun LookAndFeelActivity(
},
)
SettingsList(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
title = {
Text(text = stringResource(R.string.confirm_exit))
},
Expand All @@ -274,6 +282,7 @@ fun LookAndFeelActivity(
},
)
SettingsList(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
title = {
Text(text = stringResource(R.string.post_actionbar))
},
Expand All @@ -291,6 +300,7 @@ fun LookAndFeelActivity(
},
)
SettingsListDropdown(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = blurNSFW,
icon = {
Icon(
Expand All @@ -303,13 +313,15 @@ fun LookAndFeelActivity(
onItemSelected = { _, _ -> updateAppSettings() },
)
SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = showBottomNavState,
title = {
Text(text = stringResource(R.string.look_and_feel_show_navigation_bar))
},
onCheckedChange = { updateAppSettings() },
)
SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = showTextDescriptionsInNavbar,
title = {
Text(text = stringResource(R.string.look_and_feel_show_text_descriptions_in_navbar))
Expand All @@ -318,76 +330,87 @@ fun LookAndFeelActivity(
enabled = showBottomNavState.value,
)
SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = showCollapsedCommentContentState,
title = {
Text(text = stringResource(R.string.look_and_feel_activity_show_content_for_collapsed_comments))
},
onCheckedChange = { updateAppSettings() },
)
SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = showCommentActionBarByDefaultState,
title = {
Text(text = stringResource(R.string.look_and_feel_show_action_bar_for_comments))
},
onCheckedChange = { updateAppSettings() },
)
SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = showVotingArrowsInListViewState,
title = {
Text(text = stringResource(R.string.look_and_feel_show_voting_arrows_list_view))
},
onCheckedChange = { updateAppSettings() },
)
SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = showParentCommentNavigationButtonsState,
title = {
Text(text = stringResource(R.string.look_and_feel_show_parent_comment_navigation_buttons))
},
onCheckedChange = { updateAppSettings() },
)
SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = navigateParentCommentsWithVolumeButtonsState,
title = {
Text(text = stringResource(R.string.look_and_feel_navigate_parent_comments_with_volume_buttons))
},
onCheckedChange = { updateAppSettings() },
)
SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = useCustomTabsState,
title = {
Text(text = stringResource(id = R.string.look_and_feel_use_custom_tabs))
},
onCheckedChange = { updateAppSettings() },
)
SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = usePrivateTabsState,
title = {
Text(text = stringResource(id = R.string.look_and_feel_use_private_tabs))
},
onCheckedChange = { updateAppSettings() },
)
SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = secureWindowState,
title = {
Text(text = stringResource(R.string.look_and_feel_secure_window))
},
onCheckedChange = { updateAppSettings() },
)
SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = showPostLinkPreviewMode,
title = {
Text(stringResource(id = R.string.show_post_link_previews))
},
onCheckedChange = { updateAppSettings() },
)
SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = markAsReadOnScroll,
title = {
Text(stringResource(id = R.string.mark_as_read_on_scroll))
},
onCheckedChange = { updateAppSettings() },
)
SettingsCheckbox(
modifier = Modifier.height(SETTINGS_MENU_LINK_HEIGHT),
state = autoPlayGifs,
title = {
Text(stringResource(id = R.string.settings_autoplaygifs))
Expand Down
Loading