Skip to content

Form : Attachment theming #490

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

Merged
merged 7 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
51 changes: 47 additions & 4 deletions toolkit/featureforms/api/featureforms.api
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure how to review this, so I assume it looks good.

Copy link
Collaborator Author

@kaushikrw kaushikrw Jul 10, 2024

Choose a reason for hiding this comment

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

I agree its a bit verbose but its all generated so it should be good. Hopefully checks in the future can automate this bit.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,44 @@ public final class com/arcgismaps/toolkit/featureforms/ValidationErrorVisibility
public static final field INSTANCE Lcom/arcgismaps/toolkit/featureforms/ValidationErrorVisibility$Visible;
}

public final class com/arcgismaps/toolkit/featureforms/theme/AttachmentsElementColors {
public static final field $stable I
public final fun component1-0d7_KjU ()J
public final fun component2-0d7_KjU ()J
public final fun component3-0d7_KjU ()J
public final fun component4-0d7_KjU ()J
public final fun component5-0d7_KjU ()J
public final fun component6-0d7_KjU ()J
public final fun component7-0d7_KjU ()J
public final fun copy-4JmcsL4 (JJJJJJJ)Lcom/arcgismaps/toolkit/featureforms/theme/AttachmentsElementColors;
public static synthetic fun copy-4JmcsL4$default (Lcom/arcgismaps/toolkit/featureforms/theme/AttachmentsElementColors;JJJJJJJILjava/lang/Object;)Lcom/arcgismaps/toolkit/featureforms/theme/AttachmentsElementColors;
public fun equals (Ljava/lang/Object;)Z
public final fun getContainerColor-0d7_KjU ()J
public final fun getLabelColor-0d7_KjU ()J
public final fun getOutlineColor-0d7_KjU ()J
public final fun getScrollBarColor-0d7_KjU ()J
public final fun getSupportingTextColor-0d7_KjU ()J
public final fun getTileBorderColor-0d7_KjU ()J
public final fun getTileTextColor-0d7_KjU ()J
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class com/arcgismaps/toolkit/featureforms/theme/AttachmentsElementTypography {
public static final field $stable I
public final fun component1 ()Landroidx/compose/ui/text/TextStyle;
public final fun component2 ()Landroidx/compose/ui/text/TextStyle;
public final fun component3 ()Landroidx/compose/ui/text/TextStyle;
public final fun copy (Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;)Lcom/arcgismaps/toolkit/featureforms/theme/AttachmentsElementTypography;
public static synthetic fun copy$default (Lcom/arcgismaps/toolkit/featureforms/theme/AttachmentsElementTypography;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;ILjava/lang/Object;)Lcom/arcgismaps/toolkit/featureforms/theme/AttachmentsElementTypography;
public fun equals (Ljava/lang/Object;)Z
public final fun getLabelStyle ()Landroidx/compose/ui/text/TextStyle;
public final fun getSupportingTextStyle ()Landroidx/compose/ui/text/TextStyle;
public final fun getTileTextStyle ()Landroidx/compose/ui/text/TextStyle;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class com/arcgismaps/toolkit/featureforms/theme/EditableTextFieldColors {
public static final field $stable I
public final fun component1-0d7_KjU ()J
Expand Down Expand Up @@ -112,9 +150,11 @@ public final class com/arcgismaps/toolkit/featureforms/theme/FeatureFormColorSch
public final fun component2 ()Lcom/arcgismaps/toolkit/featureforms/theme/ReadOnlyFieldColors;
public final fun component3 ()Lcom/arcgismaps/toolkit/featureforms/theme/RadioButtonFieldColors;
public final fun component4 ()Lcom/arcgismaps/toolkit/featureforms/theme/GroupElementColors;
public final fun copy (Lcom/arcgismaps/toolkit/featureforms/theme/EditableTextFieldColors;Lcom/arcgismaps/toolkit/featureforms/theme/ReadOnlyFieldColors;Lcom/arcgismaps/toolkit/featureforms/theme/RadioButtonFieldColors;Lcom/arcgismaps/toolkit/featureforms/theme/GroupElementColors;)Lcom/arcgismaps/toolkit/featureforms/theme/FeatureFormColorScheme;
public static synthetic fun copy$default (Lcom/arcgismaps/toolkit/featureforms/theme/FeatureFormColorScheme;Lcom/arcgismaps/toolkit/featureforms/theme/EditableTextFieldColors;Lcom/arcgismaps/toolkit/featureforms/theme/ReadOnlyFieldColors;Lcom/arcgismaps/toolkit/featureforms/theme/RadioButtonFieldColors;Lcom/arcgismaps/toolkit/featureforms/theme/GroupElementColors;ILjava/lang/Object;)Lcom/arcgismaps/toolkit/featureforms/theme/FeatureFormColorScheme;
public final fun component5 ()Lcom/arcgismaps/toolkit/featureforms/theme/AttachmentsElementColors;
public final fun copy (Lcom/arcgismaps/toolkit/featureforms/theme/EditableTextFieldColors;Lcom/arcgismaps/toolkit/featureforms/theme/ReadOnlyFieldColors;Lcom/arcgismaps/toolkit/featureforms/theme/RadioButtonFieldColors;Lcom/arcgismaps/toolkit/featureforms/theme/GroupElementColors;Lcom/arcgismaps/toolkit/featureforms/theme/AttachmentsElementColors;)Lcom/arcgismaps/toolkit/featureforms/theme/FeatureFormColorScheme;
public static synthetic fun copy$default (Lcom/arcgismaps/toolkit/featureforms/theme/FeatureFormColorScheme;Lcom/arcgismaps/toolkit/featureforms/theme/EditableTextFieldColors;Lcom/arcgismaps/toolkit/featureforms/theme/ReadOnlyFieldColors;Lcom/arcgismaps/toolkit/featureforms/theme/RadioButtonFieldColors;Lcom/arcgismaps/toolkit/featureforms/theme/GroupElementColors;Lcom/arcgismaps/toolkit/featureforms/theme/AttachmentsElementColors;ILjava/lang/Object;)Lcom/arcgismaps/toolkit/featureforms/theme/FeatureFormColorScheme;
public fun equals (Ljava/lang/Object;)Z
public final fun getAttachmentsElementColors ()Lcom/arcgismaps/toolkit/featureforms/theme/AttachmentsElementColors;
public final fun getEditableTextFieldColors ()Lcom/arcgismaps/toolkit/featureforms/theme/EditableTextFieldColors;
public final fun getGroupElementColors ()Lcom/arcgismaps/toolkit/featureforms/theme/GroupElementColors;
public final fun getRadioButtonFieldColors ()Lcom/arcgismaps/toolkit/featureforms/theme/RadioButtonFieldColors;
Expand All @@ -126,7 +166,9 @@ public final class com/arcgismaps/toolkit/featureforms/theme/FeatureFormColorSch
public final class com/arcgismaps/toolkit/featureforms/theme/FeatureFormDefaults {
public static final field $stable I
public static final field INSTANCE Lcom/arcgismaps/toolkit/featureforms/theme/FeatureFormDefaults;
public final fun colorScheme (Lcom/arcgismaps/toolkit/featureforms/theme/EditableTextFieldColors;Lcom/arcgismaps/toolkit/featureforms/theme/ReadOnlyFieldColors;Lcom/arcgismaps/toolkit/featureforms/theme/RadioButtonFieldColors;Lcom/arcgismaps/toolkit/featureforms/theme/GroupElementColors;Landroidx/compose/runtime/Composer;II)Lcom/arcgismaps/toolkit/featureforms/theme/FeatureFormColorScheme;
public final fun attachmentsElementColors-69fazGs (JJJJJJJLandroidx/compose/runtime/Composer;II)Lcom/arcgismaps/toolkit/featureforms/theme/AttachmentsElementColors;
public final fun attachmentsElementTypography (Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;II)Lcom/arcgismaps/toolkit/featureforms/theme/AttachmentsElementTypography;
public final fun colorScheme (Lcom/arcgismaps/toolkit/featureforms/theme/EditableTextFieldColors;Lcom/arcgismaps/toolkit/featureforms/theme/ReadOnlyFieldColors;Lcom/arcgismaps/toolkit/featureforms/theme/RadioButtonFieldColors;Lcom/arcgismaps/toolkit/featureforms/theme/GroupElementColors;Lcom/arcgismaps/toolkit/featureforms/theme/AttachmentsElementColors;Landroidx/compose/runtime/Composer;II)Lcom/arcgismaps/toolkit/featureforms/theme/FeatureFormColorScheme;
public final fun editableTextFieldColors-s9joTbY (JJJJJJJJLandroidx/compose/foundation/text/selection/TextSelectionColors;JJJJJJJJJJJJJJJJJJJJJJJJLandroidx/compose/runtime/Composer;IIIIII)Lcom/arcgismaps/toolkit/featureforms/theme/EditableTextFieldColors;
public final fun editableTextFieldTypography (Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;II)Lcom/arcgismaps/toolkit/featureforms/theme/EditableTextFieldTypography;
public final fun groupElementColors-zjMxDiM (JJJJJLandroidx/compose/runtime/Composer;II)Lcom/arcgismaps/toolkit/featureforms/theme/GroupElementColors;
Expand All @@ -135,11 +177,12 @@ public final class com/arcgismaps/toolkit/featureforms/theme/FeatureFormDefaults
public final fun radioButtonFieldTypography (Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;II)Lcom/arcgismaps/toolkit/featureforms/theme/RadioButtonFieldTypography;
public final fun readOnlyFieldColors-ro_MJ88 (JJJJLandroidx/compose/runtime/Composer;II)Lcom/arcgismaps/toolkit/featureforms/theme/ReadOnlyFieldColors;
public final fun readOnlyFieldTypography (Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;II)Lcom/arcgismaps/toolkit/featureforms/theme/ReadOnlyFieldTypography;
public final fun typography (Lcom/arcgismaps/toolkit/featureforms/theme/EditableTextFieldTypography;Lcom/arcgismaps/toolkit/featureforms/theme/ReadOnlyFieldTypography;Lcom/arcgismaps/toolkit/featureforms/theme/GroupElementTypography;Lcom/arcgismaps/toolkit/featureforms/theme/RadioButtonFieldTypography;Landroidx/compose/runtime/Composer;II)Lcom/arcgismaps/toolkit/featureforms/theme/FeatureFormTypography;
public final fun typography (Lcom/arcgismaps/toolkit/featureforms/theme/EditableTextFieldTypography;Lcom/arcgismaps/toolkit/featureforms/theme/ReadOnlyFieldTypography;Lcom/arcgismaps/toolkit/featureforms/theme/GroupElementTypography;Lcom/arcgismaps/toolkit/featureforms/theme/RadioButtonFieldTypography;Lcom/arcgismaps/toolkit/featureforms/theme/AttachmentsElementTypography;Landroidx/compose/runtime/Composer;II)Lcom/arcgismaps/toolkit/featureforms/theme/FeatureFormTypography;
}

public final class com/arcgismaps/toolkit/featureforms/theme/FeatureFormTypography {
public static final field $stable I
public final fun getAttachmentsElementTypography ()Lcom/arcgismaps/toolkit/featureforms/theme/AttachmentsElementTypography;
public final fun getEditableTextFieldTypography ()Lcom/arcgismaps/toolkit/featureforms/theme/EditableTextFieldTypography;
public final fun getGroupElementTypography ()Lcom/arcgismaps/toolkit/featureforms/theme/GroupElementTypography;
public final fun getRadioButtonFieldTypography ()Lcom/arcgismaps/toolkit/featureforms/theme/RadioButtonFieldTypography;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ package com.arcgismaps.toolkit.featureforms

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.hasText
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performImeAction
import androidx.compose.ui.test.performScrollToNode
import androidx.compose.ui.test.performTextInput
import androidx.compose.ui.test.printToLog
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import com.arcgismaps.toolkit.featureforms.theme.FeatureFormColorScheme
Expand Down Expand Up @@ -266,4 +270,62 @@ class ThemingTests : FeatureFormTestRunner(
supportingText.assertIsDisplayed()
supportingText.assertTextColor(Color.Green)
}

/**
* Given a FeatureForm with a custom color scheme and typography for attachments elements
* When the FeatureForm is displayed
* Then the custom color scheme and typography are applied to the attachments form elements
*/
@Test
fun testAttachmentsElementTheming() {
var colorScheme: FeatureFormColorScheme
var typography: FeatureFormTypography
composeTestRule.setContent {
colorScheme = FeatureFormDefaults.colorScheme(
attachmentsElementColors = FeatureFormDefaults.attachmentsElementColors(
labelColor = Color.Red,
tileTextColor = Color.Green
)
)
typography = FeatureFormDefaults.typography(
attachmentsElementTypography = FeatureFormDefaults.attachmentsElementTypography(
labelStyle = TextStyle(
fontWeight = FontWeight.ExtraBold
),
tileTextStyle = TextStyle(
fontWeight = FontWeight.ExtraBold,
),
)
)
FeatureForm(
featureForm = featureForm,
colorScheme = colorScheme,
typography = typography
)
}
val attachmentsElement = featureForm.defaultAttachmentsElement
assertThat(attachmentsElement).isNotNull()
// find the scrollable container
val lazyColumn = composeTestRule.onNodeWithContentDescription("lazy column")
lazyColumn.performScrollToNode(hasText(attachmentsElement!!.label))
// scroll until the attachments element is visible
val attachmentsField = composeTestRule.onNodeWithText(attachmentsElement.label)
attachmentsField.printToLog("label")
attachmentsField.assertIsDisplayed()
attachmentsField.assertTextStyle(
TextStyle(
fontWeight = FontWeight.ExtraBold,
color = Color.Red
)
)
// get the first attachment tile
val tile = attachmentsField.onChildWithText(attachmentsElement.attachments.first().name)
tile.assertIsDisplayed()
tile.assertTextStyle(
TextStyle(
fontWeight = FontWeight.ExtraBold,
color = Color.Green
)
)
}
}

This file was deleted.

Loading