Skip to content

Commit 49fdf6c

Browse files
committed
Migrate AttachmentViewHolderFactory to compose
1 parent e5547a3 commit 49fdf6c

File tree

10 files changed

+701
-900
lines changed

10 files changed

+701
-900
lines changed

datacapture/src/androidTest/java/com/google/android/fhir/datacapture/test/views/AttachmentViewHolderFactoryEspressoTest.kt

Lines changed: 192 additions & 90 deletions
Large diffs are not rendered by default.

datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItemComponents.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ internal val QuestionnaireItemComponent.maxSizeInMiBs: BigDecimal?
579579
get() = maxSizeInBytes?.div(BYTES_PER_MIB)
580580

581581
/** The default maximum size of an attachment is 1 Mebibytes. */
582-
private val DEFAULT_SIZE = BigDecimal(1048576)
582+
internal val DEFAULT_SIZE = BigDecimal(1048576)
583583

584584
/** Returns true if given size is above maximum size allowed. */
585585
internal fun QuestionnaireItemComponent.isGivenSizeOverLimit(

datacapture/src/main/java/com/google/android/fhir/datacapture/views/attachment/CameraLauncherFragment.kt

Lines changed: 0 additions & 69 deletions
This file was deleted.

datacapture/src/main/java/com/google/android/fhir/datacapture/views/attachment/OpenDocumentLauncherFragment.kt

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.android.fhir.datacapture.views.compose
18+
19+
import androidx.compose.foundation.layout.padding
20+
import androidx.compose.material3.MaterialTheme
21+
import androidx.compose.material3.Text
22+
import androidx.compose.runtime.Composable
23+
import androidx.compose.ui.Modifier
24+
import androidx.compose.ui.platform.testTag
25+
import androidx.compose.ui.res.dimensionResource
26+
import com.google.android.fhir.datacapture.R
27+
28+
@Composable
29+
internal fun ErrorText(validationMessage: String) {
30+
Text(
31+
text = validationMessage,
32+
style = MaterialTheme.typography.bodySmall,
33+
color = MaterialTheme.colorScheme.error,
34+
modifier =
35+
Modifier.padding(start = dimensionResource(R.dimen.error_text_margin_horizontal))
36+
.testTag(ERROR_TEXT_TAG),
37+
)
38+
}
39+
40+
const val ERROR_TEXT_TAG = "error_text"

0 commit comments

Comments
 (0)