Skip to content

Commit 98fc70a

Browse files
authored
Merge pull request #1410 from ricknout/main
[Theme Adapter] Migrate all theme adapter libraries to Accompanist
2 parents d159194 + 98e8c81 commit 98fc70a

File tree

124 files changed

+6566
-31
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+6566
-31
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
name: AppCompat Theme Adapter bug report
3+
about: Create a report to help us improve
4+
title: "[AppCompat Theme Adapter]"
5+
labels: ''
6+
assignees: ricknout
7+
8+
---
9+
10+
**Description**
11+
12+
**Steps to reproduce**
13+
14+
**Expected behavior**
15+
16+
**Additional context**
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
name: Core Theme Adapter bug report
3+
about: Create a report to help us improve
4+
title: "[Core Theme Adapter]"
5+
labels: ''
6+
assignees: ricknout
7+
8+
---
9+
10+
**Description**
11+
12+
**Steps to reproduce**
13+
14+
**Expected behavior**
15+
16+
**Additional context**
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
name: Material Theme Adapter bug report
3+
about: Create a report to help us improve
4+
title: "[Material Theme Adapter]"
5+
labels: ''
6+
assignees: ricknout
7+
8+
---
9+
10+
**Description**
11+
12+
**Steps to reproduce**
13+
14+
**Expected behavior**
15+
16+
**Additional context**
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
name: Material 3 Theme Adapter bug report
3+
about: Create a report to help us improve
4+
title: "[Material 3 Theme Adapter]"
5+
labels: ''
6+
assignees: ricknout
7+
8+
---
9+
10+
**Description**
11+
12+
**Steps to reproduce**
13+
14+
**Expected behavior**
15+
16+
**Additional context**

ASSETS_LICENSE.txt

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
All font files are licensed under the SIL OPEN FONT LICENSE license. All other files are licensed under the Apache 2 license.
2+
3+
4+
SIL OPEN FONT LICENSE
5+
Version 1.1 - 26 February 2007
6+
7+
PREAMBLE
8+
The goals of the Open Font License (OFL) are to stimulate worldwide
9+
development of collaborative font projects, to support the font creation
10+
efforts of academic and linguistic communities, and to provide a free and
11+
open framework in which fonts may be shared and improved in partnership
12+
with others.
13+
14+
The OFL allows the licensed fonts to be used, studied, modified and
15+
redistributed freely as long as they are not sold by themselves. The
16+
fonts, including any derivative works, can be bundled, embedded,
17+
redistributed and/or sold with any software provided that any reserved
18+
names are not used by derivative works. The fonts and derivatives,
19+
however, cannot be released under any other type of license. The
20+
requirement for fonts to remain under this license does not apply
21+
to any document created using the fonts or their derivatives.
22+
23+
DEFINITIONS
24+
"Font Software" refers to the set of files released by the Copyright
25+
Holder(s) under this license and clearly marked as such. This may
26+
include source files, build scripts and documentation.
27+
28+
"Reserved Font Name" refers to any names specified as such after the
29+
copyright statement(s).
30+
31+
"Original Version" refers to the collection of Font Software components as
32+
distributed by the Copyright Holder(s).
33+
34+
"Modified Version" refers to any derivative made by adding to, deleting,
35+
or substituting — in part or in whole — any of the components of the
36+
Original Version, by changing formats or by porting the Font Software to a
37+
new environment.
38+
39+
"Author" refers to any designer, engineer, programmer, technical
40+
writer or other person who contributed to the Font Software.
41+
42+
PERMISSION & CONDITIONS
43+
Permission is hereby granted, free of charge, to any person obtaining
44+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
45+
redistribute, and sell modified and unmodified copies of the Font
46+
Software, subject to the following conditions:
47+
48+
1) Neither the Font Software nor any of its individual components,
49+
in Original or Modified Versions, may be sold by itself.
50+
51+
2) Original or Modified Versions of the Font Software may be bundled,
52+
redistributed and/or sold with any software, provided that each copy
53+
contains the above copyright notice and this license. These can be
54+
included either as stand-alone text files, human-readable headers or
55+
in the appropriate machine-readable metadata fields within text or
56+
binary files as long as those fields can be easily viewed by the user.
57+
58+
3) No Modified Version of the Font Software may use the Reserved Font
59+
Name(s) unless explicit written permission is granted by the corresponding
60+
Copyright Holder. This restriction only applies to the primary font name as
61+
presented to the users.
62+
63+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
64+
Software shall not be used to promote, endorse or advertise any
65+
Modified Version, except to acknowledge the contribution(s) of the
66+
Copyright Holder(s) and the Author(s) or with their explicit written
67+
permission.
68+
69+
5) The Font Software, modified or unmodified, in part or in whole,
70+
must be distributed entirely under this license, and must not be
71+
distributed under any other license. The requirement for fonts to
72+
remain under this license does not apply to any document created
73+
using the Font Software.
74+
75+
TERMINATION
76+
This license becomes null and void if any of the above conditions are
77+
not met.
78+
79+
DISCLAIMER
80+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
81+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
82+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
83+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
84+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
85+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
86+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
87+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
88+
OTHER DEALINGS IN THE FONT SOFTWARE.

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ For stable versions of Compose, we use the latest *stable* version of the Compos
3434
### 🍫 [System UI Controller](./systemuicontroller/)
3535
A library that provides easy-to-use utilities for recoloring the Android system bars from Jetpack Compose.
3636

