Skip to content

An Android theme manager with all the features. Everything you expect from a theme manager, contains apply theme to whole app, multiple themes, night mode, styles , ...

Notifications You must be signed in to change notification settings

MostafaTaghipour/ThemeManager

Repository files navigation

AndroidThemeManager

AndroidThemeManger is a theme manager for Android:

  • Apply theme at runtime
  • Support multiple theme
  • Supports night mode

themes

Requirements

  • Api 14+

Installation

Add JitPack to repositories in your project's root build.gradle file:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Add the dependency to your module's build.gradle file:

dependencies {
    ...
    implementation 'com.github.MostafaTaghipour:thememanager:1.0.0'
}

Usage

  • Define app theme (s):
<resources xmlns:tools="http://schemas.android.com/tools">

  <!-- Base application theme. -->
  <style name="AppTheme" parent="Theme.AppCompat.DayNight">
  </style>

  <style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
  </style>

  <style name="AppTheme.NoActionBar.Red">
    <item name="colorPrimary">@color/colorPrimary_Red</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark_Red</item>
    <item name="colorAccent">@color/colorAccent_Red</item>
  </style>

</resources>
  • Set app theme like below:
ThemeManager.getInstance().currentTheme = R.style.AppTheme_NoActionBar_Red
ThemeManager.getInstance().nightMode = AppCompatDelegate.MODE_NIGHT_YES
  • Set activities theme like this:
override fun onCreate(savedInstanceState: Bundle?) {
  super.onCreate(savedInstanceState)
  ThemeManager.getInstance().applyTheme(this)
}
  • Thats it, enjoy it

Author

Mostafa Taghipour, mostafa@taghipour.me

License

AndroidThemeManager is available under the MIT license. See the LICENSE file for more info.

About

An Android theme manager with all the features. Everything you expect from a theme manager, contains apply theme to whole app, multiple themes, night mode, styles , ...

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published