Skip to content

Commit

Permalink
Merge branch 'main' into bug/fix_navigation_compose_multiplatform_2
Browse files Browse the repository at this point in the history
  • Loading branch information
Corvus400 authored Sep 8, 2024
2 parents aab192f + e4ac971 commit 2ce6355
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ class KmpPlugin : Plugin<Project> {
}
}
compilerOptions {
freeCompilerArgs.add("-Xcontext-receivers")
freeCompilerArgs.addAll(
listOf(
"-Xcontext-receivers",
"-Xexpect-actual-classes",
)
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
<string name="link">リンク</string>
<string name="image">画像</string>
<string name="add_image">画像を追加</string>
<string name="delete">削除する</string>
<string name="enter_validate_format">%1$sを入力してください</string>
<string name="add_validate_format">%1$sを追加してください</string>
<string name="url_is_invalid">URLの形式が正しくありません</string>
<string name="flip">裏返す</string>
<string name="qrcode">QRコード</string>
<string name="share">共有する</string>
<string name="edit">編集する</string>
<string name="share_description">DroidKaigiのプロフィールカードを作成しました!イベントでつながりましょう。#DroidKaigi</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
<string name="link">Link</string>
<string name="image">Image</string>
<string name="add_image">Add Image</string>
<string name="delete">Delete</string>
<string name="enter_validate_format">Please enter a %1$s</string>
<string name="add_validate_format">Please add %1$s</string>
<string name="url_is_invalid">The URL format is incorrect</string>
<string name="flip">Flip</string>
<string name="qrcode">QR code</string>
<string name="share">Share</string>
<string name="edit">Edit</string>
<string name="share_description">Check out my DroidKaigi Profile Card! Let's connect at the event. #DroidKaigi</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package io.github.droidkaigi.confsched.profilecard
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
Expand All @@ -21,6 +20,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardActions
Expand Down Expand Up @@ -97,6 +97,7 @@ import com.preat.peekaboo.image.picker.toImageBitmap
import conference_app_2024.feature.profilecard.generated.resources.add_image
import conference_app_2024.feature.profilecard.generated.resources.card_type
import conference_app_2024.feature.profilecard.generated.resources.create_card
import conference_app_2024.feature.profilecard.generated.resources.delete
import conference_app_2024.feature.profilecard.generated.resources.edit
import conference_app_2024.feature.profilecard.generated.resources.icon_share
import conference_app_2024.feature.profilecard.generated.resources.image
Expand Down Expand Up @@ -627,7 +628,7 @@ private fun ImagePickerWithError(
Icon(
modifier = Modifier.padding(4.dp),
imageVector = Icons.Default.Close,
contentDescription = null,
contentDescription = stringResource(ProfileCardRes.string.delete),
)
}
}
Expand Down Expand Up @@ -700,12 +701,12 @@ private fun CardTypeImage(

Image(
painter = painterResource(ProfileCardRes.drawable.card_type),
contentDescription = null,
contentDescription = cardType.toString(),
modifier = modifier
.selectedBorder(isSelected, selectedBorderColor, painter)
.clip(RoundedCornerShape(2.dp))
.background(colorMap[cardType]!!)
.clickable { onClickImage(cardType) }
.selectable(isSelected) { onClickImage(cardType) }
.padding(top = 36.dp, start = 30.dp, end = 30.dp, bottom = 36.dp),
)
}
Expand Down Expand Up @@ -829,17 +830,15 @@ internal fun CardScreen(
.testTag(ProfileCardShareButtonTestTag)
.padding(horizontal = 16.dp, vertical = 8.dp),
) {
val shareLabel = stringResource(ProfileCardRes.string.share)

Icon(
painter = painterResource(ProfileCardRes.drawable.icon_share),
contentDescription = shareLabel,
contentDescription = null,
tint = Color.Black,
modifier = Modifier.size(18.dp),
)
Spacer(Modifier.width(8.dp))
Text(
text = shareLabel,
text = stringResource(ProfileCardRes.string.share),
modifier = Modifier.padding(8.dp),
style = MaterialTheme.typography.labelLarge,
color = Color.Black,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.unit.dp
import conference_app_2024.feature.profilecard.generated.resources.flip
import io.github.droidkaigi.confsched.droidkaigiui.WithDeviceOrientation
import io.github.droidkaigi.confsched.profilecard.ProfileCardRes
import io.github.droidkaigi.confsched.profilecard.ProfileCardUiState.Card
import io.github.droidkaigi.confsched.profilecard.hologramaticEffect
import io.github.droidkaigi.confsched.profilecard.tiltEffect
import kotlinx.coroutines.delay
import org.jetbrains.compose.resources.stringResource

const val ProfileCardFlipCardTestTag = "ProfileCardFlipCardTestTag"

Expand Down Expand Up @@ -57,7 +60,9 @@ internal fun FlipCard(
modifier = modifier
.testTag(ProfileCardFlipCardTestTag)
.size(width = 300.dp, height = 380.dp)
.clickable { isFlipped = isFlipped.not() }
.clickable(onClickLabel = stringResource(ProfileCardRes.string.flip)) {
isFlipped = isFlipped.not()
}
.draggable(
orientation = Orientation.Horizontal,
state = rememberDraggableState { delta ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import conference_app_2024.feature.profilecard.generated.resources.card_back_ora
import conference_app_2024.feature.profilecard.generated.resources.card_back_pink
import conference_app_2024.feature.profilecard.generated.resources.card_back_white
import conference_app_2024.feature.profilecard.generated.resources.card_back_yellow
import conference_app_2024.feature.profilecard.generated.resources.qrcode
import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme
import io.github.droidkaigi.confsched.model.ProfileCard
import io.github.droidkaigi.confsched.model.ProfileCardType.Flamingo
Expand All @@ -34,6 +35,7 @@ import io.github.droidkaigi.confsched.profilecard.ProfileCardRes
import io.github.droidkaigi.confsched.profilecard.ProfileCardUiState.Card
import io.github.droidkaigi.confsched.profilecard.toCardUiState
import org.jetbrains.compose.resources.painterResource
import org.jetbrains.compose.resources.stringResource
import org.jetbrains.compose.ui.tooling.preview.Preview
import qrcode.QRCode

Expand Down Expand Up @@ -70,7 +72,7 @@ internal fun FlipCardBack(
)
Image(
painter = painter,
contentDescription = null,
contentDescription = stringResource(ProfileCardRes.string.qrcode),
modifier = Modifier.size(160.dp),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<string name="workshop">ワークショップ</string>
<string name="back">戻る</string>
<string name="search">検索</string>
<string name="search_sessions">セッションを検索</string>
<string name="select_language">言語選択</string>
<string name="japanese">日本語</string>
<string name="english">English</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<string name="workshop">Workshop</string>
<string name="back">Back</string>
<string name="search">Search</string>
<string name="search_sessions">Search sessions</string>
<string name="select_language">Select Language</string>
<string name="japanese">日本語</string>
<string name="english">English</string>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.droidkaigi.confsched.sessions.component

import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
Expand All @@ -14,15 +15,27 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.VisualTransformation
import conference_app_2024.feature.sessions.generated.resources.search_sessions
import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme
import io.github.droidkaigi.confsched.sessions.SessionsRes
import org.jetbrains.compose.resources.stringResource
import org.jetbrains.compose.ui.tooling.preview.Preview

const val SearchTextFieldAppBarTextFieldTestTag = "SearchTextFieldAppBarTextField"
Expand All @@ -37,7 +50,13 @@ fun SearchTextFieldAppBar(
modifier: Modifier = Modifier,
) {
val focusManager = LocalFocusManager.current
val focusRequester = remember { FocusRequester() }
val keyboardController = LocalSoftwareKeyboardController.current
val interactionSource = remember { MutableInteractionSource() }

LaunchedEffect(Unit) {
focusRequester.requestFocus()
}

TopAppBar(
title = {
Expand All @@ -56,7 +75,32 @@ fun SearchTextFieldAppBar(
focusManager.clearFocus()
},
),
decorationBox = { innerTextField ->
TextFieldDefaults.DecorationBox(
value = searchWord,
innerTextField = innerTextField,
enabled = true,
singleLine = true,
visualTransformation = VisualTransformation.None,
interactionSource = interactionSource,
colors = TextFieldDefaults.colors(
focusedContainerColor = Color.Transparent,
unfocusedContainerColor = Color.Transparent,
focusedIndicatorColor = Color.Transparent,
unfocusedIndicatorColor = Color.Transparent,
),
placeholder = {
Text(
text = stringResource(SessionsRes.string.search_sessions),
style = MaterialTheme.typography.bodyLarge.copy(
fontFamily = FontFamily.Default,
),
)
},
)
},
modifier = Modifier
.focusRequester(focusRequester)
.fillMaxWidth()
.height(IntrinsicSize.Max)
.testTag(SearchTextFieldAppBarTextFieldTestTag),
Expand Down

0 comments on commit 2ce6355

Please sign in to comment.