37-
### 🎨 [AppCompat Theme Adapter](./appcompat-theme/)
38-
A library that enables the reuse of [AppCompat][appcompat] XML themes for theming in Jetpack Compose.
37+
### 🎨 [AppCompat Theme Adapter](./themeadapter-appcompat/)
38+
A library that enables the reuse of [AppCompat][appcompat] XML themes, for theming in Jetpack Compose.
39+
40+
### 🎨 [Material Theme Adapter](./themeadapter-material/)
41+
A library that enables the reuse of [MDC-Android][mdc] Material 2 XML themes, for theming in Jetpack Compose.
42+
43+
### 🎨 [Material 3 Theme Adapter](./themeadapter-material3/)
44+
A library that enables the reuse of [MDC-Android][mdc] Material 3 XML themes, for theming in Jetpack Compose.
3945

4046
### 📖 [Pager](./pager/)
4147
A library that provides utilities for building paginated layouts in Jetpack Compose, similar to Android's [ViewPager][viewpager].
@@ -73,6 +79,9 @@ See our [Migration Guide](https://google.github.io/accompanist/insets/) for migr
7379
### ⬇️ [Swipe to Refresh](./swiperefresh/) (Deprecated)
7480
See our [Migration Guide](https://google.github.io/accompanist/swiperefresh/) for migrating to PullRefresh in Compose Material.
7581

82+
### 🎨 [AppCompat Theme Adapter](./appcompat-theme/) (Deprecated)
83+
See our [Migration Guide](https://google.github.io/accompanist/appcompat-theme/) for migrating to the new artifact in Accompanist.
84+
7685
---
7786

7887
## Future?
@@ -118,7 +127,7 @@ limitations under the License.
118127
[appcompat]: https://developer.android.com/jetpack/androidx/releases/appcompat
119128
[compose]: https://developer.android.com/jetpack/compose
120129
[snap]: https://oss.sonatype.org/content/repositories/snapshots/com/google/accompanist/
121-
[mdc]: https://material.io/develop/android/
130+
[mdc]: https://github.com/material-components/material-components-android
122131
[windowinsets]: https://developer.android.com/reference/kotlin/android/view/WindowInsets
123132
[viewpager]: https://developer.android.com/reference/kotlin/androidx/viewpager/widget/ViewPager
124133
[runtimepermissions]: https://developer.android.com/guide/topics/permissions/overview

appcompat-theme/README.md

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,7 @@
22

33
[![Maven Central](https://img.shields.io/maven-central/v/com.google.accompanist/accompanist-appcompat-theme)](https://search.maven.org/search?q=g:com.google.accompanist)
44

5-
AppCompat Compose Theme Adapter enables reuse of [AppCompat][appcompat] XML themes, for theming in [Jetpack Compose][compose].
6-
7-
## Usage
8-
This library attempts to bridge the gap between [AppCompat][appcompat] XML themes, and themes in [Jetpack Compose][compose],
9-
allowing your composable [`MaterialTheme`][materialtheme] to be based on the `Activity`'s XML theme:
10-
11-
``` kotlin
12-
AppCompatTheme {
13-
// MaterialTheme.colors, MaterialTheme.shapes, MaterialTheme.typography
14-
// will now contain copies of the context's theme
15-
}
16-
```
17-
18-
For more information, visit the documentation: https://google.github.io/accompanist/appcompat-theme
5+
> :warning: This library has been deprecated in favor of the new `themeadapter-appcompat` artifact. Please see our [Migration Guide](https://google.github.io/accompanist/appcompat-theme/) for how to migrate.
196
207
## Download
218

@@ -31,7 +18,4 @@ dependencies {
3118

3219
Snapshots of the development version are available in Sonatype's `snapshots` [repository][snap]. These are updated on every commit.
3320

34-
[appcompat]: https://developer.android.com/jetpack/androidx/releases/appcompat
35-
[compose]: https://developer.android.com/jetpack/compose
36-
[appcompat]: https://developer.android.com/jetpack/androidx/releases/appcompat
3721
[snap]: https://oss.sonatype.org/content/repositories/snapshots/com/google/accompanist/accompanist-appcompat-theme/

appcompat-theme/api/current.api

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
package com.google.accompanist.appcompattheme {
33

44
public final class AppCompatTheme {
5-
method @androidx.compose.runtime.Composable public static void AppCompatTheme(optional android.content.Context context, optional boolean readColors, optional boolean readTypography, optional androidx.compose.material.Shapes shapes, kotlin.jvm.functions.Function0<kotlin.Unit> content);
6-
method public static com.google.accompanist.appcompattheme.ThemeParameters createAppCompatTheme(android.content.Context, optional boolean readColors, optional boolean readTypography);
5+
method @Deprecated @androidx.compose.runtime.Composable public static void AppCompatTheme(optional android.content.Context context, optional boolean readColors, optional boolean readTypography, optional androidx.compose.material.Shapes shapes, kotlin.jvm.functions.Function0<kotlin.Unit> content);
6+
method @Deprecated public static com.google.accompanist.appcompattheme.ThemeParameters createAppCompatTheme(android.content.Context, optional boolean readColors, optional boolean readTypography);
77
}
88

99
public final class ColorKt {
1010
}
1111

12-
public final class ThemeParameters {
13-
ctor public ThemeParameters(androidx.compose.material.Colors? colors, androidx.compose.material.Typography? typography);
14-
method public androidx.compose.material.Colors? component1();
15-
method public androidx.compose.material.Typography? component2();
16-
method public com.google.accompanist.appcompattheme.ThemeParameters copy(androidx.compose.material.Colors? colors, androidx.compose.material.Typography? typography);
17-
method public androidx.compose.material.Colors? getColors();
18-
method public androidx.compose.material.Typography? getTypography();
12+
@Deprecated public final class ThemeParameters {
13+
ctor @Deprecated public ThemeParameters(androidx.compose.material.Colors? colors, androidx.compose.material.Typography? typography);
14+
method @Deprecated public androidx.compose.material.Colors? component1();
15+
method @Deprecated public androidx.compose.material.Typography? component2();
16+
method @Deprecated public com.google.accompanist.appcompattheme.ThemeParameters copy(androidx.compose.material.Colors? colors, androidx.compose.material.Typography? typography);
17+
method @Deprecated public androidx.compose.material.Colors? getColors();
18+
method @Deprecated public androidx.compose.material.Typography? getTypography();
1919
property public final androidx.compose.material.Colors? colors;
2020
property public final androidx.compose.material.Typography? typography;
2121
}

appcompat-theme/src/androidTest/kotlin/com/google/accompanist/appcompattheme/InstrumentedAppCompatThemeTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17+
@file:Suppress("DEPRECATION")
18+
1719
package com.google.accompanist.appcompattheme
1820

1921
import androidx.appcompat.app.AppCompatActivity

appcompat-theme/src/main/java/com/google/accompanist/appcompattheme/AppCompatTheme.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
@file:JvmName("AppCompatTheme")
18+
@file:Suppress("DEPRECATION")
1819

1920
package com.google.accompanist.appcompattheme
2021

@@ -96,6 +97,13 @@ import androidx.core.content.res.use
9697
* @param readTypography whether to read the font family from [context]'s theme.
9798
* @param shapes A set of shapes to be used by the components in this hierarchy.
9899
*/
100+
@Deprecated(
101+
"""
102+
accompanist/appcompat-theme is deprecated.
103+
The API has moved to accompanist/themeadapter/appcompat.
104+
For more migration information, please visit https://google.github.io/accompanist/appcompat-theme/#migration
105+
"""
106+
)
99107
@Composable
100108
fun AppCompatTheme(
101109
context: Context = LocalContext.current,
@@ -129,6 +137,13 @@ fun AppCompatTheme(
129137
* This class contains some of the individual components of a [MaterialTheme]:
130138
* [Colors] & [Typography].
131139
*/
140+
@Deprecated(
141+
"""
142+
accompanist/appcompat-theme is deprecated.
143+
The API has moved to accompanist/themeadapter/appcompat.
144+
For more migration information, please visit https://google.github.io/accompanist/appcompat-theme/#migration
145+
"""
146+
)
132147
data class ThemeParameters(
133148
val colors: Colors?,
134149
val typography: Typography?
@@ -148,6 +163,13 @@ data class ThemeParameters(
148163
*
149164
* @return [ThemeParameters] instance containing the resulting [Colors] and [Typography]
150165
*/
166+
@Deprecated(
167+
"""
168+
accompanist/appcompat-theme is deprecated.
169+
The API has moved to accompanist/themeadapter/appcompat.
170+
For more migration information, please visit https://google.github.io/accompanist/appcompat-theme/#migration
171+
"""
172+
)
151173
fun Context.createAppCompatTheme(
152174
readColors: Boolean = true,
153175
readTypography: Boolean = true

0 commit comments

Comments
 (0)