// string literals
public const string TimeFormat = @"mm\:ss";
+ public const string LightPlatformThemeId = "org.tizen.default-light-theme";
+ public const string DarkPlatformThemeId = "org.tizen.default-dark-theme";
}
}
namespace MusicPlayer.Common
{
+ public enum ThemeType
+ {
+ Light,
+ Dark
+ };
public enum RepeatMode
{
Off,
Off,
}
+ public enum Favourite
+ {
+ On,
+ Off,
+ }
+
public enum EventType
{
Error,
{
return Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/";
}
+
+ public static string GetThemePath()
+ {
+ return Tizen.Applications.Application.Current.DirectoryInfo.Resource + "themes/";
+ }
}
}
TrackLength = currentTrack.Duration;
PlayingTime = TimeSpan.FromMilliseconds(0).ToString(AppConstants.TimeFormat);
ThumbnailPath = currentTrack.ThumbnailPath;
- PlayingStatus = PlayingStatus.None;
}
}
set => SetProperty(ref thumbnailPath, value);
}
- private PlayingStatus playingStatus;
-
- public PlayingStatus PlayingStatus
- {
- get => playingStatus;
- set { playingStatus = value; }
- }
-
private string playingTime;
public string PlayingTime
{
public class Application : NUIApplication
{
+ public Application() : base(ThemeOptions.PlatformThemeEnabled)
+ {
+
+ }
protected override void OnCreate()
{
Tizen.Log.Info(AppConstants.LogTag, "OnCreate statrted");
--- /dev/null
+using System.Collections.Generic;
+using Tizen.NUI;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Components;
+using MusicPlayer.Common;
+
+namespace MusicPlayer.Views.Utils
+{
+ class MultiStateButton: Button
+ {
+ public static readonly BindableProperty CustomStateProperty = BindableProperty.Create(nameof(CusotmState), typeof(string), typeof(MultiStateButton), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var instance = (MultiStateButton)bindable;
+ if (newValue != null)
+ {
+ string newCustomState = (string)newValue;
+ instance.UpdateCustomState(newCustomState);
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var instance = (MultiStateButton)bindable;
+ return instance.customState;
+ });
+
+ public MultiStateButton() : base()
+ {
+ ThemeChangeSensitive = true;
+ EnableControlState = true;
+ BackgroundColor = Color.Transparent;
+ }
+
+ private Dictionary<ThemeType, Dictionary<string, StringSelector>> iconResources;
+
+ public Dictionary<ThemeType, Dictionary<string, StringSelector>> IconResources
+ {
+ get => iconResources;
+ set => iconResources = value;
+ }
+
+ private string customState;
+ public string CusotmState
+ {
+ get => (string)GetValue(CustomStateProperty);
+ set => SetValue(CustomStateProperty, value);
+ }
+
+ private void UpdateCustomState(string customStatevalue)
+ {
+ if (IconResources == null)
+ {
+ Tizen.Log.Error(AppConstants.LogTag, "ThemesIconState needs to be set first");
+ return;
+ }
+ ThemeType type = GetCurrentThemeType();
+ if (iconResources.ContainsKey(type) == false)
+ {
+ Tizen.Log.Error(AppConstants.LogTag, "Theme state doesn't exists: " + type.ToString());
+ return;
+ }
+ Dictionary<string, StringSelector> stateResource = iconResources[type];
+ if (stateResource.ContainsKey(customStatevalue) == false)
+ {
+ Tizen.Log.Error(AppConstants.LogTag, "Invalid state: " + customStatevalue);
+ return;
+ }
+ IconURLSelector = stateResource[customStatevalue];
+ customState = customStatevalue;
+ }
+
+ private ThemeType GetCurrentThemeType()
+ {
+ ThemeType type;
+ string id = ThemeManager.PlatformThemeId;
+ if (id.Equals(AppConstants.LightPlatformThemeId))
+ {
+ type = ThemeType.Light;
+ }
+ else
+ {
+ type = ThemeType.Dark;
+ }
+ return type;
+ }
+
+ protected override void OnThemeChanged(object sender, ThemeChangedEventArgs e)
+ {
+ base.OnThemeChanged(sender, e);
+ UpdateCustomState(CusotmState);
+ }
+ }
+}
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Theme
+xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+xmlns:c="clr-namespace:Tizen.NUI.Components;assembly=Tizen.NUI.Components"
+Id="LightTheme">
+
+ <ViewStyle x:Key="AppBackground" BackgroundColor="#0E1017" />
+
+ <c:ButtonStyle x:Key="PrevButton" Size="48, 48" Position="168, 196" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/dark/prev.png" Pressed="*Resource*/images/prev_pressed.png" Disabled="*Resource*/images/prev_disabled.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="NextButton" Size="48, 48" Position="424, 196" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/dark/next.png" Pressed="*Resource*/images/next_pressed.png" Disabled="*Resource*/images/next_disabled.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="ShuffleButton" Size="48, 48" Position="0, 196" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/next.png" Pressed="*Resource*/images/next_pressed.png" Disabled="*Resource*/images/next_disabled.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="RepeatButton" Size="48, 48" Position="592, 196" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/next.png" Pressed="*Resource*/images/next_pressed.png" Disabled="*Resource*/images/next_disabled.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="ListButton" Size="48, 48" Position="0, 0" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/dark/playing_queue.png" Pressed="*Resource*/images/playing_queue_pressed.png" Disabled="*Resource*/images/playing_queue_disabled.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="PlaylistButton" Size="48, 48" Position="88, 0" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/dark/addtoplaylist.png" Pressed="*Resource*/images/addtoplaylist_pressed.png" Disabled="*Resource*/images/addtoplaylist_disabled.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="FavouriteButton" Size="48, 48" Position="176, 0" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/next.png" Pressed="*Resource*/images/next_pressed.png" Disabled="*Resource*/images/next_disabled.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="PlayAll" Size="48, 48" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/dark/addtoplaylist.png" Pressed="*Resource*/images/addtoplaylist_pressed.png" Disabled="*Resource*/images/addtoplaylist_disabled.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="PlaylistAdd" Size="48, 48" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/dark/shuffle_on.png" Pressed="*Resource*/images/shuffle_on_pressed.png" Disabled="*Resource*/images/shuffle_on_disabled.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:SliderStyle x:Key="Slider" TrackThickness="8" IndicatorType="Image">
+ <c:SliderStyle.Track>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>*Resource*/images/empty_track.png</ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:SliderStyle.Track>
+ <c:SliderStyle.Progress>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>*Resource*/images/dark/progress_track.png</ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:SliderStyle.Progress>
+ <c:SliderStyle.Thumb>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>*Resource*/images/dark/nomal_slider_handler.png</ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:SliderStyle.Thumb>
+ </c:SliderStyle>
+
+ <c:ButtonStyle x:Key="BackButton" Size="48, 48" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/dark/back.png" Pressed="*Resource*/images/back_pressed.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="MoreButton" Size="48, 48" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/dark/more.png" Pressed="*Resource*/images/more_pressed.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <ImageViewStyle x:Key="LeftVolume" Size="48, 48" Position="0, 336">
+ <ImageViewStyle.ResourceUrl>*Resource*/images/dark/left_sound_icon.png</ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+
+ <ImageViewStyle x:Key="RightVolume" Size="48, 48" Position="592, 336">
+ <ImageViewStyle.ResourceUrl>*Resource*/images/dark/right_sound_icon.png</ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+
+ <TextLabelStyle x:Key="LabelText" TextColor="#FFFFFF"></TextLabelStyle>
+
+ <TextLabelStyle x:Key="ItemLabel">
+ <TextLabelStyle.TextColor>
+ <Selector x:TypeArguments="Color" Normal="#FFFFFF" Selected="#1473E6"/>
+ </TextLabelStyle.TextColor>
+ </TextLabelStyle>
+
+</Theme>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Theme
+xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+xmlns:c="clr-namespace:Tizen.NUI.Components;assembly=Tizen.NUI.Components"
+Id="LightTheme">
+
+ <ViewStyle x:Key="AppBackground" BackgroundColor="#EEEFF1" />
+
+ <c:ButtonStyle x:Key="PrevButton" Size="48, 48" Position="168, 196" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/light/prev.png" Pressed="*Resource*/images/prev_pressed.png" Disabled="*Resource*/images/prev_disabled.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="NextButton" Size="48, 48" Position="424, 196" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent" >
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/light/next.png" Pressed="*Resource*/images/next_pressed.png" Disabled="*Resource*/images/next_disabled.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="ShuffleButton" Size="48, 48" Position="0, 196" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/next.png" Pressed="*Resource*/images/next_pressed.png" Disabled="*Resource*/images/next_disabled.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="RepeatButton" Size="48, 48" Position="592, 196" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/next.png" Pressed="*Resource*/images/next_pressed.png" Disabled="*Resource*/images/next_disabled.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="ListButton" Size="48, 48" Position="0, 0" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/light/playing_queue.png" Pressed="*Resource*/images/playing_queue_pressed.png" Disabled="*Resource*/images/playing_queue_disabled.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="PlaylistButton" Size="48, 48" Position="88, 0" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/light/addtoplaylist.png" Pressed="*Resource*/images/addtoplaylist_pressed.png" Disabled="*Resource*/images/addtoplaylist_disabled.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="FavouriteButton" Size="48, 48" Position="176, 0" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/next.png" Pressed="*Resource*/images/next_pressed.png" Disabled="*Resource*/images/next_disabled.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="PlayAll" Size="48, 48" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/light/addtoplaylist.png" Pressed="*Resource*/images/addtoplaylist_pressed.png" Disabled="*Resource*/images/addtoplaylist_disabled.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="PlaylistAdd" Size="48, 48" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/light/shuffle_on.png" Pressed="*Resource*/images/shuffle_on_pressed.png" Disabled="*Resource*/images/shuffle_on_disabled.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:SliderStyle x:Key="Slider" TrackThickness="8" IndicatorType="Image">
+ <c:SliderStyle.Track>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>*Resource*/images/empty_track.png</ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:SliderStyle.Track>
+ <c:SliderStyle.Progress>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>*Resource*/images/light/progress_track.png</ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:SliderStyle.Progress>
+ <c:SliderStyle.Thumb>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>*Resource*/images/light/nomal_slider_handler.png</ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:SliderStyle.Thumb>
+ </c:SliderStyle>
+
+ <c:ButtonStyle x:Key="BackButton" Size="48, 48" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/light/back.png" Pressed="*Resource*/images/back_pressed.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="MoreButton" Size="48, 48" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle>
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/light/more.png" Pressed="*Resource*/images/more_pressed.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <ImageViewStyle x:Key="LeftVolume" Size="48, 48" Position="0, 336">
+ <ImageViewStyle.ResourceUrl>*Resource*/images/light/left_sound_icon.png</ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+
+ <ImageViewStyle x:Key="RightVolume" Size="48, 48" Position="592, 336">
+ <ImageViewStyle.ResourceUrl>*Resource*/images/light/right_sound_icon.png</ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+
+ <TextLabelStyle x:Key="LabelText" TextColor="#001447"/>
+
+ <TextLabelStyle x:Key="ItemLabel">
+ <TextLabelStyle.TextColor>
+ <Selector x:TypeArguments="Color" Normal="#001447" Selected="#1473E6"/>
+ </TextLabelStyle.TextColor>
+ </TextLabelStyle>
+
+</Theme>
\ No newline at end of file