-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from meikpiep/dynamic-colors
Add support of dynamic colors
- Loading branch information
Showing
9 changed files
with
64 additions
and
7 deletions.
There are no files selected for viewing
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
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
19 changes: 19 additions & 0 deletions
19
gauguin-app/src/main/kotlin/org/piepmeyer/gauguin/ui/DynamicColorsPrecondition.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,19 @@ | ||
package org.piepmeyer.gauguin.ui | ||
|
||
import android.app.Activity | ||
import com.google.android.material.color.DynamicColors.Precondition | ||
import org.koin.core.component.KoinComponent | ||
import org.koin.core.component.inject | ||
import org.piepmeyer.gauguin.Theme | ||
import org.piepmeyer.gauguin.preferences.ApplicationPreferences | ||
|
||
class DynamicColorsPrecondition : KoinComponent, Precondition { | ||
private val applicationPreferences: ApplicationPreferences by inject() | ||
|
||
override fun shouldApplyDynamicColors( | ||
activity: Activity, | ||
theme: Int, | ||
): Boolean { | ||
return applicationPreferences.theme == Theme.DYNAMIC_COLORS | ||
} | ||
} |
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
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
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 |
---|---|---|
|
@@ -4,4 +4,5 @@ enum class Theme { | |
LIGHT, | ||
DARK, | ||
SYSTEM_DEFAULT, | ||
DYNAMIC_COLORS, | ||
} |