Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
PublicAndroidApps
Nebulo
Commits
014faba9
Commit
014faba9
authored
Aug 14, 2019
by
Daniel Wolf
Browse files
Added a variant for each main theme which has an actionbar
parent
15e24cfe
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/src/main/AndroidManifest.xml
View file @
014faba9
...
...
@@ -39,6 +39,8 @@
</activity>
<activity
android:name=
".activity.SettingsActivity"
android:label=
"@string/menu_settings"
android:theme=
"@style/AppTheme_Mono_ActionBar"
android:parentActivityName=
".activity.MainActivity"
>
</activity>
...
...
app/src/main/java/com/frostnerd/smokescreen/activity/SettingsActivity.kt
View file @
014faba9
...
...
@@ -5,6 +5,7 @@ import android.content.Intent
import
android.os.Bundle
import
com.frostnerd.lifecyclemanagement.BaseActivity
import
com.frostnerd.smokescreen.fragment.SettingsFragment
import
com.frostnerd.smokescreen.getPreferences
/*
* Copyright (C) 2019 Daniel Wolf (Ch4t4r)
...
...
@@ -39,6 +40,7 @@ class SettingsActivity : BaseActivity() {
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
setTheme
(
getPreferences
().
theme
.
layoutStyleWithActionbar
)
super
.
onCreate
(
savedInstanceState
)
supportFragmentManager
.
beginTransaction
().
replace
(
android
.
R
.
id
.
content
,
SettingsFragment
().
apply
{
arguments
=
Bundle
().
apply
{
...
...
app/src/main/java/com/frostnerd/smokescreen/util/preferences/Theme.kt
View file @
014faba9
...
...
@@ -33,11 +33,15 @@ import kotlin.reflect.KProperty
* You can contact the developer at daniel.wolf@frostnerd.com.
*/
enum
class
Theme
(
val
id
:
Int
,
@StyleRes
val
layoutStyle
:
Int
,
@StyleRes
val
dialogStyle
:
Int
,
@StyleRes
val
preferenceStyle
:
Int
)
{
MONO
(
1
,
R
.
style
.
AppTheme_Mono
,
R
.
style
.
DialogTheme_Mono
,
R
.
style
.
PreferenceTheme_Mono
),
DARK
(
2
,
R
.
style
.
AppTheme_Dark
,
R
.
style
.
DialogTheme_Dark
,
R
.
style
.
PreferenceTheme_Dark
),
TRUE_BLACK
(
3
,
R
.
style
.
AppTheme_True_Black
,
R
.
style
.
DialogTheme_True_Black
,
R
.
style
.
PreferenceTheme_True_Black
),
BLUE
(
4
,
R
.
style
.
AppTheme_Blue
,
R
.
style
.
DialogTheme_Blue
,
R
.
style
.
PreferenceTheme_Blue
);
enum
class
Theme
(
val
id
:
Int
,
@StyleRes
val
layoutStyle
:
Int
,
@StyleRes
val
dialogStyle
:
Int
,
@StyleRes
val
preferenceStyle
:
Int
,
@StyleRes
val
layoutStyleWithActionbar
:
Int
)
{
MONO
(
1
,
R
.
style
.
AppTheme_Mono
,
R
.
style
.
DialogTheme_Mono
,
R
.
style
.
PreferenceTheme_Mono
,
R
.
style
.
AppTheme_Mono_ActionBar
),
DARK
(
2
,
R
.
style
.
AppTheme_Dark
,
R
.
style
.
DialogTheme_Dark
,
R
.
style
.
PreferenceTheme_Dark
,
R
.
style
.
AppTheme_Dark_ActionBar
),
TRUE_BLACK
(
3
,
R
.
style
.
AppTheme_True_Black
,
R
.
style
.
DialogTheme_True_Black
,
R
.
style
.
PreferenceTheme_True_Black
,
R
.
style
.
AppTheme_True_Black_ActionBar
),
BLUE
(
4
,
R
.
style
.
AppTheme_Blue
,
R
.
style
.
DialogTheme_Blue
,
R
.
style
.
PreferenceTheme_Blue
,
R
.
style
.
AppTheme_Blue_ActionBar
);
@ColorInt
fun
getColor
(
context
:
Context
,
@AttrRes
attribute
:
Int
,
@ColorInt
defaultValue
:
Int
=
Color
.
BLACK
):
Int
{
...
...
app/src/main/res/values/styles.xml
View file @
014faba9
...
...
@@ -29,6 +29,11 @@
<item
name=
"android:navigationBarColor"
>
?android:attr/statusBarColor
</item>
</style>
<style
name=
"AppTheme_Blue_ActionBar"
parent=
"AppTheme_Blue"
>
<item
name=
"windowActionBar"
>
true
</item>
<item
name=
"windowNoTitle"
>
false
</item>
</style>
<style
name=
"AppTheme_Dark"
parent=
"Theme.AppCompat.DayNight.DarkActionBar"
>
<item
name=
"colorPrimary"
>
#424242
</item>
<item
name=
"colorPrimaryDark"
>
#212121
</item>
...
...
@@ -57,6 +62,11 @@
<item
name=
"android:navigationBarColor"
>
?android:attr/statusBarColor
</item>
</style>
<style
name=
"AppTheme_Dark_ActionBar"
parent=
"AppTheme_Dark"
>
<item
name=
"windowActionBar"
>
true
</item>
<item
name=
"windowNoTitle"
>
false
</item>
</style>
<style
name=
"AppTheme_Mono"
parent=
"Theme.AppCompat.DayNight.DarkActionBar"
>
<item
name=
"colorPrimary"
>
#607D8B
</item>
<item
name=
"colorPrimaryDark"
>
#37474F
</item>
...
...
@@ -85,6 +95,11 @@
<item
name=
"android:navigationBarColor"
>
?android:attr/statusBarColor
</item>
</style>
<style
name=
"AppTheme_Mono_ActionBar"
parent=
"AppTheme_Mono"
>
<item
name=
"windowActionBar"
>
true
</item>
<item
name=
"windowNoTitle"
>
false
</item>
</style>
<style
name=
"DrawerArrowStyle"
parent=
"@style/Widget.AppCompat.DrawerArrowToggle"
>
<item
name=
"spinBars"
>
true
</item>
<item
name=
"color"
>
?android:attr/textColor
</item>
...
...
@@ -117,6 +132,10 @@
<item
name=
"android:statusBarColor"
>
?attr/colorPrimary
</item>
<item
name=
"android:navigationBarColor"
>
?android:attr/statusBarColor
</item>
</style>
<style
name=
"AppTheme_True_Black_ActionBar"
parent=
"AppTheme_True_Black"
>
<item
name=
"windowActionBar"
>
true
</item>
<item
name=
"windowNoTitle"
>
false
</item>
</style>
<style
name=
"DialogTheme_Blue"
parent=
"Theme.AppCompat.Light.Dialog.Alert"
>
<item
name=
"colorPrimary"
>
@color/colorPrimary
</item>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment