Skip to content

Commit

Permalink
[foldable] Package reference instead of project reference (#6514)
Browse files Browse the repository at this point in the history
Co-authored-by: Matthew Leibowitz <[email protected]>
  • Loading branch information
conceptdev and mattleibow authored Aug 11, 2022
1 parent 1b8b298 commit a8ac748
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 64 deletions.
1 change: 1 addition & 0 deletions Microsoft.Maui.Packages-mac.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"projects": [
"src\\BlazorWebView\\src\\Maui\\Microsoft.AspNetCore.Components.WebView.Maui.csproj",
"src\\Compatibility\\Core\\src\\Compatibility.csproj",
"src\\Controls\\Foldable\\src\\Controls.Foldable.csproj",
"src\\Controls\\Maps\\src\\Controls.Maps.csproj",
"src\\Controls\\src\\Build.Tasks\\Controls.Build.Tasks.csproj",
"src\\Controls\\src\\Core.Design\\Controls.Core.Design.csproj",
Expand Down
1 change: 1 addition & 0 deletions Microsoft.Maui.Packages.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"src\\BlazorWebView\\src\\WindowsForms\\Microsoft.AspNetCore.Components.WebView.WindowsForms.csproj",
"src\\BlazorWebView\\src\\Wpf\\Microsoft.AspNetCore.Components.WebView.Wpf.csproj",
"src\\Compatibility\\Core\\src\\Compatibility.csproj",
"src\\Controls\\Foldable\\src\\Controls.Foldable.csproj",
"src\\Controls\\Maps\\src\\Controls.Maps.csproj",
"src\\Controls\\src\\Build.Tasks\\Controls.Build.Tasks.csproj",
"src\\Controls\\src\\Core.Design\\Controls.Core.Design.csproj",
Expand Down
1 change: 0 additions & 1 deletion Microsoft.Maui.Samples.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"path": "Microsoft.Maui.sln",
"projects": [
"src\\BlazorWebView\\samples\\MauiRazorClassLibrarySample\\MauiRazorClassLibrarySample.csproj",
"src\\Controls\\Foldable\\src\\Controls.Foldable.csproj",
"src\\Controls\\samples\\Controls.Sample.Sandbox\\Maui.Controls.Sample.Sandbox.csproj",
"src\\Controls\\samples\\Controls.Sample\\Maui.Controls.Sample.csproj"
]
Expand Down
1 change: 1 addition & 0 deletions eng/cake/dotnet.cake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ if (TestTFM == "default")
Exception pendingException = null;

var NuGetOnlyPackages = new string[] {
"Microsoft.Maui.Controls.Foldable.*.nupkg",
"Microsoft.Maui.Graphics.*.nupkg",
};

Expand Down
8 changes: 4 additions & 4 deletions src/Controls/Foldable/src/Controls.Foldable.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<AssemblyName>Microsoft.Maui.Controls.Foldable</AssemblyName>
<RootNamespace>Microsoft.Maui.Controls.Foldable</RootNamespace>
<WarningsNotAsErrors>BI1234</WarningsNotAsErrors>
<IsPackable>false</IsPackable>
<IsPackable>true</IsPackable>
<!-- TODO: remove this when Foldable is made into a nupkg -->
<UseMaui Condition=" '$(UseWorkload)' == 'true' ">true</UseMaui>
</PropertyGroup>
<Import Project="$(MauiNuSpecDirectory)Microsoft.Maui.Controls.MultiTargeting.targets" />
<ItemGroup Condition=" '$(UseMaui)' != 'true' ">
<ProjectReference Include="..\..\..\Graphics\src\Graphics\Graphics.csproj" />
<ProjectReference Include="..\..\..\Controls\src\Core\Controls.Core.csproj" />
<ProjectReference Include="..\..\..\Core\src\Core.csproj" />
<ProjectReference Include="..\..\..\Graphics\src\Graphics\Graphics.csproj" PrivateAssets="all" />
<ProjectReference Include="..\..\..\Controls\src\Core\Controls.Core.csproj" PrivateAssets="all" />
<ProjectReference Include="..\..\..\Core\src\Core.csproj" PrivateAssets="all" />
</ItemGroup>
<ItemGroup Condition=" '$(UseMaui)' != 'true' ">
<PackageReference Include="Microsoft.Extensions.Configuration" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@

<ItemGroup>
<ProjectReference Include="..\..\..\BlazorWebView\samples\MauiRazorClassLibrarySample\MauiRazorClassLibrarySample.csproj" />
<!-- <ProjectReference Include="..\..\Foldable\src\Controls.Foldable.csproj" /> -->
</ItemGroup>

<ItemGroup Condition=" '$(UseMaui)' != 'true' ">
Expand All @@ -57,6 +56,11 @@
<ProjectReference Include="..\..\..\Controls\src\Xaml\Controls.Xaml.csproj" />
<ProjectReference Include="..\..\..\Core\src\Core.csproj" />
<ProjectReference Include="..\..\..\Compatibility\Core\src\Compatibility.csproj" />
<ProjectReference Include="..\..\Foldable\src\Controls.Foldable.csproj" />
</ItemGroup>

<ItemGroup Condition=" '$(UseMaui)' == 'true' ">
<PackageReference Include="Microsoft.Maui.Controls.Foldable" Version="$(MauiVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Controls/samples/Controls.Sample/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ static bool LogEvent(string eventName, string type = null)
}
});

