Skip to content

Commit

Permalink
Don't setup native defaults by default
Browse files Browse the repository at this point in the history
  • Loading branch information
PureWeen committed Jul 1, 2021
1 parent eb09c2c commit 9cabc82
Show file tree
Hide file tree
Showing 22 changed files with 33 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ public partial class ActivityIndicatorHandler : ViewHandler<IActivityIndicator,
Style = UI.Xaml.Application.Current.Resources["MauiActivityIndicatorStyle"] as UI.Xaml.Style
};

protected override void SetupDefaults(MauiActivityIndicator nativeView)
void SetupDefaults(MauiActivityIndicator nativeView)
{
_foregroundDefault = nativeView.GetForegroundCache();

base.SetupDefaults(nativeView);
}

public static void MapIsRunning(ActivityIndicatorHandler handler, IActivityIndicator activityIndicator)
Expand Down
4 changes: 1 addition & 3 deletions src/Core/src/Handlers/Button/ButtonHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected override AppCompatButton CreateNativeView()
return nativeButton;
}

protected override void SetupDefaults(AppCompatButton nativeView)
void SetupDefaults(AppCompatButton nativeView)
{
DefaultPadding = new Thickness(
nativeView.PaddingLeft,
Expand All @@ -34,8 +34,6 @@ protected override void SetupDefaults(AppCompatButton nativeView)
nativeView.PaddingBottom);

DefaultBackground = nativeView.Background;

base.SetupDefaults(nativeView);
}

protected override void ConnectHandler(AppCompatButton nativeView)
Expand Down
4 changes: 1 addition & 3 deletions src/Core/src/Handlers/Button/ButtonHandler.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ public partial class ButtonHandler : ViewHandler<IButton, MauiButton>
protected override MauiButton CreateNativeView()
=> new MauiButton();

protected override void SetupDefaults(MauiButton nativeView)
void SetupDefaults(MauiButton nativeView)
{
DefaultPadding = (UI.Xaml.Thickness)MauiWinUIApplication.Current.Resources["ButtonPadding"];
DefaultForeground = (UI.Xaml.Media.Brush)MauiWinUIApplication.Current.Resources["ButtonForegroundThemeBrush"];
DefaultBackground = (UI.Xaml.Media.Brush)MauiWinUIApplication.Current.Resources["ButtonBackgroundThemeBrush"];

base.SetupDefaults(nativeView);
}

protected override void ConnectHandler(MauiButton nativeView)
Expand Down
4 changes: 1 addition & 3 deletions src/Core/src/Handlers/Button/ButtonHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@ protected override void DisconnectHandler(UIButton nativeView)
base.DisconnectHandler(nativeView);
}

protected override void SetupDefaults(UIButton nativeView)
void SetupDefaults(UIButton nativeView)
{
ButtonTextColorDefaultNormal = nativeView.TitleColor(UIControlState.Normal);
ButtonTextColorDefaultHighlighted = nativeView.TitleColor(UIControlState.Highlighted);
ButtonTextColorDefaultDisabled = nativeView.TitleColor(UIControlState.Disabled);

base.SetupDefaults(nativeView);
}

public static void MapText(ButtonHandler handler, IButton button)
Expand Down
4 changes: 2 additions & 2 deletions src/Core/src/Handlers/DatePicker/DatePickerHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ protected override MauiDatePicker CreateNativeView()
return mauiDatePicker;
}

protected override void SetupDefaults(MauiDatePicker nativeView)
void SetupDefaults(MauiDatePicker nativeView)
{
_defaultBackground = nativeView.Background;
_defaultTextColors = nativeView.TextColors;

base.SetupDefaults(nativeView);

}

internal DatePickerDialog? DatePickerDialog { get { return _dialog; } }
Expand Down
4 changes: 2 additions & 2 deletions src/Core/src/Handlers/DatePicker/DatePickerHandler.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ protected override void DisconnectHandler(CalendarDatePicker nativeView)
nativeView.DateChanged -= DateChanged;
}

