Skip to content

Commit

Permalink
Merge pull request #1410 from ricknout/main
Browse files Browse the repository at this point in the history
[Theme Adapter] Migrate all theme adapter libraries to Accompanist
  • Loading branch information
bentrengrove committed Nov 29, 2022
2 parents d159194 + 98e8c81 commit 98fc70a
Show file tree
Hide file tree
Showing 124 changed files with 6,566 additions and 31 deletions.
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/theme-adapter-appcompat-bug-report.md
@@ -0,0 +1,16 @@
---
name: AppCompat Theme Adapter bug report
about: Create a report to help us improve
title: "[AppCompat Theme Adapter]"
labels: ''
assignees: ricknout

---

**Description**

**Steps to reproduce**

**Expected behavior**

**Additional context**
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/theme-adapter-core-bug-report .md
@@ -0,0 +1,16 @@
---
name: Core Theme Adapter bug report
about: Create a report to help us improve
title: "[Core Theme Adapter]"
labels: ''
assignees: ricknout

---

**Description**

**Steps to reproduce**

**Expected behavior**

**Additional context**
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/theme-adapter-material-bug-report.md
@@ -0,0 +1,16 @@
---
name: Material Theme Adapter bug report
about: Create a report to help us improve
title: "[Material Theme Adapter]"
labels: ''
assignees: ricknout

---

**Description**

**Steps to reproduce**

**Expected behavior**

**Additional context**
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/theme-adapter-material3-bug-report.md
@@ -0,0 +1,16 @@
---
name: Material 3 Theme Adapter bug report
about: Create a report to help us improve
title: "[Material 3 Theme Adapter]"
labels: ''
assignees: ricknout

---

**Description**

**Steps to reproduce**

**Expected behavior**

**Additional context**
88 changes: 88 additions & 0 deletions ASSETS_LICENSE.txt
@@ -0,0 +1,88 @@
All font files are licensed under the SIL OPEN FONT LICENSE license. All other files are licensed under the Apache 2 license.


SIL OPEN FONT LICENSE
Version 1.1 - 26 February 2007

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting — in part or in whole — any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
15 changes: 12 additions & 3 deletions README.md
Expand Up @@ -34,8 +34,14 @@ For stable versions of Compose, we use the latest *stable* version of the Compos
### 🍫 [System UI Controller](./systemuicontroller/)
A library that provides easy-to-use utilities for recoloring the Android system bars from Jetpack Compose.

### 🎨 [AppCompat Theme Adapter](./appcompat-theme/)
A library that enables the reuse of [AppCompat][appcompat] XML themes for theming in Jetpack Compose.
### 🎨 [AppCompat Theme Adapter](./themeadapter-appcompat/)
A library that enables the reuse of [AppCompat][appcompat] XML themes, for theming in Jetpack Compose.

### 🎨 [Material Theme Adapter](./themeadapter-material/)
A library that enables the reuse of [MDC-Android][mdc] Material 2 XML themes, for theming in Jetpack Compose.

### 🎨 [Material 3 Theme Adapter](./themeadapter-material3/)
A library that enables the reuse of [MDC-Android][mdc] Material 3 XML themes, for theming in Jetpack Compose.

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

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

---

## Future?
Expand Down Expand Up @@ -118,7 +127,7 @@ limitations under the License.
[appcompat]: https://developer.android.com/jetpack/androidx/releases/appcompat
[compose]: https://developer.android.com/jetpack/compose
[snap]: https://oss.sonatype.org/content/repositories/snapshots/com/google/accompanist/
[mdc]: https://material.io/develop/android/
[mdc]: https://github.com/material-components/material-components-android
[windowinsets]: https://developer.android.com/reference/kotlin/android/view/WindowInsets
[viewpager]: https://developer.android.com/reference/kotlin/androidx/viewpager/widget/ViewPager
[runtimepermissions]: https://developer.android.com/guide/topics/permissions/overview
18 changes: 1 addition & 17 deletions appcompat-theme/README.md
Expand Up @@ -2,20 +2,7 @@

