Dynamic theme handling. Works only on the homeactivity for now.

This commit is contained in:
Amine Bou 2018-04-08 13:08:42 +02:00
parent bafd478604
commit fdcd8c6c6a
17 changed files with 174 additions and 254 deletions

View File

@ -13,7 +13,7 @@ ext {
buildDate: new Date()
]
// This will make me able to build multiple times a day. May break thinks. I may forget it.
todaysBuilds = "4"
todaysBuilds = "1"
}
def gitVersion() {
@ -172,6 +172,7 @@ dependencies {
// Themes
implementation 'com.52inc:scoops:1.0.0'
implementation'com.jrummyapps:colorpicker:2.1.7'
// Github issues reporter
implementation 'com.heinrichreimersoftware:android-issue-reporter:1.3.1'

View File

@ -33,6 +33,7 @@ import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
import apps.amine.bou.readerforselfoss.api.selfoss.Tag
import apps.amine.bou.readerforselfoss.settings.SettingsActivity
import apps.amine.bou.readerforselfoss.themes.AppColors
import apps.amine.bou.readerforselfoss.themes.Toppings
import apps.amine.bou.readerforselfoss.utils.Config
import apps.amine.bou.readerforselfoss.utils.bottombar.maybeShow
import apps.amine.bou.readerforselfoss.utils.bottombar.removeBadge
@ -90,6 +91,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
private var items: ArrayList<Item> = ArrayList()
private var allItems: ArrayList<Item> = ArrayList()
private var clickBehavior = false
private var debugReadingItems = false
private var shouldLogEverything = false
@ -109,6 +111,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
private var infiniteScroll: Boolean = false
private var lastFetchDone: Boolean = false
private lateinit var tabNewBadge: TextBadgeItem
private lateinit var tabArchiveBadge: TextBadgeItem
private lateinit var tabStarredBadge: TextBadgeItem
@ -142,9 +145,14 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Scoop.getInstance().apply(this)
sharedPref = PreferenceManager.getDefaultSharedPreferences(this)
appColors = AppColors(this@HomeActivity)
setContentView(R.layout.activity_home)
handleThemeBinding()
setSupportActionBar(toolBar)
if (savedInstanceState == null) {
Amplify.getSharedInstance().promptIfReady(promptView)
@ -156,7 +164,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
customTabActivityHelper = CustomTabActivityHelper()
settings = getSharedPreferences(Config.settingsName, Context.MODE_PRIVATE)
sharedPref = PreferenceManager.getDefaultSharedPreferences(this)
api = SelfossApi(
this,
@ -167,8 +174,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
items = ArrayList()
allItems = ArrayList()
appColors = AppColors(this@HomeActivity)
handleBottomBar()
handleDrawer()
@ -272,27 +277,27 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
tabNewBadge = TextBadgeItem()
.setText("")
.setHideOnSelect(false).hide(false)
.setBackgroundColor(appColors.primary)
.setBackgroundColor(appColors.colorPrimary)
tabArchiveBadge = TextBadgeItem()
.setText("")
.setHideOnSelect(false).hide(false)
.setBackgroundColor(appColors.primary)
.setBackgroundColor(appColors.colorPrimary)
tabStarredBadge = TextBadgeItem()
.setText("")
.setHideOnSelect(false).hide(false)
.setBackgroundColor(appColors.primary)
.setBackgroundColor(appColors.colorPrimary)
val tabNew =
BottomNavigationItem(
R.drawable.ic_fiber_new_black_24dp,
getString(R.string.tab_new)
).setActiveColor(appColors.accent)
).setActiveColor(appColors.colorAccent)
.setBadgeItem(tabNewBadge)
val tabArchive =
BottomNavigationItem(
R.drawable.ic_archive_black_24dp,
getString(R.string.tab_read)
).setActiveColor(appColors.dark)
).setActiveColor(appColors.colorAccentDark)
.setBadgeItem(tabArchiveBadge)
val tabStarred =
BottomNavigationItem(
@ -315,6 +320,9 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
override fun onResume() {
super.onResume()
// TODO: Make this the only appcolors init
appColors = AppColors(this@HomeActivity)
handleDrawerItems()
sharedPref = PreferenceManager.getDefaultSharedPreferences(this)
@ -327,6 +335,8 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
handleSharedPrefs()
handleThemeUpdate()
reloadLayoutManager()
if (!infiniteScroll) {
@ -361,6 +371,26 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
infiniteScroll = sharedPref.getBoolean("infinite_loading", false)
}
private fun handleThemeBinding() {
Scoop.getInstance()
.bind(this, Toppings.PRIMARY.value, toolBar)
.bindStatusBar(this, Toppings.PRIMARY_DARK.value)
}
private fun handleThemeUpdate() {
Scoop.getInstance()
.update(Toppings.PRIMARY.value, appColors.colorPrimary)
.update(Toppings.PRIMARY_DARK.value, appColors.colorPrimaryDark)
/*.update(Toppings.ACCENT.value, colorAccent)
.update(Toppings.ACCENT_DARK.value, colorAccentDark)
.update(Toppings.BACKGROUND.value, colorBackground)
.update(Toppings.CARD_BACKGROUND.value, cardBackgroundColor)
.update(Toppings.TEXT_PRIMARY.value, textColorPrimary)
.update(Toppings.TEXT_SECONDARY.value, textColorSecondary)
.update(Toppings.HEADER_DRAWER_TEXT.value, materialDrawerHeaderSelectionText)*/
}
private fun handleDrawer() {
displayAccountHeader =
PreferenceManager.getDefaultSharedPreferences(this)
@ -449,7 +479,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
val color = try {
Color.parseColor(it.color)
} catch (e: IllegalArgumentException) {
resources.getColor(R.color.primary)
appColors.colorPrimary
}
gd.setColor(color)
@ -464,7 +494,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
.withBadge("${it.unread}")
.withBadgeStyle(
BadgeStyle().withTextColor(Color.WHITE)
.withColor(appColors.accent)
.withColor(appColors.colorAccent)
)
.withOnDrawerItemClickListener { _, _, _ ->
allItems = ArrayList()

View File

@ -87,31 +87,6 @@ class MyApp : MultiDexApplication() {
private fun initTheme() {
Scoop.waffleCone()
.addFlavor(getString(R.string.default_theme), R.style.NoBar, true)
.addDayNightFlavor(getString(R.string.default_dark_theme), R.style.NoBarDark)
.addFlavor(getString(R.string.teal_orange_theme), R.style.NoBarTealOrange)
.addDayNightFlavor(
getString(R.string.teal_orange_dark_theme),
R.style.NoBarTealOrangeDark
)
.addFlavor(getString(R.string.cyan_pink_theme), R.style.NoBarCyanPink)
.addDayNightFlavor(getString(R.string.cyan_pink_dark_theme), R.style.NoBarCyanPinkDark)
.addFlavor(getString(R.string.grey_orange_theme), R.style.NoBarGreyOrange)
.addDayNightFlavor(
getString(R.string.grey_orange_dark_theme),
R.style.NoBarGreyOrangeDark
)
.addFlavor(getString(R.string.blue_amber_theme), R.style.NoBarBlueAmber)
.addDayNightFlavor(
getString(R.string.blue_amber_dark_theme),
R.style.NoBarBlueAmberDark
)
.addFlavor(getString(R.string.indigo_pink_theme), R.style.NoBarIndigoPink)
.addDayNightFlavor(
getString(R.string.indigo_pink_dark_theme),
R.style.NoBarIndigoPinkDark
)
.addFlavor(getString(R.string.red_teal_theme), R.style.NoBarRedTeal)
.addDayNightFlavor(getString(R.string.red_teal_dark_theme), R.style.NoBarRedTealDark)
.setSharedPreferences(PreferenceManager.getDefaultSharedPreferences(this))
.initialize()
}

View File

@ -101,7 +101,7 @@ class ItemCardAdapter(
inner class ViewHolder(val mView: CardView) : RecyclerView.ViewHolder(mView) {
init {
mView.setCardBackgroundColor(appColors.cardBackground)
mView.setCardBackgroundColor(appColors.cardBackgroundColor)
handleClickListeners()
handleCustomTabActions()
}

View File

@ -24,6 +24,8 @@ import android.text.Editable;
import android.text.InputFilter;
import android.text.Spanned;
import android.text.TextWatcher;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;
@ -135,7 +137,8 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|| GeneralPreferenceFragment.class.getName().equals(fragmentName)
|| ArticleViewerPreferenceFragment.class.getName().equals(fragmentName)
|| DebugPreferenceFragment.class.getName().equals(fragmentName)
|| LinksPreferenceFragment.class.getName().equals(fragmentName);
|| LinksPreferenceFragment.class.getName().equals(fragmentName)
|| ThemePreferenceFragment.class.getName().equals(fragmentName);
}
/**
@ -336,14 +339,38 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
}
}
@Override
public void onHeaderClick(Header header, int position) {
super.onHeaderClick(header, position);
if (header.id == R.id.theme_change) {
Intent intent = ScoopSettingsActivity.createIntent(getApplicationContext());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(intent);
finish();
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class ThemePreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_theme);
setHasOptionsMenu(true);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
getActivity().finish();
return true;
} else if (id == R.id.clear) {
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getActivity());
SharedPreferences.Editor editor = pref.edit();
editor.remove("color_primary");
editor.remove("color_primary_dark");
editor.remove("color_accent");
editor.remove("color_accent_dark");
editor.remove("dark_theme");
editor.apply();
getActivity().finish();
}
return super.onOptionsItemSelected(item);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.settings_theme, menu);
}
}

View File

@ -2,49 +2,62 @@ package apps.amine.bou.readerforselfoss.themes
import android.app.Activity
import android.content.Context
import android.preference.PreferenceManager
import android.support.annotation.ColorInt
import android.util.TypedValue
import apps.amine.bou.readerforselfoss.R
class AppColors(a: Activity) {
@ColorInt val accent: Int
@ColorInt val dark: Int
@ColorInt val primary: Int
@ColorInt val cardBackground: Int
@ColorInt val windowBackground: Int
@ColorInt val colorPrimary: Int
@ColorInt val colorPrimaryDark: Int
@ColorInt val colorAccent: Int
@ColorInt val colorAccentDark: Int
@ColorInt val cardBackgroundColor: Int
val isDarkTheme: Boolean
init {
val sharedPref = PreferenceManager.getDefaultSharedPreferences(a)
colorPrimary =
sharedPref.getInt(
"color_primary",
a.resources.getColor(R.color.colorPrimary)
)
colorPrimaryDark =
sharedPref.getInt(
"color_primary_dark",
a.resources.getColor(R.color.colorPrimaryDark)
)
colorAccent =
sharedPref.getInt(
"color_accent",
a.resources.getColor(R.color.colorAccent)
)
colorAccentDark =
sharedPref.getInt(
"color_accent_dark",
a.resources.getColor(R.color.colorAccentDark)
)
isDarkTheme =
sharedPref.getBoolean(
"dark_theme",
false
)
if (isDarkTheme) {
a.setTheme(R.style.NoBarDark)
} else {
a.setTheme(R.style.NoBar)
}
val wrapper = Context::class.java
val method = wrapper!!.getMethod("getThemeResId")
method.isAccessible = true
isDarkTheme = when (method.invoke(a.baseContext)) {
R.style.NoBarTealOrangeDark,
R.style.NoBarDark,
R.style.NoBarBlueAmberDark,
R.style.NoBarGreyOrangeDark,
R.style.NoBarIndigoPinkDark,
R.style.NoBarRedTealDark,
R.style.NoBarCyanPinkDark -> true
else -> false
}
val typedAccent = TypedValue()
val typedAccentDark = TypedValue()
val typedPrimary = TypedValue()
val typedCardBackground = TypedValue()
val typedWindowBackground = TypedValue()
a.theme.resolveAttribute(R.attr.colorAccent, typedAccent, true)
a.theme.resolveAttribute(R.attr.colorAccent, typedAccent, true)
a.theme.resolveAttribute(R.attr.colorPrimary, typedPrimary, true)
a.theme.resolveAttribute(R.attr.cardBackgroundColor, typedCardBackground, true)
a.theme.resolveAttribute(android.R.attr.colorBackground, typedWindowBackground, true)
accent = typedAccent.data
dark = typedAccentDark.data
primary = typedPrimary.data
cardBackground = typedCardBackground.data
windowBackground = typedWindowBackground.data
cardBackgroundColor = typedCardBackground.data
}
}

View File

@ -0,0 +1,8 @@
package apps.amine.bou.readerforselfoss.themes
enum class Toppings(val value: Int) {
PRIMARY(1),
PRIMARY_DARK(2),
ACCENT(3),
ACCENT_DARK(4)
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 986 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/clear"
android:icon="@drawable/ic_history"
android:title="@string/drawer_action_clear"
app:showAsAction="ifRoom" />
</menu>

View File

@ -16,4 +16,7 @@
<color name="dark_webview_text">@color/md_white_1000</color>
<color name="light_webview">@color/md_grey_50</color>
<color name="light_webview_text">@color/md_grey_900</color>
<color name="cardBackgroundColor">#FFFFFFFF</color>
<color name="materialDrawerHeaderSelectionText">@color/md_grey_900</color>
</resources>

View File

@ -43,182 +43,6 @@
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>-->
</style>
<style name="NoBarBlueAmber" parent="MaterialDrawerTheme.Light">
<item name="colorPrimary">@color/md_blue_500</item>
<item name="colorPrimaryDark">@color/md_blue_700</item>
<item name="colorAccent">@color/md_amber_500</item>
<item name="colorAccentDark">@color/md_amber_700</item>
<item name="cardBackgroundColor">@color/white</item>
<item name="android:colorBackground">@color/md_grey_50</item>
<item name="android:textColorPrimary">@color/md_grey_900</item>
<item name="android:textColorSecondary">@color/md_grey_400</item>
<item name="material_drawer_header_selection_text">@color/md_grey_900</item>
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>
</style>
<style name="NoBarBlueAmberDark" parent="MaterialDrawerTheme">
<item name="colorPrimary">@color/md_blue_500</item>
<item name="colorPrimaryDark">@color/md_blue_700</item>
<item name="colorAccent">@color/md_amber_500</item>
<item name="colorAccentDark">@color/md_amber_700</item>
<item name="cardBackgroundColor">@color/md_grey_800</item>
<item name="android:colorBackground">#303030</item>
<item name="bnbBackgroundColor">@color/md_grey_900</item>
<item name="android:textColorPrimary">@color/md_white_1000</item>
<item name="android:textColorSecondary">@color/md_grey_600</item>
<item name="material_drawer_header_selection_text">@color/md_grey_900</item>
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
</style>
<style name="NoBarGreyOrange" parent="MaterialDrawerTheme.Light">
<item name="colorPrimary">@color/md_blue_grey_500</item>
<item name="colorPrimaryDark">@color/md_blue_grey_700</item>
<item name="colorAccent">@color/md_deep_orange_500</item>
<item name="colorAccentDark">@color/md_deep_orange_700</item>
<item name="cardBackgroundColor">@color/white</item>
<item name="android:colorBackground">@color/md_grey_50</item>
<item name="android:textColorPrimary">@color/md_grey_900</item>
<item name="android:textColorSecondary">@color/md_grey_400</item>
<item name="material_drawer_header_selection_text">@color/md_grey_900</item>
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>
</style>
<style name="NoBarGreyOrangeDark" parent="MaterialDrawerTheme">
<item name="colorPrimary">@color/md_blue_grey_500</item>
<item name="colorPrimaryDark">@color/md_blue_grey_700</item>
<item name="colorAccent">@color/md_deep_orange_500</item>
<item name="colorAccentDark">@color/md_deep_orange_700</item>
<item name="cardBackgroundColor">@color/md_grey_800</item>
<item name="android:colorBackground">#303030</item>
<item name="bnbBackgroundColor">@color/md_grey_900</item>
<item name="android:textColorPrimary">@color/md_white_1000</item>
<item name="android:textColorSecondary">@color/md_grey_600</item>
<item name="material_drawer_header_selection_text">@color/md_grey_900</item>
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
</style>
<style name="NoBarIndigoPink" parent="MaterialDrawerTheme.Light">
<item name="colorPrimary">@color/md_indigo_500</item>
<item name="colorPrimaryDark">@color/md_indigo_700</item>
<item name="colorAccent">@color/md_pink_500</item>
<item name="colorAccentDark">@color/md_pink_700</item>
<item name="cardBackgroundColor">@color/white</item>
<item name="android:colorBackground">@color/md_grey_50</item>
<item name="android:textColorPrimary">@color/md_grey_900</item>
<item name="android:textColorSecondary">@color/md_grey_400</item>
<item name="material_drawer_header_selection_text">@color/md_grey_900</item>
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>
</style>
<style name="NoBarIndigoPinkDark" parent="MaterialDrawerTheme">
<item name="colorPrimary">@color/md_indigo_500</item>
<item name="colorPrimaryDark">@color/md_indigo_700</item>
<item name="colorAccent">@color/md_pink_500</item>
<item name="colorAccentDark">@color/md_pink_700</item>
<item name="cardBackgroundColor">@color/md_grey_800</item>
<item name="android:colorBackground">#303030</item>
<item name="bnbBackgroundColor">@color/md_grey_900</item>
<item name="android:textColorPrimary">@color/md_white_1000</item>
<item name="android:textColorSecondary">@color/md_grey_600</item>
<item name="material_drawer_header_selection_text">@color/md_grey_900</item>
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
</style>
<style name="NoBarRedTeal" parent="MaterialDrawerTheme.Light">
<item name="colorPrimary">@color/md_red_500</item>
<item name="colorPrimaryDark">@color/md_red_700</item>
<item name="colorAccent">@color/md_teal_500</item>
<item name="colorAccentDark">@color/md_teal_700</item>
<item name="cardBackgroundColor">@color/white</item>
<item name="android:colorBackground">@color/md_grey_50</item>
<item name="android:textColorPrimary">@color/md_grey_900</item>
<item name="android:textColorSecondary">@color/md_grey_400</item>
<item name="material_drawer_header_selection_text">@color/md_grey_900</item>
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>
</style>
<style name="NoBarRedTealDark" parent="MaterialDrawerTheme">
<item name="colorPrimary">@color/md_red_500</item>
<item name="colorPrimaryDark">@color/md_red_700</item>
<item name="colorAccent">@color/md_teal_500</item>
<item name="colorAccentDark">@color/md_teal_700</item>
<item name="cardBackgroundColor">@color/md_grey_800</item>
<item name="android:colorBackground">#303030</item>
<item name="bnbBackgroundColor">@color/md_grey_900</item>
<item name="android:textColorPrimary">@color/md_white_1000</item>
<item name="android:textColorSecondary">@color/md_grey_600</item>
<item name="material_drawer_header_selection_text">@color/md_grey_900</item>
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
</style>
<style name="NoBarCyanPink" parent="MaterialDrawerTheme.Light">
<item name="colorPrimary">@color/md_cyan_500</item>
<item name="colorPrimaryDark">@color/md_cyan_700</item>
<item name="colorAccent">@color/md_pink_500</item>
<item name="colorAccentDark">@color/md_pink_700</item>
<item name="cardBackgroundColor">@color/white</item>
<item name="android:colorBackground">@color/md_grey_50</item>
<item name="android:textColorPrimary">@color/md_grey_900</item>
<item name="android:textColorSecondary">@color/md_grey_400</item>
<item name="material_drawer_header_selection_text">@color/md_grey_900</item>
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>
</style>
<style name="NoBarCyanPinkDark" parent="MaterialDrawerTheme">
<item name="colorPrimary">@color/md_cyan_500</item>
<item name="colorPrimaryDark">@color/md_cyan_700</item>
<item name="colorAccent">@color/md_pink_500</item>
<item name="colorAccentDark">@color/md_pink_700</item>
<item name="cardBackgroundColor">@color/md_grey_800</item>
<item name="android:colorBackground">#303030</item>
<item name="bnbBackgroundColor">@color/md_grey_900</item>
<item name="android:textColorPrimary">@color/md_white_1000</item>
<item name="android:textColorSecondary">@color/md_grey_600</item>
<item name="material_drawer_header_selection_text">@color/md_grey_900</item>
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
</style>
<style name="NoBarTealOrange" parent="MaterialDrawerTheme.Light">
<item name="colorPrimary">@color/md_teal_500</item>
<item name="colorPrimaryDark">@color/md_teal_700</item>
<item name="colorAccent">@color/md_orange_500</item>
<item name="colorAccentDark">@color/md_orange_700</item>
<item name="cardBackgroundColor">@color/white</item>
<item name="android:colorBackground">@color/md_grey_50</item>
<item name="android:textColorPrimary">@color/md_grey_900</item>
<item name="android:textColorSecondary">@color/md_grey_400</item>
<item name="material_drawer_header_selection_text">@color/md_grey_900</item>
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>
</style>
<style name="NoBarTealOrangeDark" parent="MaterialDrawerTheme">
<item name="colorPrimary">@color/md_teal_500</item>
<item name="colorPrimaryDark">@color/md_teal_700</item>
<item name="colorAccent">@color/md_orange_500</item>
<item name="colorAccentDark">@color/md_orange_700</item>
<item name="cardBackgroundColor">@color/md_grey_800</item>
<item name="android:colorBackground">#303030</item>
<item name="bnbBackgroundColor">@color/md_grey_900</item>
<item name="android:textColorPrimary">@color/md_white_1000</item>
<item name="android:textColorSecondary">@color/md_grey_600</item>
<item name="material_drawer_header_selection_text">@color/md_grey_900</item>
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
</style>
<style name="Theme.App.Light" parent="Theme.IssueReporter.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>

View File

@ -17,7 +17,7 @@
android:title="@string/pref_header_debug"/>
<header
android:id="@+id/theme_change"
android:fragment="apps.amine.bou.readerforselfoss.settings.SettingsActivity$ThemePreferenceFragment"
android:icon="@drawable/ic_color_lens_black_24dp"
android:title="@string/pref_header_theme"/>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<!-- TODO translate this file -->
<SwitchPreference
android:defaultValue="false"
android:key="dark_theme"
android:title="Dark theme" />
<com.jrummyapps.android.colorpicker.ColorPreference
android:defaultValue="@color/colorPrimary"
android:key="color_primary"
android:title="Primary color"/>
<com.jrummyapps.android.colorpicker.ColorPreference
android:defaultValue="@color/colorPrimaryDark"
android:key="color_primary_dark"
android:title="Primary dark color"/>
<com.jrummyapps.android.colorpicker.ColorPreference
android:defaultValue="@color/colorAccent"
android:key="color_accent"
android:title="Accent color"/>
<com.jrummyapps.android.colorpicker.ColorPreference
android:defaultValue="@color/colorAccentDark"
android:key="color_accent_dark"
android:title="Accent dark color"/>
</PreferenceScreen>