Library That Handles The Device Theme Based On The Sunrise And Sunset
Add these repositories to the android part of your app build.gradle
// Repositories For App//
repositories {
// Github Repository//
mavenCentral()
// Maven Repository Url//
maven { url 'https://jitpack.io' }
}
Add This line of code to the dependencies in your build.gradle
implementation 'com.github.JordanZimmitti:JZNightMode:1.0.0'
JZNightMode can be set up in two ways, the first way is
// Define And Instantiates JZNightMode Value//
val jzNightMode = JZNightMode(this, R.style.DayTheme, R.style.NightTheme)
The second way is
// Define And Instantiates JZNightMode Value//
val jzNightMode = JZNightMode(this)
// Sets The Day Theme And Night Theme//
jzNightMode.dayTheme = R.style.DayTheme
jzNightMode.nightTheme = R.style.NightTheme
// Gets The Day And Night Themes//
jzNightMode.dayTheme
jzNightMode.nightTheme
// Gets The Theme Based On The Time Of Day//
val theme = jzNightMode.getTheme()
// Sets The Theme//
setTheme(theme)
// Gets The Sunrise And Sunset Times In 'HH:MM AA'//
jzNightMode.getSunrise()
jzNightMode.getSunset()
// Returns True If It Is Night//
jzNightMode.isNight()