[![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)

AppCompat Compose Theme Adapter enables reuse of [AppCompat][appcompat] XML themes, for theming in [Jetpack Compose][compose].

## Usage
This library attempts to bridge the gap between [AppCompat][appcompat] XML themes, and themes in [Jetpack Compose][compose],
allowing your composable [`MaterialTheme`][materialtheme] to be based on the `Activity`'s XML theme:

``` kotlin
AppCompatTheme {
// MaterialTheme.colors, MaterialTheme.shapes, MaterialTheme.typography
// will now contain copies of the context's theme
}
```

For more information, visit the documentation: https://google.github.io/accompanist/appcompat-theme
> :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.
## Download

Expand All @@ -31,7 +18,4 @@ dependencies {

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

[appcompat]: https://developer.android.com/jetpack/androidx/releases/appcompat
[compose]: https://developer.android.com/jetpack/compose
[appcompat]: https://developer.android.com/jetpack/androidx/releases/appcompat
[snap]: https://oss.sonatype.org/content/repositories/snapshots/com/google/accompanist/accompanist-appcompat-theme/
18 changes: 9 additions & 9 deletions appcompat-theme/api/current.api
Expand Up @@ -2,20 +2,20 @@
package com.google.accompanist.appcompattheme {

public final class AppCompatTheme {
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);
method public static com.google.accompanist.appcompattheme.ThemeParameters createAppCompatTheme(android.content.Context, optional boolean readColors, optional boolean readTypography);
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);
method @Deprecated public static com.google.accompanist.appcompattheme.ThemeParameters createAppCompatTheme(android.content.Context, optional boolean readColors, optional boolean readTypography);
}

public final class ColorKt {
}

public final class ThemeParameters {
ctor public ThemeParameters(androidx.compose.material.Colors? colors, androidx.compose.material.Typography? typography);
method public androidx.compose.material.Colors? component1();
method public androidx.compose.material.Typography? component2();
method public com.google.accompanist.appcompattheme.ThemeParameters copy(androidx.compose.material.Colors? colors, androidx.compose.material.Typography? typography);
method public androidx.compose.material.Colors? getColors();
method public androidx.compose.material.Typography? getTypography();
@Deprecated public final class ThemeParameters {
ctor @Deprecated public ThemeParameters(androidx.compose.material.Colors? colors, androidx.compose.material.Typography? typography);
method @Deprecated public androidx.compose.material.Colors? component1();
method @Deprecated public androidx.compose.material.Typography? component2();
method @Deprecated public com.google.accompanist.appcompattheme.ThemeParameters copy(androidx.compose.material.Colors? colors, androidx.compose.material.Typography? typography);
method @Deprecated public androidx.compose.material.Colors? getColors();
method @Deprecated public androidx.compose.material.Typography? getTypography();
property public final androidx.compose.material.Colors? colors;
property public final androidx.compose.material.Typography? typography;
}
Expand Down
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

@file:Suppress("DEPRECATION")

package com.google.accompanist.appcompattheme

import androidx.appcompat.app.AppCompatActivity
Expand Down
Expand Up @@ -15,6 +15,7 @@
*/

@file:JvmName("AppCompatTheme")
@file:Suppress("DEPRECATION")

package com.google.accompanist.appcompattheme

Expand Down Expand Up @@ -96,6 +97,13 @@ import androidx.core.content.res.use
* @param readTypography whether to read the font family from [context]'s theme.
* @param shapes A set of shapes to be used by the components in this hierarchy.
*/
@Deprecated(
"""
accompanist/appcompat-theme is deprecated.
The API has moved to accompanist/themeadapter/appcompat.
For more migration information, please visit https://google.github.io/accompanist/appcompat-theme/#migration
"""
)
@Composable
fun AppCompatTheme(
context: Context = LocalContext.current,
Expand Down Expand Up @@ -129,6 +137,13 @@ fun AppCompatTheme(
* This class contains some of the individual components of a [MaterialTheme]:
* [Colors] & [Typography].
*/
@Deprecated(
"""
accompanist/appcompat-theme is deprecated.
The API has moved to accompanist/themeadapter/appcompat.
For more migration information, please visit https://google.github.io/accompanist/appcompat-theme/#migration
"""
)
data class ThemeParameters(
val colors: Colors?,
val typography: Typography?
Expand All @@ -148,6 +163,13 @@ data class ThemeParameters(
*
* @return [ThemeParameters] instance containing the resulting [Colors] and [Typography]
*/
@Deprecated(
"""
accompanist/appcompat-theme is deprecated.
The API has moved to accompanist/themeadapter/appcompat.
For more migration information, please visit https://google.github.io/accompanist/appcompat-theme/#migration
"""
)
fun Context.createAppCompatTheme(
readColors: Boolean = true,
readTypography: Boolean = true
Expand Down
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

@file:Suppress("DEPRECATION")

package com.google.accompanist.appcompattheme

import android.view.ContextThemeWrapper
Expand Down
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

@file:Suppress("DEPRECATION")

package com.google.accompanist.appcompattheme

import androidx.compose.ui.test.junit4.createAndroidComposeRule
Expand Down
17 changes: 17 additions & 0 deletions docs/appcompat-theme.md
Expand Up @@ -2,6 +2,21 @@

[![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)

!!! warning
**This library is deprecated in favor of the new [`themeadapter-appcompat`][themeadapterappcompatlib] artifact. The migration guide and original documentation is below.

## Migration

Accompanist AppCompat Theme Adapter has moved from the [`appcompat-theme`][appcompatthemelib] artifact to the [`themeadapter-appcompat`][themeadapterappcompatlib] artifact.
The implementation is identical but the dependency and import package have changed.

### Migration steps

1. Change the dependency from `com.google.accompanist:accompanist-appcompat-theme:<version>` to `com.google.accompanist:accompanist-themeadapter-appcompat:<version>`
2. Change any `com.google.accompanist.appcompattheme.*` imports to `com.google.accompanist.themeadapter.appcompat.*`

## Original Docs

A library that enables reuse of [AppCompat][appcompat] XML themes for theming in [Jetpack Compose][compose].

The basis of theming in [Jetpack Compose][compose] is the [`MaterialTheme`][materialtheme] composable, where you provide [`Colors`][colors], [`Shapes`][shapes] and [`Typography`][typography] instances containing your styling parameters:
Expand Down Expand Up @@ -167,6 +182,8 @@ See the License for the specific language governing permissions and
limitations under the License.
```

[appcompatthemelib]: ../appcompat-theme
[themeadapterappcompatlib]: ../themeadapter-appcompat
[compose]: https://developer.android.com/jetpack/compose
[appcompat]: https://developer.android.com/jetpack/androidx/releases/appcompat
[appcompattheme]: ../api/appcompat-theme/appcompat-theme/com.google.accompanist.appcompattheme/-app-compat-theme.html
Expand Down

0 comments on commit 98fc70a

Please sign in to comment.