protected override void SetupDefaults(CalendarDatePicker nativeView)
void SetupDefaults(CalendarDatePicker nativeView)
{
_defaultForeground = nativeView.Foreground;

base.SetupDefaults(nativeView);

}

public static void MapFormat(DatePickerHandler handler, IDatePicker datePicker)
Expand Down
4 changes: 2 additions & 2 deletions src/Core/src/Handlers/Editor/EditorHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ protected override void DisconnectHandler(AppCompatEditText nativeView)
FocusChangeListener.Handler = null;
}

protected override void SetupDefaults(AppCompatEditText nativeView)
void SetupDefaults(AppCompatEditText nativeView)
{
base.SetupDefaults(nativeView);


DefaultTextColors = nativeView.TextColors;
DefaultPlaceholderTextColors = nativeView.HintTextColors;
Expand Down
4 changes: 2 additions & 2 deletions src/Core/src/Handlers/Editor/EditorHandler.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ protected override void DisconnectHandler(MauiTextBox nativeView)
nativeView.LostFocus -= OnLostFocus;
}

protected override void SetupDefaults(MauiTextBox nativeView)
void SetupDefaults(MauiTextBox nativeView)
{
_placeholderDefaultBrush = nativeView.PlaceholderForeground;
_defaultPlaceholderColorFocusBrush = nativeView.PlaceholderForegroundFocusBrush;

base.SetupDefaults(nativeView);

}

public static void MapText(EditorHandler handler, IEditor editor)
Expand Down
4 changes: 2 additions & 2 deletions src/Core/src/Handlers/Entry/EntryHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ protected override void DisconnectHandler(AppCompatEditText nativeView)
ActionListener.Handler = null;
}

protected override void SetupDefaults(AppCompatEditText nativeView)
void SetupDefaults(AppCompatEditText nativeView)
{
base.SetupDefaults(nativeView);


ClearButtonDrawable = GetClearButtonDrawable();
DefaultTextColors = nativeView.TextColors;
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Handlers/Entry/EntryHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected override void DisconnectHandler(MauiTextField nativeView)
nativeView.ShouldChangeCharacters -= OnShouldChangeCharacters;
}

protected override void SetupDefaults(MauiTextField nativeView)
void SetupDefaults(MauiTextField nativeView)
{
DefaultTextColor = nativeView.TextColor;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Handlers/Label/LabelHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public partial class LabelHandler : ViewHandler<ILabel, TextView>

protected override TextView CreateNativeView() => new TextView(Context);

protected override void SetupDefaults(TextView nativeView)
void SetupDefaults(TextView nativeView)
{
if (nativeView.TextColors == null)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Core/src/Handlers/Picker/PickerHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ protected override void DisconnectHandler(MauiPicker nativeView)
base.DisconnectHandler(nativeView);
}

protected override void SetupDefaults(MauiPicker nativeView)
void SetupDefaults(MauiPicker nativeView)
{
base.SetupDefaults(nativeView);


DefaultBackground = nativeView.Background;
DefaultTitleColors = nativeView.HintTextColors;
Expand Down
4 changes: 2 additions & 2 deletions src/Core/src/Handlers/Picker/PickerHandler.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ protected override void DisconnectHandler(MauiComboBox nativeView)
nativeView.SelectionChanged -= OnControlSelectionChanged;
}

protected override void SetupDefaults(MauiComboBox nativeView)
void SetupDefaults(MauiComboBox nativeView)
{
_defaultForeground = nativeView.Foreground;

base.SetupDefaults(nativeView);

}
void Reload()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Core/src/Handlers/SearchBar/SearchBarHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ protected override SearchView CreateNativeView()
return searchView;
}

protected override void SetupDefaults(SearchView nativeView)
void SetupDefaults(SearchView nativeView)
{
DefaultBackground = nativeView.Background;

base.SetupDefaults(nativeView);

}

