A táblázat görgethető, formázott; egyéb javítások
This commit is contained in:
parent
0444c1b867
commit
2a8dbe811d
11 changed files with 231 additions and 62 deletions
|
@ -73,9 +73,11 @@ namespace Orarend
|
|||
continue;
|
||||
if (óra == null)
|
||||
(ahét ? órarend.ÓrákAHét : órarend.ÓrákBHét)[i, x] = óra = new Óra();
|
||||
var csoportok = óranode.FirstChild.InnerText.TrimEnd(':');
|
||||
var csoport = óranode.FirstChild.InnerText.TrimEnd(':');
|
||||
if (csoport != "Egész osztály" && !órarend.Csoportok.Contains(csoport))
|
||||
continue;
|
||||
óra.Sorszám = x + 1;
|
||||
óra.Csoportok = new string[] { csoportok }; //Az állandó órarendben osztályonként csak egy csoport van egy órán
|
||||
óra.Csoportok = new string[] { csoport }; //Az állandó órarendben osztályonként csak egy csoport van egy órán
|
||||
óra.Azonosító = óranode.ChildNodes[2].InnerText;
|
||||
óra.TeljesNév = óranode.ChildNodes[2].Attributes["title"].Value;
|
||||
óra.Terem = óranode.ChildNodes[3].InnerText.Trim(' ', '(', ')');
|
||||
|
@ -99,7 +101,7 @@ namespace Orarend
|
|||
/// </summary>
|
||||
public static async Task HelyettesítésFrissítés()
|
||||
{
|
||||
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,10 @@ namespace Orarend
|
|||
{
|
||||
public class Osztály
|
||||
{
|
||||
public string Azonosító { get; set; }
|
||||
public string Név { get; set; }
|
||||
public string Azonosító { get; internal set; }
|
||||
public string Név { get; internal set; }
|
||||
internal Osztály()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,13 +9,18 @@ namespace Orarend
|
|||
public class Órarend
|
||||
{
|
||||
/// <summary>
|
||||
/// Egy 6x16 2D tömb, az első koordináta a nap indexe, a második az óráé. Az értékek lehetnek null-ok, ha nincs óra az adott időpontban
|
||||
/// <para>Egy 6x16 2D tömb, az első koordináta a nap indexe, a második az óráé. Az értékek lehetnek null-ok, ha nincs óra az adott időpontban</para>
|
||||
/// <para>Egy <see cref="API.Frissítés"/> hívás állítja be az órákat</para>
|
||||
/// </summary>
|
||||
public Óra[,] ÓrákAHét { get; } = new Óra[6, 16];
|
||||
/// <summary>
|
||||
/// Egy 6x16 2D tömb, az első koordináta a nap indexe, a második az óráé. Az értékek lehetnek null-ok, ha nincs óra az adott időpontban
|
||||
/// <para>Egy 6x16 2D tömb, az első koordináta a nap indexe, a második az óráé. Az értékek lehetnek null-ok, ha nincs óra az adott időpontban</para>
|
||||
/// <para>Egy <see cref="API.Frissítés"/> hívás állítja be az órákat</para>
|
||||
/// </summary>
|
||||
public Óra[,] ÓrákBHét { get; } = new Óra[6, 16];
|
||||
/// <summary>
|
||||
/// <para>Egy <see cref="API.Frissítés"/> hívás állítja be</para>
|
||||
/// </summary>
|
||||
public string Név { get; set; }
|
||||
public Osztály Osztály { get; set; }
|
||||
/// <summary>
|
||||
|
@ -23,5 +28,18 @@ namespace Orarend
|
|||
/// </summary>
|
||||
public TimeSpan[] Órakezdetek { get; } = new TimeSpan[16];
|
||||
public List<string> Csoportok { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Létrehoz egy új órarendet
|
||||
/// </summary>
|
||||
/// <param name="név">Az órarend neve. Ez jelenik meg a fejlécen</param>
|
||||
/// <param name="osztály">Az osztály, amihez tartozik ez az órarend. Lásd <see cref="API.Osztályok"/> </param>
|
||||
/// <param name="csoportok">A megjelenítendő csoportok szóközzel elválasztva</param>
|
||||
public Órarend(string név, Osztály osztály, string csoportok)
|
||||
{
|
||||
Név = név;
|
||||
Osztály = osztály;
|
||||
Csoportok = new List<string>(csoportok.Replace("Egész osztály", "").Trim().Split(' '));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ using Orarend;
|
|||
using System.Linq;
|
||||
using Android.Graphics;
|
||||
using Java.Lang;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrarendAndroidApp
|
||||
{
|
||||
|
@ -23,8 +25,19 @@ namespace OrarendAndroidApp
|
|||
base.OnCreate(bundle);
|
||||
SetContentView(Resource.Layout.MainLayout);
|
||||
handler = new Handler();
|
||||
API.Frissítés().ContinueWith(t =>
|
||||
{
|
||||
handler.Post(() =>
|
||||
{
|
||||
TaskHiba(t);
|
||||
});
|
||||
órarend = new Órarend("Teszt", API.Osztályok.First(), "gy1");
|
||||
API.Órarendek.Add(órarend);
|
||||
API.Frissítés().ContinueWith(tt => HelyettesítésFrissítés());
|
||||
});
|
||||
}
|
||||
|
||||
private int a = 0; //TODO: TMP
|
||||
private void HelyettesítésFrissítés()
|
||||
{
|
||||
var table = FindViewById<TableLayout>(Resource.Id.tableLayout1);
|
||||
|
@ -33,29 +46,69 @@ namespace OrarendAndroidApp
|
|||
TextView textview = new TextView(this);
|
||||
textview.SetText(text, TextView.BufferType.Normal);
|
||||
textview.SetTextColor(color);
|
||||
textview.SetPadding(10, 10, 10, 10);
|
||||
switch(a)
|
||||
{
|
||||
case 0:
|
||||
textview.SetBackgroundResource(Resource.Drawable.cell_shape_light);
|
||||
a++;
|
||||
break;
|
||||
case 1:
|
||||
textview.SetBackgroundResource(Resource.Drawable.cell_shape_selected_light);
|
||||
a++;
|
||||
break;
|
||||
case 2:
|
||||
textview.SetBackgroundResource(Resource.Drawable.cell_shape_removed_light);
|
||||
a++;
|
||||
break;
|
||||
case 3:
|
||||
textview.SetBackgroundResource(Resource.Drawable.cell_shape_added_light);
|
||||
a++;
|
||||
break;
|
||||
default:
|
||||
a = 0;
|
||||
break;
|
||||
}
|
||||
tr1.AddView(textview);
|
||||
};
|
||||
API.HelyettesítésFrissítés().ContinueWith(t =>
|
||||
{
|
||||
handler.Post(() =>
|
||||
{
|
||||
if (t.Exception?.InnerExceptions.Count > 0)
|
||||
TaskHiba(t);
|
||||
{
|
||||
foreach (var ex in t.Exception.InnerExceptions)
|
||||
{
|
||||
TableRow tr = new TableRow(this);
|
||||
addCell(ex.ToString(), Color.Red, tr);
|
||||
table.AddView(tr);
|
||||
}
|
||||
TableRow tr = new TableRow(this);
|
||||
addCell("", Color.Black, tr);
|
||||
addCell("Hétfő", Color.Black, tr);
|
||||
addCell("Kedd", Color.Black, tr);
|
||||
addCell("Szerda", Color.Black, tr);
|
||||
addCell("Csütörtök", Color.Black, tr);
|
||||
addCell("Péntek", Color.Black, tr);
|
||||
addCell("Szombat", Color.Black, tr);
|
||||
table.AddView(tr, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent));
|
||||
|
||||
}
|
||||
else
|
||||
if ((t.Exception?.InnerExceptions?.Count ?? 0) == 0)
|
||||
{
|
||||
for (int j = 0; j < órarend.ÓrákAHét.GetLength(1); j++)
|
||||
{
|
||||
TableRow tr = new TableRow(this);
|
||||
bool notnull = false;
|
||||
for (int i = 0; i < órarend.ÓrákAHét.GetLength(0); i++)
|
||||
addCell(órarend.ÓrákAHét[i, j] != null ? órarend.ÓrákAHét[i, j].EgyediNév : "", Color.Aqua, tr);
|
||||
table.AddView(tr);
|
||||
{ //Kihagyja az üres sorokat
|
||||
if (órarend.ÓrákAHét[i, j] != null)
|
||||
{
|
||||
notnull = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (notnull)
|
||||
{
|
||||
addCell((j + 1).ToString(), Color.Black, tr);
|
||||
for (int i = 0; i < órarend.ÓrákAHét.GetLength(0); i++)
|
||||
addCell(órarend.ÓrákAHét[i, j] != null ? órarend.ÓrákAHét[i, j].EgyediNév : "", Color.Black, tr);
|
||||
table.AddView(tr, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -101,5 +154,16 @@ namespace OrarendAndroidApp
|
|||
}
|
||||
return base.OnOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void Hiba(string msg)
|
||||
{
|
||||
new AlertDialog.Builder(this).SetMessage(msg).SetNeutralButton("OK", (s, e) => { ((AlertDialog)s).Dismiss(); ((AlertDialog)s).Dispose(); }).SetTitle("Hiba").Show();
|
||||
}
|
||||
|
||||
private void TaskHiba(Task t)
|
||||
{
|
||||
foreach (var ex in (IEnumerable<System.Exception>)t.Exception?.InnerExceptions ?? new System.Exception[0])
|
||||
Hiba(ex.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,6 +89,26 @@
|
|||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\ic_autorenew_black_24dp.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\cell_shape_light.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\cell_shape_selected_light.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\cell_shape_removed_light.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\cell_shape_added_light.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<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.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
64
OrarendAndroidApp/Resources/Resource.Designer.cs
generated
64
OrarendAndroidApp/Resources/Resource.Designer.cs
generated
|
@ -45,19 +45,31 @@ namespace OrarendAndroidApp
|
|||
{
|
||||
|
||||
// aapt resource value: 0x7f020000
|
||||
public const int ic_add_black_24dp = 2130837504;
|
||||
public const int cell_shape_added_light = 2130837504;
|
||||
|
||||
// aapt resource value: 0x7f020001
|
||||
public const int ic_autorenew_black_24dp = 2130837505;
|
||||
public const int cell_shape_light = 2130837505;
|
||||
|
||||
// aapt resource value: 0x7f020002
|
||||
public const int ic_create_black_24dp = 2130837506;
|
||||
public const int cell_shape_removed_light = 2130837506;
|
||||
|
||||
// aapt resource value: 0x7f020003
|
||||
public const int ic_settings_black_24dp = 2130837507;
|
||||
public const int cell_shape_selected_light = 2130837507;
|
||||
|
||||
// aapt resource value: 0x7f020004
|
||||
public const int Icon = 2130837508;
|
||||
public const int ic_add_black_24dp = 2130837508;
|
||||
|
||||
// aapt resource value: 0x7f020005
|
||||
public const int ic_autorenew_black_24dp = 2130837509;
|
||||
|
||||
// aapt resource value: 0x7f020006
|
||||
public const int ic_create_black_24dp = 2130837510;
|
||||
|
||||
// aapt resource value: 0x7f020007
|
||||
public const int ic_settings_black_24dp = 2130837511;
|
||||
|
||||
// aapt resource value: 0x7f020008
|
||||
public const int Icon = 2130837512;
|
||||
|
||||
static Drawable()
|
||||
{
|
||||
|
@ -72,29 +84,35 @@ namespace OrarendAndroidApp
|
|||
public partial class Id
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f060002
|
||||
public const int actionMenuView1 = 2131099650;
|
||||
// aapt resource value: 0x7f060000
|
||||
public const int ScrollView01 = 2131099648;
|
||||
|
||||
// aapt resource value: 0x7f060004
|
||||
public const int menu_add = 2131099652;
|
||||
|
||||
// aapt resource value: 0x7f060005
|
||||
public const int menu_edit = 2131099653;
|
||||
|
||||
// aapt resource value: 0x7f060007
|
||||
public const int menu_fullrefresh = 2131099655;
|
||||
|
||||
// aapt resource value: 0x7f060006
|
||||
public const int menu_preferences = 2131099654;
|
||||
|
||||
// aapt resource value: 0x7f060003
|
||||
public const int menu_refresh = 2131099651;
|
||||
public const int actionMenuView1 = 2131099652;
|
||||
|
||||
// aapt resource value: 0x7f060001
|
||||
public const int progressBar1 = 2131099649;
|
||||
public const int horizontalView = 2131099649;
|
||||
|
||||
// aapt resource value: 0x7f060000
|
||||
public const int tableLayout1 = 2131099648;
|
||||
// aapt resource value: 0x7f060006
|
||||
public const int menu_add = 2131099654;
|
||||
|
||||
// aapt resource value: 0x7f060007
|
||||
public const int menu_edit = 2131099655;
|
||||
|
||||
// aapt resource value: 0x7f060009
|
||||
public const int menu_fullrefresh = 2131099657;
|
||||
|
||||
// aapt resource value: 0x7f060008
|
||||
public const int menu_preferences = 2131099656;
|
||||
|
||||
// aapt resource value: 0x7f060005
|
||||
public const int menu_refresh = 2131099653;
|
||||
|
||||
// aapt resource value: 0x7f060003
|
||||
public const int progressBar1 = 2131099651;
|
||||
|
||||
// aapt resource value: 0x7f060002
|
||||
public const int tableLayout1 = 2131099650;
|
||||
|
||||
static Id()
|
||||
{
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape= "rectangle" >
|
||||
<solid android:color="#eee"/>
|
||||
<stroke android:width="1dp" android:color="#00d"/>
|
||||
</shape>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape= "rectangle" >
|
||||
<solid android:color="#eee"/>
|
||||
<stroke android:width="1dp" android:color="#000"/>
|
||||
</shape>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape= "rectangle" >
|
||||
<solid android:color="#eee"/>
|
||||
<stroke android:width="1dp" android:color="#0d0"/>
|
||||
</shape>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape= "rectangle" >
|
||||
<solid android:color="#ddd"/>
|
||||
<stroke android:width="1dp" android:color="#000"/>
|
||||
</shape>
|
|
@ -1,28 +1,44 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:minWidth="25px"
|
||||
android:minHeight="25px">
|
||||
<TableLayout
|
||||
android:id="@+id/tableLayout1"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:stretchColumns="1"
|
||||
android:scrollbars="horizontal">
|
||||
<ProgressBar
|
||||
style="@android:attr/progressBarStyleHorizontal"
|
||||
android:id="@+id/progressBar1"
|
||||
android:indeterminateTint="#00ffffff"
|
||||
android:indeterminate="true"
|
||||
android:indeterminateBehavior="repeat"
|
||||
android:indeterminateOnly="true"
|
||||
android:indeterminateTintMode="add"
|
||||
android:visibility="gone" />
|
||||
<ActionMenuView
|
||||
android:minWidth="25px"
|
||||
android:minHeight="25px"
|
||||
android:id="@+id/actionMenuView1" />
|
||||
</TableLayout>
|
||||
<ScrollView
|
||||
android:id="@+id/ScrollView01"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="horizontal|vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="5dip"
|
||||
android:scrollbarStyle="outsideInset"
|
||||
android:fillViewport="true">
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/horizontalView"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginTop="5dip">
|
||||
<TableLayout
|
||||
android:id="@+id/tableLayout1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:stretchColumns="1"
|
||||
android:isScrollContainer="true">
|
||||
<ProgressBar
|
||||
style="@android:attr/progressBarStyleHorizontal"
|
||||
android:id="@+id/progressBar1"
|
||||
android:indeterminateTint="#00ffffff"
|
||||
android:indeterminate="true"
|
||||
android:indeterminateBehavior="repeat"
|
||||
android:indeterminateOnly="true"
|
||||
android:indeterminateTintMode="add"
|
||||
android:visibility="gone" />
|
||||
<ActionMenuView
|
||||
android:minWidth="25px"
|
||||
android:minHeight="25px"
|
||||
android:id="@+id/actionMenuView1" />
|
||||
</TableLayout>
|
||||
</HorizontalScrollView>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
Loading…
Reference in a new issue