-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add back old AppCompat Theme artifact with deprecation
- Loading branch information
Nick Rout
committed
Nov 28, 2022
1 parent
539bead
commit 98e8c81
Showing
32 changed files
with
1,533 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
.github/ISSUE_TEMPLATE/appcompat-theme-adapter-bug-report.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# AppCompat Compose Theme Adapter | ||
|
||
[![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 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 | ||
|
||
```groovy | ||
repositories { | ||
mavenCentral() | ||
} | ||
dependencies { | ||
implementation "com.google.accompanist:accompanist-appcompat-theme:<version>" | ||
} | ||
``` | ||
|
||
Snapshots of the development version are available in Sonatype's `snapshots` [repository][snap]. These are updated on every commit. | ||
|
||
[snap]: https://oss.sonatype.org/content/repositories/snapshots/com/google/accompanist/accompanist-appcompat-theme/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Signature format: 4.0 | ||
package com.google.accompanist.appcompattheme { | ||
|
||
public final class AppCompatTheme { | ||
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 { | ||
} | ||
|
||
@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; | ||
} | ||
|
||
public final class TypedArrayUtilsKt { | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* | ||
* Copyright 2020 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
plugins { | ||
id 'com.android.library' | ||
id 'kotlin-android' | ||
id 'org.jetbrains.dokka' | ||
} | ||
|
||
kotlin { | ||
explicitApi() | ||
} | ||
|
||
android { | ||
compileSdkVersion 33 | ||
|
||
defaultConfig { | ||
minSdkVersion 21 | ||
// targetSdkVersion has no effect for libraries. This is only used for the test APK | ||
targetSdkVersion 33 | ||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
|
||
buildFeatures { | ||
compose true | ||
buildConfig false | ||
} | ||
|
||
composeOptions { | ||
kotlinCompilerExtensionVersion libs.versions.composeCompiler.get() | ||
} | ||
|
||
lintOptions { | ||
textReport true | ||
textOutput 'stdout' | ||
// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks | ||
checkReleaseBuilds false | ||
} | ||
|
||
packagingOptions { | ||
// Multiple dependencies bring these files in. Exclude them to enable | ||
// our test APK to build (has no effect on our AARs) | ||
excludes += "/META-INF/AL2.0" | ||
excludes += "/META-INF/LGPL2.1" | ||
} | ||
|
||
testOptions { | ||
unitTests { | ||
includeAndroidResources = true | ||
} | ||
animationsDisabled true | ||
} | ||
|
||
sourceSets { | ||
test { | ||
java.srcDirs += 'src/sharedTest/kotlin' | ||
res.srcDirs += 'src/sharedTest/res' | ||
} | ||
androidTest { | ||
java.srcDirs += 'src/sharedTest/kotlin' | ||
res.srcDirs += 'src/sharedTest/res' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation libs.androidx.core | ||
implementation libs.compose.material.material | ||
implementation libs.kotlin.coroutines.android | ||
|
||
api libs.androidx.appcompat | ||
|
||
// ====================== | ||
// Test dependencies | ||
// ====================== | ||
|
||
androidTestImplementation project(':internal-testutils') | ||
testImplementation project(':internal-testutils') | ||
|
||
androidTestImplementation libs.junit | ||
testImplementation libs.junit | ||
|
||
androidTestImplementation libs.compose.ui.test.junit4 | ||
testImplementation libs.compose.ui.test.junit4 | ||
|
||
androidTestImplementation libs.androidx.test.runner | ||
testImplementation libs.androidx.test.runner | ||
|
||
androidTestImplementation libs.androidx.test.espressoCore | ||
testImplementation libs.androidx.test.espressoCore | ||
|
||
testImplementation libs.robolectric | ||
} | ||
|
||
apply plugin: 'com.vanniktech.maven.publish' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# Copyright 2020 The Android Open Source Project | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
POM_ARTIFACT_ID=accompanist-appcompat-theme | ||
POM_NAME=AppCompat Theme Adapter for Compose | ||
POM_PACKAGING=aar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!-- | ||
~ Copyright 2020 The Android Open Source Project | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ https://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.google.accompanist.appcompattheme"> | ||
|
||
<application> | ||
<activity | ||
android:name=".LightAppCompatActivity" | ||
android:exported="true" | ||
android:theme="@style/Theme.AppCompatThemeTest" /> | ||
|
||
<activity | ||
android:name=".DarkAppCompatActivity" | ||
android:exported="true" | ||
android:theme="@style/Theme.AppCompatThemeTest" /> | ||
|
||
<activity | ||
android:name=".NotAppCompatActivity" | ||
android:exported="true" | ||
android:theme="@android:style/Theme.Material" /> | ||
</application> | ||
|
||
</manifest> |
65 changes: 65 additions & 0 deletions
65
...ndroidTest/kotlin/com/google/accompanist/appcompattheme/InstrumentedAppCompatThemeTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright 2021 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
@file:Suppress("DEPRECATION") | ||
|
||
package com.google.accompanist.appcompattheme | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.ui.text.font.Font | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.text.font.toFontFamily | ||
import androidx.test.filters.SdkSuppress | ||
import com.google.accompanist.appcompattheme.test.R | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.runners.Parameterized | ||
|
||
/** | ||
* Version of [BaseAppCompatThemeTest] which is designed to be run on device/emulators. | ||
*/ | ||
@RunWith(Parameterized::class) | ||
class InstrumentedAppCompatThemeTest<T : AppCompatActivity>( | ||
activityClass: Class<T> | ||
) : BaseAppCompatThemeTest<T>(activityClass) { | ||
companion object { | ||
@JvmStatic | ||
@Parameterized.Parameters | ||
fun activities() = listOf( | ||
DarkAppCompatActivity::class.java, | ||
LightAppCompatActivity::class.java | ||
) | ||
} | ||
|
||
/** | ||
* On API 21-22, the family is loaded with only the 400 font. | ||
* | ||
* This only works on device as Robolectric seems to always use the behavior from API 23+, | ||
* which is not what we want to test. | ||
*/ | ||
@Test | ||
@SdkSuppress(maxSdkVersion = 22) | ||
fun type_rubik_family_api21() = composeTestRule.setContent { | ||
val rubik = Font(R.font.rubik, FontWeight.W400).toFontFamily() | ||
|
||
WithThemeOverlay(R.style.ThemeOverlay_RubikFontFamily) { | ||
AppCompatTheme { | ||
MaterialTheme.typography.assertFontFamily(expected = rubik) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!-- | ||
~ Copyright 2020 The Android Open Source Project | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ https://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<manifest package="com.google.accompanist.appcompattheme"> | ||
</manifest> |
Oops, something went wrong.