mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-21 15:09:18 +00:00
Retarget Android and cleanup page xml
This commit is contained in:
@@ -12,6 +12,7 @@ namespace qController
|
||||
|
||||
public QButton(QCommand command)
|
||||
{
|
||||
|
||||
qCommand = command;
|
||||
Text = qCommand.text;
|
||||
TextColor = Color.Black;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="qController.ControlPage">
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="qController.ControlPage"
|
||||
BackgroundColor="#4A4A4A">
|
||||
<ContentPage.Content>
|
||||
<AbsoluteLayout x:Name="sLayout">
|
||||
<Grid x:Name="topBar" HorizontalOptions="FillAndExpand" AbsoluteLayout.LayoutBounds="0,0,1,.09" AbsoluteLayout.LayoutFlags="All" BackgroundColor="#71AEFF">
|
||||
|
||||
@@ -111,7 +111,6 @@ namespace qController
|
||||
App.rootPage.MenuPage.ChangeToControl();
|
||||
NavigationPage.SetHasNavigationBar(this, false);
|
||||
|
||||
BackgroundColor = Color.FromHex("4A4A4A");
|
||||
qCell = new QSelectedCueCell();
|
||||
|
||||
qCell.SelectedCueEdited += OnSelectedCueEdited;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="qController.MenuPage">
|
||||
<ContentPage.Content>
|
||||
</ContentPage.Content>
|
||||
<StackLayout>
|
||||
<ListView x:Name="listView">
|
||||
</ListView>
|
||||
</StackLayout>
|
||||
</ContentPage>
|
||||
|
||||
@@ -1,68 +1,79 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using Xamarin.Forms;
|
||||
using qController.QItems;
|
||||
using System;
|
||||
|
||||
namespace qController
|
||||
{
|
||||
public partial class MenuPage : ContentPage
|
||||
{
|
||||
|
||||
public ListView listView;
|
||||
public ObservableCollection<MenuPageItem> items;
|
||||
int subLevel = 0;
|
||||
public ObservableCollection<MenuPageItem> items { get; } = new ObservableCollection<MenuPageItem>();
|
||||
public MenuPage()
|
||||
{
|
||||
Title = "Menu";
|
||||
InitializeComponent();
|
||||
items = new ObservableCollection<MenuPageItem>();
|
||||
|
||||
ChangeToHome();
|
||||
|
||||
listView = new ListView
|
||||
|
||||
listView.ItemsSource = items;
|
||||
listView.RowHeight = (int)(App.HeightUnit * 6);
|
||||
listView.ItemTemplate = new DataTemplate(() =>
|
||||
{
|
||||
ItemsSource = items,
|
||||
RowHeight = (int)(App.HeightUnit * 6),
|
||||
ItemTemplate = new DataTemplate(() =>
|
||||
{
|
||||
var grid = new Grid { Padding = new Thickness(5, 10) };
|
||||
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(30) });
|
||||
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
|
||||
|
||||
|
||||
var icon = new Label();
|
||||
|
||||
icon.FontFamily = App.QFont;
|
||||
icon.SetBinding(Label.TextProperty, "Icon");
|
||||
icon.HorizontalTextAlignment = TextAlignment.Center;
|
||||
icon.VerticalTextAlignment = TextAlignment.Center;
|
||||
icon.FontSize = App.HeightUnit * 3;
|
||||
var label = new Label { VerticalOptions = LayoutOptions.FillAndExpand };
|
||||
label.SetBinding(Label.TextProperty, "Title");
|
||||
if (label.Text == "Disconnect")
|
||||
var grid = new Grid {
|
||||
Padding = new Thickness(5, 10),
|
||||
ColumnDefinitions =
|
||||
{
|
||||
label.TextColor = Color.DarkRed;
|
||||
new ColumnDefinition{Width = new GridLength(30)},
|
||||
new ColumnDefinition { Width = GridLength.Star }
|
||||
}
|
||||
switch (Device.RuntimePlatform)
|
||||
{
|
||||
case Device.iOS:
|
||||
label.FontSize = App.HeightUnit * 3;
|
||||
break;
|
||||
case Device.Android:
|
||||
label.FontSize = App.HeightUnit * 2.2;
|
||||
break;
|
||||
}
|
||||
grid.Children.Add(icon);
|
||||
grid.Children.Add(label, 1, 0);
|
||||
return new ViewCell {View = grid};
|
||||
|
||||
})
|
||||
};
|
||||
Content = new StackLayout
|
||||
{
|
||||
Children = { listView }
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
var icon = new Label {
|
||||
FontFamily = App.QFont,
|
||||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
VerticalTextAlignment = TextAlignment.Center,
|
||||
FontSize = App.HeightUnit * 3
|
||||
};
|
||||
|
||||
icon.SetBinding(Label.TextProperty, "Icon");
|
||||
|
||||
var label = new Label {
|
||||
VerticalOptions = LayoutOptions.FillAndExpand
|
||||
};
|
||||
label.SetBinding(Label.TextProperty, "Title");
|
||||
|
||||
if (label.Text == "Disconnect")
|
||||
label.TextColor = Color.DarkRed;
|
||||
|
||||
switch (Device.RuntimePlatform)
|
||||
{
|
||||
case Device.iOS:
|
||||
label.FontSize = App.HeightUnit * 3;
|
||||
break;
|
||||
case Device.Android:
|
||||
label.FontSize = App.HeightUnit * 2.2;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
grid.Children.Add(icon);
|
||||
grid.Children.Add(label, 1, 0);
|
||||
return new ViewCell { View = grid };
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void setItemSelected(EventHandler<SelectedItemChangedEventArgs> ItemSelected){
|
||||
listView.ItemSelected += ItemSelected;
|
||||
}
|
||||
|
||||
public void clearSelectedItem()
|
||||
{
|
||||
listView.SelectedItem = null;
|
||||
}
|
||||
|
||||
public void ChangeToControl()
|
||||
{
|
||||
items.Clear();
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace qController
|
||||
{
|
||||
MenuPage = (MenuPage)Master;
|
||||
|
||||
MenuPage.listView.ItemSelected += OnItemSelected;
|
||||
MenuPage.setItemSelected(OnItemSelected);
|
||||
}
|
||||
|
||||
void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
|
||||
@@ -36,7 +36,7 @@ namespace qController
|
||||
var item = e.SelectedItem as MenuPageItem;
|
||||
if (item != null)
|
||||
{
|
||||
MenuPage.listView.SelectedItem = null;
|
||||
MenuPage.clearSelectedItem();
|
||||
IsPresented = false;
|
||||
if (MenuItemSelected != null)
|
||||
MenuItemSelected(this, new MenuEventArgs { Command = item.Command });
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label x:Name = "menuButton" FontFamily = "{StaticResource qfont}" HorizontalOptions = "Start" VerticalOptions="End" Margin="20,10,20,10" Grid.Row="0" Grid.Column="0" Text=""/>
|
||||
</Grid>
|
||||
<ListView x:Name="listView" HasUnevenRows="true" BackgroundColor="#4A4A4A" SeparatorVisibility="None"></ListView>
|
||||
|
||||
<ListView x:Name="listView" HasUnevenRows="true" BackgroundColor="#4A4A4A" SeparatorVisibility="None"></ListView>
|
||||
</StackLayout>
|
||||
</ContentPage>
|
||||
Reference in New Issue
Block a user