-
Notifications
You must be signed in to change notification settings - Fork 0
/
ColorThemeListPreference.cs
39 lines (33 loc) · 1.24 KB
/
ColorThemeListPreference.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using Android.Content;
using Android.Util;
using AndroidX.Preference;
namespace com.companyname.SplashScreen2
{
public class ColorThemeListPreference : ListPreference
{
internal readonly string DefaultThemeValue = "Select Color Theme";
internal string[] themeEntries = { "Red Bmw", "Blue Audi", "Green Bmw" };
internal string[] themeValues = { "1", "2", "3" };
#region Ctors
public ColorThemeListPreference(Context context) : base(context, null)
{
}
public ColorThemeListPreference(Context context, IAttributeSet attrs) : base(context, attrs)
{
}
#endregion
#region Init
public void Init()
{
// This is called from the SettingsFragment, just to update the Summary. It wont be called again each time OnCreateDialogview is called.
// Therefore we need to call FindIndexByValue again in OnCreateDialogView
SetEntries(themeEntries);
SetEntryValues(themeValues);
if (!string.IsNullOrEmpty(Value))
Summary = themeEntries[FindIndexOfValue(Value)]; // Get the current theme
else
Summary = DefaultThemeValue;
}
#endregion
}
}