Skip to content

Commit 12fd29f

Browse files
HMA-11141 Fix Gradle build issues and added compose MenuPanelRowView (#211)
* HMA-11141 Fix Gradle build issues * HMA-11141 Downgrade Java version back to 11 * HMA-11141 Downgrade Java version back to 11 * HMA-11141 Added MenuPanelRowView in Compose * HMA-11141 Added Copyright * HMA-11141 Suppressed LongMethod * HMA-11141 Removed ExperimentalMaterial3Api * HMA-11141 Added Copyrights * HMA-11141 Updated build.gradle * HMA-11141 Upgraded Gradle, Kotlin & Java Versions * HMA-11141 Specified Java Compile version * HMA-11141 Fixed the imports * HMA-11141 Fixed imports Spotless * HMA-11141 Fixed Kotlin version compatibility * HMA-11141 Fixed READ_EXTERNAL_STORAGE is deprecated error * HMA-11141 Updated buildToolsVersion * HMA-11141 Updated gradle version in distributionUrl * HMA-11141 Updated gradle version in distributionUrl * Revert "HMA-11141 Fixed READ_EXTERNAL_STORAGE is deprecated error" This reverts commit ba35f3b. * Revert "HMA-11141 Updated buildToolsVersion" This reverts commit 6d23a7b. * HMA-11141 Added javaCompile to use Java 17 * HMA-11141 Changed Kotlin version to 1.8.22 * HMA-11141 Added ScopedStorage to Manifest * HMA-11141 Updated Fastlane * HMA-11141 updated configurations to support java 17 * HMA-11141 updated configurations to support java 17 * HMA-11141 reverting detekt version * HMA-11141 adding facebook testing screenshot in classpath * HMA-11141 Added Firebase androidTestImplementation * HMA-11141 Remove unzipBundle from Fastlane --------- Co-authored-by: vijay-hmrc <vijaya.bhaskara.rao.illa@digital.hmrc.gov.uk>
1 parent 83a89e4 commit 12fd29f

31 files changed

Lines changed: 512 additions & 107 deletions

File tree

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ buildscript {
2929
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigation_safe_args"
3030
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.44.2'
3131
classpath "uk.gov.hmrc.gradle:spotless:1.1.1"
32-
classpath 'com.karumi:shot:5.7.0'
32+
classpath 'com.karumi:shot:6.1.0'
3333

3434
// NOTE: Do not place your application dependencies here; they belong
3535
// in the individual module build.gradle files
@@ -39,6 +39,7 @@ buildscript {
3939
plugins {
4040
id 'io.gitlab.arturbosch.detekt' version '1.18.1'
4141
id "org.jetbrains.kotlin.android" version "$kotlin_version" apply false
42+
id "org.jetbrains.kotlin.kapt" version "1.8.22" apply false
4243
}
4344

4445
allprojects {

buildSrc/build.gradle.kts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
13
repositories {
24
mavenCentral()
35
}
46

57
plugins {
68
`kotlin-dsl`
9+
}
10+
11+
java {
12+
sourceCompatibility = JavaVersion.VERSION_17
13+
targetCompatibility = JavaVersion.VERSION_17
14+
}
15+
kotlin {
16+
compilerOptions {
17+
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
18+
}
19+
}
20+
21+
val compileKotlin: KotlinCompile by tasks
22+
compileKotlin.kotlinOptions {
23+
jvmTarget = "17"
24+
}
25+
26+
val compileTestKotlin: KotlinCompile by tasks
27+
compileTestKotlin.kotlinOptions {
28+
jvmTarget = "17"
729
}

buildSrc/src/main/java/uk/gov/hmrc/components/buildsrc/Dependencies.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ class Dependencies {
2424
}
2525

2626
object Libs {
27-
const val androidX_annotation = "androidx.annotation:annotation:1.8.0"
28-
const val androidX_appcompat = "androidx.appcompat:appcompat:1.6.1"
27+
const val androidX_annotation = "androidx.annotation:annotation:1.9.1"
28+
const val androidX_appcompat = "androidx.appcompat:appcompat:1.7.1"
2929
const val androidX_recyclerview = "androidx.recyclerview:recyclerview:1.3.2"
3030
const val androidX_constraintlayout = "androidx.constraintlayout:constraintlayout:2.1.4"
3131
const val androidX_lifecycle = "androidx.lifecycle:lifecycle-compiler:2.7.0"
@@ -39,6 +39,8 @@ class Dependencies {
3939

4040
const val material = "com.google.android.material:material:1.12.0"
4141

42+
const val facebook_screenshot = "com.facebook.testing.screenshot:core:0.15.0"
43+
4244
const val junit = "junit:junit:4.13.2"
4345
}
4446
}

buildSrc/src/main/java/uk/gov/hmrc/components/buildsrc/Gradle.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ package uk.gov.hmrc.components.buildsrc
1616
* limitations under the License.
1717
*/
1818
object Gradle {
19-
const val version = "7.4.1"
19+
const val version = "8.5.1"
2020
}

components-compose/build.gradle

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,20 @@ android {
4444
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
4545
}
4646
}
47+
4748
compileOptions {
48-
sourceCompatibility JavaVersion.VERSION_11
49-
targetCompatibility JavaVersion.VERSION_11
49+
sourceCompatibility = JavaVersion.VERSION_17
50+
targetCompatibility = JavaVersion.VERSION_17
51+
}
52+
53+
kotlin {
54+
jvmToolchain(17)
5055
}
51-
kotlinOptions {
52-
jvmTarget = '11'
56+
57+
java {
58+
toolchain {
59+
languageVersion.set(JavaLanguageVersion.of(17))
60+
}
5361
}
5462

5563
composeOptions {
@@ -62,23 +70,23 @@ dependencies {
6270
implementation platform(Libs.compose_bom)
6371
androidTestImplementation platform(Libs.compose_bom)
6472

65-
implementation Libs.androidX_coreKtx
66-
implementation Libs.compose_ui
67-
implementation Libs.compose_tooling
68-
implementation Libs.compose_foundation
69-
implementation Libs.compose_material3
73+
implementation(Libs.androidX_coreKtx)
74+
implementation(Libs.compose_ui)
75+
implementation(Libs.compose_tooling)
76+
implementation(Libs.compose_foundation)
77+
implementation(Libs.compose_material3)
7078

71-
testImplementation Libs.junit
79+
testImplementation(Libs.junit)
7280

7381
//Navigation
74-
implementation Libs.androidX_navigation_navigationCompose
75-
implementation Libs.androidX_navigation_ui_ktx
76-
implementation Libs.androidX_navigation_fragment
82+
implementation(Libs.androidX_navigation_navigationCompose)
83+
implementation(Libs.androidX_navigation_ui_ktx)
84+
implementation(Libs.androidX_navigation_fragment)
7785

7886
// UI Tests
79-
androidTestImplementation Libs.compose_uiTest
80-
androidTestImplementation Libs.androidX_test_ext_junit_ktx
81-
androidTestImplementation Libs.androidX_test_espressoCore
87+
androidTestImplementation(Libs.compose_uiTest)
88+
androidTestImplementation(Libs.androidX_test_ext_junit_ktx)
89+
androidTestImplementation(Libs.androidX_test_espressoCore)
8290
}
8391

8492
repositories {

components-compose/src/main/java/uk/gov/hmrc/components/compose/atom/heading/Heading.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import androidx.compose.ui.Modifier
2121
import androidx.compose.ui.semantics.heading
2222
import androidx.compose.ui.semantics.semantics
2323
import androidx.compose.ui.text.TextStyle
24+
import uk.gov.hmrc.components.compose.ui.theme.HmrcTheme
2425
import uk.gov.hmrc.components.compose.ui.theme.HmrcTheme.typography
2526

2627
@Composable
@@ -42,3 +43,17 @@ fun Heading4(text: String, modifier: Modifier = Modifier) {
4243
fun Heading5(text: String, modifier: Modifier = Modifier) {
4344
Heading(text = text, style = typography.h5, modifier = modifier)
4445
}
46+
47+
@Composable
48+
fun Heading5Blue(
49+
text: String,
50+
modifier: Modifier = Modifier
51+
) {
52+
Heading(
53+
text = text,
54+
modifier = modifier,
55+
style = typography.h5.copy(
56+
color = HmrcTheme.colors.hmrcBlue
57+
)
58+
)
59+
}
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
/*
2+
* Copyright 2026 HM Revenue & Customs
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+
package uk.gov.hmrc.components.compose.organism.menu
17+
18+
import androidx.compose.foundation.Image
19+
import androidx.compose.foundation.background
20+
import androidx.compose.foundation.clickable
21+
import androidx.compose.foundation.isSystemInDarkTheme
22+
import androidx.compose.foundation.layout.Box
23+
import androidx.compose.foundation.layout.Column
24+
import androidx.compose.foundation.layout.Row
25+
import androidx.compose.foundation.layout.Spacer
26+
import androidx.compose.foundation.layout.fillMaxWidth
27+
import androidx.compose.foundation.layout.padding
28+
import androidx.compose.foundation.layout.size
29+
import androidx.compose.foundation.layout.width
30+
import androidx.compose.foundation.shape.RoundedCornerShape
31+
import androidx.compose.material3.Text
32+
import androidx.compose.runtime.Composable
33+
import androidx.compose.ui.Alignment
34+
import androidx.compose.ui.Modifier
35+
import androidx.compose.ui.graphics.ColorFilter
36+
import androidx.compose.ui.res.painterResource
37+
import androidx.compose.ui.unit.dp
38+
import uk.gov.hmrc.components.compose.R
39+
import uk.gov.hmrc.components.compose.atom.heading.Heading5Blue
40+
import uk.gov.hmrc.components.compose.atom.text.BodyText
41+
import uk.gov.hmrc.components.compose.organism.HmrcCardView
42+
import uk.gov.hmrc.components.compose.ui.theme.HmrcBlack
43+
import uk.gov.hmrc.components.compose.ui.theme.HmrcBlackDark
44+
import uk.gov.hmrc.components.compose.ui.theme.HmrcTheme
45+
46+
@Suppress("LongMethod")
47+
@Composable
48+
fun MenuPanelRowView(
49+
heading: String,
50+
body: String? = null,
51+
hasNotification: Boolean = false,
52+
notification: String? = null,
53+
modifier: Modifier = Modifier,
54+
onClick: () -> Unit,
55+
) {
56+
HmrcCardView(
57+
customBackgroundColor = HmrcTheme.colors.hmrcGrey3,
58+
modifier = modifier
59+
.clickable(
60+
onClick = onClick,
61+
)
62+
) {
63+
Row(
64+
modifier = Modifier
65+
.fillMaxWidth()
66+
.padding(HmrcTheme.dimensions.hmrcSpacing16),
67+
verticalAlignment = Alignment.CenterVertically,
68+
) {
69+
Column(
70+
modifier = Modifier.weight(1f)
71+
) {
72+
Row(
73+
verticalAlignment = Alignment.CenterVertically,
74+
) {
75+
Heading5Blue(
76+
text = heading,
77+
)
78+
79+
Spacer(modifier = Modifier.padding(HmrcTheme.dimensions.hmrcSpacing4))
80+
81+
if (hasNotification) {
82+
Box(
83+
modifier = Modifier
84+
.size(
85+
width = if (notification != null) 48.dp else 24.dp, // Just to show a red dot
86+
height = 24.dp,
87+
)
88+
.background(
89+
color = HmrcTheme.colors.hmrcRed,
90+
shape = RoundedCornerShape(size = HmrcTheme.dimensions.hmrcSpacing32)
91+
),
92+
contentAlignment = Alignment.Center
93+
) {
94+
if (notification != null) {
95+
Text(
96+
text = notification,
97+
style = HmrcTheme.typography.notificationText,
98+
)
99+
}
100+
}
101+
}
102+
}
103+
104+
if (body != null) {
105+
Spacer(modifier = Modifier.padding(HmrcTheme.dimensions.hmrcSpacing16))
106+
107+
BodyText(
108+
text = body,
109+
)
110+
}
111+
}
112+
Spacer(modifier = Modifier.width(HmrcTheme.dimensions.hmrcSpacing8))
113+
Image(
114+
painter = painterResource(id = R.drawable.components_ic_chevron_right),
115+
colorFilter = ColorFilter.tint(
116+
if (isSystemInDarkTheme()) {
117+
HmrcBlackDark
118+
} else {
119+
HmrcBlack
120+
}
121+
),
122+
contentDescription = "",
123+
)
124+
}
125+
}
126+
}

components-compose/src/main/java/uk/gov/hmrc/components/compose/ui/theme/Dimensions.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ data class Dimensions(
2424
val hmrcSpacing8: Dp,
2525
val hmrcSpacing16: Dp,
2626
val hmrcSpacing24: Dp,
27+
val hmrcSpacing32: Dp,
2728
val hmrcSpacing48: Dp,
2829
val hmrcIconSize24: Dp,
2930
val hmrcIconSize36: Dp,
@@ -37,6 +38,7 @@ val smallDimensions = Dimensions(
3738
hmrcSpacing8 = 8.dp,
3839
hmrcSpacing16 = 16.dp,
3940
hmrcSpacing24 = 24.dp,
41+
hmrcSpacing32 = 32.dp,
4042
hmrcSpacing48 = 48.dp,
4143
hmrcIconSize24 = 24.dp,
4244
hmrcIconSize36 = 36.dp,
@@ -50,6 +52,7 @@ val compactDimensions = Dimensions(
5052
hmrcSpacing8 = 8.dp,
5153
hmrcSpacing16 = 16.dp,
5254
hmrcSpacing24 = 24.dp,
55+
hmrcSpacing32 = 32.dp,
5356
hmrcSpacing48 = 48.dp,
5457
hmrcIconSize24 = 24.dp,
5558
hmrcIconSize36 = 36.dp,
@@ -63,6 +66,7 @@ val mediumDimensions = Dimensions(
6366
hmrcSpacing8 = 8.dp,
6467
hmrcSpacing16 = 16.dp,
6568
hmrcSpacing24 = 24.dp,
69+
hmrcSpacing32 = 32.dp,
6670
hmrcSpacing48 = 48.dp,
6771
hmrcIconSize24 = 24.dp,
6872
hmrcIconSize36 = 36.dp,
@@ -76,6 +80,7 @@ val largeDimensions = Dimensions(
7680
hmrcSpacing8 = 8.dp,
7781
hmrcSpacing16 = 16.dp,
7882
hmrcSpacing24 = 24.dp,
83+
hmrcSpacing32 = 32.dp,
7984
hmrcSpacing48 = 48.dp,
8085
hmrcIconSize24 = 24.dp,
8186
hmrcIconSize36 = 36.dp,

components-compose/src/main/java/uk/gov/hmrc/components/compose/ui/theme/HmrcTypography.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import androidx.compose.ui.unit.sp
2525
data class HmrcTypography(
2626
val hmrcBlack: Color,
2727
val hmrcGrey1: Color,
28+
val hmrcWhite: Color,
2829
val hmrcBlue: Color,
2930
val hmrcRed: Color,
3031

@@ -87,5 +88,11 @@ data class HmrcTypography(
8788
fontFamily = FontFamily.Default,
8889
fontWeight = FontWeight.Bold,
8990
fontSize = 16.sp,
91+
),
92+
val notificationText: TextStyle = TextStyle(
93+
fontFamily = FontFamily.Default,
94+
fontWeight = FontWeight.Bold,
95+
fontSize = 16.sp,
96+
color = hmrcWhite,
9097
)
9198
)

components-compose/src/main/java/uk/gov/hmrc/components/compose/ui/theme/Theme.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ fun HmrcTheme(
9898

9999
val hmrcTypography = HmrcTypography(
100100
hmrcBlack = colors.hmrcBlack,
101+
hmrcWhite = colors.hmrcWhite,
101102
hmrcGrey1 = colors.hmrcGrey1,
102103
hmrcBlue = colors.hmrcBlue,
103104
hmrcRed = colors.hmrcRed,

0 commit comments

Comments
 (0)