-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b66fba2
commit 2477864
Showing
4 changed files
with
79 additions
and
93 deletions.
There are no files selected for viewing
79 changes: 0 additions & 79 deletions
79
jsonthemer/src/main/java/jsonthemer/model/BaseThemeModel.kt
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,16 +1,81 @@ | ||
package jsonthemer.model | ||
|
||
import android.graphics.Color | ||
import android.graphics.drawable.ColorDrawable | ||
import jsonthemer.annotation.* | ||
|
||
/** | ||
* Created by Manne Öhlund on 2018-02-27. | ||
* Created by Manne Öhlund on 2018-02-23. | ||
* Copyright © 2018. All rights reserved. | ||
*/ | ||
interface ThemeModel { | ||
var theme: Int | ||
var statusBarColor: String | ||
var navigationBarColor: String | ||
|
||
fun getModelTheme(): Int | ||
fun getStatusBarColor(): Int | ||
fun getToolbarColor(): Int | ||
fun getNavigationBarColor(): Int | ||
|
||
class ThemeModel { | ||
val LIGHT = 0 | ||
val DARK = 1 | ||
|
||
var theme = LIGHT | ||
@StatusBar | ||
var statusBarColor = "#FFFF5722" | ||
@NavigationBar | ||
var navigationBarColor = "#FFFF5722" | ||
|
||
// Theme overlays | ||
|
||
private var toolbarThemeOverlay: Int = LIGHT | ||
private var popupThemeOverlay: Int = LIGHT | ||
|
||
// Other | ||
|
||
@ToolbarBar | ||
private var toolbarColor: String = "#FFFF5722" | ||
@AccentColor | ||
private var accentColor: String = "#FFFF5722" | ||
private var windowBackgroundColor: String = "#FF000000" | ||
|
||
@Theme | ||
fun getModelTheme(): Int { | ||
return when (theme) { | ||
DARK -> return android.support.v7.appcompat.R.style.Theme_AppCompat_NoActionBar | ||
else -> android.support.v7.appcompat.R.style.Theme_AppCompat_Light_NoActionBar | ||
} | ||
} | ||
|
||
@ToolbarThemeOverlay | ||
fun getToolbarThemeOverlay(): Int { | ||
return when (toolbarThemeOverlay) { | ||
DARK -> return android.support.v7.appcompat.R.style.ThemeOverlay_AppCompat_Dark_ActionBar | ||
else -> android.support.v7.appcompat.R.style.ThemeOverlay_AppCompat_ActionBar | ||
} | ||
} | ||
|
||
fun getPopupThemeOverlay(): Int { | ||
return when (popupThemeOverlay) { | ||
DARK -> return android.support.v7.appcompat.R.style.Theme_AppCompat | ||
else -> android.support.v7.appcompat.R.style.Theme_AppCompat_Light | ||
} | ||
} | ||
|
||
fun getStatusBarColor(): Int { | ||
return Color.parseColor(statusBarColor) | ||
} | ||
|
||
fun getStatusBarColorDrawable(): ColorDrawable { | ||
return ColorDrawable(getStatusBarColor()) | ||
} | ||
|
||
fun getToolbarColor(): Int { | ||
return Color.parseColor(toolbarColor) | ||
} | ||
|
||
fun getAccentColor(): Int { | ||
return Color.parseColor(accentColor) | ||
} | ||
|
||
fun getNavigationBarColor(): Int { | ||
return Color.parseColor(navigationBarColor) | ||
} | ||
|
||
fun getWindowBackgroundColor(): Int { | ||
return Color.parseColor(windowBackgroundColor) | ||
} | ||
} |
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