//appBuilder
// .UseFoldable();
// Adapt to dual-screen and foldable Android devices like Surface Duo, includes TwoPaneView layout control
appBuilder.UseFoldable();

// If someone wanted to completely turn off the CascadeInputTransparent behavior in their application, this next line would be an easy way to do it
// Microsoft.Maui.Controls.Layout.ControlsLayoutMapper.ModifyMapping(nameof(Microsoft.Maui.Controls.Layout.CascadeInputTransparent), (_, _, _) => { });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Pages.TwoPaneViewPage"
xmlns:views="clr-namespace:Maui.Controls.Sample.Pages.Base"
xmlns:foldable="clr-namespace:Microsoft.Maui.Controls.Foldable;assembly=Microsoft.Maui.Controls.Foldable"
Title="TwoPaneView"
BackgroundColor="#bbbbbb">
<!-- For Surface Duo and other foldable Android phones -->
<!-- Requires Microsoft.Maui.Controls.Foldable NuGet -->
<!--
xmlns:foldable="clr-namespace:Microsoft.Maui.Controls.Foldable;assembly=Microsoft.Maui.Controls.Foldable"
<views:BasePage.Content>
<foldable:TwoPaneView x:Name="twoPaneView"
MinTallModeHeight="{Binding Source={x:Reference MinTallModeHeight}, Path=Value}"
Expand All @@ -24,7 +23,7 @@
Orientation="Vertical"
VerticalOptions="StartAndExpand"
>

<Label Text="ScreenSize" x:Name="sizeLabel"/>
<Label Text="SinglePane" x:Name="spanLabel"/>
<Label Text="Hinge" x:Name="hingeLabel"/>
Expand All @@ -34,13 +33,13 @@
<Slider x:Name="MinTallModeHeight" Maximum="2000" />
<Label Text="MinWideModeWidth"/>
<Slider x:Name="MinWideModeWidth" Maximum="2000" />

<Label Text=""/>
<Label Text="Pane1Length"/>
<Slider x:Name="Pane1Length" Maximum="1" Value="0.5" />
<Label Text="Pane2Length"/>
<Slider x:Name="Pane2Length" Maximum="1" Value="0.5" />

