-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add stub for virtualizing recycling scrollview
- Loading branch information
panayot-cankov
committed
Nov 2, 2024
1 parent
c9f299f
commit b18e019
Showing
44 changed files
with
1,495 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version = "1.0" encoding = "UTF-8" ?> | ||
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:local="clr-namespace:VirtualizingRecyclingScrollView" | ||
x:Class="VirtualizingRecyclingScrollView.App"> | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<ResourceDictionary Source="Resources/Styles/Colors.xaml" /> | ||
<ResourceDictionary Source="Resources/Styles/Styles.xaml" /> | ||
</ResourceDictionary.MergedDictionaries> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace VirtualizingRecyclingScrollView; | ||
|
||
public partial class App : Application | ||
{ | ||
public App() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
protected override Window CreateWindow(IActivationState? activationState) | ||
{ | ||
return new Window(new AppShell()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<Shell | ||
x:Class="VirtualizingRecyclingScrollView.AppShell" | ||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:local="clr-namespace:VirtualizingRecyclingScrollView"> | ||
|
||
<ShellContent | ||
ContentTemplate="{DataTemplate local:MainPage}" | ||
Route="MainPage"/> | ||
|
||
</Shell> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace VirtualizingRecyclingScrollView; | ||
|
||
public partial class AppShell : Shell | ||
{ | ||
public AppShell() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
using System.ComponentModel; | ||
|
||
namespace VirtualizingRecyclingScrollView; | ||
|
||
public class CellModel : INotifyPropertyChanged | ||
{ | ||
public Key key; | ||
|
||
private string text; | ||
|
||
private Color color; | ||
|
||
public event PropertyChangedEventHandler? PropertyChanged; | ||
|
||
public string Text | ||
{ | ||
get => this.text; | ||
set | ||
{ | ||
this.text = value; | ||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Text))); | ||
} | ||
} | ||
|
||
public Color Color | ||
{ | ||
get => this.color; | ||
set | ||
{ | ||
this.color = value; | ||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Color))); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace VirtualizingRecyclingScrollView; | ||
|
||
public struct Key | ||
{ | ||
public int x; | ||
public int y; | ||
|
||
public Key(int x, int y) | ||
{ | ||
this.x = x; | ||
this.y = y; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="VirtualizingRecyclingScrollView.MainPage" | ||
xmlns:local="clr-namespace:VirtualizingRecyclingScrollView" | ||
xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls" | ||
ios:Page.UseSafeArea="False" | ||
Shell.NavBarIsVisible="False"> | ||
|
||
<Grid IgnoreSafeArea="True"> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="60" /> | ||
<RowDefinition Height="50" /> | ||
<RowDefinition Height="*" /> | ||
<RowDefinition Height="50" /> | ||
</Grid.RowDefinitions> | ||
|
||
<local:TrackingBorder x:Name="HeaderBackground" Grid.Row="0" Grid.RowSpan="2" Background="#AAFFFFFF" /> | ||
<Grid Grid.Row="1" x:Name="HeaderContent"> | ||
<HorizontalStackLayout> | ||
<local:TrackingLabel Text="Title" VerticalOptions="Center" Margin="10,0,10,0" FontSize="24" /> | ||
<local:TrackingBorder Margin="5" Background="Red" WidthRequest="5" HeightRequest="5" /> | ||
<local:TrackingBorder Margin="5" Background="Red" WidthRequest="5" HeightRequest="5" /> | ||
<local:TrackingBorder Margin="5" Background="Red" WidthRequest="5" HeightRequest="5" /> | ||
</HorizontalStackLayout> | ||
<HorizontalStackLayout HorizontalOptions="End"> | ||
<Label Text="{Binding LayoutNodes}" VerticalOptions="Center" HorizontalOptions="End" Margin="10,0,10,0" FontSize="14" WidthRequest="120" HeightRequest="30" /> | ||
<Label Text="{Binding LayoutVirtualNodes}" VerticalOptions="Center" HorizontalOptions="End" Margin="10,0,10,0" FontSize="14" WidthRequest="120" HeightRequest="30" /> | ||
</HorizontalStackLayout> | ||
</Grid> | ||
<local:TrackingBorder x:Name="FooterBackground" Grid.Row="3" Background="#AAFFFFFF" /> | ||
|
||
<local:TheScrollView Grid.RowSpan="4" ZIndex="-1"> | ||
<local:TheScrollView.Template> | ||
<DataTemplate x:DataType="local:CellModel"> | ||
<!-- Slim template: we can't trim further than that --> | ||
<!-- <local:TrackingLabel Virtualized="True" Text="{Binding Text}" Background="{Binding Color}" Margin="2" FontSize="16" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" /> --> | ||
|
||
<!-- Medium template: no triggers or visual states --> | ||
<local:TrackingBorder Virtualized="True" Background="{Binding Color}" Margin="1" StrokeThickness="1" Stroke="DarkGray"> | ||
<local:TrackingLabel Virtualized="True" Text="{Binding Text}" Margin="2" FontSize="16" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" /> | ||
</local:TrackingBorder> | ||
|
||
<!-- Fat template: That would include a border, a grid, icon and a label, maybe interactive with a trigger --> | ||
</DataTemplate> | ||
</local:TheScrollView.Template> | ||
</local:TheScrollView> | ||
</Grid> | ||
|
||
</ContentPage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace VirtualizingRecyclingScrollView; | ||
|
||
public partial class MainPage : ContentPage | ||
{ | ||
public MainPage() | ||
{ | ||
this.BindingContext = TrackingModel.Instance; | ||
InitializeComponent(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Maui.Handlers; | ||
|
||
namespace VirtualizingRecyclingScrollView; | ||
|
||
public static class MauiProgram | ||
{ | ||
public static MauiApp CreateMauiApp() | ||
{ | ||
var builder = MauiApp.CreateBuilder(); | ||
builder | ||
.UseMauiApp<App>() | ||
.ConfigureMauiHandlers(handlers => | ||
{ | ||
ViewHandler.ViewCommandMapper.ModifyMapping<IView, IViewHandler>(nameof(IView.InvalidateMeasure), (layout, handler, args, current) => | ||
{ | ||
// Comment this out to stop layout invalidation... | ||
current?.Invoke(layout, handler, args); | ||
}); | ||
}) | ||
.ConfigureFonts(fonts => | ||
{ | ||
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); | ||
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); | ||
}); | ||
|
||
#if DEBUG | ||
builder.Logging.AddDebug(); | ||
#endif | ||
|
||
return builder.Build(); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
Maui/VirtualizingRecyclingScrollView/Platforms/Android/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
</manifest> |
10 changes: 10 additions & 0 deletions
10
Maui/VirtualizingRecyclingScrollView/Platforms/Android/MainActivity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Android.App; | ||
using Android.Content.PM; | ||
using Android.OS; | ||
|
||
namespace VirtualizingRecyclingScrollView; | ||
|
||
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] | ||
public class MainActivity : MauiAppCompatActivity | ||
{ | ||
} |
15 changes: 15 additions & 0 deletions
15
Maui/VirtualizingRecyclingScrollView/Platforms/Android/MainApplication.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Android.App; | ||
using Android.Runtime; | ||
|
||
namespace VirtualizingRecyclingScrollView; | ||
|
||
[Application] | ||
public class MainApplication : MauiApplication | ||
{ | ||
public MainApplication(IntPtr handle, JniHandleOwnership ownership) | ||
: base(handle, ownership) | ||
{ | ||
} | ||
|
||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); | ||
} |
6 changes: 6 additions & 0 deletions
6
Maui/VirtualizingRecyclingScrollView/Platforms/Android/Resources/values/colors.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<color name="colorPrimary">#512BD4</color> | ||
<color name="colorPrimaryDark">#2B0B98</color> | ||
<color name="colorAccent">#2B0B98</color> | ||
</resources> |
9 changes: 9 additions & 0 deletions
9
Maui/VirtualizingRecyclingScrollView/Platforms/MacCatalyst/AppDelegate.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using Foundation; | ||
|
||
namespace VirtualizingRecyclingScrollView; | ||
|
||
[Register("AppDelegate")] | ||
public class AppDelegate : MauiUIApplicationDelegate | ||
{ | ||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); | ||
} |
14 changes: 14 additions & 0 deletions
14
Maui/VirtualizingRecyclingScrollView/Platforms/MacCatalyst/Entitlements.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<!-- See https://aka.ms/maui-publish-app-store#add-entitlements for more information about adding entitlements.--> | ||
<dict> | ||
<!-- App Sandbox must be enabled to distribute a MacCatalyst app through the Mac App Store. --> | ||
<key>com.apple.security.app-sandbox</key> | ||
<true/> | ||
<!-- When App Sandbox is enabled, this value is required to open outgoing network connections. --> | ||
<key>com.apple.security.network.client</key> | ||
<true/> | ||
</dict> | ||
</plist> | ||
|
38 changes: 38 additions & 0 deletions
38
Maui/VirtualizingRecyclingScrollView/Platforms/MacCatalyst/Info.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<!-- The Mac App Store requires you specify if the app uses encryption. --> | ||
<!-- Please consult https://developer.apple.com/documentation/bundleresources/information_property_list/itsappusesnonexemptencryption --> | ||
<!-- <key>ITSAppUsesNonExemptEncryption</key> --> | ||
<!-- Please indicate <true/> or <false/> here. --> | ||
|
||
<!-- Specify the category for your app here. --> | ||
<!-- Please consult https://developer.apple.com/documentation/bundleresources/information_property_list/lsapplicationcategorytype --> | ||
<!-- <key>LSApplicationCategoryType</key> --> | ||
<!-- <string>public.app-category.YOUR-CATEGORY-HERE</string> --> | ||
<key>UIDeviceFamily</key> | ||
<array> | ||
<integer>2</integer> | ||
</array> | ||
<key>UIRequiredDeviceCapabilities</key> | ||
<array> | ||
<string>arm64</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations~ipad</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>XSAppIconAssets</key> | ||
<string>Assets.xcassets/appicon.appiconset</string> | ||
</dict> | ||
</plist> |
15 changes: 15 additions & 0 deletions
15
Maui/VirtualizingRecyclingScrollView/Platforms/MacCatalyst/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using ObjCRuntime; | ||
using UIKit; | ||
|
||
namespace VirtualizingRecyclingScrollView; | ||
|
||
public class Program | ||
{ | ||
// This is the main entry point of the application. | ||
static void Main(string[] args) | ||
{ | ||
// if you want to use a different Application Delegate class from "AppDelegate" | ||
// you can specify it here. | ||
UIApplication.Main(args, null, typeof(AppDelegate)); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
Maui/VirtualizingRecyclingScrollView/Platforms/Tizen/Main.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
using Microsoft.Maui; | ||
using Microsoft.Maui.Hosting; | ||
|
||
namespace VirtualizingRecyclingScrollView; | ||
|
||
class Program : MauiApplication | ||
{ | ||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); | ||
|
||
static void Main(string[] args) | ||
{ | ||
var app = new Program(); | ||
app.Run(args); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
Maui/VirtualizingRecyclingScrollView/Platforms/Tizen/tizen-manifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest package="maui-application-id-placeholder" version="0.0.0" api-version="9" xmlns="http://tizen.org/ns/packages"> | ||
<profile name="common" /> | ||
<ui-application appid="maui-application-id-placeholder" exec="VirtualizingRecyclingScrollView.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single"> | ||
<label>maui-application-title-placeholder</label> | ||
<icon>maui-appicon-placeholder</icon> | ||
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" /> | ||
</ui-application> | ||
<shortcut-list /> | ||
<privileges> | ||
<privilege>http://tizen.org/privilege/internet</privilege> | ||
</privileges> | ||
<dependencies /> | ||
<provides-appdefined-privileges /> | ||
</manifest> |
8 changes: 8 additions & 0 deletions
8
Maui/VirtualizingRecyclingScrollView/Platforms/Windows/App.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<maui:MauiWinUIApplication | ||
x:Class="VirtualizingRecyclingScrollView.WinUI.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:maui="using:Microsoft.Maui" | ||
xmlns:local="using:VirtualizingRecyclingScrollView.WinUI"> | ||
|
||
</maui:MauiWinUIApplication> |
24 changes: 24 additions & 0 deletions
24
Maui/VirtualizingRecyclingScrollView/Platforms/Windows/App.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Microsoft.UI.Xaml; | ||
|
||
// To learn more about WinUI, the WinUI project structure, | ||
// and more about our project templates, see: http://aka.ms/winui-project-info. | ||
|
||
namespace VirtualizingRecyclingScrollView.WinUI; | ||
|
||
/// <summary> | ||
/// Provides application-specific behavior to supplement the default Application class. | ||
/// </summary> | ||
public partial class App : MauiWinUIApplication | ||
{ | ||
/// <summary> | ||
/// Initializes the singleton application object. This is the first line of authored code | ||
/// executed, and as such is the logical equivalent of main() or WinMain(). | ||
/// </summary> | ||
public App() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
|
||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); | ||
} | ||
|
Oops, something went wrong.