Beállítások menü és sötét/világos téma hozzáadva!

Több óra próbálkozással
De működik
This commit is contained in:
Norbi Peti 2017-03-11 22:25:37 +01:00
parent 665b3327f7
commit de330e854c
18 changed files with 268 additions and 118 deletions

View file

@ -14,8 +14,8 @@ namespace Orarend
{ {
[DataContract] [DataContract]
public class API public class API
{ //TODO: Beállítások: Téma (sötét, világos) (Android; platformfüggő beállítások), Előre megadott egyedi nevek használata { //TODO: Előre megadott egyedi nevek használata
internal static API példány = new API(); internal static API példány = new API(); //TODO: FrissítésHa1ÓraEltelt() mentés
private API() private API()
{ {
} }
@ -28,7 +28,7 @@ namespace Orarend
public Osztály[] osztályok { get; private set; } public Osztály[] osztályok { get; private set; }
[DataMember(Order = 2)] [DataMember(Order = 2)]
public List<Órarend> órarendek { get; private set; } = new List<Órarend>(); public List<Órarend> órarendek { get; private set; } = new List<Órarend>();
[DataMember] //[DataMember]
public Settings beállítások { get; private set; } = new Settings(); public Settings beállítások { get; private set; } = new Settings();
/// <summary> /// <summary>
/// <para>Visszatér az osztályok listájával.</para> /// <para>Visszatér az osztályok listájával.</para>

View file

@ -7,13 +7,9 @@ using System.Threading.Tasks;
namespace Orarend namespace Orarend
{ {
[DataContract] [DataContract] //
public class Settings public class Settings
{ {
[DataMember]
public bool DarkTheme { get; set; }
[DataMember]
public TimeSpan Difference { get; set; } //TODO
public void UseCommonNames() public void UseCommonNames()
{ {
set("mateme", "Matek"); set("mateme", "Matek");

View file

@ -0,0 +1,27 @@
using Android.App;
using Android.OS;
using Android.Preferences;
namespace OrarendAndroidApp
{
public class ActivityBase : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetTheme(this);
}
public static void SetTheme(Activity activity)
{
var settings = PreferenceManager.GetDefaultSharedPreferences(activity);
bool darktheme = settings.GetBoolean("pref_theme", false);
if (activity is ActivityBase)
(activity as ActivityBase).DarkTheme = darktheme;
activity.SetTheme(darktheme ? Android.Resource.Style.ThemeDeviceDefault : Android.Resource.Style.ThemeDeviceDefaultLight);
}
public bool DarkTheme;
}
}

View file

@ -11,11 +11,12 @@ using Android.Views;
using Android.Widget; using Android.Widget;
using Orarend; using Orarend;
using Android.Graphics; using Android.Graphics;
using Android.Preferences;
namespace OrarendAndroidApp namespace OrarendAndroidApp
{ {
[Activity(Label = "AddActivity", Theme = "@android:style/Theme.Holo.Light")] [Activity(Label = "AddActivity", Theme = "@android:style/Theme.Holo.Light")]
public class EditActivity : Activity public class EditActivity : ActivityBase
{ {
private bool add; private bool add;
private int index; private int index;

View file

@ -13,25 +13,32 @@ using System.Threading.Tasks;
using System.Threading; using System.Threading;
using System.IO; using System.IO;
using System.Net; using System.Net;
using Android.Preferences;
namespace OrarendAndroidApp namespace OrarendAndroidApp
{ {
[Activity(Label = "Órarend", MainLauncher = true, Theme = "@android:style/Theme.Holo.Light")] [Activity(Label = "Órarend", MainLauncher = true, Theme = "@android:style/Theme.Holo.Light")]
public class MainActivity : Activity public class MainActivity : ActivityBase
{ {
private Handler handler; private Handler handler;
private Órarend órarend; private Órarend órarend;
private Timer timer; private Timer timer;
private const int EDIT_ADD_ACT_REQUEST = 1; private const int EDIT_ADD_ACT_REQUEST = 1;
private const int SETTINGS_ACT_REQUEST = 2;
public const string DATA_FILENAME = "data.json"; public const string DATA_FILENAME = "data.json";
protected override void OnCreate(Bundle bundle) protected override void OnCreate(Bundle bundle)
{ {
AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironment_UnhandledExceptionRaiser;
base.OnCreate(bundle); base.OnCreate(bundle);
//RequestWindowFeature(WindowFeatures.ActionBar);
SetContentView(Resource.Layout.MainLayout); SetContentView(Resource.Layout.MainLayout);
//SetActionBar(new Toolbar(this));
ActionBar.SetDisplayShowTitleEnabled(false); ActionBar.SetDisplayShowTitleEnabled(false);
ActionBar.CustomView = FindViewById<Spinner>(Resource.Id.spinner); //ActionBar.CustomView = new Spinner(this);
//ActionBar.CustomView = FindViewById<Spinner>(Resource.Id.spinner);
//ActionBar.SetCustomView(FindViewById<Spinner>(Resource.Id.spinner), new ActionBar.LayoutParams(GravityFlags.Left));
handler = new Handler(); handler = new Handler();
string[] list = FileList(); string[] list = FileList();
if (list.Contains(DATA_FILENAME)) if (list.Contains(DATA_FILENAME))
@ -39,11 +46,18 @@ namespace OrarendAndroidApp
timer = new Timer(CsengőTimer, null, new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 5)); timer = new Timer(CsengőTimer, null, new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 5));
} }
private void AndroidEnvironment_UnhandledExceptionRaiser(object sender, RaiseThrowableEventArgs e)
{
if (!e.Handled)
Hiba("Kezeletlen hiba!\n" + e.Exception);
e.Handled = true;
}
private Spinner list;
private void órarendlistafrissítés() private void órarendlistafrissítés()
{ {
handler.Post(() => handler.Post(() =>
{ {
var list = FindViewById<Spinner>(Resource.Id.spinner);
int selected = list.SelectedItemPosition; int selected = list.SelectedItemPosition;
int count = list.Count; int count = list.Count;
ArrayAdapter adapter; ArrayAdapter adapter;
@ -78,7 +92,7 @@ namespace OrarendAndroidApp
textview.SetText(text, TextView.BufferType.Normal); textview.SetText(text, TextView.BufferType.Normal);
textview.SetTextColor(color); textview.SetTextColor(color);
textview.SetPadding(10, 10, 10, 10); textview.SetPadding(10, 10, 10, 10);
textview.SetBackgroundResource(Resource.Drawable.cell_shape_light); textview.SetBackgroundResource(DarkTheme ? Resource.Drawable.cell_shape_dark : Resource.Drawable.cell_shape_light);
textview.Tag = tag; textview.Tag = tag;
textview.Clickable = true; textview.Clickable = true;
textview.Click += ÓraClick; textview.Click += ÓraClick;
@ -88,11 +102,11 @@ namespace OrarendAndroidApp
private void HelyettesítésFrissítés(bool internethiba = true) private void HelyettesítésFrissítés(bool internethiba = true)
{ {
var bar = FindViewById<ProgressBar>(Resource.Id.progressBar1); var bar = FindViewById<ProgressBar>(Resource.Id.progressBar1);
var menu = FindViewById<ActionMenuView>(Resource.Id.actionMenuView1); //var menu = FindViewById<ActionMenuView>(Resource.Id.actionMenuView1);
Action loadstart = () => Action loadstart = () =>
{ {
bar.Visibility = ViewStates.Visible; bar.Visibility = ViewStates.Visible;
menu.Enabled = false; //menu.Enabled = false;
}; };
handler.Post(loadstart); handler.Post(loadstart);
API.HelyettesítésFrissítés(() => OpenFileOutput(DATA_FILENAME, FileCreationMode.Private)).ContinueWith(t => API.HelyettesítésFrissítés(() => OpenFileOutput(DATA_FILENAME, FileCreationMode.Private)).ContinueWith(t =>
@ -101,7 +115,7 @@ namespace OrarendAndroidApp
handler.Post(() => handler.Post(() =>
{ {
bar.Visibility = ViewStates.Gone; bar.Visibility = ViewStates.Gone;
menu.Enabled = true; //menu.Enabled = true;
if (TaskHiba(t, internethiba)) if (TaskHiba(t, internethiba))
{ {
órarendfrissítés(); órarendfrissítés();
@ -115,11 +129,11 @@ namespace OrarendAndroidApp
private void ÓrarendFrissítés(Órarend ór = null) private void ÓrarendFrissítés(Órarend ór = null)
{ {
var bar = FindViewById<ProgressBar>(Resource.Id.progressBar1); var bar = FindViewById<ProgressBar>(Resource.Id.progressBar1);
var menu = FindViewById<ActionMenuView>(Resource.Id.actionMenuView1); //var menu = FindViewById<ActionMenuView>(Resource.Id.actionMenuView1);
Action loadstart = () => Action loadstart = () =>
{ {
bar.Visibility = ViewStates.Visible; bar.Visibility = ViewStates.Visible;
menu.Enabled = false; //menu.Enabled = false;
}; };
handler.Post(loadstart); handler.Post(loadstart);
API.Frissítés(() => OpenFileOutput(DATA_FILENAME, FileCreationMode.Private), ór).ContinueWith(t => API.Frissítés(() => OpenFileOutput(DATA_FILENAME, FileCreationMode.Private), ór).ContinueWith(t =>
@ -151,9 +165,9 @@ namespace OrarendAndroidApp
if (órarend == null) if (órarend == null)
return; return;
TableRow tr = new TableRow(this); TableRow tr = new TableRow(this);
addCell(API.AHét ? "A" : "B", Color.Black, tr); addCell(API.AHét ? "A" : "B", DarkTheme ? Color.White : Color.Black, tr);
for (int i = 0; i < Napok.Length; i++) for (int i = 0; i < Napok.Length; i++)
addCell(Napok[i], Color.Black, tr); addCell(Napok[i], DarkTheme ? Color.White : Color.Black, tr);
table.AddView(tr, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent)); table.AddView(tr, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent));
for (int j = 0; j < 16; j++) for (int j = 0; j < 16; j++)
{ {
@ -169,14 +183,13 @@ namespace OrarendAndroidApp
} }
if (notnull) if (notnull)
{ {
addCell((j + 1).ToString(), Color.Black, tr); addCell((j + 1).ToString(), DarkTheme ? Color.White : Color.Black, tr);
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
{ {
var innenide = helyettesítésInnenIde(i, j); var innenide = helyettesítésInnenIde(i, j);
var helyettesítés = innenide[0]; var helyettesítés = innenide[0];
var helyettesítésIde = innenide[1]; var helyettesítésIde = innenide[1];
//addCell(helyettesítés?.ÚjÓra?.EgyediNév ?? órarend.Órák[i][j]?.EgyediNév ?? "", helyettesítés == null ? Color.Black : Color.Red, tr, new int[2] { i, j }); addCell(helyettesítésIde != null ? helyettesítésIde.ÚjÓra.EgyediNév : helyettesítés != null ? helyettesítés.EredetiNap != helyettesítés.ÚjNap || helyettesítés.EredetiSorszám != helyettesítés.ÚjSorszám ? "Áthelyezve" : helyettesítés.ÚjÓra?.EgyediNév ?? "elmarad" : órarend.Órák[i][j]?.EgyediNév ?? "", helyettesítés == null ? (DarkTheme ? Color.WhiteSmoke : Color.Black) : Color.Red, tr, new int[2] { i, j });
addCell(helyettesítésIde != null ? helyettesítésIde.ÚjÓra.EgyediNév : helyettesítés != null ? helyettesítés.EredetiNap != helyettesítés.ÚjNap || helyettesítés.EredetiSorszám != helyettesítés.ÚjSorszám ? "Áthelyezve" : helyettesítés.ÚjÓra?.EgyediNév ?? "elmarad" : órarend.Órák[i][j]?.EgyediNév ?? "", helyettesítés == null ? Color.Black : Color.Red, tr, new int[2] { i, j });
} }
table.AddView(tr, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent)); table.AddView(tr, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent));
} }
@ -212,7 +225,7 @@ namespace OrarendAndroidApp
var tv = (TextView)sender; var tv = (TextView)sender;
var ij = (int[])tv.Tag; var ij = (int[])tv.Tag;
if (selected != null && selected != sender) if (selected != null && selected != sender)
selected.SetBackgroundResource(Resource.Drawable.cell_shape_light); selected.SetBackgroundResource(DarkTheme ? Resource.Drawable.cell_shape_dark : Resource.Drawable.cell_shape_light);
Óra óra; Óra óra;
Helyettesítés helyettesítésInnen = null; Helyettesítés helyettesítésInnen = null;
Helyettesítés helyettesítésIde = null; Helyettesítés helyettesítésIde = null;
@ -227,7 +240,7 @@ namespace OrarendAndroidApp
deselect(); deselect();
return; return;
} }
tv.SetBackgroundResource(Resource.Drawable.cell_shape_selected_light); tv.SetBackgroundResource(DarkTheme ? Resource.Drawable.cell_shape_selected_dark : Resource.Drawable.cell_shape_selected_light);
selected = tv; selected = tv;
var kivora = FindViewById<TextView>(Resource.Id.kivoraTV); var kivora = FindViewById<TextView>(Resource.Id.kivoraTV);
if (óra == null) if (óra == null)
@ -268,6 +281,15 @@ namespace OrarendAndroidApp
public override bool OnCreateOptionsMenu(IMenu menu) public override bool OnCreateOptionsMenu(IMenu menu)
{ {
MenuInflater.Inflate(Resource.Menu.main_menu_light, menu); MenuInflater.Inflate(Resource.Menu.main_menu_light, menu);
ActionBar.SetCustomView(list = new Spinner(this, SpinnerMode.Dropdown), new ActionBar.LayoutParams(ActionBar.LayoutParams.MatchParent, ActionBar.LayoutParams.MatchParent, GravityFlags.Left));
ActionBar.SetDisplayShowCustomEnabled(true);
if (DarkTheme)
{
menu.FindItem(Resource.Id.menu_add).SetIcon(Resource.Drawable.ic_add_white_24dp);
menu.FindItem(Resource.Id.menu_edit).SetIcon(Resource.Drawable.ic_create_white_24dp);
menu.FindItem(Resource.Id.menu_refresh).SetIcon(Resource.Drawable.ic_autorenew_white_24dp);
menu.FindItem(Resource.Id.menu_preferences).SetIcon(Resource.Drawable.ic_settings_white_24dp);
}
if (API.Osztályok == null || API.Osztályok.Length == 0) if (API.Osztályok == null || API.Osztályok.Length == 0)
ÓrarendFrissítés(); ÓrarendFrissítés();
else else
@ -304,8 +326,12 @@ namespace OrarendAndroidApp
StartActivityForResult(intent, EDIT_ADD_ACT_REQUEST); StartActivityForResult(intent, EDIT_ADD_ACT_REQUEST);
break; break;
} }
case Resource.Id.menu_preferences: //TODO case Resource.Id.menu_preferences:
break; {
var intent = new Intent(this, typeof(SettingsActivity));
StartActivityForResult(intent, SETTINGS_ACT_REQUEST);
break;
}
case Resource.Id.menu_fullrefresh: case Resource.Id.menu_fullrefresh:
{ {
ÓrarendFrissítés(); ÓrarendFrissítés();
@ -360,7 +386,7 @@ namespace OrarendAndroidApp
return; return;
} }
var most = DateTime.Now - DateTime.Today; var most = DateTime.Now - DateTime.Today;
//var most = new TimeSpan(13, 46, 0); //var most = new TimeSpan(9, 46, 0);
bool talált = false; bool talált = false;
var kovora = FindViewById<TextView>(Resource.Id.kovoraTV); var kovora = FindViewById<TextView>(Resource.Id.kovoraTV);
nincstöbbóra = false; nincstöbbóra = false;
@ -375,15 +401,17 @@ namespace OrarendAndroidApp
var vége = órarend.Órakezdetek[i].Add(new TimeSpan(0, 45, 0)); var vége = órarend.Órakezdetek[i].Add(new TimeSpan(0, 45, 0));
bool becsengetés; bool becsengetés;
int x = (int)DateTime.Today.DayOfWeek - 1; //TODO: A mai nap és ez az egész az API-ba int x = (int)DateTime.Today.DayOfWeek - 1; //TODO: A mai nap és ez az egész az API-ba
//x = 2; //TODO: TMP
Óra óra; Óra óra;
var innenide = helyettesítésInnenIde(x, i); var innenide = helyettesítésInnenIde(x, i);
Func<TimeSpan, string> óraperc = ts => ts.Hours > 0 ? ts.ToString("h\\ómm\\p") : ts.ToString("mm") + " perc";
if (x != -1 && x < 6 && (óra = innenide[1] != null ? innenide[1].ÚjÓra : innenide[0] != null ? innenide[0].EredetiNap != innenide[0].ÚjNap || innenide[0].EredetiSorszám != innenide[0].ÚjSorszám ? null : innenide[0].ÚjÓra : órarend.Órák[x][i]) != null) if (x != -1 && x < 6 && (óra = innenide[1] != null ? innenide[1].ÚjÓra : innenide[0] != null ? innenide[0].EredetiNap != innenide[0].ÚjNap || innenide[0].EredetiSorszám != innenide[0].ÚjSorszám ? null : innenide[0].ÚjÓra : órarend.Órák[x][i]) != null)
{ //-1: Vasárnap { //-1: Vasárnap
if (most > órarend.Órakezdetek[i]) if (most > órarend.Órakezdetek[i])
{ {
if (most < vége) if (most < vége)
{ {
kezdveg.Text = "Kicsengetés: " + (vége - most).ToString("hh\\:mm\\:ss"); kezdveg.Text = "Kicsengetés: " + óraperc(vége - most);
talált = true; talált = true;
becsengetés = false; becsengetés = false;
} }
@ -392,7 +420,7 @@ namespace OrarendAndroidApp
} }
else else
{ {
kezdveg.Text = "Becsengetés: " + (órarend.Órakezdetek[i] - most).ToString("hh\\:mm\\:ss"); kezdveg.Text = "Becsengetés: " + óraperc(órarend.Órakezdetek[i] - most);
talált = true; talált = true;
becsengetés = true; becsengetés = true;
} }
@ -415,11 +443,11 @@ namespace OrarendAndroidApp
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data) protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
{ {
base.OnActivityResult(requestCode, resultCode, data); base.OnActivityResult(requestCode, resultCode, data);
if (resultCode == Result.Canceled)
return;
int index = data.Extras.GetBoolean("add") ? API.Órarendek.Count - 1 : data.Extras.GetInt("index");
if (requestCode == EDIT_ADD_ACT_REQUEST) if (requestCode == EDIT_ADD_ACT_REQUEST)
{ {
if (resultCode == Result.Canceled)
return;
int index = data.Extras.GetBoolean("add") ? API.Órarendek.Count - 1 : data.Extras.GetInt("index");
if (!data.Extras.GetBoolean("deleted")) if (!data.Extras.GetBoolean("deleted"))
ÓrarendFrissítés(API.Órarendek[index]); ÓrarendFrissítés(API.Órarendek[index]);
else else
@ -429,6 +457,10 @@ namespace OrarendAndroidApp
} }
órarendlistafrissítés(); órarendlistafrissítés();
} }
else if (requestCode == SETTINGS_ACT_REQUEST)
{
Recreate();
}
} }
public override void OnWindowFocusChanged(bool hasFocus) public override void OnWindowFocusChanged(bool hasFocus)

View file

@ -57,10 +57,12 @@
<Reference Include="System.Core" /> <Reference Include="System.Core" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ActivityBase.cs" />
<Compile Include="EditActivity.cs" /> <Compile Include="EditActivity.cs" />
<Compile Include="MainActivity.cs" /> <Compile Include="MainActivity.cs" />
<Compile Include="Resources\Resource.Designer.cs" /> <Compile Include="Resources\Resource.Designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SettingsActivity.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="GettingStarted.Xamarin" /> <None Include="GettingStarted.Xamarin" />
@ -117,15 +119,30 @@
</AndroidResource> </AndroidResource>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<AndroidResource Include="Resources\drawable\cell_shape_removed_light.xml"> <AndroidResource Include="Resources\xml\preferences.xml" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\cell_shape_dark.xml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</AndroidResource> </AndroidResource>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<AndroidResource Include="Resources\drawable\cell_shape_added_light.xml"> <AndroidResource Include="Resources\drawable\cell_shape_selected_dark.xml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</AndroidResource> </AndroidResource>
</ItemGroup> </ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\ic_add_white_24dp.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\ic_autorenew_white_24dp.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\ic_create_white_24dp.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\ic_settings_white_24dp.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.github.norbipeti.orarend" android:versionCode="1" android:versionName="1.0" android:installLocation="auto"> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.github.norbipeti.orarend" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
<uses-sdk android:minSdkVersion="14" /> <uses-sdk android:minSdkVersion="11" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<application android:label="Orarend"></application> <application android:label="Orarend"></application>
</manifest> </manifest>

View file

@ -45,13 +45,13 @@ namespace OrarendAndroidApp
{ {
// aapt resource value: 0x7f020000 // aapt resource value: 0x7f020000
public const int cell_shape_added_light = 2130837504; public const int cell_shape_dark = 2130837504;
// aapt resource value: 0x7f020001 // aapt resource value: 0x7f020001
public const int cell_shape_light = 2130837505; public const int cell_shape_light = 2130837505;
// aapt resource value: 0x7f020002 // aapt resource value: 0x7f020002
public const int cell_shape_removed_light = 2130837506; public const int cell_shape_selected_dark = 2130837506;
// aapt resource value: 0x7f020003 // aapt resource value: 0x7f020003
public const int cell_shape_selected_light = 2130837507; public const int cell_shape_selected_light = 2130837507;
@ -60,16 +60,28 @@ namespace OrarendAndroidApp
public const int ic_add_black_24dp = 2130837508; public const int ic_add_black_24dp = 2130837508;
// aapt resource value: 0x7f020005 // aapt resource value: 0x7f020005
public const int ic_autorenew_black_24dp = 2130837509; public const int ic_add_white_24dp = 2130837509;
// aapt resource value: 0x7f020006 // aapt resource value: 0x7f020006
public const int ic_create_black_24dp = 2130837510; public const int ic_autorenew_black_24dp = 2130837510;
// aapt resource value: 0x7f020007 // aapt resource value: 0x7f020007
public const int ic_settings_black_24dp = 2130837511; public const int ic_autorenew_white_24dp = 2130837511;
// aapt resource value: 0x7f020008 // aapt resource value: 0x7f020008
public const int Icon = 2130837512; public const int ic_create_black_24dp = 2130837512;
// aapt resource value: 0x7f020009
public const int ic_create_white_24dp = 2130837513;
// aapt resource value: 0x7f02000a
public const int ic_settings_black_24dp = 2130837514;
// aapt resource value: 0x7f02000b
public const int ic_settings_white_24dp = 2130837515;
// aapt resource value: 0x7f02000c
public const int Icon = 2130837516;
static Drawable() static Drawable()
{ {
@ -84,89 +96,83 @@ namespace OrarendAndroidApp
public partial class Id public partial class Id
{ {
// aapt resource value: 0x7f06000d // aapt resource value: 0x7f07000d
public const int ScrollView01 = 2131099661; public const int ScrollView01 = 2131165197;
// aapt resource value: 0x7f06000a // aapt resource value: 0x7f07000a
public const int ScrollView02 = 2131099658; public const int ScrollView02 = 2131165194;
// aapt resource value: 0x7f060015 // aapt resource value: 0x7f070009
public const int actionMenuView1 = 2131099669; public const int container = 2131165193;
// aapt resource value: 0x7f060009 // aapt resource value: 0x7f070005
public const int container = 2131099657; public const int csoportokEditText = 2131165189;
// aapt resource value: 0x7f060005 // aapt resource value: 0x7f070008
public const int csoportokEditText = 2131099653; public const int deleteButton = 2131165192;
// aapt resource value: 0x7f060008 // aapt resource value: 0x7f070011
public const int deleteButton = 2131099656; public const int helyTV = 2131165201;
// aapt resource value: 0x7f060011 // aapt resource value: 0x7f07000e
public const int helyTV = 2131099665; public const int horizontalView = 2131165198;
// aapt resource value: 0x7f06000e // aapt resource value: 0x7f070012
public const int horizontalView = 2131099662; public const int kezdvegTV = 2131165202;
// aapt resource value: 0x7f060012 // aapt resource value: 0x7f070010
public const int kezdvegTV = 2131099666; public const int kivoraTV = 2131165200;
// aapt resource value: 0x7f060010 // aapt resource value: 0x7f070013
public const int kivoraTV = 2131099664; public const int kovoraTV = 2131165203;
// aapt resource value: 0x7f060013 // aapt resource value: 0x7f070016
public const int kovoraTV = 2131099667; public const int menu_add = 2131165206;
// aapt resource value: 0x7f060018 // aapt resource value: 0x7f070017
public const int menu_add = 2131099672; public const int menu_edit = 2131165207;
// aapt resource value: 0x7f060019 // aapt resource value: 0x7f070019
public const int menu_edit = 2131099673; public const int menu_fullrefresh = 2131165209;
// aapt resource value: 0x7f06001b // aapt resource value: 0x7f070018
public const int menu_fullrefresh = 2131099675; public const int menu_preferences = 2131165208;
// aapt resource value: 0x7f06001a // aapt resource value: 0x7f070015
public const int menu_preferences = 2131099674; public const int menu_refresh = 2131165205;
// aapt resource value: 0x7f060017 // aapt resource value: 0x7f070001
public const int menu_refresh = 2131099671; public const int névEditText = 2131165185;
// aapt resource value: 0x7f060001 // aapt resource value: 0x7f070014
public const int névEditText = 2131099649; public const int osztalylistaTV = 2131165204;
// aapt resource value: 0x7f060014 // aapt resource value: 0x7f070003
public const int osztalylistaTV = 2131099668; public const int osztálySpinner = 2131165187;
// aapt resource value: 0x7f060003 // aapt resource value: 0x7f07000c
public const int osztálySpinner = 2131099651; public const int progressBar1 = 2131165196;
// aapt resource value: 0x7f06000c // aapt resource value: 0x7f070007
public const int progressBar1 = 2131099660; public const int saveButton = 2131165191;
// aapt resource value: 0x7f060007 // aapt resource value: 0x7f07000b
public const int saveButton = 2131099655; public const int scrollLinearLayout = 2131165195;
// aapt resource value: 0x7f06000b // aapt resource value: 0x7f07000f
public const int scrollLinearLayout = 2131099659; public const int tableLayout1 = 2131165199;
// aapt resource value: 0x7f060016 // aapt resource value: 0x7f070000
public const int spinner = 2131099670; public const int textView1 = 2131165184;
// aapt resource value: 0x7f06000f // aapt resource value: 0x7f070002
public const int tableLayout1 = 2131099663; public const int textView2 = 2131165186;
// aapt resource value: 0x7f060000 // aapt resource value: 0x7f070004
public const int textView1 = 2131099648; public const int textView3 = 2131165188;
// aapt resource value: 0x7f060002 // aapt resource value: 0x7f070006
public const int textView2 = 2131099650; public const int textView4 = 2131165190;
// aapt resource value: 0x7f060004
public const int textView3 = 2131099652;
// aapt resource value: 0x7f060006
public const int textView4 = 2131099654;
static Id() static Id()
{ {
@ -203,8 +209,8 @@ namespace OrarendAndroidApp
public partial class Menu public partial class Menu
{ {
// aapt resource value: 0x7f050000 // aapt resource value: 0x7f060000
public const int main_menu_light = 2131034112; public const int main_menu_light = 2131099648;
static Menu() static Menu()
{ {
@ -219,11 +225,11 @@ namespace OrarendAndroidApp
public partial class String public partial class String
{ {
// aapt resource value: 0x7f040001 // aapt resource value: 0x7f050001
public const int ApplicationName = 2130968577; public const int ApplicationName = 2131034113;
// aapt resource value: 0x7f040000 // aapt resource value: 0x7f050000
public const int Hello = 2130968576; public const int Hello = 2131034112;
static String() static String()
{ {
@ -234,6 +240,22 @@ namespace OrarendAndroidApp
{ {
} }
} }
public partial class Xml
{
// aapt resource value: 0x7f040000
public const int preferences = 2130968576;
static Xml()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Xml()
{
}
}
} }
} }
#pragma warning restore 1591 #pragma warning restore 1591

View file

@ -2,6 +2,6 @@
<shape <shape
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:shape= "rectangle" > android:shape= "rectangle" >
<solid android:color="#eee"/> <solid android:color="#222"/>
<stroke android:width="1dp" android:color="#00d"/> <stroke android:width="1dp" android:color="#fff"/>
</shape> </shape>

View file

@ -2,6 +2,6 @@
<shape <shape
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:shape= "rectangle" > android:shape= "rectangle" >
<solid android:color="#eee"/> <solid android:color="#333"/>
<stroke android:width="1dp" android:color="#0d0"/> <stroke android:width="1dp" android:color="#fff"/>
</shape> </shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 B

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container" android:id="@+id/container"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="fill_parent" android:layout_width="fill_parent"
@ -96,10 +97,4 @@
android:visibility="gone" /> android:visibility="gone" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
<ActionMenuView
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/actionMenuView1" />
</LinearLayout> </LinearLayout>

View file

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/spinner" <!-- <item android:id="@+id/spinner"
android:title="will be replaced anyway" android:title="will be replaced anyway"
android:showAsAction="always" android:showAsAction="always"
android:actionViewClass="android.widget.Spinner" /> android:actionViewClass="android.widget.Spinner"
android:layout_width="fill_parent" /> -->
<item <item
android:id="@+id/menu_refresh" android:id="@+id/menu_refresh"
android:icon="@drawable/ic_autorenew_black_24dp" android:icon="@drawable/ic_autorenew_black_24dp"

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBoxPreference
android:key="pref_theme"
android:title="Sötét téma"
android:summary="Sötét téma"
android:defaultValue="false" />
</PreferenceScreen>

View file

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Preferences;
namespace OrarendAndroidApp
{
[Activity(Label = "Beállítások", Theme = "@android:style/Theme.Holo.Light")]
public class SettingsActivity : PreferenceActivity, ISharedPreferencesOnSharedPreferenceChangeListener
{
protected override void OnCreate(Bundle savedInstanceState)
{
ActivityBase.SetTheme(this);
/*var settings = PreferenceManager.GetDefaultSharedPreferences(this);
bool darktheme = settings.GetBoolean("pref_theme", false);
//SetTheme(darktheme ? Android.Resource.Style.ThemeDeviceDefault : Android.Resource.Style.ThemeDeviceDefaultLight);
SetTheme(darktheme ? Android.Resource.Style.ThemeHolo : Android.Resource.Style.ThemeHoloLight);*/
base.OnCreate(savedInstanceState);
#pragma warning disable CS0618 // Type or member is obsolete
AddPreferencesFromResource(Resource.Xml.preferences);
#pragma warning restore CS0618 // Type or member is obsolete
PreferenceManager.SetDefaultValues(this, Resource.Xml.preferences, false);
}
public void OnSharedPreferenceChanged(ISharedPreferences sharedPreferences, string key)
{
if (key == "pref_theme")
Recreate();
}
protected override void OnResume()
{
base.OnResume();
PreferenceManager.GetDefaultSharedPreferences(this).RegisterOnSharedPreferenceChangeListener(this);
}
protected override void OnPause()
{
base.OnPause();
PreferenceManager.GetDefaultSharedPreferences(this).UnregisterOnSharedPreferenceChangeListener(this);
}
}
}