Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 942be4e

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 596a0d4 + 8dd6617 commit 942be4e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,22 @@ ThemeColor.BLACK
8080

8181
### Using Themes
8282

83-
Any `Activity` you wish to be automatically themed must inherit from either `CActivity` or `CAppCompatActivity` if you wish to use AppCompat
83+
Any `Activity` you wish to be automatically themed must inherit from either `CActivity`, `CAppCompatActivity` if you wish to use AppCompat or `CMaterialActivity` if you wish to use the new Material Componets theme.
8484
```kotlin
8585
class MainActivity : CActivity()
8686
```
8787
```kotlin
8888
class MainActivity : CAppCompatActivity()
8989
```
90+
```kotlin
91+
class MainActivity : CMaterialActivity()
92+
```
9093
If you wish to use your own activity, you can manually apply Colorful's theme to any activity using `apply(activity:Activity)`
9194
```kotlin
92-
Colorful().apply(this, override = true, appcompat = false)
95+
Colorful().apply(this, override = true, baseTheme = BaseTheme.THEME_MATERIAL)
9396
```
9497
The `override` value will control whether Colorful overrides your activitie's existing base theme, or merely sets primary and accent colors. **Note**: dark/light themeing will not work when override is disabled
95-
The `appcompat` value will control which base theme Colorful will use, Appcompat or Material
96-
*Note*: The override value is optional and may be omitted. Default value is true.
98+
The `baseTheme` value will control which base theme Colorful will use, Appcompat, Material, or Material Componets.
9799

98100
Alternatively, as of Colorful 2.1, you can now have your activity inherit from the interface `CThemeInterface` which will provide the `handleOnCreate` and `handleOnResume` methods for automatic theme handling.
99101
See both [CActivity](https://github.com/garretyoder/Colorful/blob/master/library/src/main/java/io/multimoon/colorful/CActivity.kt) and [CAppCompatActivity](https://github.com/garretyoder/Colorful/blob/master/library/src/main/java/io/multimoon/colorful/CAppCompatActivity.kt) for examples on how to implement the `CThemeInterface`

library/src/main/java/io/multimoon/colorful/CMaterialActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package io.multimoon.colorful
33
import android.os.Bundle
44
import android.support.v7.app.AppCompatActivity
55

6-
class CMaterialActivity : AppCompatActivity(), CThemeInterface {
6+
open class CMaterialActivity : AppCompatActivity(), CThemeInterface {
77

88
override var themeString: String = ""
99

@@ -16,4 +16,4 @@ class CMaterialActivity : AppCompatActivity(), CThemeInterface {
1616
super.onResume()
1717
handleOnResume(this)
1818
}
19-
}
19+
}

0 commit comments

Comments
 (0)