// This is a Android-specific mapping
Expand Down
4 changes: 2 additions & 2 deletions src/Core/src/Handlers/SearchBar/SearchBarHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected override void DisconnectHandler(UISearchBar nativeView)
base.DisconnectHandler(nativeView);
}

protected override void SetupDefaults(UISearchBar nativeView)
void SetupDefaults(UISearchBar nativeView)
{
_defaultTextColor = QueryEditor?.TextColor;

Expand All @@ -60,7 +60,7 @@ protected override void SetupDefaults(UISearchBar nativeView)
_cancelButtonTextColorDefaultDisabled = cancelButton.TitleColor(UIControlState.Disabled);
}

base.SetupDefaults(nativeView);

}

public static void MapText(SearchBarHandler handler, ISearchBar searchBar)
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Handlers/Slider/SliderHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected override void DisconnectHandler(SeekBar nativeView)
nativeView.SetOnSeekBarChangeListener(null);
}

protected override void SetupDefaults(SeekBar nativeView)
void SetupDefaults(SeekBar nativeView)
{
DefaultThumbColorFilter = nativeView.Thumb?.GetColorFilter();
DefaultProgressTintMode = nativeView.ProgressTintMode;
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Handlers/Slider/SliderHandler.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected override void DisconnectHandler(MauiSlider nativeView)
_pointerReleasedHandler = null;
}

protected override void SetupDefaults(MauiSlider nativeView)
void SetupDefaults(MauiSlider nativeView)
{
DefaultForegroundColor = nativeView.Foreground;
DefaultBackgroundColor = nativeView.Background;
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Handlers/Slider/SliderHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected override void DisconnectHandler(UISlider nativeView)
nativeView.RemoveTarget(OnTouchUpControlEvent, UIControlEvent.TouchUpInside | UIControlEvent.TouchUpOutside);
}

protected override void SetupDefaults(UISlider nativeView)
void SetupDefaults(UISlider nativeView)
{
DefaultMinTrackColor = nativeView.MinimumTrackTintColor;
DefaultMaxTrackColor = nativeView.MaximumTrackTintColor;
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Handlers/Switch/SwitchHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected override void DisconnectHandler(ASwitch nativeView)
nativeView.SetOnCheckedChangeListener(null);
}

protected override void SetupDefaults(ASwitch nativeView)
void SetupDefaults(ASwitch nativeView)
{
DefaultTrackColorStateList = nativeView.GetDefaultSwitchTrackColorStateList();
DefaultThumbColorStateList = nativeView.GetDefaultSwitchThumbColorStateList();
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Handlers/Switch/SwitchHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected override void DisconnectHandler(UISwitch nativeView)
nativeView.ValueChanged -= OnControlValueChanged;
}

protected override void SetupDefaults(UISwitch nativeView)
void SetupDefaults(UISwitch nativeView)
{
DefaultOnTrackColor = UISwitch.Appearance.OnTintColor;
DefaultOffTrackColor = nativeView.GetOffTrackColor();
Expand Down
4 changes: 2 additions & 2 deletions src/Core/src/Handlers/TimePicker/TimePickerHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ protected override MauiTimePicker CreateNativeView()
return _timePicker;
}

protected override void SetupDefaults(MauiTimePicker nativeView)
void SetupDefaults(MauiTimePicker nativeView)
{
DefaultBackground = nativeView.Background;

base.SetupDefaults(nativeView);

}

protected override void DisconnectHandler(MauiTimePicker nativeView)
Expand Down
4 changes: 2 additions & 2 deletions src/Core/src/Handlers/TimePicker/TimePickerHandler.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ protected override void DisconnectHandler(TimePicker nativeView)
nativeView.TimeChanged -= OnControlTimeChanged;
}

protected override void SetupDefaults(TimePicker nativeView)
void SetupDefaults(TimePicker nativeView)
{
_defaultForeground = nativeView.Foreground;

base.SetupDefaults(nativeView);

}

public static void MapFormat(TimePickerHandler handler, ITimePicker timePicker)
Expand Down

0 comments on commit 9cabc82

Please sign in to comment.