Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
paulvarache committed Jan 11, 2023
0 parents commit 219d328
Show file tree
Hide file tree
Showing 51 changed files with 2,229 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 The49 Ltd. (https://the49.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
60 changes: 60 additions & 0 deletions NUGET-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
## What is Maui.MaterialSwitch?

The .NET MAUI MaterialSwitch plugin adds the ability to use android Material 3 switches instead of the `SwitchCompat` used as default.

## Getting Started

In order to use the plugin you need to call the extension method in your `MauiProgram.cs` file as follows:

```cs
using Plugin.ContextMenu;

public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();

// Initialise the plugin
builder.UseMauiApp<App>()
.UseMaterialSwitch();

// the rest of your logic...
}
}
```

You also need to make sure your application's theme extends the Material3 theme. This mean you need a `Platforms/Android/Resources/values/styles.xml` file with the following content:

```xml
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="Maui.MainTheme" parent="Theme.Material3.DayNight"></style>
</resources>
```

If you aleready have this file, just make sure the `Maui.MainTheme` style inherits the `Theme.Material3.DayNight` parent.

## Selectively use the MaterialSwitch

You can decide to not change the default `Switch` control. Call `UseMaterialSwitch` with `applyToAll` set to false.

```cs
.UseMaterialSwitch(applyToAll: false)
```

You can then use the `MaterialSwitch` control selectively. Simply add the following namespace:

```xml
xmlns:the49="https://schemas.the49.com/dotnet/2023/maui"
```

Then use `<the49:MaterialSwitch />` alongside `<Switch />`.

## Notes

This will NOT change the switches on any other platform than Android

---

Made within The49
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<img src="./The49.Maui.MaterialSwitch.svg?raw=true" height="64" />

## What is Maui.MaterialSwitch?

The .NET MAUI MaterialSwitch plugin adds the ability to use android Material 3 switches instead of the `SwitchCompat` used as default.

Default | MaterialSwitch enabled |
|:---:|:---:|
|<img src="screenshots/before.png?raw=true" height="480" />|<img src="screenshots/after.png?raw=true" height="480" /> |

## Getting Started

In order to use the plugin you need to call the extension method in your `MauiProgram.cs` file as follows:

```cs
using Plugin.ContextMenu;

public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();

// Initialise the plugin
builder.UseMauiApp<App>()
.UseMaterialSwitch();

// the rest of your logic...
}
}
```

You also need to make sure your application's theme extends the Material3 theme. This mean you need a `Platforms/Android/Resources/values/styles.xml` file with the following content:

```xml
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="Maui.MainTheme" parent="Theme.Material3.DayNight"></style>
</resources>
```

If you aleready have this file, just make sure the `Maui.MainTheme` style inherits the `Theme.Material3.DayNight` parent.

## Selectively use the MaterialSwitch

You can decide to not change the default `Switch` control. Call `UseMaterialSwitch` with `applyToAll` set to false.

```cs
.UseMaterialSwitch(applyToAll: false)
```

You can then use the `MaterialSwitch` control selectively. Simply add the following namespace:

```xml
xmlns:the49="https://schemas.the49.com/dotnet/2023/maui"
```

Then use `<the49:MaterialSwitch />` alongside `<Switch />`.

## Notes

This will NOT change the switches on any other platform than Android

---


<img src="https://the49.com/logo.svg" height="64" />

Made within The49
Binary file added The49.Maui.MaterialSwitch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions The49.Maui.MaterialSwitch.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 219d328

Please sign in to comment.