<Label Text=""/>
<Picker x:Name="PanePriority" Title="PanePriority" SelectedIndex="0" />
<Picker x:Name="TallModeConfiguration" Title="TallModeConfiguration" SelectedIndex="1" />
Expand All @@ -59,5 +58,5 @@
</StackLayout>
</foldable:TwoPaneView.Pane2>
</foldable:TwoPaneView>
</views:BasePage.Content>-->
</views:BasePage.Content>
</views:BasePage>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace Maui.Controls.Sample.Pages
{
//using Microsoft.Maui;
//using Microsoft.Maui.Foldable;
//using Microsoft.Maui.Controls.Foldable;
using Microsoft.Maui;
using Microsoft.Maui.Foldable;
using Microsoft.Maui.Controls.Foldable;

/// <summary>
/// Sample demonstrating the use of TwoPaneView control and
Expand All @@ -20,63 +20,63 @@ public TwoPaneViewPage()
{
InitializeComponent();

//System.Diagnostics.Debug.Write("TwoPaneViewPage.ctor", "JWM");
System.Diagnostics.Debug.Write("TwoPaneViewPage.ctor", "JWM");

//Pane1Length.ValueChanged += PaneLength_ValueChanged;
//Pane2Length.ValueChanged += PaneLength_ValueChanged;
//PanePriority.ItemsSource = System.Enum.GetValues(typeof(TwoPaneViewPriority));
//TallModeConfiguration.ItemsSource = System.Enum.GetValues(typeof(TwoPaneViewTallModeConfiguration));
//WideModeConfiguration.ItemsSource = System.Enum.GetValues(typeof(TwoPaneViewWideModeConfiguration));
Pane1Length.ValueChanged += PaneLength_ValueChanged;
Pane2Length.ValueChanged += PaneLength_ValueChanged;
PanePriority.ItemsSource = System.Enum.GetValues(typeof(TwoPaneViewPriority));
TallModeConfiguration.ItemsSource = System.Enum.GetValues(typeof(TwoPaneViewTallModeConfiguration));
WideModeConfiguration.ItemsSource = System.Enum.GetValues(typeof(TwoPaneViewWideModeConfiguration));

//OnReset(null, null);
OnReset(null, null);
}

//private void PaneLength_ValueChanged(object sender, Microsoft.Maui.Controls.ValueChangedEventArgs e)
//{
// twoPaneView.Pane1Length = new GridLength(Pane1Length.Value, GridUnitType.Star);
// twoPaneView.Pane2Length = new GridLength(Pane2Length.Value, GridUnitType.Star);
//}
private void PaneLength_ValueChanged(object sender, Microsoft.Maui.Controls.ValueChangedEventArgs e)
{
twoPaneView.Pane1Length = new GridLength(Pane1Length.Value, GridUnitType.Star);
twoPaneView.Pane2Length = new GridLength(Pane2Length.Value, GridUnitType.Star);
}

//protected override async void OnAppearing()
//{
// base.OnAppearing();
// System.Diagnostics.Debug.Write("TwoPaneViewPage.OnAppearing - hinge angle prepped", "JWM");
// DualScreenInfo.Current.HingeAngleChanged += Current_HingeAngleChanged;
// DualScreenInfo.Current.PropertyChanged += Current_PropertyChanged;
protected override async void OnAppearing()
{
base.OnAppearing();
System.Diagnostics.Debug.Write("TwoPaneViewPage.OnAppearing - hinge angle prepped", "JWM");
DualScreenInfo.Current.HingeAngleChanged += Current_HingeAngleChanged;
DualScreenInfo.Current.PropertyChanged += Current_PropertyChanged;

// PanePriority.SelectedIndex = 0;
// TallModeConfiguration.SelectedIndex = 1;
// WideModeConfiguration.SelectedIndex = 1;
PanePriority.SelectedIndex = 0;
TallModeConfiguration.SelectedIndex = 1;
WideModeConfiguration.SelectedIndex = 1;

// hingeLabel.Text = "Hinge prepped " + await DualScreenInfo.Current.GetHingeAngleAsync();
//}
hingeLabel.Text = "Hinge prepped " + await DualScreenInfo.Current.GetHingeAngleAsync();
}

//private void Current_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
//{
// spanLabel.Text += "Spanmode: " + DualScreenInfo.Current.SpanMode;
//}
private void Current_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
spanLabel.Text += "Spanmode: " + DualScreenInfo.Current.SpanMode;
}

//protected override void OnDisappearing()
//{
// DualScreenInfo.Current.HingeAngleChanged -= Current_HingeAngleChanged;
// DualScreenInfo.Current.PropertyChanged -= Current_PropertyChanged;
//}
//private void Current_HingeAngleChanged(object sender, HingeAngleChangedEventArgs e)
//{
// System.Diagnostics.Debug.Write("TwoPaneViewPage.Current_HingeAngleChanged - " + e.HingeAngleInDegrees, "JWM");
protected override void OnDisappearing()
{
DualScreenInfo.Current.HingeAngleChanged -= Current_HingeAngleChanged;
DualScreenInfo.Current.PropertyChanged -= Current_PropertyChanged;
}
private void Current_HingeAngleChanged(object sender, HingeAngleChangedEventArgs e)
{
System.Diagnostics.Debug.Write("TwoPaneViewPage.Current_HingeAngleChanged - " + e.HingeAngleInDegrees, "JWM");

// hingeLabel.Text = "Hinge angle: " + e.HingeAngleInDegrees + " degrees";
//}
hingeLabel.Text = "Hinge angle: " + e.HingeAngleInDegrees + " degrees";
}

//void OnReset(object sender, System.EventArgs e)
//{
// PanePriority.SelectedIndex = 0;
// Pane1Length.Value = 0.5;
// Pane2Length.Value = 0.5;
// TallModeConfiguration.SelectedIndex = 1;
// WideModeConfiguration.SelectedIndex = 1;
// MinTallModeHeight.Value = 0;
// MinWideModeWidth.Value = 0;
//}
void OnReset(object sender, System.EventArgs e)
{
PanePriority.SelectedIndex = 0;
Pane1Length.Value = 0.5;
Pane2Length.Value = 0.5;
TallModeConfiguration.SelectedIndex = 1;
WideModeConfiguration.SelectedIndex = 1;
MinTallModeHeight.Value = 0;
MinWideModeWidth.Value = 0;
}
}
}

0 comments on commit a8ac748

Please sign in to comment.