Skip to content

Commit

Permalink
Some optimizations for android and some code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
roubachof committed Oct 22, 2024
1 parent 0327085 commit d3a60ce
Show file tree
Hide file tree
Showing 14 changed files with 1,078 additions and 540 deletions.
109 changes: 109 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# NOTE: Requires **VS2019 16.3** or later

# StyleCopRules
# Description: StyleCopRules custom ruleset

# Code files
[*.{cs,vb}]


# Default severity for analyzer diagnostics - Requires **VS2019 16.5** or later
dotnet_analyzer_diagnostic.severity = warning

dotnet_diagnostic.SA1101.severity = none

dotnet_diagnostic.SA1200.severity = none

dotnet_diagnostic.SA1305.severity = warning

dotnet_diagnostic.SA1309.severity = none

dotnet_diagnostic.SA1402.severity = none

dotnet_diagnostic.SA1407.severity = none

dotnet_diagnostic.SA1412.severity = warning

dotnet_diagnostic.SA1600.severity = none

dotnet_diagnostic.SA1601.severity = none

dotnet_diagnostic.SA1602.severity = none

dotnet_diagnostic.SA1604.severity = none

dotnet_diagnostic.SA1605.severity = none

dotnet_diagnostic.SA1606.severity = none

dotnet_diagnostic.SA1607.severity = none

dotnet_diagnostic.SA1608.severity = none

dotnet_diagnostic.SA1610.severity = none

dotnet_diagnostic.SA1611.severity = none

dotnet_diagnostic.SA1612.severity = none

dotnet_diagnostic.SA1613.severity = none

dotnet_diagnostic.SA1614.severity = none

dotnet_diagnostic.SA1615.severity = none

dotnet_diagnostic.SA1616.severity = none

dotnet_diagnostic.SA1617.severity = none

dotnet_diagnostic.SA1618.severity = none

dotnet_diagnostic.SA1619.severity = none

dotnet_diagnostic.SA1620.severity = none

dotnet_diagnostic.SA1621.severity = none

dotnet_diagnostic.SA1622.severity = none

dotnet_diagnostic.SA1623.severity = none

dotnet_diagnostic.SA1624.severity = none

dotnet_diagnostic.SA1625.severity = none

dotnet_diagnostic.SA1626.severity = none

dotnet_diagnostic.SA1627.severity = none

dotnet_diagnostic.SA1633.severity = none

dotnet_diagnostic.SA1634.severity = none

dotnet_diagnostic.SA1635.severity = none

dotnet_diagnostic.SA1636.severity = none

dotnet_diagnostic.SA1637.severity = none

dotnet_diagnostic.SA1638.severity = none

dotnet_diagnostic.SA1640.severity = none

dotnet_diagnostic.SA1641.severity = none

dotnet_diagnostic.SA1642.severity = none

dotnet_diagnostic.SA1643.severity = none

dotnet_diagnostic.SA1648.severity = none

dotnet_diagnostic.SA1649.severity = none

dotnet_diagnostic.SA1651.severity = none

dotnet_diagnostic.SA1652.severity = none

dotnet_diagnostic.SX1101.severity = warning

dotnet_diagnostic.SX1309.severity = warning
117 changes: 69 additions & 48 deletions Maui.Tabs/Effects/TouchEffect.cs
Original file line number Diff line number Diff line change
@@ -1,63 +1,84 @@
using Microsoft.Maui.Controls;

namespace Sharpnado.Tabs.Effects {
public static class TouchEffect {

public static readonly BindableProperty ColorProperty =
BindableProperty.CreateAttached(
"Color",
typeof(Color),
typeof(TouchEffect),
KnownColor.Accent,
propertyChanged: PropertyChanged
);

public static void SetColor(BindableObject view, Color value) {
view.SetValue(ColorProperty, value);
}
namespace Sharpnado.Tabs.Effects;

public static Color GetColor(BindableObject view) {
return (Color)view.GetValue(ColorProperty);
}
public static class TouchEffect
{
public static readonly BindableProperty ColorProperty = BindableProperty.CreateAttached(
"Color",
typeof(Color),
typeof(TouchEffect),
KnownColor.Accent,
propertyChanged: PropertyChanged);

public static void SetColor(BindableObject view, Color value)
{
view.SetValue(ColorProperty, value);
}

public static Color GetColor(BindableObject view)
{
return (Color)view.GetValue(ColorProperty);
}

public static void UnregisterEffect(BindableObject bindable)
public static void UnregisterEffect(BindableObject bindable)
{
if (!(bindable is View view))
{
if (!(bindable is View view))
return;
return;
}

var eff = view.Effects.FirstOrDefault(e => e is TouchRoutingEffect);
var eff = view.Effects.FirstOrDefault(e => e is TouchRoutingEffect);

if (eff == null) return;
view.Effects.Remove(eff);
if (eff == null)
{
return;
}

static void PropertyChanged(BindableObject bindable, object oldValue, object newValue) {
if (!(bindable is View view))
return;
view.Effects.Remove(eff);
}

var eff = view.Effects.FirstOrDefault(e => e is TouchRoutingEffect);
if (GetColor(bindable) != Colors.Transparent) {
view.InputTransparent = false;
private static void PropertyChanged(BindableObject bindable, object oldValue, object newValue)
{
if (!(bindable is View view))
{
return;
}

var eff = view.Effects.FirstOrDefault(e => e is TouchRoutingEffect);
if (GetColor(bindable) != Colors.Transparent)
{
view.InputTransparent = false;

if (eff != null) return;
view.Effects.Add(new TouchRoutingEffect());
if (EffectsConfig.AutoChildrenInputTransparent && bindable is Layout &&
!EffectsConfig.GetChildrenInputTransparent(view)) {
EffectsConfig.SetChildrenInputTransparent(view, true);
}
if (eff != null)
{
return;
}
else {
if (eff == null) return;
view.Effects.Remove(eff);
if (EffectsConfig.AutoChildrenInputTransparent && bindable is Layout &&
EffectsConfig.GetChildrenInputTransparent(view)) {
EffectsConfig.SetChildrenInputTransparent(view, false);
}

view.Effects.Add(new TouchRoutingEffect());
if (EffectsConfig.AutoChildrenInputTransparent
&& bindable is Layout
&& !EffectsConfig.GetChildrenInputTransparent(view))
{
EffectsConfig.SetChildrenInputTransparent(view, true);
}
}
}
else
{
if (eff == null)
{
return;
}

public class TouchRoutingEffect : RoutingEffect
{
view.Effects.Remove(eff);
if (EffectsConfig.AutoChildrenInputTransparent
&& bindable is Layout
&& EffectsConfig.GetChildrenInputTransparent(view))
{
EffectsConfig.SetChildrenInputTransparent(view, false);
}
}
}
}

public class TouchRoutingEffect : RoutingEffect
{
}
6 changes: 3 additions & 3 deletions Maui.Tabs/Maui.Tabs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

<PropertyGroup>
<Product>$(AssemblyName) ($(TargetFramework))</Product>
<AssemblyVersion>3.1.0</AssemblyVersion>
<AssemblyFileVersion>3.1.0</AssemblyFileVersion>
<Version>3.1.0</Version>
<AssemblyVersion>3.1.1</AssemblyVersion>
<AssemblyFileVersion>3.1.1</AssemblyFileVersion>
<Version>3.1.1</Version>
<PackOnBuild>true</PackOnBuild>
<NeutralLanguage>en</NeutralLanguage>

Expand Down
Loading

0 comments on commit d3a60ce

Please sign in to comment.