Skip to content

Commit 0c76038

Browse files
authoredMay 18, 2020
Merge pull request android#86 from android/nb/theme
Update structure of theming.
2 parents 7a65b28 + 709e477 commit 0c76038

24 files changed

+202
-188
lines changed
 

‎JetNews/app/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ dependencies {
6363
implementation("androidx.ui:ui-core:$compose_version")
6464
implementation("androidx.ui:ui-layout:$compose_version")
6565
implementation("androidx.ui:ui-material:$compose_version")
66+
implementation("androidx.ui:ui-material-icons-extended:$compose_version")
6667
implementation("androidx.ui:ui-foundation:$compose_version")
6768
implementation("androidx.ui:ui-animation:$compose_version")
6869
implementation "androidx.ui:ui-tooling:$compose_version"

‎JetNews/app/src/main/java/com/example/jetnews/data/posts/impl/FakePostsRepository.kt

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import androidx.ui.graphics.imageFromResource
2222
import com.example.jetnews.data.Result
2323
import com.example.jetnews.data.posts.PostsRepository
2424
import com.example.jetnews.model.Post
25-
import java.lang.IllegalStateException
2625
import java.util.concurrent.ExecutorService
2726
import kotlin.random.Random
2827

‎JetNews/app/src/main/java/com/example/jetnews/ui/JetnewsApp.kt

+3-6
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,11 @@ import com.example.jetnews.data.posts.PostsRepository
4747
import com.example.jetnews.ui.article.ArticleScreen
4848
import com.example.jetnews.ui.home.HomeScreen
4949
import com.example.jetnews.ui.interests.InterestsScreen
50+
import com.example.jetnews.ui.theme.JetnewsTheme
5051

5152
@Composable
5253
fun JetnewsApp(appContainer: AppContainer) {
53-
54-
MaterialTheme(
55-
colors = lightThemeColors,
56-
typography = themeTypography
57-
) {
54+
JetnewsTheme {
5855
AppContent(
5956
interestsRepository = appContainer.interestsRepository,
6057
postsRepository = appContainer.postsRepository
@@ -192,7 +189,7 @@ fun PreviewJetnewsApp() {
192189
@Preview("Drawer contents dark theme")
193190
@Composable
194191
fun PreviewJetnewsAppDark() {
195-
ThemedPreview(darkThemeColors) {
192+
ThemedPreview(darkTheme = true) {
196193
AppDrawer(
197194
currentScreen = JetnewsStatus.currentScreen,
198195
closeDrawer = { }

‎JetNews/app/src/main/java/com/example/jetnews/ui/PreviewUtils.kt

+3-6
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,15 @@
1717
package com.example.jetnews.ui
1818

1919
import androidx.compose.Composable
20-
import androidx.ui.material.ColorPalette
21-
import androidx.ui.material.MaterialTheme
2220
import androidx.ui.material.Surface
23-
import androidx.ui.material.Typography
21+
import com.example.jetnews.ui.theme.JetnewsTheme
2422

2523
@Composable
2624
internal fun ThemedPreview(
27-
colors: ColorPalette = lightThemeColors,
28-
typography: Typography = themeTypography,
25+
darkTheme: Boolean = false,
2926
children: @Composable() () -> Unit
3027
) {
31-
MaterialTheme(colors = colors, typography = typography) {
28+
JetnewsTheme(darkTheme = darkTheme) {
3229
Surface {
3330
children()
3431
}

‎JetNews/app/src/main/java/com/example/jetnews/ui/Themes.kt

-51
This file was deleted.

‎JetNews/app/src/main/java/com/example/jetnews/ui/article/ArticleScreen.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ import com.example.jetnews.data.successOr
5555
import com.example.jetnews.model.Post
5656
import com.example.jetnews.ui.Screen
5757
import com.example.jetnews.ui.ThemedPreview
58-
import com.example.jetnews.ui.darkThemeColors
5958
import com.example.jetnews.ui.effect.fetchPost
6059
import com.example.jetnews.ui.home.BookmarkButton
6160
import com.example.jetnews.ui.home.isFavorite
@@ -173,7 +172,7 @@ fun PreviewArticle() {
173172
@Preview("Article screen dark theme")
174173
@Composable
175174
fun PreviewArticleDark() {
176-
ThemedPreview(darkThemeColors) {
175+
ThemedPreview(darkTheme = true) {
177176
val post = loadFakePost(post3.id)
178177
ArticleScreen(post)
179178
}

‎JetNews/app/src/main/java/com/example/jetnews/ui/article/PostContent.kt

+11-12
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ import com.example.jetnews.model.Paragraph
6969
import com.example.jetnews.model.ParagraphType
7070
import com.example.jetnews.model.Post
7171
import com.example.jetnews.ui.ThemedPreview
72-
import com.example.jetnews.ui.darkThemeColors
7372

7473
private val defaultSpacerSize = 16.dp
7574

@@ -208,21 +207,21 @@ private fun BulletParagraph(
208207
// this box is acting as a character, so it's sized with font scaling (sp)
209208
Box(
210209
modifier = Modifier
211-
.preferredSize(8.sp.toDp(), 8.sp.toDp())
212-
.alignWithSiblings {
213-
// Add an alignment "baseline" 1sp below the bottom of the circle
214-
9.sp.toIntPx()
215-
},
210+
.preferredSize(8.sp.toDp(), 8.sp.toDp())
211+
.alignWithSiblings {
212+
// Add an alignment "baseline" 1sp below the bottom of the circle
213+
9.sp.toIntPx()
214+
},
216215
backgroundColor = contentColor(),
217216
shape = CircleShape
218217
)
219218
}
220219
Text(
221-
modifier = Modifier
222-
.weight(1f)
223-
.alignWithSiblings(FirstBaseline),
224-
text = text,
225-
style = textStyle.merge(paragraphStyle)
220+
modifier = Modifier
221+
.weight(1f)
222+
.alignWithSiblings(FirstBaseline),
223+
text = text,
224+
style = textStyle.merge(paragraphStyle)
226225
)
227226
}
228227
}
@@ -334,7 +333,7 @@ fun PreviewPost() {
334333
@Preview("Post content dark theme")
335334
@Composable
336335
fun PreviewPostDark() {
337-
ThemedPreview(darkThemeColors) {
336+
ThemedPreview(darkTheme = true) {
338337
PostContent(post = post3)
339338
}
340339
}

‎JetNews/app/src/main/java/com/example/jetnews/ui/home/HomeScreen.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ import com.example.jetnews.ui.AppDrawer
6464
import com.example.jetnews.ui.Screen
6565
import com.example.jetnews.ui.SwipeToRefreshLayout
6666
import com.example.jetnews.ui.ThemedPreview
67-
import com.example.jetnews.ui.darkThemeColors
6867
import com.example.jetnews.ui.navigateTo
6968
import com.example.jetnews.ui.state.RefreshableUiState
7069
import com.example.jetnews.ui.state.currentData
@@ -306,7 +305,7 @@ private fun PreviewDrawerOpen() {
306305
@Preview("Home screen dark theme")
307306
@Composable
308307
fun PreviewHomeScreenBodyDark() {
309-
ThemedPreview(darkThemeColors) {
308+
ThemedPreview(darkTheme = true) {
310309
val posts = loadFakePosts()
311310
HomeScreenBody(posts)
312311
}
@@ -315,7 +314,7 @@ fun PreviewHomeScreenBodyDark() {
315314
@Preview("Home screen, open drawer dark theme")
316315
@Composable
317316
private fun PreviewDrawerOpenDark() {
318-
ThemedPreview(darkThemeColors) {
317+
ThemedPreview(darkTheme = true) {
319318
HomeScreen(
320319
postsRepository = BlockingFakePostsRepository(ContextAmbient.current),
321320
scaffoldState = ScaffoldState(drawerState = DrawerState.Opened)

‎JetNews/app/src/main/java/com/example/jetnews/ui/home/PostCardTop.kt

+5-8
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import androidx.ui.layout.fillMaxWidth
3030
import androidx.ui.layout.padding
3131
import androidx.ui.layout.preferredHeight
3232
import androidx.ui.layout.preferredHeightIn
33-
import androidx.ui.material.ColorPalette
3433
import androidx.ui.material.EmphasisAmbient
3534
import androidx.ui.material.MaterialTheme
3635
import androidx.ui.material.ProvideEmphasis
@@ -41,12 +40,10 @@ import com.example.jetnews.data.posts.impl.post2
4140
import com.example.jetnews.data.posts.impl.posts
4241
import com.example.jetnews.model.Post
4342
import com.example.jetnews.ui.ThemedPreview
44-
import com.example.jetnews.ui.darkThemeColors
45-
import com.example.jetnews.ui.lightThemeColors
4643

4744
@Composable
4845
fun PostCardTop(post: Post) {
49-
// TUTORIAL CONTENT STARTS HERE
46+
// TUTORIAL CONTENT STARTS HERE
5047
val typography = MaterialTheme.typography
5148
Column(modifier = Modifier.fillMaxWidth().padding(16.dp)) {
5249
post.image?.let { image ->
@@ -90,7 +87,7 @@ fun TutorialPreview() {
9087
@Preview("Dark theme")
9188
@Composable
9289
fun TutorialPreviewDark() {
93-
TutorialPreviewTemplate(colors = darkThemeColors)
90+
TutorialPreviewTemplate(darkTheme = true)
9491
}
9592

9693
@Preview("Font scaling 1.5", fontScale = 1.5f)
@@ -101,13 +98,13 @@ fun TutorialPreviewFontscale() {
10198

10299
@Composable
103100
fun TutorialPreviewTemplate(
104-
colors: ColorPalette = lightThemeColors
101+
darkTheme: Boolean = false
105102
) {
106103
val context = ContextAmbient.current
107104
val previewPosts = getPostsWithImagesLoaded(posts.subList(1, 2), context.resources)
108105
val post = previewPosts[0]
109106

110-
ThemedPreview(colors) {
107+
ThemedPreview(darkTheme) {
111108
PostCardTop(post)
112109
}
113110
}
@@ -123,7 +120,7 @@ fun PreviewPostCardTop() {
123120
@Preview("Post card top dark theme")
124121
@Composable
125122
fun PreviewPostCardTopDark() {
126-
ThemedPreview(darkThemeColors) {
123+
ThemedPreview(darkTheme = true) {
127124
PostCardTop(post = post2)
128125
}
129126
}

‎JetNews/app/src/main/java/com/example/jetnews/ui/home/PostCardYourNetwork.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ import com.example.jetnews.model.Post
4242
import com.example.jetnews.model.PostAuthor
4343
import com.example.jetnews.ui.Screen
4444
import com.example.jetnews.ui.ThemedPreview
45-
import com.example.jetnews.ui.darkThemeColors
4645
import com.example.jetnews.ui.navigateTo
4746

4847
@Composable
@@ -95,7 +94,7 @@ fun PreviewPostCardPopular() {
9594
@Preview("Dark colors")
9695
@Composable
9796
fun PreviewPostCardPopularDark() {
98-
ThemedPreview(darkThemeColors) {
97+
ThemedPreview(darkTheme = true) {
9998
PostCardPopular(post = post1)
10099
}
101100
}

‎JetNews/app/src/main/java/com/example/jetnews/ui/home/PostCards.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import com.example.jetnews.model.Post
4343
import com.example.jetnews.ui.JetnewsStatus
4444
import com.example.jetnews.ui.Screen
4545
import com.example.jetnews.ui.ThemedPreview
46-
import com.example.jetnews.ui.darkThemeColors
4746
import com.example.jetnews.ui.navigateTo
4847

4948
@Composable
@@ -157,7 +156,7 @@ fun PreviewHistoryPost() {
157156
@Preview("Simple post card dark theme")
158157
@Composable
159158
fun PreviewSimplePostDark() {
160-
ThemedPreview(darkThemeColors) {
159+
ThemedPreview(darkTheme = true) {
161160
PostCardSimple(post = post3)
162161
}
163162
}

‎JetNews/app/src/main/java/com/example/jetnews/ui/interests/InterestsScreen.kt

+6-7
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ import com.example.jetnews.ui.AppDrawer
5454
import com.example.jetnews.ui.JetnewsStatus
5555
import com.example.jetnews.ui.Screen
5656
import com.example.jetnews.ui.ThemedPreview
57-
import com.example.jetnews.ui.darkThemeColors
5857
import com.example.jetnews.ui.state.UiState
5958
import com.example.jetnews.ui.state.previewDataFrom
6059
import com.example.jetnews.ui.state.uiStateFrom
@@ -270,7 +269,7 @@ fun PreviewInterestsScreen() {
270269
@Preview("Interests screen dark theme")
271270
@Composable
272271
fun PreviewInterestsScreenDark() {
273-
ThemedPreview(darkThemeColors) {
272+
ThemedPreview(darkTheme = true) {
274273
InterestsScreen(
275274
scaffoldState = ScaffoldState(drawerState = DrawerState.Opened),
276275
interestsRepository = FakeInterestsRepository()
@@ -292,7 +291,7 @@ private fun PreviewDrawerOpen() {
292291
@Preview("Interests screen drawer open dark theme")
293292
@Composable
294293
private fun PreviewDrawerOpenDark() {
295-
ThemedPreview(darkThemeColors) {
294+
ThemedPreview(darkTheme = true) {
296295
InterestsScreen(
297296
scaffoldState = ScaffoldState(drawerState = DrawerState.Opened),
298297
interestsRepository = FakeInterestsRepository()
@@ -311,7 +310,7 @@ fun PreviewTopicsTab() {
311310
@Preview("Interests screen topics tab dark theme")
312311
@Composable
313312
fun PreviewTopicsTabDark() {
314-
ThemedPreview(darkThemeColors) {
313+
ThemedPreview(darkTheme = true) {
315314
TopicsTab(loadFakeTopics())
316315
}
317316
}
@@ -332,7 +331,7 @@ fun PreviewPeopleTab() {
332331
@Preview("Interests screen people tab dark theme")
333332
@Composable
334333
fun PreviewPeopleTabDark() {
335-
ThemedPreview(darkThemeColors) {
334+
ThemedPreview(darkTheme = true) {
336335
PeopleTab(loadFakePeople())
337336
}
338337
}
@@ -353,7 +352,7 @@ fun PreviewPublicationsTab() {
353352
@Preview("Interests screen publications tab dark theme")
354353
@Composable
355354
fun PreviewPublicationsTabDark() {
356-
ThemedPreview(darkThemeColors) {
355+
ThemedPreview(darkTheme = true) {
357356
PublicationsTab(loadFakePublications())
358357
}
359358
}
@@ -374,7 +373,7 @@ fun PreviewTabWithTopics() {
374373
@Preview("Interests screen tab with topics dark theme")
375374
@Composable
376375
fun PreviewTabWithTopicsDark() {
377-
ThemedPreview {
376+
ThemedPreview(darkTheme = true) {
378377
TabWithTopics(tabName = "preview", topics = listOf("Hello", "Compose"))
379378
}
380379
}

‎JetNews/app/src/main/java/com/example/jetnews/ui/interests/SelectTopicButton.kt

+31-40
Original file line numberDiff line numberDiff line change
@@ -17,96 +17,87 @@
1717
package com.example.jetnews.ui.interests
1818

1919
import androidx.compose.Composable
20+
import androidx.compose.Pivotal
2021
import androidx.ui.core.Modifier
21-
import androidx.ui.foundation.Box
2222
import androidx.ui.foundation.Icon
2323
import androidx.ui.foundation.shape.corner.CircleShape
2424
import androidx.ui.layout.padding
2525
import androidx.ui.layout.preferredSize
26-
import androidx.ui.material.ColorPalette
26+
import androidx.ui.material.EmphasisAmbient
2727
import androidx.ui.material.MaterialTheme
28-
import androidx.ui.res.vectorResource
28+
import androidx.ui.material.ProvideEmphasis
29+
import androidx.ui.material.Surface
30+
import androidx.ui.material.icons.Icons
31+
import androidx.ui.material.icons.filled.Add
32+
import androidx.ui.material.icons.filled.Done
2933
import androidx.ui.tooling.preview.Preview
3034
import androidx.ui.unit.dp
31-
import com.example.jetnews.R
3235
import com.example.jetnews.ui.ThemedPreview
33-
import com.example.jetnews.ui.darkThemeColors
34-
import com.example.jetnews.ui.lightThemeColors
3536

3637
@Composable
3738
fun SelectTopicButton(
3839
modifier: Modifier = Modifier,
39-
selected: Boolean = false
40+
@Pivotal selected: Boolean = false
4041
) {
41-
if (selected) {
42-
SelectTopicButtonOn(modifier.preferredSize(36.dp, 36.dp))
42+
val icon = if (selected) Icons.Filled.Done else Icons.Filled.Add
43+
val backgroundColor = if (selected) {
44+
MaterialTheme.colors.primary
4345
} else {
44-
SelectTopicButtonOff(modifier.preferredSize(36.dp, 36.dp))
46+
MaterialTheme.colors.onSurface.copy(alpha = 0.12f)
4547
}
46-
}
47-
48-
@Composable
49-
private fun SelectTopicButtonOn(modifier: Modifier = Modifier) {
50-
Box(
51-
backgroundColor = MaterialTheme.colors.primary,
52-
shape = CircleShape,
53-
modifier = modifier
54-
) {
55-
Icon(vectorResource(R.drawable.ic_check))
56-
}
57-
}
58-
59-
@Composable
60-
private fun SelectTopicButtonOff(modifier: Modifier = Modifier) {
61-
val borderColor = MaterialTheme.colors.onSurface.copy(alpha = 0.12f)
62-
Box(
63-
backgroundColor = borderColor,
48+
Surface(
49+
color = backgroundColor,
6450
shape = CircleShape,
65-
modifier = modifier
51+
modifier = modifier.preferredSize(36.dp, 36.dp)
6652
) {
67-
Icon(vectorResource(R.drawable.ic_add))
53+
ProvideEmphasis(EmphasisAmbient.current.high) {
54+
Icon(icon)
55+
}
6856
}
6957
}
7058

7159
@Preview("Off")
7260
@Composable
7361
fun SelectTopicButtonPreviewOff() {
7462
SelectTopicButtonPreviewTemplate(
75-
lightThemeColors,
76-
false
63+
darkTheme = false,
64+
selected = false
7765
)
7866
}
7967

8068
@Preview("On")
8169
@Composable
8270
fun SelectTopicButtonPreviewOn() {
8371
SelectTopicButtonPreviewTemplate(
84-
lightThemeColors,
85-
true
72+
darkTheme = false,
73+
selected = true
8674
)
8775
}
8876

8977
@Preview("Off - dark theme")
9078
@Composable
9179
fun SelectTopicButtonPreviewOffDark() {
9280
SelectTopicButtonPreviewTemplate(
93-
darkThemeColors,
94-
false
81+
darkTheme = true,
82+
selected = false
9583
)
9684
}
9785

9886
@Preview("On - dark theme")
9987
@Composable
10088
fun SelectTopicButtonPreviewOnDark() {
10189
SelectTopicButtonPreviewTemplate(
102-
darkThemeColors,
103-
true
90+
darkTheme = true,
91+
selected = true
10492
)
10593
}
10694

10795
@Composable
108-
private fun SelectTopicButtonPreviewTemplate(themeColors: ColorPalette, selected: Boolean) {
109-
ThemedPreview(themeColors) {
96+
private fun SelectTopicButtonPreviewTemplate(
97+
darkTheme: Boolean = false,
98+
selected: Boolean
99+
) {
100+
ThemedPreview(darkTheme) {
110101
SelectTopicButton(
111102
modifier = Modifier.padding(32.dp),
112103
selected = selected
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2019 Google, Inc.
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.jetnews.ui.theme
18+
19+
import androidx.ui.graphics.Color
20+
21+
val Red200 = Color(0xfff297a2)
22+
val Red300 = Color(0xffea6d7e)
23+
val Red700 = Color(0xffdd0d3c)
24+
val Red800 = Color(0xffd00036)
25+
val Red900 = Color(0xffc20029)
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.jetnews.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(8.dp),
26+
large = RoundedCornerShape(16.dp)
27+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright 2019 Google, Inc.
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.jetnews.ui.theme
18+
19+
import androidx.compose.Composable
20+
import androidx.ui.foundation.isSystemInDarkTheme
21+
import androidx.ui.graphics.Color
22+
import androidx.ui.material.MaterialTheme
23+
import androidx.ui.material.darkColorPalette
24+
import androidx.ui.material.lightColorPalette
25+
26+
private val LightThemeColors = lightColorPalette(
27+
primary = Red700,
28+
primaryVariant = Red900,
29+
onPrimary = Color.White,
30+
secondary = Red700,
31+
secondaryVariant = Red900,
32+
onSecondary = Color.White,
33+
error = Red800
34+
)
35+
36+
private val DarkThemeColors = darkColorPalette(
37+
primary = Red300,
38+
primaryVariant = Red700,
39+
onPrimary = Color.Black,
40+
secondary = Red300,
41+
onSecondary = Color.White,
42+
error = Red200
43+
)
44+
45+
@Composable
46+
fun JetnewsTheme(
47+
darkTheme: Boolean = isSystemInDarkTheme(),
48+
content: @Composable() () -> Unit
49+
) {
50+
MaterialTheme(
51+
colors = if (darkTheme) DarkThemeColors else LightThemeColors,
52+
typography = themeTypography,
53+
shapes = shapes,
54+
content = content
55+
)
56+
}

‎JetNews/app/src/main/java/com/example/jetnews/ui/Typography.kt renamed to ‎JetNews/app/src/main/java/com/example/jetnews/ui/theme/Type.kt

+12-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.example.jetnews.ui
17+
package com.example.jetnews.ui.theme
1818

1919
import androidx.ui.material.Typography
2020
import androidx.ui.text.TextStyle
@@ -24,13 +24,19 @@ import androidx.ui.text.font.fontFamily
2424
import androidx.ui.unit.sp
2525
import com.example.jetnews.R
2626

27-
val regular = font(R.font.montserrat_regular)
28-
val medium = font(R.font.montserrat_medium, FontWeight.W500)
29-
val semibold = font(R.font.montserrat_semibold, FontWeight.W600)
27+
private val regular = font(R.font.montserrat_regular)
28+
private val medium = font(R.font.montserrat_medium, FontWeight.W500)
29+
private val semibold = font(R.font.montserrat_semibold, FontWeight.W600)
3030

31-
val appFontFamily = fontFamily(fonts = listOf(regular, medium, semibold))
31+
private val appFontFamily = fontFamily(
32+
fonts = listOf(
33+
regular,
34+
medium,
35+
semibold
36+
)
37+
)
3238

33-
val bodyFontFamily = fontFamily(
39+
private val bodyFontFamily = fontFamily(
3440
fonts = listOf(
3541
font(R.font.domine_regular),
3642
font(R.font.domine_bold, FontWeight.Bold)

‎JetNews/app/src/main/res/drawable/ic_check.xml

-25
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<!--
2-
~ Copyright 2019 Google LLC
3+
~ Copyright 2020 Google LLC
34
~
45
~ Licensed under the Apache License, Version 2.0 (the "License");
56
~ you may not use this file except in compliance with the License.
@@ -14,12 +15,7 @@
1415
~ limitations under the License.
1516
~
1617
-->
17-
<vector xmlns:android="http://schemas.android.com/apk/res/android"
18-
android:width="36dp"
19-
android:height="36dp"
20-
android:viewportWidth="36"
21-
android:viewportHeight="36">
22-
<path
23-
android:pathData="M19,11L19,17L25,17L25,19L19,19L19,25L17,25L17,19L11,19L11,17L17,17L17,11L19,11Z"
24-
android:fillColor="@color/colorPrimary"/>
25-
</vector>
18+
19+
<resources>
20+
<color name="status_bar">#0e0e0e</color>
21+
</resources>

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
-->
1818

1919
<resources>
20-
<color name="colorPrimary">#DD0D3E</color>
21-
<color name="colorPrimaryDark">#C20029</color>
22-
<color name="colorAccent">#DD0D3E</color>
20+
<color name="red700">#dd0d3e</color>
21+
<color name="red900">#c20029</color>
22+
<color name="status_bar">@color/red900</color>
2323
</resources>

‎JetNews/app/src/main/res/values/styles.xml

+5-4
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919

2020
<!-- Base application theme. In this Jetpack Compose sample app, these colors
2121
don't affect the Composable functions, just the color of the Status Bar.
22-
For the colors used by the Composable functions, see Themes.kt -->
22+
For the colors used by the Composable functions, see Theme.kt -->
2323
<style name="Theme.Jetnews" parent="Theme.AppCompat.Light.NoActionBar">
24-
<item name="colorPrimary">@color/colorPrimary</item>
25-
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
26-
<item name="colorAccent">@color/colorAccent</item>
24+
<item name="colorPrimary">@color/red700</item>
25+
<item name="colorPrimaryDark">@color/red900</item>
26+
<item name="colorAccent">@color/red700</item>
27+
<item name="android:statusBarColor">@color/status_bar</item>
2728
</style>
2829

2930
</resources>
216 Bytes
Binary file not shown.

‎JetNews/gradlew

+2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ esac
8282

8383
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
8484

85+
8586
# Determine the Java command to use to start the JVM.
8687
if [ -n "$JAVA_HOME" ] ; then
8788
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -129,6 +130,7 @@ fi
129130
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133+
132134
JAVACMD=`cygpath --unix "$JAVACMD"`
133135

134136
# We build the pattern for arguments to be converted via cygpath

‎JetNews/gradlew.bat

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ set CMD_LINE_ARGS=%*
8484

8585
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
8686

87+
8788
@rem Execute Gradle
8889
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
8990

0 commit comments

Comments
 (0)
Please sign in to comment.