Merge pull request #326 from Maxmystere/develop
Add Material Black Theme
This commit is contained in:
commit
25854ab808
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -301,6 +301,7 @@
|
|||
<string name="settings.testing_connection">Connexion en cours de test…</string>
|
||||
<string name="settings.testing_ok">Connexion correcte</string>
|
||||
<string name="settings.testing_unlicensed">Connection correcte. Serveur sans licence.</string>
|
||||
<string name="settings.theme_black">Noir</string>
|
||||
<string name="settings.theme_dark">Sombre</string>
|
||||
<string name="settings.theme_light">Clair</string>
|
||||
<string name="settings.theme_title">Thème</string>
|
||||
|
|
|
@ -2,12 +2,14 @@
|
|||
<resources>
|
||||
|
||||
<string-array name="themeValues" translatable="false">
|
||||
<item>light</item>
|
||||
<item>dark</item>
|
||||
<item>@string/preferences_key_theme_light</item>
|
||||
<item>@string/preferences_key_theme_dark</item>
|
||||
<item>@string/preferences_key_theme_black</item>
|
||||
</string-array>
|
||||
<string-array name="themeNames" translatable="false">
|
||||
<item>@string/settings.theme_light</item>
|
||||
<item>@string/settings.theme_dark</item>
|
||||
<item>@string/settings.theme_black</item>
|
||||
</string-array>
|
||||
<string-array name="preloadCountValues" translatable="false">
|
||||
<item>1</item>
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!--
|
||||
Do not forget to match string ressources with constants
|
||||
-->
|
||||
<string translatable="false" name="preferences_key_theme_light">light</string>
|
||||
<string translatable="false" name="preferences_key_theme_dark">dark</string>
|
||||
<string translatable="false" name="preferences_key_theme_black">black</string>
|
||||
|
||||
</resources>
|
|
@ -303,8 +303,9 @@
|
|||
<string name="settings.testing_connection">Testing connection…</string>
|
||||
<string name="settings.testing_ok">Connection is OK</string>
|
||||
<string name="settings.testing_unlicensed">Connection is OK. Server unlicensed.</string>
|
||||
<string name="settings.theme_dark">Dark</string>
|
||||
<string name="settings.theme_light">Light</string>
|
||||
<string name="settings.theme_dark">Dark</string>
|
||||
<string name="settings.theme_black">Black</string>
|
||||
<string name="settings.theme_title">Theme</string>
|
||||
<string name="settings.title.allow_self_signed_certificate">Allow self-signed HTTPS certificate</string>
|
||||
<string name="settings.title.enable_ldap_users_support">Enable support for LDAP users</string>
|
||||
|
|
|
@ -1,5 +1,63 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="UltrasonicTheme.Black" parent="Theme.MaterialComponents">
|
||||
<item name="color_background">@color/background_color_dark</item>
|
||||
<item name="color_selected">@color/selected_color_dark</item>
|
||||
<item name="star_hollow">@drawable/ic_star_hollow_dark</item>
|
||||
<item name="star_full">@drawable/ic_star_full_dark</item>
|
||||
<item name="about">@drawable/ic_menu_about_dark</item>
|
||||
<item name="select_all">@drawable/ic_menu_select_all_dark</item>
|
||||
<item name="add_to_queue">@drawable/ic_menu_add_to_queue_dark</item>
|
||||
<item name="browse">@drawable/ic_menu_browse_dark</item>
|
||||
<item name="exit">@drawable/ic_menu_exit_dark</item>
|
||||
<item name="backward">@drawable/ic_menu_backward_dark</item>
|
||||
<item name="forward">@drawable/ic_menu_forward_dark</item>
|
||||
<item name="stop">@drawable/ic_menu_close_dark</item>
|
||||
<item name="help">@drawable/ic_menu_help_dark</item>
|
||||
<item name="home">@drawable/ic_menu_home_dark</item>
|
||||
<item name="pin">@drawable/ic_menu_pin_dark</item>
|
||||
<item name="unpin">@drawable/ic_menu_unpin_dark</item>
|
||||
<item name="playlists">@drawable/ic_menu_playlists_dark</item>
|
||||
<item name="remove_all">@drawable/ic_menu_remove_all_dark</item>
|
||||
<item name="save">@drawable/ic_menu_save_dark</item>
|
||||
<item name="screen_on_off">@drawable/ic_menu_screen_on_off_dark</item>
|
||||
<item name="search">@drawable/ic_menu_search_holo_dark</item>
|
||||
<item name="server">@drawable/ic_menu_server_dark</item>
|
||||
<item name="select_server">@drawable/ic_menu_select_server_dark</item>
|
||||
<item name="select_folder">@drawable/ic_menu_select_folder_dark</item>
|
||||
<item name="settings">@drawable/ic_menu_settings_dark</item>
|
||||
<item name="share">@drawable/ic_menu_share_dark</item>
|
||||
<item name="download">@drawable/ic_menu_download_dark</item>
|
||||
<item name="downloaded">@drawable/stat_sys_download_anim_0_dark</item>
|
||||
<item name="downloading">@drawable/stat_sys_download_dark</item>
|
||||
<item name="media_previous">@drawable/media_backward_normal_dark</item>
|
||||
<item name="media_next">@drawable/media_forward_normal_dark</item>
|
||||
<item name="media_pause">@drawable/media_pause_normal_dark</item>
|
||||
<item name="media_repeat_all">@drawable/media_repeat_all_dark</item>
|
||||
<item name="media_repeat_off">@drawable/media_repeat_off_dark</item>
|
||||
<item name="media_repeat_single">@drawable/media_repeat_one_dark</item>
|
||||
<item name="media_shuffle">@drawable/media_shuffle_normal_dark</item>
|
||||
<item name="media_play">@drawable/media_start_normal_dark</item>
|
||||
<item name="podcasts">@drawable/ic_menu_podcasts_dark</item>
|
||||
<item name="refresh">@drawable/ic_menu_refresh_dark</item>
|
||||
<item name="media_play_next">@drawable/media_play_next_dark</item>
|
||||
<item name="media_play_small">@drawable/ic_stat_play_dark</item>
|
||||
<item name="media_stop">@drawable/media_stop_normal_dark</item>
|
||||
<item name="media_toggle">@drawable/media_toggle_list_normal_dark</item>
|
||||
<item name="chat">@drawable/ic_menu_chat_dark</item>
|
||||
<item name="chat_send">@drawable/ic_menu_chat_send_dark</item>
|
||||
<item name="bookmark">@drawable/ic_menu_bookmark_dark</item>
|
||||
<item name="button_check_custom">@drawable/btn_check_custom_dark</item>
|
||||
<item name="filepicker_create_new_folder">@drawable/ic_create_new_folder_dark</item>
|
||||
<item name="filepicker_folder">@drawable/ic_folder_dark</item>
|
||||
<item name="filepicker_subdirectory_up">@drawable/ic_subdirectory_up_dark</item>
|
||||
<item name="filepicker_sd_card">@drawable/ic_sd_storage_dark</item>
|
||||
<item name="drag_queue">@drawable/ic_drag_queue_dark</item>
|
||||
<item name="more_vert">@drawable/ic_more_vert_dark</item>
|
||||
<item name="list_selector_holo">@drawable/list_selector_holo_dark</item>
|
||||
<item name="list_selector_holo_selected">@drawable/list_selector_holo_dark_selected</item>
|
||||
</style>
|
||||
|
||||
<style name="UltrasonicTheme" parent="Theme.AppCompat">
|
||||
<item name="color_background">@color/background_color_dark</item>
|
||||
<item name="color_selected">@color/selected_color_dark</item>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</PreferenceCategory>
|
||||
<PreferenceCategory a:title="@string/settings.appearance_title">
|
||||
<ListPreference
|
||||
a:defaultValue="dark"
|
||||
a:defaultValue="@string/preferences_key_theme_dark"
|
||||
a:entries="@array/themeNames"
|
||||
a:entryValues="@array/themeValues"
|
||||
a:key="theme"
|
||||
|
|
Loading…
Reference in New Issue