Dynamic theme handling. Works only on the homeactivity for now.
This commit is contained in:
parent
bafd478604
commit
fdcd8c6c6a
@ -13,7 +13,7 @@ ext {
|
|||||||
buildDate: new Date()
|
buildDate: new Date()
|
||||||
]
|
]
|
||||||
// This will make me able to build multiple times a day. May break thinks. I may forget it.
|
// This will make me able to build multiple times a day. May break thinks. I may forget it.
|
||||||
todaysBuilds = "4"
|
todaysBuilds = "1"
|
||||||
}
|
}
|
||||||
|
|
||||||
def gitVersion() {
|
def gitVersion() {
|
||||||
@ -172,6 +172,7 @@ dependencies {
|
|||||||
|
|
||||||
// Themes
|
// Themes
|
||||||
implementation 'com.52inc:scoops:1.0.0'
|
implementation 'com.52inc:scoops:1.0.0'
|
||||||
|
implementation'com.jrummyapps:colorpicker:2.1.7'
|
||||||
|
|
||||||
// Github issues reporter
|
// Github issues reporter
|
||||||
implementation 'com.heinrichreimersoftware:android-issue-reporter:1.3.1'
|
implementation 'com.heinrichreimersoftware:android-issue-reporter:1.3.1'
|
||||||
|
@ -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.api.selfoss.Tag
|
||||||
import apps.amine.bou.readerforselfoss.settings.SettingsActivity
|
import apps.amine.bou.readerforselfoss.settings.SettingsActivity
|
||||||
import apps.amine.bou.readerforselfoss.themes.AppColors
|
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.Config
|
||||||
import apps.amine.bou.readerforselfoss.utils.bottombar.maybeShow
|
import apps.amine.bou.readerforselfoss.utils.bottombar.maybeShow
|
||||||
import apps.amine.bou.readerforselfoss.utils.bottombar.removeBadge
|
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 items: ArrayList<Item> = ArrayList()
|
||||||
private var allItems: ArrayList<Item> = ArrayList()
|
private var allItems: ArrayList<Item> = ArrayList()
|
||||||
|
|
||||||
private var clickBehavior = false
|
private var clickBehavior = false
|
||||||
private var debugReadingItems = false
|
private var debugReadingItems = false
|
||||||
private var shouldLogEverything = false
|
private var shouldLogEverything = false
|
||||||
@ -109,6 +111,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
private var infiniteScroll: Boolean = false
|
private var infiniteScroll: Boolean = false
|
||||||
private var lastFetchDone: Boolean = false
|
private var lastFetchDone: Boolean = false
|
||||||
|
|
||||||
|
|
||||||
private lateinit var tabNewBadge: TextBadgeItem
|
private lateinit var tabNewBadge: TextBadgeItem
|
||||||
private lateinit var tabArchiveBadge: TextBadgeItem
|
private lateinit var tabArchiveBadge: TextBadgeItem
|
||||||
private lateinit var tabStarredBadge: TextBadgeItem
|
private lateinit var tabStarredBadge: TextBadgeItem
|
||||||
@ -142,9 +145,14 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
Scoop.getInstance().apply(this)
|
|
||||||
|
sharedPref = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
|
appColors = AppColors(this@HomeActivity)
|
||||||
|
|
||||||
setContentView(R.layout.activity_home)
|
setContentView(R.layout.activity_home)
|
||||||
|
|
||||||
|
handleThemeBinding()
|
||||||
|
|
||||||
setSupportActionBar(toolBar)
|
setSupportActionBar(toolBar)
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
Amplify.getSharedInstance().promptIfReady(promptView)
|
Amplify.getSharedInstance().promptIfReady(promptView)
|
||||||
@ -156,7 +164,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
customTabActivityHelper = CustomTabActivityHelper()
|
customTabActivityHelper = CustomTabActivityHelper()
|
||||||
|
|
||||||
settings = getSharedPreferences(Config.settingsName, Context.MODE_PRIVATE)
|
settings = getSharedPreferences(Config.settingsName, Context.MODE_PRIVATE)
|
||||||
sharedPref = PreferenceManager.getDefaultSharedPreferences(this)
|
|
||||||
|
|
||||||
api = SelfossApi(
|
api = SelfossApi(
|
||||||
this,
|
this,
|
||||||
@ -167,8 +174,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
items = ArrayList()
|
items = ArrayList()
|
||||||
allItems = ArrayList()
|
allItems = ArrayList()
|
||||||
|
|
||||||
appColors = AppColors(this@HomeActivity)
|
|
||||||
|
|
||||||
handleBottomBar()
|
handleBottomBar()
|
||||||
handleDrawer()
|
handleDrawer()
|
||||||
|
|
||||||
@ -272,27 +277,27 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
tabNewBadge = TextBadgeItem()
|
tabNewBadge = TextBadgeItem()
|
||||||
.setText("")
|
.setText("")
|
||||||
.setHideOnSelect(false).hide(false)
|
.setHideOnSelect(false).hide(false)
|
||||||
.setBackgroundColor(appColors.primary)
|
.setBackgroundColor(appColors.colorPrimary)
|
||||||
tabArchiveBadge = TextBadgeItem()
|
tabArchiveBadge = TextBadgeItem()
|
||||||
.setText("")
|
.setText("")
|
||||||
.setHideOnSelect(false).hide(false)
|
.setHideOnSelect(false).hide(false)
|
||||||
.setBackgroundColor(appColors.primary)
|
.setBackgroundColor(appColors.colorPrimary)
|
||||||
tabStarredBadge = TextBadgeItem()
|
tabStarredBadge = TextBadgeItem()
|
||||||
.setText("")
|
.setText("")
|
||||||
.setHideOnSelect(false).hide(false)
|
.setHideOnSelect(false).hide(false)
|
||||||
.setBackgroundColor(appColors.primary)
|
.setBackgroundColor(appColors.colorPrimary)
|
||||||
|
|
||||||
val tabNew =
|
val tabNew =
|
||||||
BottomNavigationItem(
|
BottomNavigationItem(
|
||||||
R.drawable.ic_fiber_new_black_24dp,
|
R.drawable.ic_fiber_new_black_24dp,
|
||||||
getString(R.string.tab_new)
|
getString(R.string.tab_new)
|
||||||
).setActiveColor(appColors.accent)
|
).setActiveColor(appColors.colorAccent)
|
||||||
.setBadgeItem(tabNewBadge)
|
.setBadgeItem(tabNewBadge)
|
||||||
val tabArchive =
|
val tabArchive =
|
||||||
BottomNavigationItem(
|
BottomNavigationItem(
|
||||||
R.drawable.ic_archive_black_24dp,
|
R.drawable.ic_archive_black_24dp,
|
||||||
getString(R.string.tab_read)
|
getString(R.string.tab_read)
|
||||||
).setActiveColor(appColors.dark)
|
).setActiveColor(appColors.colorAccentDark)
|
||||||
.setBadgeItem(tabArchiveBadge)
|
.setBadgeItem(tabArchiveBadge)
|
||||||
val tabStarred =
|
val tabStarred =
|
||||||
BottomNavigationItem(
|
BottomNavigationItem(
|
||||||
@ -315,6 +320,9 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
|
// TODO: Make this the only appcolors init
|
||||||
|
appColors = AppColors(this@HomeActivity)
|
||||||
|
|
||||||
handleDrawerItems()
|
handleDrawerItems()
|
||||||
|
|
||||||
sharedPref = PreferenceManager.getDefaultSharedPreferences(this)
|
sharedPref = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
@ -327,6 +335,8 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
|
|
||||||
handleSharedPrefs()
|
handleSharedPrefs()
|
||||||
|
|
||||||
|
handleThemeUpdate()
|
||||||
|
|
||||||
reloadLayoutManager()
|
reloadLayoutManager()
|
||||||
|
|
||||||
if (!infiniteScroll) {
|
if (!infiniteScroll) {
|
||||||
@ -361,6 +371,26 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
infiniteScroll = sharedPref.getBoolean("infinite_loading", false)
|
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() {
|
private fun handleDrawer() {
|
||||||
displayAccountHeader =
|
displayAccountHeader =
|
||||||
PreferenceManager.getDefaultSharedPreferences(this)
|
PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
@ -449,7 +479,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
val color = try {
|
val color = try {
|
||||||
Color.parseColor(it.color)
|
Color.parseColor(it.color)
|
||||||
} catch (e: IllegalArgumentException) {
|
} catch (e: IllegalArgumentException) {
|
||||||
resources.getColor(R.color.primary)
|
appColors.colorPrimary
|
||||||
}
|
}
|
||||||
|
|
||||||
gd.setColor(color)
|
gd.setColor(color)
|
||||||
@ -464,7 +494,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
.withBadge("${it.unread}")
|
.withBadge("${it.unread}")
|
||||||
.withBadgeStyle(
|
.withBadgeStyle(
|
||||||
BadgeStyle().withTextColor(Color.WHITE)
|
BadgeStyle().withTextColor(Color.WHITE)
|
||||||
.withColor(appColors.accent)
|
.withColor(appColors.colorAccent)
|
||||||
)
|
)
|
||||||
.withOnDrawerItemClickListener { _, _, _ ->
|
.withOnDrawerItemClickListener { _, _, _ ->
|
||||||
allItems = ArrayList()
|
allItems = ArrayList()
|
||||||
|
@ -87,31 +87,6 @@ class MyApp : MultiDexApplication() {
|
|||||||
private fun initTheme() {
|
private fun initTheme() {
|
||||||
Scoop.waffleCone()
|
Scoop.waffleCone()
|
||||||
.addFlavor(getString(R.string.default_theme), R.style.NoBar, true)
|
.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))
|
.setSharedPreferences(PreferenceManager.getDefaultSharedPreferences(this))
|
||||||
.initialize()
|
.initialize()
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ class ItemCardAdapter(
|
|||||||
|
|
||||||
inner class ViewHolder(val mView: CardView) : RecyclerView.ViewHolder(mView) {
|
inner class ViewHolder(val mView: CardView) : RecyclerView.ViewHolder(mView) {
|
||||||
init {
|
init {
|
||||||
mView.setCardBackgroundColor(appColors.cardBackground)
|
mView.setCardBackgroundColor(appColors.cardBackgroundColor)
|
||||||
handleClickListeners()
|
handleClickListeners()
|
||||||
handleCustomTabActions()
|
handleCustomTabActions()
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,8 @@ import android.text.Editable;
|
|||||||
import android.text.InputFilter;
|
import android.text.InputFilter;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
@ -135,7 +137,8 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
|||||||
|| GeneralPreferenceFragment.class.getName().equals(fragmentName)
|
|| GeneralPreferenceFragment.class.getName().equals(fragmentName)
|
||||||
|| ArticleViewerPreferenceFragment.class.getName().equals(fragmentName)
|
|| ArticleViewerPreferenceFragment.class.getName().equals(fragmentName)
|
||||||
|| DebugPreferenceFragment.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
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
public void onHeaderClick(Header header, int position) {
|
public static class ThemePreferenceFragment extends PreferenceFragment {
|
||||||
super.onHeaderClick(header, position);
|
@Override
|
||||||
if (header.id == R.id.theme_change) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
Intent intent = ScoopSettingsActivity.createIntent(getApplicationContext());
|
super.onCreate(savedInstanceState);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
addPreferencesFromResource(R.xml.pref_theme);
|
||||||
getApplicationContext().startActivity(intent);
|
setHasOptionsMenu(true);
|
||||||
finish();
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,49 +2,62 @@ package apps.amine.bou.readerforselfoss.themes
|
|||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.preference.PreferenceManager
|
||||||
import android.support.annotation.ColorInt
|
import android.support.annotation.ColorInt
|
||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
import apps.amine.bou.readerforselfoss.R
|
import apps.amine.bou.readerforselfoss.R
|
||||||
|
|
||||||
class AppColors(a: Activity) {
|
class AppColors(a: Activity) {
|
||||||
@ColorInt val accent: Int
|
|
||||||
@ColorInt val dark: Int
|
@ColorInt val colorPrimary: Int
|
||||||
@ColorInt val primary: Int
|
@ColorInt val colorPrimaryDark: Int
|
||||||
@ColorInt val cardBackground: Int
|
@ColorInt val colorAccent: Int
|
||||||
@ColorInt val windowBackground: Int
|
@ColorInt val colorAccentDark: Int
|
||||||
|
@ColorInt val cardBackgroundColor: Int
|
||||||
val isDarkTheme: Boolean
|
val isDarkTheme: Boolean
|
||||||
|
|
||||||
init {
|
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 wrapper = Context::class.java
|
||||||
val method = wrapper!!.getMethod("getThemeResId")
|
val method = wrapper!!.getMethod("getThemeResId")
|
||||||
method.isAccessible = true
|
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 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(R.attr.cardBackgroundColor, typedCardBackground, true)
|
||||||
a.theme.resolveAttribute(android.R.attr.colorBackground, typedWindowBackground, true)
|
|
||||||
accent = typedAccent.data
|
cardBackgroundColor = typedCardBackground.data
|
||||||
dark = typedAccentDark.data
|
|
||||||
primary = typedPrimary.data
|
|
||||||
cardBackground = typedCardBackground.data
|
|
||||||
windowBackground = typedWindowBackground.data
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
|
}
|
BIN
app/src/main/res/drawable-hdpi/ic_history.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_history.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 551 B |
BIN
app/src/main/res/drawable-mdpi/ic_history.png
Normal file
BIN
app/src/main/res/drawable-mdpi/ic_history.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 352 B |
BIN
app/src/main/res/drawable-xhdpi/ic_history.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_history.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 684 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_history.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_history.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 986 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_history.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/ic_history.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
10
app/src/main/res/menu/settings_theme.xml
Normal file
10
app/src/main/res/menu/settings_theme.xml
Normal 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>
|
@ -16,4 +16,7 @@
|
|||||||
<color name="dark_webview_text">@color/md_white_1000</color>
|
<color name="dark_webview_text">@color/md_white_1000</color>
|
||||||
<color name="light_webview">@color/md_grey_50</color>
|
<color name="light_webview">@color/md_grey_50</color>
|
||||||
<color name="light_webview_text">@color/md_grey_900</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>
|
</resources>
|
||||||
|
@ -43,182 +43,6 @@
|
|||||||
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>-->
|
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>-->
|
||||||
</style>
|
</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">
|
<style name="Theme.App.Light" parent="Theme.IssueReporter.Light.DarkActionBar">
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
android:title="@string/pref_header_debug"/>
|
android:title="@string/pref_header_debug"/>
|
||||||
|
|
||||||
<header
|
<header
|
||||||
android:id="@+id/theme_change"
|
android:fragment="apps.amine.bou.readerforselfoss.settings.SettingsActivity$ThemePreferenceFragment"
|
||||||
android:icon="@drawable/ic_color_lens_black_24dp"
|
android:icon="@drawable/ic_color_lens_black_24dp"
|
||||||
android:title="@string/pref_header_theme"/>
|
android:title="@string/pref_header_theme"/>
|
||||||
|
|
||||||
|
29
app/src/main/res/xml/pref_theme.xml
Normal file
29
app/src/main/res/xml/pref_theme.xml
Normal 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>
|
Loading…
Reference in New Issue
Block a user