Switch to Heights based on Display Dimensions

This commit is contained in:
2019-06-25 01:59:47 -05:00
parent 20dc095515
commit 60ec28c952
9 changed files with 27 additions and 10 deletions
+2
View File
@@ -31,6 +31,7 @@
<package id="System.Net.NetworkInformation" version="4.3.0" targetFramework="xamarinios10" /> <package id="System.Net.NetworkInformation" version="4.3.0" targetFramework="xamarinios10" />
<package id="System.Net.Primitives" version="4.3.1" targetFramework="xamarinios10" /> <package id="System.Net.Primitives" version="4.3.1" targetFramework="xamarinios10" />
<package id="System.Net.Sockets" version="4.3.0" targetFramework="xamarinios10" /> <package id="System.Net.Sockets" version="4.3.0" targetFramework="xamarinios10" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="xamarinios10" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="xamarinios10" /> <package id="System.ObjectModel" version="4.3.0" targetFramework="xamarinios10" />
<package id="System.Reactive" version="4.1.5" targetFramework="xamarinios10" /> <package id="System.Reactive" version="4.1.5" targetFramework="xamarinios10" />
<package id="System.Reactive.Core" version="4.1.5" targetFramework="xamarinios10" /> <package id="System.Reactive.Core" version="4.1.5" targetFramework="xamarinios10" />
@@ -62,6 +63,7 @@
<package id="System.Xml.ReaderWriter" version="4.3.1" targetFramework="xamarinios10" /> <package id="System.Xml.ReaderWriter" version="4.3.1" targetFramework="xamarinios10" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="xamarinios10" /> <package id="System.Xml.XDocument" version="4.3.0" targetFramework="xamarinios10" />
<package id="System.Xml.XmlDocument" version="4.3.0" targetFramework="xamarinios10" /> <package id="System.Xml.XmlDocument" version="4.3.0" targetFramework="xamarinios10" />
<package id="Xamarin.Essentials" version="1.1.0" targetFramework="xamarinios10" />
<package id="Xamarin.Forms" version="4.0.0.497661" targetFramework="xamarinios10" /> <package id="Xamarin.Forms" version="4.0.0.497661" targetFramework="xamarinios10" />
<package id="Zeroconf" version="3.0.30" targetFramework="xamarinios10" /> <package id="Zeroconf" version="3.0.30" targetFramework="xamarinios10" />
</packages> </packages>
+3
View File
@@ -133,6 +133,9 @@
<Reference Include="Xamarin.Forms.Xaml"> <Reference Include="Xamarin.Forms.Xaml">
<HintPath>..\packages\Xamarin.Forms.4.0.0.497661\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath> <HintPath>..\packages\Xamarin.Forms.4.0.0.497661\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
</Reference> </Reference>
<Reference Include="Xamarin.Essentials">
<HintPath>..\packages\Xamarin.Essentials.1.1.0\lib\xamarinios10\Xamarin.Essentials.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" /> <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" />
@@ -28,7 +28,6 @@ namespace qController
InitItems(); InitItems();
//SET BINDINGS //SET BINDINGS
nameLabel.SetBinding(Label.TextProperty, new Binding("name")); nameLabel.SetBinding(Label.TextProperty, new Binding("name"));
addressLabel.SetBinding(Label.TextProperty,new Binding("address")); addressLabel.SetBinding(Label.TextProperty,new Binding("address"));
@@ -63,7 +62,7 @@ namespace qController
HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand,
Padding = 30, Padding = 30,
Margin = new Thickness(10,10,10,10), Margin = new Thickness(10,10,10,10),
CornerRadius=20 CornerRadius=20,
}; };
f.BackgroundColor = Color.FromHex("D8D8D8"); f.BackgroundColor = Color.FromHex("D8D8D8");
View = f; View = f;
+9 -2
View File
@@ -1,6 +1,6 @@
using Acr.UserDialogs; using Acr.UserDialogs;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Essentials;
namespace qController namespace qController
{ {
public partial class App : Application public partial class App : Application
@@ -9,7 +9,9 @@ namespace qController
public static NavigationPage NavigationPage { get; private set; } public static NavigationPage NavigationPage { get; private set; }
public static RootPage rootPage; public static RootPage rootPage;
public static string QFont; public static string QFont;
public static DisplayInfo mainDisplayInfo;
public static double Height;
public static double Width;
public static bool MenuIsPresented public static bool MenuIsPresented
{ {
get get
@@ -29,6 +31,11 @@ namespace qController
/*MainPage = new NavigationPage(new QConnectionPage()); /*MainPage = new NavigationPage(new QConnectionPage());
iNav = MainPage.Navigation;*/ iNav = MainPage.Navigation;*/
mainDisplayInfo = DeviceDisplay.MainDisplayInfo;
Height = mainDisplayInfo.Height / mainDisplayInfo.Density;
Width = mainDisplayInfo.Width / mainDisplayInfo.Density;
System.Console.WriteLine(Height);
System.Console.WriteLine(Width);
switch (Device.RuntimePlatform) switch (Device.RuntimePlatform)
{ {
case Device.iOS: case Device.iOS:
+1 -1
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-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">
<ContentPage.Content> <ContentPage.Content>
<StackLayout x:Name="sLayout"> <StackLayout x:Name="sLayout">
@@ -73,11 +73,14 @@ namespace qController
{ {
App.rootPage.MenuPage.ChangeToControl(); App.rootPage.MenuPage.ChangeToControl();
NavigationPage.SetHasNavigationBar(this, false); NavigationPage.SetHasNavigationBar(this, false);
instanceName.HorizontalTextAlignment = TextAlignment.Center; instanceName.HorizontalTextAlignment = TextAlignment.Center;
instanceName.HorizontalOptions = LayoutOptions.CenterAndExpand; instanceName.HorizontalOptions = LayoutOptions.CenterAndExpand;
instanceName.VerticalOptions = LayoutOptions.CenterAndExpand; instanceName.VerticalOptions = LayoutOptions.CenterAndExpand;
topBar.Children.Add(instanceName, 1, 0); topBar.Children.Add(instanceName, 1, 0);
topBar.BackgroundColor = Color.FromHex("71AEFF"); topBar.BackgroundColor = Color.FromHex("71AEFF");
topBar.HeightRequest = Math.Max(App.Height * .09, 65);
BackgroundColor = Color.FromHex("4A4A4A"); BackgroundColor = Color.FromHex("4A4A4A");
menuButton.Text = QIcon.MENU; menuButton.Text = QIcon.MENU;
@@ -96,6 +99,8 @@ namespace qController
qCell = new QSelectedCueCell(); qCell = new QSelectedCueCell();
qCell.HeightRequest = Math.Max(App.Height * .20, 125);
sLayout.Children.Add(qCell); sLayout.Children.Add(qCell);
} }
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-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" xmlns:local="clr-namespace:qController" x:Class="qController.QConnectionPage"> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:qController" x:Class="qController.QConnectionPage">
<StackLayout x:Name="sLayout"> <StackLayout x:Name="sLayout">
@@ -11,7 +11,6 @@
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label x:Name = "menuButton" FontFamily = "{StaticResource qfont}" HorizontalOptions = "Start" Margin="20,10,20,10" Grid.Row="0" Grid.Column="0" FontSize="25"/> <Label x:Name = "menuButton" FontFamily = "{StaticResource qfont}" HorizontalOptions = "Start" Margin="20,10,20,10" Grid.Row="0" Grid.Column="0" FontSize="25"/>
</Grid> </Grid>
<ListView x:Name="lstView" HasUnevenRows = "true" > <ListView x:Name="lstView" HasUnevenRows = "true" >
</ListView> </ListView>
@@ -30,13 +30,14 @@ namespace qController
AddWorkspace(); AddWorkspace();
}else if(args.Command == "open_link") }else if(args.Command == "open_link")
{ {
Device.OpenUri(new Uri("http://www.example.com")); Device.OpenUri(new Uri("http://www.jwetzell.com"));
} }
} }
private void InitGUI() private void InitGUI()
{ {
NavigationPage.SetHasNavigationBar(this, false); NavigationPage.SetHasNavigationBar(this, false);
topBar.HeightRequest = Math.Max(App.Height * .09, 65);
lstView.ItemsSource = QStorage.qInstances; lstView.ItemsSource = QStorage.qInstances;
lstView.ItemTemplate = new DataTemplate(typeof(QInstanceCell)); lstView.ItemTemplate = new DataTemplate(typeof(QInstanceCell));
+1
View File
@@ -59,6 +59,7 @@
<PackageReference Include="Acr.Settings" Version="9.0.1" /> <PackageReference Include="Acr.Settings" Version="9.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="Rssdp" Version="4.0.2" /> <PackageReference Include="Rssdp" Version="4.0.2" />
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Remove="App.xaml" /> <None Remove="App.xaml" />