Skip to content

Commit 93511b7

Browse files
committedJun 9, 2020
[Jetsnack] Initial commit.
Change-Id: I74bc1a5aae92014271deca57ace6b8c419baba4c
1 parent 2b8365e commit 93511b7

30 files changed

+1012
-0
lines changed
 

‎Jetsnack/.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties

‎Jetsnack/app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

‎Jetsnack/app/build.gradle

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/*
2+
* Copyright 2020 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+
* 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+
plugins {
18+
id 'com.android.application'
19+
id 'kotlin-android'
20+
}
21+
22+
android {
23+
compileSdkVersion 29
24+
25+
defaultConfig {
26+
applicationId "com.example.jetsnack"
27+
minSdkVersion 21
28+
targetSdkVersion 29
29+
versionCode 1
30+
versionName "1.0"
31+
32+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
33+
}
34+
35+
buildTypes {
36+
release {
37+
minifyEnabled false
38+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
39+
}
40+
}
41+
42+
compileOptions {
43+
sourceCompatibility JavaVersion.VERSION_1_8
44+
targetCompatibility JavaVersion.VERSION_1_8
45+
}
46+
47+
kotlinOptions {
48+
jvmTarget = "1.8"
49+
apiVersion = "1.3"
50+
allWarningsAsErrors = true
51+
}
52+
53+
buildFeatures {
54+
compose true
55+
}
56+
57+
composeOptions {
58+
kotlinCompilerVersion "1.3.70-dev-withExperimentalGoogleExtensions-20200424"
59+
kotlinCompilerExtensionVersion compose_version
60+
}
61+
}
62+
63+
configurations {
64+
ktlint
65+
}
66+
67+
dependencies {
68+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
69+
implementation('androidx.core:core-ktx:1.1.0') // don't update yet b/152023266
70+
implementation 'androidx.appcompat:appcompat:1.1.0'
71+
72+
implementation("androidx.ui:ui-core:$compose_version")
73+
implementation("androidx.ui:ui-layout:$compose_version")
74+
implementation("androidx.ui:ui-material:$compose_version")
75+
implementation("androidx.ui:ui-tooling:$compose_version")
76+
77+
ktlint "com.pinterest:ktlint:0.37.0"
78+
}
79+
80+
task ktlint(type: JavaExec, group: "verification") {
81+
description = "Check Kotlin code style."
82+
main = "com.pinterest.ktlint.Main"
83+
classpath = configurations.ktlint
84+
args "src/**/*.kt"
85+
}
86+
87+
check.dependsOn ktlint
88+
89+
task ktlintFormat(type: JavaExec, group: "formatting") {
90+
description = "Fix Kotlin code style deviations."
91+
main = "com.pinterest.ktlint.Main"
92+
classpath = configurations.ktlint
93+
args "-F", "src/**/*.kt"
94+
}

‎Jetsnack/app/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2020 The Android Open Source Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6+
in compliance with the License. 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 distributed under the License
11+
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12+
or implied. See the License for the specific language governing permissions and limitations under
13+
the License.
14+
-->
15+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
16+
package="com.example.jetsnack">
17+
18+
<application
19+
android:allowBackup="true"
20+
android:icon="@mipmap/ic_launcher"
21+
android:label="@string/app_name"
22+
android:supportsRtl="true"
23+
android:theme="@style/Theme.Jetsnack">
24+
<activity
25+
android:name=".ui.MainActivity"
26+
android:label="@string/app_name"
27+
android:theme="@style/Theme.Jetsnack">
28+
<intent-filter>
29+
<action android:name="android.intent.action.MAIN" />
30+
<category android:name="android.intent.category.LAUNCHER" />
31+
</intent-filter>
32+
</activity>
33+
</application>
34+
35+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright 2020 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+
* 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.example.jetsnack.ui
18+
19+
import androidx.compose.Composable
20+
import androidx.ui.foundation.Text
21+
import com.example.jetsnack.ui.theme.AppTheme
22+
23+
@Composable
24+
fun JetsnackApp() {
25+
AppTheme {
26+
Text(text = "Jetsnack!")
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2020 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+
* 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.example.jetsnack.ui
18+
19+
import android.os.Bundle
20+
import androidx.appcompat.app.AppCompatActivity
21+
import androidx.ui.core.setContent
22+
23+
class MainActivity : AppCompatActivity() {
24+
override fun onCreate(savedInstanceState: Bundle?) {
25+
super.onCreate(savedInstanceState)
26+
setContent {
27+
JetsnackApp()
28+
}
29+
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright 2020 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+
* 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.example.jetsnack.ui.theme
18+
19+
import androidx.ui.graphics.Color
20+
21+
val Purple200 = Color(0xFFBB86FC)
22+
val Purple500 = Color(0xFF6200EE)
23+
val Purple700 = Color(0xFF3700B3)
24+
val Teal200 = Color(0xFF03DAC5)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright 2020 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+
* 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.example.jetsnack.ui.theme
18+
19+
import androidx.ui.foundation.shape.corner.RoundedCornerShape
20+
import androidx.ui.material.Shapes
21+
import androidx.ui.unit.dp
22+
23+
val Shapes = Shapes(
24+
small = RoundedCornerShape(4.dp),
25+
medium = RoundedCornerShape(4.dp),
26+
large = RoundedCornerShape(0.dp)
27+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright 2020 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+
* 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.example.jetsnack.ui.theme
18+
19+
import androidx.compose.Composable
20+
import androidx.ui.foundation.isSystemInDarkTheme
21+
import androidx.ui.material.MaterialTheme
22+
import androidx.ui.material.darkColorPalette
23+
import androidx.ui.material.lightColorPalette
24+
25+
private val DarkColorPalette = darkColorPalette(
26+
primary = Purple200,
27+
primaryVariant = Purple700,
28+
secondary = Teal200
29+
)
30+
31+
private val LightColorPalette = lightColorPalette(
32+
primary = Purple500,
33+
primaryVariant = Purple700,
34+
secondary = Teal200
35+
)
36+
37+
@Composable
38+
fun AppTheme(
39+
darkTheme: Boolean = isSystemInDarkTheme(),
40+
content: @Composable () -> Unit
41+
) {
42+
val colors = if (darkTheme) {
43+
DarkColorPalette
44+
} else {
45+
LightColorPalette
46+
}
47+
48+
MaterialTheme(
49+
colors = colors,
50+
typography = typography,
51+
shapes = Shapes,
52+
content = content
53+
)
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2020 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+
* 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.example.jetsnack.ui.theme
18+
19+
import androidx.ui.material.Typography
20+
import androidx.ui.text.TextStyle
21+
import androidx.ui.text.font.FontFamily
22+
import androidx.ui.text.font.FontWeight
23+
import androidx.ui.unit.sp
24+
25+
val typography = Typography(
26+
body1 = TextStyle(
27+
fontFamily = FontFamily.Default,
28+
fontWeight = FontWeight.Normal,
29+
fontSize = 16.sp
30+
)
31+
)

0 commit comments

Comments
 (0)