diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/activity/HelpActivity.java b/ultrasonic/src/main/java/org/moire/ultrasonic/activity/HelpActivity.java
index e7ea24dc..86672bcc 100644
--- a/ultrasonic/src/main/java/org/moire/ultrasonic/activity/HelpActivity.java
+++ b/ultrasonic/src/main/java/org/moire/ultrasonic/activity/HelpActivity.java
@@ -65,7 +65,7 @@ public final class HelpActivity extends ResultActivity implements OnClickListene
@Override
protected void onCreate(Bundle bundle)
{
- applyTheme();
+ Util.applyTheme(this);
getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
super.onCreate(bundle);
@@ -192,20 +192,6 @@ public final class HelpActivity extends ResultActivity implements OnClickListene
return super.onKeyDown(keyCode, event);
}
- private void applyTheme()
- {
- String theme = Util.getTheme(this);
-
- if ("dark".equalsIgnoreCase(theme) || "fullscreen".equalsIgnoreCase(theme))
- {
- setTheme(R.style.UltrasonicTheme);
- }
- else if ("light".equalsIgnoreCase(theme) || "fullscreenlight".equalsIgnoreCase(theme))
- {
- setTheme(R.style.UltrasonicTheme_Light);
- }
- }
-
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/activity/SubsonicTabActivity.java b/ultrasonic/src/main/java/org/moire/ultrasonic/activity/SubsonicTabActivity.java
index b7445beb..f3a63e85 100644
--- a/ultrasonic/src/main/java/org/moire/ultrasonic/activity/SubsonicTabActivity.java
+++ b/ultrasonic/src/main/java/org/moire/ultrasonic/activity/SubsonicTabActivity.java
@@ -101,7 +101,7 @@ public class SubsonicTabActivity extends ResultActivity implements OnClickListen
protected void onCreate(Bundle bundle)
{
setUncaughtExceptionHandler();
- applyTheme();
+ Util.applyTheme(this);
super.onCreate(bundle);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
@@ -157,7 +157,7 @@ public class SubsonicTabActivity extends ResultActivity implements OnClickListen
protected void onResume()
{
super.onResume();
- applyTheme();
+ Util.applyTheme(this);
instance = this;
Util.registerMediaButtonEventReceiver(this, false);
@@ -295,20 +295,6 @@ public class SubsonicTabActivity extends ResultActivity implements OnClickListen
});
}
- private void applyTheme()
- {
- String theme = Util.getTheme(this);
-
- if ("dark".equalsIgnoreCase(theme) || "fullscreen".equalsIgnoreCase(theme))
- {
- setTheme(R.style.UltrasonicTheme);
- }
- else if ("light".equalsIgnoreCase(theme) || "fullscreenlight".equalsIgnoreCase(theme))
- {
- setTheme(R.style.UltrasonicTheme_Light);
- }
- }
-
private void showNowPlaying(final Context context, final MediaPlayerController mediaPlayerController, final Entry song, final PlayerState playerState)
{
if (context == null || mediaPlayerController == null || song == null || playerState == null)
@@ -1419,4 +1405,4 @@ public class SubsonicTabActivity extends ResultActivity implements OnClickListen
return false;
}
}
-}
\ No newline at end of file
+}
diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/util/Constants.java b/ultrasonic/src/main/java/org/moire/ultrasonic/util/Constants.java
index 07355b94..00d30124 100644
--- a/ultrasonic/src/main/java/org/moire/ultrasonic/util/Constants.java
+++ b/ultrasonic/src/main/java/org/moire/ultrasonic/util/Constants.java
@@ -78,6 +78,9 @@ public final class Constants
public static final String PREFERENCES_KEY_SERVERS_KEY = "serversKey";
public static final String PREFERENCES_KEY_INSTALL_TIME = "installTime";
public static final String PREFERENCES_KEY_THEME = "theme";
+ public static final String PREFERENCES_KEY_THEME_LIGHT = "light";
+ public static final String PREFERENCES_KEY_THEME_DARK = "dark";
+ public static final String PREFERENCES_KEY_THEME_BLACK = "black";
public static final String PREFERENCES_KEY_DISPLAY_BITRATE_WITH_ARTIST = "displayBitrateWithArtist";
public static final String PREFERENCES_KEY_USE_FOLDER_FOR_ALBUM_ARTIST = "useFolderForAlbumArtist";
public static final String PREFERENCES_KEY_SHOW_TRACK_NUMBER = "showTrackNumber";
diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/util/Util.java b/ultrasonic/src/main/java/org/moire/ultrasonic/util/Util.java
index 50a3d6bc..505ffe94 100644
--- a/ultrasonic/src/main/java/org/moire/ultrasonic/util/Util.java
+++ b/ultrasonic/src/main/java/org/moire/ultrasonic/util/Util.java
@@ -153,7 +153,25 @@ public class Util
public static String getTheme(Context context)
{
SharedPreferences preferences = getPreferences(context);
- return preferences.getString(Constants.PREFERENCES_KEY_THEME, "dark");
+ return preferences.getString(Constants.PREFERENCES_KEY_THEME, Constants.PREFERENCES_KEY_THEME_DARK);
+ }
+
+ public static void applyTheme(Context context)
+ {
+ String theme = Util.getTheme(context);
+
+ if (Constants.PREFERENCES_KEY_THEME_DARK.equalsIgnoreCase(theme) || "fullscreen".equalsIgnoreCase(theme))
+ {
+ context.setTheme(R.style.UltrasonicTheme);
+ }
+ else if (Constants.PREFERENCES_KEY_THEME_BLACK.equalsIgnoreCase(theme))
+ {
+ context.setTheme(R.style.UltrasonicTheme_Black);
+ }
+ else if (Constants.PREFERENCES_KEY_THEME_LIGHT.equalsIgnoreCase(theme) || "fullscreenlight".equalsIgnoreCase(theme))
+ {
+ context.setTheme(R.style.UltrasonicTheme_Light);
+ }
}
public static int getMaxBitRate(Context context)
diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/activity/EditServerActivity.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/activity/EditServerActivity.kt
index 5383d6d1..f987cda7 100644
--- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/activity/EditServerActivity.kt
+++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/activity/EditServerActivity.kt
@@ -61,7 +61,7 @@ internal class EditServerActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- applyTheme()
+ Util.applyTheme(this)
if (savedInstanceState == null) configureActionBar()
setContentView(R.layout.server_edit)
@@ -137,21 +137,6 @@ internal class EditServerActivity : AppCompatActivity() {
finishActivity()
}
- private fun applyTheme() {
- val theme = Util.getTheme(this)
- if (
- "dark".equals(theme, ignoreCase = true) ||
- "fullscreen".equals(theme, ignoreCase = true)
- ) {
- setTheme(R.style.UltrasonicTheme)
- } else if (
- "light".equals(theme, ignoreCase = true) ||
- "fullscreenlight".equals(theme, ignoreCase = true)
- ) {
- setTheme(R.style.UltrasonicTheme_Light)
- }
- }
-
private fun configureActionBar() {
val actionBar: ActionBar? = supportActionBar
if (actionBar != null) {
diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/activity/ServerSelectorActivity.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/activity/ServerSelectorActivity.kt
index 0cc48c2a..ae647fa1 100644
--- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/activity/ServerSelectorActivity.kt
+++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/activity/ServerSelectorActivity.kt
@@ -45,7 +45,7 @@ internal class ServerSelectorActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- applyTheme()
+ Util.applyTheme(this)
if (savedInstanceState == null) configureActionBar()
setContentView(R.layout.server_selector)
@@ -110,20 +110,6 @@ internal class ServerSelectorActivity : AppCompatActivity() {
}
)
}
- private fun applyTheme() {
- val theme = Util.getTheme(this)
- if (
- "dark".equals(theme, ignoreCase = true) ||
- "fullscreen".equals(theme, ignoreCase = true)
- ) {
- setTheme(R.style.UltrasonicTheme)
- } else if (
- "light".equals(theme, ignoreCase = true) ||
- "fullscreenlight".equals(theme, ignoreCase = true)
- ) {
- setTheme(R.style.UltrasonicTheme_Light)
- }
- }
private fun configureActionBar() {
val actionBar: ActionBar? = supportActionBar
diff --git a/ultrasonic/src/main/res/values-fr/strings.xml b/ultrasonic/src/main/res/values-fr/strings.xml
index ffb4d850..ca6ab828 100644
--- a/ultrasonic/src/main/res/values-fr/strings.xml
+++ b/ultrasonic/src/main/res/values-fr/strings.xml
@@ -301,6 +301,7 @@
Connexion en cours de test…
Connexion correcte
Connection correcte. Serveur sans licence.
+ Noir
Sombre
Clair
Thème
diff --git a/ultrasonic/src/main/res/values/arrays.xml b/ultrasonic/src/main/res/values/arrays.xml
index fc178dea..edc5a09f 100644
--- a/ultrasonic/src/main/res/values/arrays.xml
+++ b/ultrasonic/src/main/res/values/arrays.xml
@@ -2,12 +2,14 @@
- - light
- - dark
+ - @string/preferences_key_theme_light
+ - @string/preferences_key_theme_dark
+ - @string/preferences_key_theme_black
- @string/settings.theme_light
- @string/settings.theme_dark
+ - @string/settings.theme_black
- 1
diff --git a/ultrasonic/src/main/res/values/constants.xml b/ultrasonic/src/main/res/values/constants.xml
new file mode 100644
index 00000000..5f4df6c4
--- /dev/null
+++ b/ultrasonic/src/main/res/values/constants.xml
@@ -0,0 +1,10 @@
+
+
+
+ light
+ dark
+ black
+
+
diff --git a/ultrasonic/src/main/res/values/strings.xml b/ultrasonic/src/main/res/values/strings.xml
index e3c5ca39..b201ce14 100644
--- a/ultrasonic/src/main/res/values/strings.xml
+++ b/ultrasonic/src/main/res/values/strings.xml
@@ -303,8 +303,9 @@
Testing connection…
Connection is OK
Connection is OK. Server unlicensed.
- Dark
Light
+ Dark
+ Black
Theme
Allow self-signed HTTPS certificate
Enable support for LDAP users
diff --git a/ultrasonic/src/main/res/values/themes.xml b/ultrasonic/src/main/res/values/themes.xml
index 3e006f46..3948a79e 100644
--- a/ultrasonic/src/main/res/values/themes.xml
+++ b/ultrasonic/src/main/res/values/themes.xml
@@ -1,5 +1,63 @@
+
+