Skip to content

Commit 4ca17b9

Browse files
Merge pull request #39 from google-developer-training/main-kotlin-dsl
Migrate Groovy to Kotlin DSL
2 parents d237b50 + 42a5609 commit 4ca17b9

17 files changed

Lines changed: 194 additions & 143 deletions

app/build.gradle

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

app/build.gradle.kts

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* Copyright (C) 2023 The Android Open Source Project
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+
* https://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+
plugins {
18+
id("com.android.application")
19+
id("org.jetbrains.kotlin.android")
20+
}
21+
22+
android {
23+
namespace = "com.example.reply"
24+
compileSdk = 33
25+
26+
defaultConfig {
27+
applicationId = "com.example.reply"
28+
minSdk = 24
29+
targetSdk = 33
30+
versionCode = 1
31+
versionName = "1.0"
32+
33+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
34+
vectorDrawables {
35+
useSupportLibrary = true
36+
}
37+
}
38+
39+
buildTypes {
40+
release {
41+
isMinifyEnabled = false
42+
proguardFiles(
43+
getDefaultProguardFile("proguard-android-optimize.txt"),
44+
"proguard-rules.pro"
45+
)
46+
}
47+
}
48+
compileOptions {
49+
sourceCompatibility = JavaVersion.VERSION_1_8
50+
targetCompatibility = JavaVersion.VERSION_1_8
51+
}
52+
kotlinOptions {
53+
jvmTarget = "1.8"
54+
allWarningsAsErrors = false
55+
}
56+
buildFeatures {
57+
compose = true
58+
}
59+
composeOptions {
60+
kotlinCompilerExtensionVersion = "1.4.7"
61+
}
62+
packaging {
63+
resources {
64+
excludes += "/META-INF/{AL2.0,LGPL2.1}"
65+
}
66+
}
67+
}
68+
69+
dependencies {
70+
71+
implementation(platform("androidx.compose:compose-bom:2023.06.00"))
72+
implementation("androidx.activity:activity-compose:1.7.2")
73+
implementation("androidx.compose.material:material-icons-extended")
74+
implementation("androidx.compose.material3:material3")
75+
implementation("androidx.compose.material3:material3-window-size-class")
76+
implementation("androidx.compose.ui:ui")
77+
implementation("androidx.compose.ui:ui-graphics")
78+
implementation("androidx.compose.ui:ui-tooling-preview")
79+
implementation("androidx.core:core-ktx:1.10.1")
80+
implementation("androidx.lifecycle:lifecycle-runtime-ktx:${rootProject.extra["lifecycle_version"]}")
81+
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:${rootProject.extra["lifecycle_version"]}")
82+
83+
androidTestImplementation(platform("androidx.compose:compose-bom:2023.06.00"))
84+
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
85+
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
86+
androidTestImplementation("androidx.test.ext:junit:1.1.5")
87+
testImplementation("junit:junit:4.13.2")
88+
89+
debugImplementation("androidx.compose.ui:ui-test-manifest")
90+
debugImplementation("androidx.compose.ui:ui-tooling")
91+
}

app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
android:theme="@style/Theme.Reply">
3535
<intent-filter>
3636
<action android:name="android.intent.action.MAIN" />
37-
3837
<category android:name="android.intent.category.LAUNCHER" />
3938
</intent-filter>
4039
</activity>

app/src/main/java/com/example/reply/MainActivity.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import android.os.Bundle
1919
import androidx.activity.ComponentActivity
2020
import androidx.activity.compose.setContent
2121
import androidx.compose.material3.Surface
22+
import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
2223
import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass
2324
import androidx.compose.material3.windowsizeclass.calculateWindowSizeClass
2425
import androidx.compose.runtime.Composable
@@ -28,6 +29,7 @@ import com.example.reply.ui.theme.ReplyTheme
2829

