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

✨ Implement Middle Section of AboutScreen #504

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ sealed class AboutStrings : Strings<AboutStrings>(Bindings) {
object PlaceTitle : AboutStrings()
object PlaceDescription : AboutStrings()
object PlaceLink : AboutStrings()
object CreditsTitle : AboutStrings()
object Staff : AboutStrings()
object Contributor : AboutStrings()
object Sponsor : AboutStrings()
object OthersTitle : AboutStrings()
object CodeOfConduct : AboutStrings()
object License : AboutStrings()
object PrivacyPolicy : AboutStrings()

private object Bindings : StringsBindings<AboutStrings>(
Lang.Japanese to { item, _ ->
when (item) {
Expand All @@ -22,17 +31,33 @@ sealed class AboutStrings : Strings<AboutStrings>(Bindings) {
PlaceTitle -> "場所"
PlaceDescription -> "ベルサール渋谷ガーデン"
PlaceLink -> "地図を見る"
CreditsTitle -> "Credits"
Staff -> "スタッフ"
Contributor -> "コントリビューター"
Sponsor -> "スポンサー"
OthersTitle -> "Others"
CodeOfConduct -> "行動規範"
License -> "ライセンス"
PrivacyPolicy -> "プライバシーポリシー"
}
},
Lang.English to { item, bindings ->
when (item) {
Title -> "About"
Title -> bindings.defaultBinding(item, bindings)
Description -> "DroidKaigi is a conference tailored for Android developers."
DateTitle -> "Date & Time"
DateDescription -> "2023.09.14(Thu) - 16(Sat) 3days"
PlaceTitle -> "Location"
PlaceDescription -> "Bellesalle Shibuya Garden"
PlaceLink -> "View Map"
CreditsTitle -> bindings.defaultBinding(item, bindings)
Staff -> "Staff"
Contributor -> "Contributor"
Sponsor -> "Sponsor"
OthersTitle -> bindings.defaultBinding(item, bindings)
CodeOfConduct -> "Code Of Conduct"
License -> "License"
PrivacyPolicy -> "Privacy Policy"
}
},
default = Lang.Japanese,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
package io.github.droidkaigi.confsched2023.about.component

import android.content.res.Configuration
import androidx.annotation.DrawableRes
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Divider
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import io.github.droidkaigi.confsched2023.about.AboutStrings
import io.github.droidkaigi.confsched2023.designsystem.theme.KaigiTheme
import io.github.droidkaigi.confsched2023.feature.about.R

@Composable
fun AboutContentColumn(
@DrawableRes leadingIconRes: Int,
label: String,
testTag: String,
onClickAction: () -> Unit,
modifier: Modifier = Modifier,
) {
Column(
modifier = modifier
.fillMaxWidth()
.height(73.dp)
.testTag(testTag)
.clickable { onClickAction() },
) {
Row(
modifier = Modifier
.height(72.dp)
.align(
alignment = Alignment.Start,
),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
painter = painterResource(id = leadingIconRes),
contentDescription = null,
modifier = Modifier
.padding(
horizontal = 12.dp,
),
)
Text(
text = label,
style = MaterialTheme.typography.labelLarge,
modifier = Modifier
.fillMaxWidth()
.padding(
end = 16.dp,
),
)
}
Divider(
thickness = 1.dp,
color = MaterialTheme.colorScheme.outlineVariant,
)
}
}

@Preview(locale = "en", uiMode = Configuration.UI_MODE_NIGHT_NO)
@Preview(locale = "ja", uiMode = Configuration.UI_MODE_NIGHT_NO)
@Composable
fun AboutContentColumnPreview() {
KaigiTheme {
Surface {
AboutContentColumn(
leadingIconRes = R.drawable.ic_sentiment_very_satisfied,
label = AboutStrings.Staff.asString(),
testTag = "",
onClickAction = {},
)
}
}
}

@Preview(locale = "en", uiMode = Configuration.UI_MODE_NIGHT_YES)
@Preview(locale = "ja", uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
fun AboutContentColumnDarkModePreview() {
KaigiTheme {
Surface {
AboutContentColumn(
leadingIconRes = R.drawable.ic_sentiment_very_satisfied,
label = AboutStrings.Staff.asString(),
testTag = "",
onClickAction = {},
)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,45 +1,69 @@
package io.github.droidkaigi.confsched2023.about.component

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.unit.dp
import io.github.droidkaigi.confsched2023.about.AboutStrings
import io.github.droidkaigi.confsched2023.feature.about.R

const val AboutCreditsSponsorsItemTestTag = "AboutCreditsSponsorsItem"
const val AboutCreditsContributorsItemTestTag = "AboutCreditsContributorsItem"
const val AboutCreditsStaffItemTestTag = "AboutCreditsStaffItem"
const val AboutCreditsContributorsItemTestTag = "AboutCreditsContributorsItem"
const val AboutCreditsSponsorsItemTestTag = "AboutCreditsSponsorsItem"

fun LazyListScope.aboutCredits(
onStaffItemClick: () -> Unit,
onContributorsItemClick: () -> Unit,
onSponsorsItemClick: () -> Unit,
) {
item {
Text("Credits")
Text(
text = AboutStrings.CreditsTitle.asString(),
style = MaterialTheme.typography.titleMedium,
modifier = Modifier
.padding(
start = 16.dp,
top = 32.dp,
end = 16.dp,
),
)
}
item {
Text(
AboutContentColumn(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we can't see the AboutContentColumn for Screenshot Tests, could you provide a scrolled screenshot test? 📸

leadingIconRes = R.drawable.ic_sentiment_very_satisfied,
label = AboutStrings.Staff.asString(),
testTag = AboutCreditsStaffItemTestTag,
onClickAction = onStaffItemClick,
modifier = Modifier
.testTag(AboutCreditsContributorsItemTestTag)
.clickable { onContributorsItemClick() },
text = "Go to contributors screen",
.padding(
horizontal = 16.dp,
),
)
}
item {
Text(
AboutContentColumn(
leadingIconRes = R.drawable.ic_diversity_1,
label = AboutStrings.Contributor.asString(),
testTag = AboutCreditsContributorsItemTestTag,
onClickAction = onContributorsItemClick,
modifier = Modifier
.testTag(AboutCreditsStaffItemTestTag)
.clickable { onStaffItemClick() },
text = "Go to staff screen",
.padding(
horizontal = 16.dp,
),
)
}
item {
Text(
AboutContentColumn(
leadingIconRes = R.drawable.ic_apartment,
label = AboutStrings.Sponsor.asString(),
testTag = AboutCreditsSponsorsItemTestTag,
onClickAction = onSponsorsItemClick,
modifier = Modifier
.testTag(AboutCreditsSponsorsItemTestTag)
.clickable { onSponsorsItemClick() },
text = "Go to sponsors screen",
.padding(
horizontal = 16.dp,
),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ fun AboutDroidKaigiDetail(
start = 16.dp,
top = 12.dp,
end = 16.dp,
bottom = 16.dp,
),
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package io.github.droidkaigi.confsched2023.about.component

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import io.github.droidkaigi.confsched2023.about.AboutStrings
import io.github.droidkaigi.confsched2023.feature.about.R

const val AboutOthersCodeOfConductItemTestTag = "AboutOthersCodeOfConductItem"
const val AboutOthersLicenseItemTestTag = "AboutOthersLicenseItem"
Expand All @@ -15,33 +19,51 @@ fun LazyListScope.aboutOthers(
onPrivacyPolicyItemClick: () -> Unit,
) {
item {
Text("Others")
}
item {
Text("Others items")
Text(
text = AboutStrings.OthersTitle.asString(),
style = MaterialTheme.typography.titleMedium,
modifier = Modifier
.padding(
start = 16.dp,
top = 32.dp,
end = 16.dp,
),
)
}
item {
Text(
text = "Go to Code of Conduct screen",
modifier = androidx.compose.ui.Modifier
.testTag(AboutOthersCodeOfConductItemTestTag)
.clickable { onCodeOfConductItemClick() },
AboutContentColumn(
leadingIconRes = R.drawable.ic_gavel,
label = AboutStrings.CodeOfConduct.asString(),
testTag = AboutOthersCodeOfConductItemTestTag,
onClickAction = onCodeOfConductItemClick,
modifier = Modifier
.padding(
horizontal = 16.dp,
),
)
}
item {
Text(
text = "Go to License screen",
modifier = androidx.compose.ui.Modifier
.testTag(AboutOthersLicenseItemTestTag)
.clickable { onLicenseItemClick() },
AboutContentColumn(
leadingIconRes = R.drawable.ic_file_copy,
label = AboutStrings.License.asString(),
testTag = AboutOthersLicenseItemTestTag,
onClickAction = onLicenseItemClick,
modifier = Modifier
.padding(
horizontal = 16.dp,
),
)
}
item {
Text(
text = "Go to Privacy Policy screen",
modifier = androidx.compose.ui.Modifier
.testTag(AboutOthersPrivacyPolicyItemTestTag)
.clickable { onPrivacyPolicyItemClick() },
AboutContentColumn(
leadingIconRes = R.drawable.ic_privacy_tip,
label = AboutStrings.PrivacyPolicy.asString(),
testTag = AboutOthersPrivacyPolicyItemTestTag,
onClickAction = onPrivacyPolicyItemClick,
modifier = Modifier
.padding(
horizontal = 16.dp,
),
)
}
}
17 changes: 17 additions & 0 deletions feature/about/src/main/res/drawable/ic_apartment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M5,21C4.45,21 3.979,20.804 3.588,20.413C3.196,20.021 3,19.55 3,19V9C3,8.45 3.196,7.979 3.588,7.588C3.979,7.196 4.45,7 5,7H7V5C7,4.45 7.196,3.979 7.588,3.588C7.979,3.196 8.45,3 9,3H15C15.55,3 16.021,3.196 16.413,3.588C16.804,3.979 17,4.45 17,5V11H19C19.55,11 20.021,11.196 20.413,11.587C20.804,11.979 21,12.45 21,13V19C21,19.55 20.804,20.021 20.413,20.413C20.021,20.804 19.55,21 19,21H13V17H11V21H5ZM5,19H7V17H5V19ZM5,15H7V13H5V15ZM5,11H7V9H5V11ZM9,15H11V13H9V15ZM9,11H11V9H9V11ZM9,7H11V5H9V7ZM13,15H15V13H13V15ZM13,11H15V9H13V11ZM13,7H15V5H13V7ZM17,19H19V17H17V19ZM17,15H19V13H17V15Z"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check if this icon is in Material Icon Library and use it? 👀

android:fillColor="#404944"/>
</group>
</group>
</vector>
17 changes: 17 additions & 0 deletions feature/about/src/main/res/drawable/ic_diversity_1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M6.6,3C7.65,3 8.65,3.221 9.6,3.662C10.55,4.104 11.35,4.717 12,5.5C12.65,4.717 13.45,4.104 14.4,3.662C15.35,3.221 16.35,3 17.4,3C19.267,3 20.833,3.633 22.1,4.9C23.367,6.167 24,7.733 24,9.6C24,10.233 23.917,10.858 23.75,11.475C23.583,12.092 23.35,12.7 23.05,13.3C22.867,12.983 22.65,12.7 22.4,12.45C22.15,12.2 21.858,12 21.525,11.85C21.675,11.467 21.792,11.092 21.875,10.725C21.958,10.358 22,9.983 22,9.6C22,8.3 21.558,7.208 20.675,6.325C19.792,5.442 18.7,5 17.4,5C16.05,5 15.012,5.371 14.288,6.113C13.563,6.854 12.8,7.683 12,8.6C11.2,7.667 10.438,6.833 9.712,6.1C8.988,5.367 7.95,5 6.6,5C5.3,5 4.208,5.442 3.325,6.325C2.442,7.208 2,8.3 2,9.6C2,9.983 2.042,10.358 2.125,10.725C2.208,11.092 2.325,11.467 2.475,11.85C2.142,12 1.85,12.2 1.6,12.45C1.35,12.7 1.133,12.983 0.95,13.3C0.65,12.7 0.417,12.092 0.25,11.475C0.083,10.858 0,10.233 0,9.6C0,7.733 0.633,6.167 1.9,4.9C3.167,3.633 4.733,3 6.6,3ZM1,22C0.717,22 0.479,21.904 0.287,21.712C0.096,21.521 0,21.283 0,21V20.425C0,19.692 0.367,19.104 1.1,18.663C1.833,18.221 2.8,18 4,18C4.217,18 4.421,18.008 4.613,18.025C4.804,18.042 4.992,18.067 5.175,18.1C4.942,18.433 4.771,18.792 4.662,19.175C4.554,19.558 4.5,19.967 4.5,20.4V22H1ZM7,22C6.717,22 6.479,21.904 6.287,21.712C6.096,21.521 6,21.283 6,21V20.4C6,19.317 6.554,18.438 7.662,17.763C8.771,17.087 10.217,16.75 12,16.75C13.8,16.75 15.25,17.087 16.35,17.763C17.45,18.438 18,19.317 18,20.4V21C18,21.283 17.904,21.521 17.712,21.712C17.521,21.904 17.283,22 17,22H7ZM19.5,22V20.4C19.5,19.967 19.442,19.558 19.325,19.175C19.208,18.792 19.042,18.433 18.825,18.1C19.008,18.067 19.196,18.042 19.388,18.025C19.579,18.008 19.783,18 20,18C21.2,18 22.167,18.221 22.9,18.663C23.633,19.104 24,19.692 24,20.425V21C24,21.283 23.904,21.521 23.712,21.712C23.521,21.904 23.283,22 23,22H19.5ZM12,18.75C11.05,18.75 10.2,18.879 9.45,19.138C8.7,19.396 8.258,19.683 8.125,20H15.875C15.725,19.667 15.279,19.375 14.538,19.125C13.796,18.875 12.95,18.75 12,18.75ZM4,17C3.45,17 2.979,16.804 2.588,16.413C2.196,16.021 2,15.55 2,15C2,14.45 2.196,13.979 2.588,13.587C2.979,13.196 3.45,13 4,13C4.55,13 5.021,13.196 5.412,13.587C5.804,13.979 6,14.45 6,15C6,15.55 5.804,16.021 5.412,16.413C5.021,16.804 4.55,17 4,17ZM20,17C19.45,17 18.979,16.804 18.587,16.413C18.196,16.021 18,15.55 18,15C18,14.45 18.196,13.979 18.587,13.587C18.979,13.196 19.45,13 20,13C20.55,13 21.021,13.196 21.413,13.587C21.804,13.979 22,14.45 22,15C22,15.55 21.804,16.021 21.413,16.413C21.021,16.804 20.55,17 20,17ZM12,16C11.167,16 10.458,15.708 9.875,15.125C9.292,14.542 9,13.833 9,13C9,12.167 9.292,11.458 9.875,10.875C10.458,10.292 11.167,10 12,10C12.833,10 13.542,10.292 14.125,10.875C14.708,11.458 15,12.167 15,13C15,13.833 14.708,14.542 14.125,15.125C13.542,15.708 12.833,16 12,16ZM12,12C11.717,12 11.479,12.096 11.288,12.288C11.096,12.479 11,12.717 11,13C11,13.283 11.096,13.521 11.288,13.712C11.479,13.904 11.717,14 12,14C12.283,14 12.521,13.904 12.712,13.712C12.904,13.521 13,13.283 13,13C13,12.717 12.904,12.479 12.712,12.288C12.521,12.096 12.283,12 12,12Z"
android:fillColor="#404944"/>
</group>
</group>
</vector>
17 changes: 17 additions & 0 deletions feature/about/src/main/res/drawable/ic_file_copy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M19,19H8C7.45,19 6.979,18.804 6.588,18.413C6.196,18.021 6,17.55 6,17V3C6,2.45 6.196,1.979 6.588,1.587C6.979,1.196 7.45,1 8,1H14.175C14.442,1 14.696,1.05 14.938,1.15C15.179,1.25 15.392,1.392 15.575,1.575L20.425,6.425C20.608,6.608 20.75,6.821 20.85,7.063C20.95,7.304 21,7.558 21,7.825V17C21,17.55 20.804,18.021 20.413,18.413C20.021,18.804 19.55,19 19,19ZM19,8H15.5C15.083,8 14.729,7.854 14.438,7.563C14.146,7.271 14,6.917 14,6.5V3H8V17H19V8ZM4,23C3.45,23 2.979,22.804 2.588,22.413C2.196,22.021 2,21.55 2,21V8C2,7.717 2.096,7.479 2.287,7.287C2.479,7.096 2.717,7 3,7C3.283,7 3.521,7.096 3.713,7.287C3.904,7.479 4,7.717 4,8V21H14C14.283,21 14.521,21.096 14.712,21.288C14.904,21.479 15,21.717 15,22C15,22.283 14.904,22.521 14.712,22.712C14.521,22.904 14.283,23 14,23H4Z"
android:fillColor="#404944"/>
</group>
</group>
</vector>
Loading
Loading