Skip to content

Commit b0ce65e

Browse files
committed
Migrate Groovy to Kotlin DSL
1 parent 79a0c9e commit b0ce65e

16 files changed

+192
-52
lines changed

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.material3:material3")
74+
implementation("androidx.compose.material3:material3-window-size-class")
75+
implementation("androidx.compose.material:material-icons-extended")
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:2022.10.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,13 +19,15 @@ 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.runtime.Composable
2324
import androidx.compose.ui.tooling.preview.Preview
2425
import com.example.reply.ui.ReplyApp
2526
import com.example.reply.ui.theme.ReplyTheme
2627

2728
class MainActivity : ComponentActivity() {
2829

30+
@OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
2931
override fun onCreate(savedInstanceState: Bundle?) {
3032
super.onCreate(savedInstanceState)
3133

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/res/drawable/avatar_parcel.xml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
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
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+
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
1116
<vector xmlns:android="http://schemas.android.com/apk/res/android"
1217
android:width="59dp"

app/src/main/res/values/colors.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
<color name="teal_700">#FF018786color>
2323
<color name="black">#FF000000color>
2424
<color name="white">#FFFFFFFFcolor>
25-
resources>
25+
resources>

app/src/main/res/values/dimens.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<dimen name="drawer_padding_header">16dpdimen>
2323
<dimen name="drawer_padding_content">12dpdimen>
2424

25-
<dimen name="profile_image_padding">16.dpdimen>
25+
<dimen name="profile_image_padding">16dpdimen>
2626
<dimen name="profile_image_size">20dpdimen>
2727
<dimen name="reply_logo_size">48dpdimen>
2828

@@ -58,4 +58,4 @@
5858
<dimen name="detail_topbar_padding_bottom">24dpdimen>
5959
<dimen name="detail_topbar_back_button_padding_horizontal">24dpdimen>
6060

61-
resources>
61+
resources>

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,4 @@
176176
string>
177177
<string name="email_11_time">3 hours agostring>
178178

179-
resources>
179+
resources>

app/src/main/res/values/themes.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
-->
1717
<resources>
1818
<style name="Theme.Reply" parent="android:Theme.Material.Light.NoActionBar"/>
19-
resources>
19+
resources>

build.gradle renamed to build.gradle.kts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
* limitations under the License.
1515
*/
1616
buildscript {
17-
ext {
18-
lifecycle_version = '2.6.0'
17+
extra.apply {
18+
set("lifecycle_version", "2.6.1")
1919
}
2020
}
2121

2222
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2323
plugins {
24-
id 'com.android.application' version '8.0.0-beta05' apply false
25-
id 'com.android.library' version '8.0.0-beta05' apply false
26-
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
24+
id("com.android.application") version "8.0.2" apply false
25+
id("com.android.library") version "8.0.2" apply false
26+
id("org.jetbrains.kotlin.android") version "1.8.21" apply false
2727
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Mon Mar 13 13:23:28 PDT 2023
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

settings.gradle

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

settings.gradle.kts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
pluginManagement {
18+
repositories {
19+
google()
20+
mavenCentral()
21+
gradlePluginPortal()
22+
}
23+
}
24+
dependencyResolutionManagement {
25+
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
26+
repositories {
27+
google()
28+
mavenCentral()
29+
}
30+
}
31+
rootProject.name = "Reply"
32+
include(":app")

0 commit comments

Comments
 (0)