2930
class MainActivity : ComponentActivity() {
3031

32+
@OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
3133
override fun onCreate(savedInstanceState: Bundle?) {
3234
super.onCreate(savedInstanceState)
3335

app/src/main/java/com/example/reply/ui/ReplyHomeContent.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import androidx.compose.foundation.lazy.items
3030
import androidx.compose.foundation.shape.CircleShape
3131
import androidx.compose.material3.Card
3232
import androidx.compose.material3.CardDefaults
33+
import androidx.compose.material3.ExperimentalMaterial3Api
3334
import androidx.compose.material3.MaterialTheme
3435
import androidx.compose.material3.Text
3536
import androidx.compose.runtime.Composable
@@ -118,6 +119,7 @@ fun ReplyListAndDetailContent(
118119
}
119120
}
120121

122+
@OptIn(ExperimentalMaterial3Api::class)
121123
@Composable
122124
fun ReplyEmailListItem(
123125
email: Email,

app/src/main/java/com/example/reply/ui/ReplyHomeScreen.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import androidx.compose.material.icons.filled.Drafts
3333
import androidx.compose.material.icons.filled.Inbox
3434
import androidx.compose.material.icons.filled.Report
3535
import androidx.compose.material.icons.filled.Send
36+
import androidx.compose.material3.ExperimentalMaterial3Api
3637
import androidx.compose.material3.Icon
3738
import androidx.compose.material3.MaterialTheme
3839
import androidx.compose.material3.NavigationBar
@@ -59,6 +60,7 @@ import com.example.reply.data.local.LocalAccountsDataProvider
5960
import com.example.reply.ui.utils.ReplyContentType
6061
import com.example.reply.ui.utils.ReplyNavigationType
6162

63+
@OptIn(ExperimentalMaterial3Api::class)
6264
@Composable
6365
fun ReplyHomeScreen(
6466
navigationType: ReplyNavigationType,
@@ -250,6 +252,7 @@ private fun ReplyBottomNavigationBar(
250252
}
251253
}
252254

255+
@OptIn(ExperimentalMaterial3Api::class)
253256
@Composable
254257
private fun NavigationDrawerContent(
255258
selectedDestination: MailboxType,

app/src/main/res/drawable/avatar_parcel.xml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
<!--
2-
Copyright 2022 The Android Open Source Project
3-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
4-
in compliance with the License. You may obtain a copy of the License at
5-
http://www.apache.org/licenses/LICENSE-2.0
6-
Unless required by applicable law or agreed to in writing, software distributed under the License
7-
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
8-
or implied. See the License for the specific language governing permissions and limitations under
9-
the License.
2+
~ Copyright (C) 2023 The Android Open Source Project
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+
~ https://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.
1015
-->
1116
<vector xmlns:android="http://schemas.android.com/apk/res/android"
1217
android:width="175dp"

app/src/main/res/drawable/avatar_spam.xml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
<!--
2-
Copyright 2022 The Android Open Source Project
3-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
4-
in compliance with the License. You may obtain a copy of the License at
5-
http://www.apache.org/licenses/LICENSE-2.0
6-
Unless required by applicable law or agreed to in writing, software distributed under the License
7-
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
8-
or implied. See the License for the specific language governing permissions and limitations under
9-
the License.
2+
~ Copyright (C) 2023 The Android Open Source Project
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+
~ https://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.
1015
-->
1116
<vector xmlns:android="http://schemas.android.com/apk/res/android"
1217
android:width="175dp"

app/src/main/res/drawable/ic_launcher_background.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ Copyright (C) 2023 The Android Open Source Project
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ https://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
217
<vector xmlns:android="http://schemas.android.com/apk/res/android"
318
android:width="108dp"
419
android:height="108dp"

app/src/main/res/drawable/logo.xml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
<!--
2-
Copyright 2022 The Android Open Source Project
3-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
4-
in compliance with the License. You may obtain a copy of the License at
5-
http://www.apache.org/licenses/LICENSE-2.0
6-
Unless required by applicable law or agreed to in writing, software distributed under the License
7-
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
8-
or implied. See the License for the specific language governing permissions and limitations under
9-
the License.
2+
~ Copyright (C) 2023 The Android Open Source Project
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+
~ https://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.
1015
-->
1116
<vector xmlns:android="http://schemas.android.com/apk/res/android"
1217
android:width="59dp"

0 commit comments

Comments
 (0)