diff --git a/Pixiview.Android/GlobalSuppressions.cs b/Pixiview.Android/GlobalSuppressions.cs index 4a412a1..3048d28 100644 --- a/Pixiview.Android/GlobalSuppressions.cs +++ b/Pixiview.Android/GlobalSuppressions.cs @@ -6,4 +6,6 @@ using System.Diagnostics.CodeAnalysis; [assembly: SuppressMessage("Style", "IDE0056:Use index operator", Justification = "")] +[assembly: SuppressMessage("Style", "IDE0057:Use range operator", Justification = "")] +[assembly: SuppressMessage("Style", "IDE0063:Use simple 'using' statement", Justification = "")] [assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "")] diff --git a/Pixiview.Android/Pixiview.Android.csproj b/Pixiview.Android/Pixiview.Android.csproj index 20a4453..fc31ec3 100644 --- a/Pixiview.Android/Pixiview.Android.csproj +++ b/Pixiview.Android/Pixiview.Android.csproj @@ -68,6 +68,8 @@ + + @@ -155,6 +157,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -166,6 +192,7 @@ + diff --git a/Pixiview.Android/Renderers/BlurryPanelRenderer.cs b/Pixiview.Android/Renderers/BlurryPanelRenderer.cs new file mode 100644 index 0000000..a449b31 --- /dev/null +++ b/Pixiview.Android/Renderers/BlurryPanelRenderer.cs @@ -0,0 +1,23 @@ +using Android.Content; +using Pixiview.Droid.Renderers; +using Pixiview.UI; +using Xamarin.Forms; +using Xamarin.Forms.Platform.Android; + +[assembly: ExportRenderer(typeof(BlurryPanel), typeof(BlurryPanelRenderer))] +namespace Pixiview.Droid.Renderers +{ + public class BlurryPanelRenderer : ViewRenderer + { + public BlurryPanelRenderer(Context context) : base(context) + { + } + + protected override void OnElementChanged(ElementChangedEventArgs e) + { + base.OnElementChanged(e); + + SetBackgroundColor(Color.Black.MultiplyAlpha(.92).ToAndroid()); + } + } +} diff --git a/Pixiview.Android/Renderers/SegmentedControlRenderer.cs b/Pixiview.Android/Renderers/SegmentedControlRenderer.cs new file mode 100644 index 0000000..fe839b3 --- /dev/null +++ b/Pixiview.Android/Renderers/SegmentedControlRenderer.cs @@ -0,0 +1,234 @@ +using Android.Content; +using Android.Graphics.Drawables; +using Android.Views; +using Android.Widget; +using Pixiview.Droid.Renderers; +using Pixiview.UI; +using Xamarin.Forms.Platform.Android; + +[assembly: Xamarin.Forms.ExportRenderer(typeof(SegmentedControl), typeof(SegmentedControlRenderer))] +namespace Pixiview.Droid.Renderers +{ + public class SegmentedControlRenderer : ViewRenderer + { + RadioGroup nativeControl; + RadioButton _rb; + readonly Context context; + + public SegmentedControlRenderer(Context context) : base(context) + { + this.context = context; + } + + protected override void OnElementChanged(ElementChangedEventArgs e) + { + base.OnElementChanged(e); + + if (Control == null) + { + // Instantiate the native control and assign it to the Control property with + // the SetNativeControl method + + var layoutInflater = LayoutInflater.From(context); + + var view = layoutInflater.Inflate(Resource.Layout.RadioGroup, null); + + nativeControl = (RadioGroup)layoutInflater.Inflate(Resource.Layout.RadioGroup, null); + var density = context.Resources.DisplayMetrics.Density; + + for (var i = 0; i < Element.Children.Count; i++) + { + var o = Element.Children[i]; + var rb = (RadioButton)layoutInflater.Inflate(Resource.Layout.RadioButton, null); + + var width = rb.Paint.MeasureText(o.Text) * density + 0.5f; + rb.LayoutParameters = new RadioGroup.LayoutParams((int)width, LayoutParams.WrapContent, 1f); + rb.Text = o.Text; + + if (i == 0) + rb.SetBackgroundResource(Resource.Drawable.segmented_control_first_background); + else if (i == Element.Children.Count - 1) + rb.SetBackgroundResource(Resource.Drawable.segmented_control_last_background); + else + rb.SetBackgroundResource(Resource.Drawable.segmented_control_background); + + ConfigureRadioButton(i, rb); + + nativeControl.AddView(rb); + } + + var option = (RadioButton)nativeControl.GetChildAt(Element.SelectedSegmentIndex); + + if (option != null) + option.Checked = true; + + SetNativeControl(nativeControl); + } + + if (e.OldElement != null) + { + // Unsubscribe from event handlers and cleanup any resources + + if (nativeControl != null) + nativeControl.CheckedChange -= NativeControl_ValueChanged; + } + + if (e.NewElement != null) + { + // Configure the control and subscribe to event handlers + + nativeControl.CheckedChange += NativeControl_ValueChanged; + } + } + + protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) + { + base.OnElementPropertyChanged(sender, e); + + if (nativeControl == null || Element == null) return; + + switch (e.PropertyName) + { + case "Renderer": + Element?.SendValueChanged(); + break; + case nameof(SegmentedControl.SelectedSegmentIndex): + var option = (RadioButton)nativeControl.GetChildAt(Element.SelectedSegmentIndex); + + if (option != null) + option.Checked = true; + + if (Element.SelectedSegmentIndex < 0) + { + var layoutInflater = LayoutInflater.From(context); + + nativeControl = (RadioGroup)layoutInflater.Inflate(Resource.Layout.RadioGroup, null); + + for (var i = 0; i < Element.Children.Count; i++) + { + var o = Element.Children[i]; + var rb = (RadioButton)layoutInflater.Inflate(Resource.Layout.RadioButton, null); + + var width = rb.Paint.MeasureText(o.Text); + rb.LayoutParameters = new RadioGroup.LayoutParams((int)width, LayoutParams.WrapContent, 1f); + rb.Text = o.Text; + + if (i == 0) + rb.SetBackgroundResource(Resource.Drawable.segmented_control_first_background); + else if (i == Element.Children.Count - 1) + rb.SetBackgroundResource(Resource.Drawable.segmented_control_last_background); + else + rb.SetBackgroundResource(Resource.Drawable.segmented_control_background); + + ConfigureRadioButton(i, rb); + + nativeControl.AddView(rb); + } + + nativeControl.CheckedChange += NativeControl_ValueChanged; + + SetNativeControl(nativeControl); + } + + Element.SendValueChanged(); + break; + case nameof(SegmentedControl.TintColor): + OnPropertyChanged(); + break; + case nameof(SegmentedControl.IsEnabled): + OnPropertyChanged(); + break; + case nameof(SegmentedControl.SelectedTextColor): + var v = (RadioButton)nativeControl.GetChildAt(Element.SelectedSegmentIndex); + v.SetTextColor(Element.SelectedTextColor.ToAndroid()); + break; + } + } + + void OnPropertyChanged() + { + if (nativeControl != null && Element != null) + { + for (var i = 0; i < Element.Children.Count; i++) + { + var rb = (RadioButton)nativeControl.GetChildAt(i); + + ConfigureRadioButton(i, rb); + } + } + } + + void ConfigureRadioButton(int i, RadioButton rb) + { + if (i == Element.SelectedSegmentIndex) + { + rb.SetTextColor(Element.SelectedTextColor.ToAndroid()); + _rb = rb; + } + else + { + var textColor = Element.IsEnabled ? Element.TintColor.ToAndroid() : Element.DisabledColor.ToAndroid(); + rb.SetTextColor(textColor); + } + + GradientDrawable selectedShape; + GradientDrawable unselectedShape; + + var gradientDrawable = (StateListDrawable)rb.Background; + var drawableContainerState = (DrawableContainer.DrawableContainerState)gradientDrawable.GetConstantState(); + var children = drawableContainerState.GetChildren(); + + // Doesnt works on API < 18 + selectedShape = children[0] is GradientDrawable ? (GradientDrawable)children[0] : (GradientDrawable)((InsetDrawable)children[0]).Drawable; + unselectedShape = children[1] is GradientDrawable ? (GradientDrawable)children[1] : (GradientDrawable)((InsetDrawable)children[1]).Drawable; + + var color = Element.IsEnabled ? Element.TintColor.ToAndroid() : Element.DisabledColor.ToAndroid(); + + selectedShape.SetStroke(3, color); + selectedShape.SetColor(color); + unselectedShape.SetStroke(3, color); + + rb.Enabled = Element.IsEnabled; + } + + void NativeControl_ValueChanged(object sender, RadioGroup.CheckedChangeEventArgs e) + { + var rg = (RadioGroup)sender; + if (rg.CheckedRadioButtonId != -1) + { + var id = rg.CheckedRadioButtonId; + var radioButton = rg.FindViewById(id); + var radioId = rg.IndexOfChild(radioButton); + + var rb = (RadioButton)rg.GetChildAt(radioId); + + var color = Element.IsEnabled ? Element.TintColor.ToAndroid() : Element.DisabledColor.ToAndroid(); + _rb?.SetTextColor(color); + rb.SetTextColor(Element.SelectedTextColor.ToAndroid()); + _rb = rb; + + Element.SelectedSegmentIndex = radioId; + } + } + + protected override void Dispose(bool disposing) + { + if (nativeControl != null) + { + nativeControl.CheckedChange -= NativeControl_ValueChanged; + nativeControl.Dispose(); + nativeControl = null; + _rb = null; + } + + try + { + base.Dispose(disposing); + } + catch + { + return; + } + } + } +} diff --git a/Pixiview.Android/Resources/Resource.designer.cs b/Pixiview.Android/Resources/Resource.designer.cs index 93e746d..dc5db25 100644 --- a/Pixiview.Android/Resources/Resource.designer.cs +++ b/Pixiview.Android/Resources/Resource.designer.cs @@ -7262,79 +7262,88 @@ namespace Pixiview.Droid public const int mtrl_text_btn_text_color_selector = 2131034218; // aapt resource value: 0x7F05006F - public const int notification_action_color_filter = 2131034223; + public const int normal = 2131034223; // aapt resource value: 0x7F050070 - public const int notification_icon_bg_color = 2131034224; + public const int notification_action_color_filter = 2131034224; // aapt resource value: 0x7F050071 - public const int notification_material_background_media_default_color = 2131034225; + public const int notification_icon_bg_color = 2131034225; // aapt resource value: 0x7F050072 - public const int primary_dark_material_dark = 2131034226; + public const int notification_material_background_media_default_color = 2131034226; // aapt resource value: 0x7F050073 - public const int primary_dark_material_light = 2131034227; + public const int primary_dark_material_dark = 2131034227; // aapt resource value: 0x7F050074 - public const int primary_material_dark = 2131034228; + public const int primary_dark_material_light = 2131034228; // aapt resource value: 0x7F050075 - public const int primary_material_light = 2131034229; + public const int primary_material_dark = 2131034229; // aapt resource value: 0x7F050076 - public const int primary_text_default_material_dark = 2131034230; + public const int primary_material_light = 2131034230; // aapt resource value: 0x7F050077 - public const int primary_text_default_material_light = 2131034231; + public const int primary_text_default_material_dark = 2131034231; // aapt resource value: 0x7F050078 - public const int primary_text_disabled_material_dark = 2131034232; + public const int primary_text_default_material_light = 2131034232; // aapt resource value: 0x7F050079 - public const int primary_text_disabled_material_light = 2131034233; + public const int primary_text_disabled_material_dark = 2131034233; // aapt resource value: 0x7F05007A - public const int ripple_material_dark = 2131034234; + public const int primary_text_disabled_material_light = 2131034234; // aapt resource value: 0x7F05007B - public const int ripple_material_light = 2131034235; + public const int ripple_material_dark = 2131034235; // aapt resource value: 0x7F05007C - public const int secondary_text_default_material_dark = 2131034236; + public const int ripple_material_light = 2131034236; // aapt resource value: 0x7F05007D - public const int secondary_text_default_material_light = 2131034237; + public const int secondary_text_default_material_dark = 2131034237; // aapt resource value: 0x7F05007E - public const int secondary_text_disabled_material_dark = 2131034238; + public const int secondary_text_default_material_light = 2131034238; // aapt resource value: 0x7F05007F - public const int secondary_text_disabled_material_light = 2131034239; + public const int secondary_text_disabled_material_dark = 2131034239; // aapt resource value: 0x7F050080 - public const int switch_thumb_disabled_material_dark = 2131034240; + public const int secondary_text_disabled_material_light = 2131034240; // aapt resource value: 0x7F050081 - public const int switch_thumb_disabled_material_light = 2131034241; + public const int segmented_control_text = 2131034241; // aapt resource value: 0x7F050082 - public const int switch_thumb_material_dark = 2131034242; + public const int selected = 2131034242; // aapt resource value: 0x7F050083 - public const int switch_thumb_material_light = 2131034243; + public const int switch_thumb_disabled_material_dark = 2131034243; // aapt resource value: 0x7F050084 - public const int switch_thumb_normal_material_dark = 2131034244; + public const int switch_thumb_disabled_material_light = 2131034244; // aapt resource value: 0x7F050085 - public const int switch_thumb_normal_material_light = 2131034245; + public const int switch_thumb_material_dark = 2131034245; // aapt resource value: 0x7F050086 - public const int tooltip_background_dark = 2131034246; + public const int switch_thumb_material_light = 2131034246; // aapt resource value: 0x7F050087 - public const int tooltip_background_light = 2131034247; + public const int switch_thumb_normal_material_dark = 2131034247; + + // aapt resource value: 0x7F050088 + public const int switch_thumb_normal_material_light = 2131034248; + + // aapt resource value: 0x7F050089 + public const int tooltip_background_dark = 2131034249; + + // aapt resource value: 0x7F05008A + public const int tooltip_background_light = 2131034250; static Color() { @@ -8359,13 +8368,22 @@ namespace Pixiview.Droid public const int notify_panel_notification_icon_bg = 2131165300; // aapt resource value: 0x7F070075 - public const int tooltip_frame_dark = 2131165301; + public const int segmented_control_background = 2131165301; // aapt resource value: 0x7F070076 - public const int tooltip_frame_light = 2131165302; + public const int segmented_control_first_background = 2131165302; // aapt resource value: 0x7F070077 - public const int userprofile = 2131165303; + public const int segmented_control_last_background = 2131165303; + + // aapt resource value: 0x7F070078 + public const int tooltip_frame_dark = 2131165304; + + // aapt resource value: 0x7F070079 + public const int tooltip_frame_light = 2131165305; + + // aapt resource value: 0x7F07007A + public const int userprofile = 2131165306; static Drawable() { @@ -8380,626 +8398,632 @@ namespace Pixiview.Droid public partial class Id { - // aapt resource value: 0x7F080006 - public const int action0 = 2131230726; - - // aapt resource value: 0x7F080018 - public const int actions = 2131230744; - // aapt resource value: 0x7F080007 - public const int action_bar = 2131230727; - - // aapt resource value: 0x7F080008 - public const int action_bar_activity_content = 2131230728; - - // aapt resource value: 0x7F080009 - public const int action_bar_container = 2131230729; - - // aapt resource value: 0x7F08000A - public const int action_bar_root = 2131230730; - - // aapt resource value: 0x7F08000B - public const int action_bar_spinner = 2131230731; - - // aapt resource value: 0x7F08000C - public const int action_bar_subtitle = 2131230732; - - // aapt resource value: 0x7F08000D - public const int action_bar_title = 2131230733; - - // aapt resource value: 0x7F08000E - public const int action_container = 2131230734; - - // aapt resource value: 0x7F08000F - public const int action_context_bar = 2131230735; - - // aapt resource value: 0x7F080010 - public const int action_divider = 2131230736; - - // aapt resource value: 0x7F080011 - public const int action_image = 2131230737; - - // aapt resource value: 0x7F080012 - public const int action_menu_divider = 2131230738; - - // aapt resource value: 0x7F080013 - public const int action_menu_presenter = 2131230739; - - // aapt resource value: 0x7F080014 - public const int action_mode_bar = 2131230740; - - // aapt resource value: 0x7F080015 - public const int action_mode_bar_stub = 2131230741; - - // aapt resource value: 0x7F080016 - public const int action_mode_close_button = 2131230742; - - // aapt resource value: 0x7F080017 - public const int action_text = 2131230743; + public const int action0 = 2131230727; // aapt resource value: 0x7F080019 - public const int activity_chooser_view_content = 2131230745; + public const int actions = 2131230745; + + // aapt resource value: 0x7F080008 + public const int action_bar = 2131230728; + + // aapt resource value: 0x7F080009 + public const int action_bar_activity_content = 2131230729; + + // aapt resource value: 0x7F08000A + public const int action_bar_container = 2131230730; + + // aapt resource value: 0x7F08000B + public const int action_bar_root = 2131230731; + + // aapt resource value: 0x7F08000C + public const int action_bar_spinner = 2131230732; + + // aapt resource value: 0x7F08000D + public const int action_bar_subtitle = 2131230733; + + // aapt resource value: 0x7F08000E + public const int action_bar_title = 2131230734; + + // aapt resource value: 0x7F08000F + public const int action_container = 2131230735; + + // aapt resource value: 0x7F080010 + public const int action_context_bar = 2131230736; + + // aapt resource value: 0x7F080011 + public const int action_divider = 2131230737; + + // aapt resource value: 0x7F080012 + public const int action_image = 2131230738; + + // aapt resource value: 0x7F080013 + public const int action_menu_divider = 2131230739; + + // aapt resource value: 0x7F080014 + public const int action_menu_presenter = 2131230740; + + // aapt resource value: 0x7F080015 + public const int action_mode_bar = 2131230741; + + // aapt resource value: 0x7F080016 + public const int action_mode_bar_stub = 2131230742; + + // aapt resource value: 0x7F080017 + public const int action_mode_close_button = 2131230743; + + // aapt resource value: 0x7F080018 + public const int action_text = 2131230744; // aapt resource value: 0x7F08001A - public const int add = 2131230746; + public const int activity_chooser_view_content = 2131230746; // aapt resource value: 0x7F08001B - public const int alertTitle = 2131230747; + public const int add = 2131230747; // aapt resource value: 0x7F08001C - public const int all = 2131230748; + public const int alertTitle = 2131230748; + + // aapt resource value: 0x7F08001D + public const int all = 2131230749; // aapt resource value: 0x7F080000 public const int ALT = 2131230720; - // aapt resource value: 0x7F08001D - public const int always = 2131230749; - // aapt resource value: 0x7F08001E - public const int async = 2131230750; + public const int always = 2131230750; // aapt resource value: 0x7F08001F - public const int auto = 2131230751; + public const int async = 2131230751; // aapt resource value: 0x7F080020 - public const int beginning = 2131230752; + public const int auto = 2131230752; // aapt resource value: 0x7F080021 - public const int blocking = 2131230753; + public const int beginning = 2131230753; // aapt resource value: 0x7F080022 - public const int bottom = 2131230754; + public const int blocking = 2131230754; // aapt resource value: 0x7F080023 - public const int bottomtab_navarea = 2131230755; + public const int bottom = 2131230755; // aapt resource value: 0x7F080024 - public const int bottomtab_tabbar = 2131230756; + public const int bottomtab_navarea = 2131230756; // aapt resource value: 0x7F080025 - public const int browser_actions_header_text = 2131230757; - - // aapt resource value: 0x7F080028 - public const int browser_actions_menu_items = 2131230760; + public const int bottomtab_tabbar = 2131230757; // aapt resource value: 0x7F080026 - public const int browser_actions_menu_item_icon = 2131230758; - - // aapt resource value: 0x7F080027 - public const int browser_actions_menu_item_text = 2131230759; + public const int browser_actions_header_text = 2131230758; // aapt resource value: 0x7F080029 - public const int browser_actions_menu_view = 2131230761; + public const int browser_actions_menu_items = 2131230761; + + // aapt resource value: 0x7F080027 + public const int browser_actions_menu_item_icon = 2131230759; + + // aapt resource value: 0x7F080028 + public const int browser_actions_menu_item_text = 2131230760; // aapt resource value: 0x7F08002A - public const int buttonPanel = 2131230762; + public const int browser_actions_menu_view = 2131230762; // aapt resource value: 0x7F08002B - public const int cancel_action = 2131230763; + public const int buttonPanel = 2131230763; // aapt resource value: 0x7F08002C - public const int center = 2131230764; + public const int cancel_action = 2131230764; // aapt resource value: 0x7F08002D - public const int center_horizontal = 2131230765; + public const int center = 2131230765; // aapt resource value: 0x7F08002E - public const int center_vertical = 2131230766; + public const int center_horizontal = 2131230766; // aapt resource value: 0x7F08002F - public const int checkbox = 2131230767; + public const int center_vertical = 2131230767; // aapt resource value: 0x7F080030 - public const int chronometer = 2131230768; + public const int checkbox = 2131230768; // aapt resource value: 0x7F080031 - public const int clip_horizontal = 2131230769; + public const int chronometer = 2131230769; // aapt resource value: 0x7F080032 - public const int clip_vertical = 2131230770; + public const int clip_horizontal = 2131230770; // aapt resource value: 0x7F080033 - public const int collapseActionView = 2131230771; + public const int clip_vertical = 2131230771; // aapt resource value: 0x7F080034 - public const int container = 2131230772; + public const int collapseActionView = 2131230772; // aapt resource value: 0x7F080035 - public const int content = 2131230773; + public const int container = 2131230773; // aapt resource value: 0x7F080036 - public const int contentPanel = 2131230774; + public const int content = 2131230774; // aapt resource value: 0x7F080037 - public const int coordinator = 2131230775; + public const int contentPanel = 2131230775; + + // aapt resource value: 0x7F080038 + public const int coordinator = 2131230776; // aapt resource value: 0x7F080001 public const int CTRL = 2131230721; - // aapt resource value: 0x7F080038 - public const int custom = 2131230776; - // aapt resource value: 0x7F080039 - public const int customPanel = 2131230777; + public const int custom = 2131230777; // aapt resource value: 0x7F08003A - public const int decor_content_parent = 2131230778; + public const int customPanel = 2131230778; // aapt resource value: 0x7F08003B - public const int default_activity_button = 2131230779; + public const int decor_content_parent = 2131230779; // aapt resource value: 0x7F08003C - public const int design_bottom_sheet = 2131230780; + public const int default_activity_button = 2131230780; // aapt resource value: 0x7F08003D - public const int design_menu_item_action_area = 2131230781; + public const int design_bottom_sheet = 2131230781; // aapt resource value: 0x7F08003E - public const int design_menu_item_action_area_stub = 2131230782; + public const int design_menu_item_action_area = 2131230782; // aapt resource value: 0x7F08003F - public const int design_menu_item_text = 2131230783; + public const int design_menu_item_action_area_stub = 2131230783; // aapt resource value: 0x7F080040 - public const int design_navigation_view = 2131230784; + public const int design_menu_item_text = 2131230784; // aapt resource value: 0x7F080041 - public const int disableHome = 2131230785; + public const int design_navigation_view = 2131230785; // aapt resource value: 0x7F080042 - public const int edit_query = 2131230786; + public const int disableHome = 2131230786; // aapt resource value: 0x7F080043 - public const int end = 2131230787; + public const int edit_query = 2131230787; // aapt resource value: 0x7F080044 - public const int end_padder = 2131230788; + public const int end = 2131230788; // aapt resource value: 0x7F080045 - public const int enterAlways = 2131230789; + public const int end_padder = 2131230789; // aapt resource value: 0x7F080046 - public const int enterAlwaysCollapsed = 2131230790; + public const int enterAlways = 2131230790; // aapt resource value: 0x7F080047 - public const int exitUntilCollapsed = 2131230791; - - // aapt resource value: 0x7F080049 - public const int expanded_menu = 2131230793; + public const int enterAlwaysCollapsed = 2131230791; // aapt resource value: 0x7F080048 - public const int expand_activities_button = 2131230792; + public const int exitUntilCollapsed = 2131230792; // aapt resource value: 0x7F08004A - public const int fill = 2131230794; + public const int expanded_menu = 2131230794; - // aapt resource value: 0x7F08004D - public const int filled = 2131230797; + // aapt resource value: 0x7F080049 + public const int expand_activities_button = 2131230793; // aapt resource value: 0x7F08004B - public const int fill_horizontal = 2131230795; - - // aapt resource value: 0x7F08004C - public const int fill_vertical = 2131230796; + public const int fill = 2131230795; // aapt resource value: 0x7F08004E - public const int @fixed = 2131230798; + public const int filled = 2131230798; + + // aapt resource value: 0x7F08004C + public const int fill_horizontal = 2131230796; + + // aapt resource value: 0x7F08004D + public const int fill_vertical = 2131230797; // aapt resource value: 0x7F08004F - public const int flyoutcontent_appbar = 2131230799; + public const int @fixed = 2131230799; // aapt resource value: 0x7F080050 - public const int flyoutcontent_recycler = 2131230800; + public const int flyoutcontent_appbar = 2131230800; // aapt resource value: 0x7F080051 - public const int forever = 2131230801; + public const int flyoutcontent_recycler = 2131230801; + + // aapt resource value: 0x7F080052 + public const int forever = 2131230802; // aapt resource value: 0x7F080002 public const int FUNCTION = 2131230722; - // aapt resource value: 0x7F080052 - public const int ghost_view = 2131230802; - // aapt resource value: 0x7F080053 - public const int group_divider = 2131230803; + public const int ghost_view = 2131230803; // aapt resource value: 0x7F080054 - public const int home = 2131230804; + public const int group_divider = 2131230804; // aapt resource value: 0x7F080055 - public const int homeAsUp = 2131230805; + public const int home = 2131230805; // aapt resource value: 0x7F080056 - public const int icon = 2131230806; + public const int homeAsUp = 2131230806; // aapt resource value: 0x7F080057 - public const int icon_group = 2131230807; + public const int icon = 2131230807; // aapt resource value: 0x7F080058 - public const int ifRoom = 2131230808; + public const int icon_group = 2131230808; // aapt resource value: 0x7F080059 - public const int image = 2131230809; + public const int ifRoom = 2131230809; // aapt resource value: 0x7F08005A - public const int info = 2131230810; + public const int image = 2131230810; // aapt resource value: 0x7F08005B - public const int italic = 2131230811; + public const int info = 2131230811; // aapt resource value: 0x7F08005C - public const int item_touch_helper_previous_elevation = 2131230812; + public const int italic = 2131230812; // aapt resource value: 0x7F08005D - public const int labeled = 2131230813; + public const int item_touch_helper_previous_elevation = 2131230813; // aapt resource value: 0x7F08005E - public const int largeLabel = 2131230814; + public const int labeled = 2131230814; // aapt resource value: 0x7F08005F - public const int left = 2131230815; + public const int largeLabel = 2131230815; // aapt resource value: 0x7F080060 - public const int line1 = 2131230816; + public const int left = 2131230816; // aapt resource value: 0x7F080061 - public const int line3 = 2131230817; + public const int line1 = 2131230817; // aapt resource value: 0x7F080062 - public const int listMode = 2131230818; + public const int line3 = 2131230818; // aapt resource value: 0x7F080063 - public const int list_item = 2131230819; + public const int listMode = 2131230819; // aapt resource value: 0x7F080064 - public const int main_appbar = 2131230820; + public const int list_item = 2131230820; // aapt resource value: 0x7F080065 - public const int main_tablayout = 2131230821; + public const int main_appbar = 2131230821; // aapt resource value: 0x7F080066 - public const int main_toolbar = 2131230822; + public const int main_tablayout = 2131230822; // aapt resource value: 0x7F080067 - public const int main_viewpager = 2131230823; + public const int main_toolbar = 2131230823; // aapt resource value: 0x7F080068 - public const int masked = 2131230824; + public const int main_viewpager = 2131230824; // aapt resource value: 0x7F080069 - public const int media_actions = 2131230825; + public const int masked = 2131230825; // aapt resource value: 0x7F08006A - public const int message = 2131230826; + public const int media_actions = 2131230826; + + // aapt resource value: 0x7F08006B + public const int message = 2131230827; // aapt resource value: 0x7F080003 public const int META = 2131230723; - // aapt resource value: 0x7F08006B - public const int middle = 2131230827; - // aapt resource value: 0x7F08006C - public const int mini = 2131230828; + public const int middle = 2131230828; // aapt resource value: 0x7F08006D - public const int mtrl_child_content_container = 2131230829; + public const int mini = 2131230829; // aapt resource value: 0x7F08006E - public const int mtrl_internal_children_alpha_tag = 2131230830; + public const int mtrl_child_content_container = 2131230830; // aapt resource value: 0x7F08006F - public const int multiply = 2131230831; + public const int mtrl_internal_children_alpha_tag = 2131230831; // aapt resource value: 0x7F080070 - public const int navigation_header_container = 2131230832; + public const int multiply = 2131230832; // aapt resource value: 0x7F080071 - public const int never = 2131230833; + public const int navigation_header_container = 2131230833; // aapt resource value: 0x7F080072 - public const int none = 2131230834; + public const int never = 2131230834; // aapt resource value: 0x7F080073 - public const int normal = 2131230835; + public const int none = 2131230835; // aapt resource value: 0x7F080074 - public const int notification_background = 2131230836; + public const int normal = 2131230836; // aapt resource value: 0x7F080075 - public const int notification_main_column = 2131230837; + public const int notification_background = 2131230837; // aapt resource value: 0x7F080076 - public const int notification_main_column_container = 2131230838; + public const int notification_main_column = 2131230838; // aapt resource value: 0x7F080077 - public const int outline = 2131230839; + public const int notification_main_column_container = 2131230839; // aapt resource value: 0x7F080078 - public const int parallax = 2131230840; + public const int outline = 2131230840; // aapt resource value: 0x7F080079 - public const int parentPanel = 2131230841; + public const int parallax = 2131230841; // aapt resource value: 0x7F08007A - public const int parent_matrix = 2131230842; + public const int parentPanel = 2131230842; // aapt resource value: 0x7F08007B - public const int pin = 2131230843; + public const int parent_matrix = 2131230843; // aapt resource value: 0x7F08007C - public const int progress_circular = 2131230844; + public const int pin = 2131230844; // aapt resource value: 0x7F08007D - public const int progress_horizontal = 2131230845; + public const int progress_circular = 2131230845; // aapt resource value: 0x7F08007E - public const int radio = 2131230846; + public const int progress_horizontal = 2131230846; // aapt resource value: 0x7F08007F - public const int right = 2131230847; + public const int radio = 2131230847; // aapt resource value: 0x7F080080 - public const int right_icon = 2131230848; + public const int right = 2131230848; // aapt resource value: 0x7F080081 - public const int right_side = 2131230849; + public const int right_icon = 2131230849; // aapt resource value: 0x7F080082 - public const int save_image_matrix = 2131230850; + public const int right_side = 2131230850; // aapt resource value: 0x7F080083 - public const int save_non_transition_alpha = 2131230851; + public const int save_image_matrix = 2131230851; // aapt resource value: 0x7F080084 - public const int save_scale_type = 2131230852; + public const int save_non_transition_alpha = 2131230852; // aapt resource value: 0x7F080085 - public const int screen = 2131230853; + public const int save_scale_type = 2131230853; // aapt resource value: 0x7F080086 - public const int scroll = 2131230854; - - // aapt resource value: 0x7F08008A - public const int scrollable = 2131230858; + public const int screen = 2131230854; // aapt resource value: 0x7F080087 - public const int scrollIndicatorDown = 2131230855; - - // aapt resource value: 0x7F080088 - public const int scrollIndicatorUp = 2131230856; - - // aapt resource value: 0x7F080089 - public const int scrollView = 2131230857; + public const int scroll = 2131230855; // aapt resource value: 0x7F08008B - public const int search_badge = 2131230859; + public const int scrollable = 2131230859; + + // aapt resource value: 0x7F080088 + public const int scrollIndicatorDown = 2131230856; + + // aapt resource value: 0x7F080089 + public const int scrollIndicatorUp = 2131230857; + + // aapt resource value: 0x7F08008A + public const int scrollView = 2131230858; // aapt resource value: 0x7F08008C - public const int search_bar = 2131230860; + public const int search_badge = 2131230860; // aapt resource value: 0x7F08008D - public const int search_button = 2131230861; + public const int search_bar = 2131230861; // aapt resource value: 0x7F08008E - public const int search_close_btn = 2131230862; + public const int search_button = 2131230862; // aapt resource value: 0x7F08008F - public const int search_edit_frame = 2131230863; + public const int search_close_btn = 2131230863; // aapt resource value: 0x7F080090 - public const int search_go_btn = 2131230864; + public const int search_edit_frame = 2131230864; // aapt resource value: 0x7F080091 - public const int search_mag_icon = 2131230865; + public const int search_go_btn = 2131230865; // aapt resource value: 0x7F080092 - public const int search_plate = 2131230866; + public const int search_mag_icon = 2131230866; // aapt resource value: 0x7F080093 - public const int search_src_text = 2131230867; + public const int search_plate = 2131230867; // aapt resource value: 0x7F080094 - public const int search_voice_btn = 2131230868; - - // aapt resource value: 0x7F080096 - public const int selected = 2131230870; + public const int search_src_text = 2131230868; // aapt resource value: 0x7F080095 - public const int select_dialog_listview = 2131230869; + public const int search_voice_btn = 2131230869; + + // aapt resource value: 0x7F080006 + public const int SegControl = 2131230726; // aapt resource value: 0x7F080097 - public const int shellcontent_appbar = 2131230871; + public const int selected = 2131230871; + + // aapt resource value: 0x7F080096 + public const int select_dialog_listview = 2131230870; // aapt resource value: 0x7F080098 - public const int shellcontent_toolbar = 2131230872; + public const int shape_id = 2131230872; + + // aapt resource value: 0x7F080099 + public const int shellcontent_appbar = 2131230873; + + // aapt resource value: 0x7F08009A + public const int shellcontent_toolbar = 2131230874; // aapt resource value: 0x7F080004 public const int SHIFT = 2131230724; - // aapt resource value: 0x7F080099 - public const int shortcut = 2131230873; - - // aapt resource value: 0x7F08009A - public const int showCustom = 2131230874; - // aapt resource value: 0x7F08009B - public const int showHome = 2131230875; + public const int shortcut = 2131230875; // aapt resource value: 0x7F08009C - public const int showTitle = 2131230876; + public const int showCustom = 2131230876; // aapt resource value: 0x7F08009D - public const int sliding_tabs = 2131230877; + public const int showHome = 2131230877; // aapt resource value: 0x7F08009E - public const int smallLabel = 2131230878; + public const int showTitle = 2131230878; // aapt resource value: 0x7F08009F - public const int snackbar_action = 2131230879; + public const int sliding_tabs = 2131230879; // aapt resource value: 0x7F0800A0 - public const int snackbar_text = 2131230880; + public const int smallLabel = 2131230880; // aapt resource value: 0x7F0800A1 - public const int snap = 2131230881; + public const int snackbar_action = 2131230881; // aapt resource value: 0x7F0800A2 - public const int snapMargins = 2131230882; + public const int snackbar_text = 2131230882; // aapt resource value: 0x7F0800A3 - public const int spacer = 2131230883; + public const int snap = 2131230883; // aapt resource value: 0x7F0800A4 - public const int split_action_bar = 2131230884; + public const int snapMargins = 2131230884; // aapt resource value: 0x7F0800A5 - public const int src_atop = 2131230885; + public const int spacer = 2131230885; // aapt resource value: 0x7F0800A6 - public const int src_in = 2131230886; + public const int split_action_bar = 2131230886; // aapt resource value: 0x7F0800A7 - public const int src_over = 2131230887; + public const int src_atop = 2131230887; // aapt resource value: 0x7F0800A8 - public const int start = 2131230888; + public const int src_in = 2131230888; // aapt resource value: 0x7F0800A9 - public const int status_bar_latest_event_content = 2131230889; + public const int src_over = 2131230889; // aapt resource value: 0x7F0800AA - public const int stretch = 2131230890; + public const int start = 2131230890; // aapt resource value: 0x7F0800AB - public const int submenuarrow = 2131230891; + public const int status_bar_latest_event_content = 2131230891; // aapt resource value: 0x7F0800AC - public const int submit_area = 2131230892; + public const int stretch = 2131230892; + + // aapt resource value: 0x7F0800AD + public const int submenuarrow = 2131230893; + + // aapt resource value: 0x7F0800AE + public const int submit_area = 2131230894; // aapt resource value: 0x7F080005 public const int SYM = 2131230725; - // aapt resource value: 0x7F0800AD - public const int tabMode = 2131230893; - - // aapt resource value: 0x7F0800AE - public const int tag_transition_group = 2131230894; - // aapt resource value: 0x7F0800AF - public const int tag_unhandled_key_event_manager = 2131230895; + public const int tabMode = 2131230895; // aapt resource value: 0x7F0800B0 - public const int tag_unhandled_key_listeners = 2131230896; + public const int tag_transition_group = 2131230896; // aapt resource value: 0x7F0800B1 - public const int text = 2131230897; + public const int tag_unhandled_key_event_manager = 2131230897; // aapt resource value: 0x7F0800B2 - public const int text2 = 2131230898; - - // aapt resource value: 0x7F0800B7 - public const int textinput_counter = 2131230903; - - // aapt resource value: 0x7F0800B8 - public const int textinput_error = 2131230904; - - // aapt resource value: 0x7F0800B9 - public const int textinput_helper_text = 2131230905; + public const int tag_unhandled_key_listeners = 2131230898; // aapt resource value: 0x7F0800B3 - public const int textSpacerNoButtons = 2131230899; + public const int text = 2131230899; // aapt resource value: 0x7F0800B4 - public const int textSpacerNoTitle = 2131230900; + public const int text2 = 2131230900; - // aapt resource value: 0x7F0800B5 - public const int textStart = 2131230901; - - // aapt resource value: 0x7F0800B6 - public const int text_input_password_toggle = 2131230902; + // aapt resource value: 0x7F0800B9 + public const int textinput_counter = 2131230905; // aapt resource value: 0x7F0800BA - public const int time = 2131230906; + public const int textinput_error = 2131230906; // aapt resource value: 0x7F0800BB - public const int title = 2131230907; + public const int textinput_helper_text = 2131230907; + + // aapt resource value: 0x7F0800B5 + public const int textSpacerNoButtons = 2131230901; + + // aapt resource value: 0x7F0800B6 + public const int textSpacerNoTitle = 2131230902; + + // aapt resource value: 0x7F0800B7 + public const int textStart = 2131230903; + + // aapt resource value: 0x7F0800B8 + public const int text_input_password_toggle = 2131230904; // aapt resource value: 0x7F0800BC - public const int titleDividerNoCustom = 2131230908; + public const int time = 2131230908; // aapt resource value: 0x7F0800BD - public const int title_template = 2131230909; + public const int title = 2131230909; // aapt resource value: 0x7F0800BE - public const int toolbar = 2131230910; + public const int titleDividerNoCustom = 2131230910; // aapt resource value: 0x7F0800BF - public const int top = 2131230911; + public const int title_template = 2131230911; // aapt resource value: 0x7F0800C0 - public const int topPanel = 2131230912; + public const int toolbar = 2131230912; // aapt resource value: 0x7F0800C1 - public const int touch_outside = 2131230913; + public const int top = 2131230913; // aapt resource value: 0x7F0800C2 - public const int transition_current_scene = 2131230914; + public const int topPanel = 2131230914; // aapt resource value: 0x7F0800C3 - public const int transition_layout_save = 2131230915; + public const int touch_outside = 2131230915; // aapt resource value: 0x7F0800C4 - public const int transition_position = 2131230916; + public const int transition_current_scene = 2131230916; // aapt resource value: 0x7F0800C5 - public const int transition_scene_layoutid_cache = 2131230917; + public const int transition_layout_save = 2131230917; // aapt resource value: 0x7F0800C6 - public const int transition_transform = 2131230918; + public const int transition_position = 2131230918; // aapt resource value: 0x7F0800C7 - public const int uniform = 2131230919; + public const int transition_scene_layoutid_cache = 2131230919; // aapt resource value: 0x7F0800C8 - public const int unlabeled = 2131230920; + public const int transition_transform = 2131230920; // aapt resource value: 0x7F0800C9 - public const int up = 2131230921; + public const int uniform = 2131230921; // aapt resource value: 0x7F0800CA - public const int useLogo = 2131230922; + public const int unlabeled = 2131230922; // aapt resource value: 0x7F0800CB - public const int view_offset_helper = 2131230923; + public const int up = 2131230923; // aapt resource value: 0x7F0800CC - public const int visible = 2131230924; + public const int useLogo = 2131230924; // aapt resource value: 0x7F0800CD - public const int withText = 2131230925; + public const int view_offset_helper = 2131230925; // aapt resource value: 0x7F0800CE - public const int wrap_content = 2131230926; + public const int visible = 2131230926; + + // aapt resource value: 0x7F0800CF + public const int withText = 2131230927; + + // aapt resource value: 0x7F0800D0 + public const int wrap_content = 2131230928; static Id() { @@ -9287,28 +9311,34 @@ namespace Pixiview.Droid public const int notification_template_part_time = 2131427390; // aapt resource value: 0x7F0B003F - public const int RootLayout = 2131427391; + public const int RadioButton = 2131427391; // aapt resource value: 0x7F0B0040 - public const int select_dialog_item_material = 2131427392; + public const int RadioGroup = 2131427392; // aapt resource value: 0x7F0B0041 - public const int select_dialog_multichoice_material = 2131427393; + public const int RootLayout = 2131427393; // aapt resource value: 0x7F0B0042 - public const int select_dialog_singlechoice_material = 2131427394; + public const int select_dialog_item_material = 2131427394; // aapt resource value: 0x7F0B0043 - public const int ShellContent = 2131427395; + public const int select_dialog_multichoice_material = 2131427395; // aapt resource value: 0x7F0B0044 - public const int support_simple_spinner_dropdown_item = 2131427396; + public const int select_dialog_singlechoice_material = 2131427396; // aapt resource value: 0x7F0B0045 - public const int Tabbar = 2131427397; + public const int ShellContent = 2131427397; // aapt resource value: 0x7F0B0046 - public const int Toolbar = 2131427398; + public const int support_simple_spinner_dropdown_item = 2131427398; + + // aapt resource value: 0x7F0B0047 + public const int Tabbar = 2131427399; + + // aapt resource value: 0x7F0B0048 + public const int Toolbar = 2131427400; static Layout() { diff --git a/Pixiview.Android/Resources/color/segmented_control_text.xml b/Pixiview.Android/Resources/color/segmented_control_text.xml new file mode 100644 index 0000000..7de0d91 --- /dev/null +++ b/Pixiview.Android/Resources/color/segmented_control_text.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Pixiview.Android/Resources/drawable/segmented_control_background.xml b/Pixiview.Android/Resources/drawable/segmented_control_background.xml new file mode 100644 index 0000000..615a421 --- /dev/null +++ b/Pixiview.Android/Resources/drawable/segmented_control_background.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Pixiview.Android/Resources/drawable/segmented_control_first_background.xml b/Pixiview.Android/Resources/drawable/segmented_control_first_background.xml new file mode 100644 index 0000000..864deb1 --- /dev/null +++ b/Pixiview.Android/Resources/drawable/segmented_control_first_background.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Pixiview.Android/Resources/drawable/segmented_control_last_background.xml b/Pixiview.Android/Resources/drawable/segmented_control_last_background.xml new file mode 100644 index 0000000..b8d6338 --- /dev/null +++ b/Pixiview.Android/Resources/drawable/segmented_control_last_background.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Pixiview.Android/Resources/layout/RadioButton.xml b/Pixiview.Android/Resources/layout/RadioButton.xml new file mode 100644 index 0000000..d69618a --- /dev/null +++ b/Pixiview.Android/Resources/layout/RadioButton.xml @@ -0,0 +1,13 @@ + + \ No newline at end of file diff --git a/Pixiview.Android/Resources/layout/RadioGroup.xml b/Pixiview.Android/Resources/layout/RadioGroup.xml new file mode 100644 index 0000000..28c5704 --- /dev/null +++ b/Pixiview.Android/Resources/layout/RadioGroup.xml @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/Pixiview.Android/Resources/values/colors.xml b/Pixiview.Android/Resources/values/colors.xml index 92a3691..aa915a1 100644 --- a/Pixiview.Android/Resources/values/colors.xml +++ b/Pixiview.Android/Resources/values/colors.xml @@ -4,4 +4,6 @@ #3F51B5 #303F9F #FF4081 + @android:color/transparent + #007AFF \ No newline at end of file diff --git a/Pixiview.iOS/GlobalSuppressions.cs b/Pixiview.iOS/GlobalSuppressions.cs index 692d919..3048d28 100644 --- a/Pixiview.iOS/GlobalSuppressions.cs +++ b/Pixiview.iOS/GlobalSuppressions.cs @@ -5,6 +5,7 @@ using System.Diagnostics.CodeAnalysis; -[assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "")] +[assembly: SuppressMessage("Style", "IDE0056:Use index operator", Justification = "")] [assembly: SuppressMessage("Style", "IDE0057:Use range operator", Justification = "")] [assembly: SuppressMessage("Style", "IDE0063:Use simple 'using' statement", Justification = "")] +[assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "")] diff --git a/Pixiview.iOS/Renderers/SegmentedControlRenderer.cs b/Pixiview.iOS/Renderers/SegmentedControlRenderer.cs index d4aacfe..047aae6 100644 --- a/Pixiview.iOS/Renderers/SegmentedControlRenderer.cs +++ b/Pixiview.iOS/Renderers/SegmentedControlRenderer.cs @@ -30,7 +30,7 @@ namespace Pixiview.iOS.Renderers } nativeControl.Enabled = element.IsEnabled; - nativeControl.BackgroundColor = element.BackgroundColor.ToUIColor(); + //nativeControl.BackgroundColor = element.BackgroundColor.ToUIColor(); nativeControl.SelectedSegmentTintColor = GetTintColor(element); SetTextColor(); nativeControl.SelectedSegment = element.SelectedSegmentIndex; @@ -68,9 +68,9 @@ namespace Pixiview.iOS.Renderers element.SendValueChanged(); break; - case nameof(element.BackgroundColor): - nativeControl.BackgroundColor = element.BackgroundColor.ToUIColor(); - break; + //case nameof(element.BackgroundColor): + // nativeControl.BackgroundColor = element.BackgroundColor.ToUIColor(); + // break; case nameof(element.SelectedSegmentIndex): nativeControl.SelectedSegment = element.SelectedSegmentIndex; @@ -93,8 +93,9 @@ namespace Pixiview.iOS.Renderers private void SetTextColor() { - var color = Element.SelectedTextColor; - UIColor c = color == default ? UIColor.LabelColor : color.ToUIColor(); + //var color = Element.SelectedTextColor; + //UIColor c = color == default ? UIColor.LabelColor : color.ToUIColor(); + UIColor c = UIColor.LabelColor; var attribute = new UITextAttributes { TextColor = c @@ -111,27 +112,27 @@ namespace Pixiview.iOS.Renderers { if (element.IsEnabled) { - var tintColor = element.TintColor; - if (tintColor == default) - { + //var tintColor = element.TintColor; + //if (tintColor == default) + //{ return UIColor.SystemGray6Color; - } - else - { - return tintColor.ToUIColor().ColorWithAlpha(.3f); - } + //} + //else + //{ + // return tintColor.ToUIColor().ColorWithAlpha(.3f); + //} } else { - var disabledColor = element.DisabledColor; - if (disabledColor == default) - { + //var disabledColor = element.DisabledColor; + //if (disabledColor == default) + //{ return UIColor.SecondaryLabelColor; - } - else - { - return disabledColor.ToUIColor(); - } + //} + //else + //{ + // return disabledColor.ToUIColor(); + //} } } diff --git a/Pixiview/Illust/IllustCollectionPage.cs b/Pixiview/Illust/IllustCollectionPage.cs index f968fbb..37a239d 100644 --- a/Pixiview/Illust/IllustCollectionPage.cs +++ b/Pixiview/Illust/IllustCollectionPage.cs @@ -143,9 +143,13 @@ namespace Pixiview.Illust } else if (isPhone) { +#if __IOS__ newMargin = width > height ? StyleDefinition.TopOffset16 : StyleDefinition.TopOffset32; +#elif __ANDROID__ + newMargin = default; +#endif } else { @@ -545,10 +549,10 @@ namespace Pixiview.Illust [JsonObject(MemberSerialization.OptIn)] public class IllustItem : BindableObject { - public static readonly BindableProperty TitleProperty = BindableProperty.Create( - nameof(Title), typeof(string), typeof(IllustItem)); - public static readonly BindableProperty RankTitleProperty = BindableProperty.Create( - nameof(RankTitle), typeof(string), typeof(IllustItem)); + //public static readonly BindableProperty TitleProperty = BindableProperty.Create( + // nameof(Title), typeof(string), typeof(IllustItem)); + //public static readonly BindableProperty RankTitleProperty = BindableProperty.Create( + // nameof(RankTitle), typeof(string), typeof(IllustItem)); public static readonly BindableProperty ImageProperty = BindableProperty.Create( nameof(Image), typeof(ImageSource), typeof(IllustItem)); public static readonly BindableProperty ProfileImageProperty = BindableProperty.Create( @@ -557,20 +561,20 @@ namespace Pixiview.Illust nameof(ImageHeight), typeof(GridLength), typeof(IllustItem), GridLength.Auto); public static readonly BindableProperty IsFavoriteProperty = BindableProperty.Create( nameof(IsFavorite), typeof(bool), typeof(IllustItem)); - public static readonly BindableProperty IsPlayingProperty = BindableProperty.Create( - nameof(IsPlaying), typeof(bool), typeof(IllustItem)); + //public static readonly BindableProperty IsPlayingProperty = BindableProperty.Create( + // nameof(IsPlaying), typeof(bool), typeof(IllustItem)); [JsonProperty] - public string Title - { - get => (string)GetValue(TitleProperty); - set => SetValue(TitleProperty, value); - } - public string RankTitle - { - get => (string)GetValue(RankTitleProperty); - set => SetValue(RankTitleProperty, value); - } + public string Title { get; set; } + //{ + // get => (string)GetValue(TitleProperty); + // set => SetValue(TitleProperty, value); + //} + public string RankTitle { get; set; } + //{ + // get => (string)GetValue(RankTitleProperty); + // set => SetValue(RankTitleProperty, value); + //} public ImageSource Image { get => (ImageSource)GetValue(ImageProperty); @@ -591,11 +595,11 @@ namespace Pixiview.Illust get => (bool)GetValue(IsFavoriteProperty); set => SetValue(IsFavoriteProperty, value); } - public bool IsPlaying - { - get => (bool)GetValue(IsPlayingProperty); - set => SetValue(IsPlayingProperty, value); - } + public bool IsPlaying { get; set; } + //{ + // get => (bool)GetValue(IsPlayingProperty); + // set => SetValue(IsPlayingProperty, value); + //} public ICommand IllustTapped { get; set; } [JsonProperty] diff --git a/Pixiview/Illust/MainPage.xaml b/Pixiview/Illust/MainPage.xaml index 090e33b..433e5b0 100644 --- a/Pixiview/Illust/MainPage.xaml +++ b/Pixiview/Illust/MainPage.xaml @@ -15,9 +15,24 @@ + RowSpacing="16" ColumnSpacing="16" + ItemTemplate="{StaticResource cardView}"> + + + + + + (string)GetValue(KeywordsProperty); + set => SetValue(KeywordsProperty, value); + } + public MainPage() { Resources.Add("cardView", GetCardViewTemplate()); InitializeComponent(); + +#if __IOS__ + searchBar.BackgroundColor = Color.Transparent; +#elif __ANDROID__ + searchBar.SetDynamicResource(SearchBar.TextColorProperty, UI.Theme.ThemeBase.TextColor); + searchBar.SetDynamicResource(SearchBar.PlaceholderColorProperty, UI.Theme.ThemeBase.SubTextColor); + searchBar.SetDynamicResource(BackgroundColorProperty, UI.Theme.ThemeBase.WindowColor); +#endif } protected override IEnumerable DoGetIllustList(IllustData data, ICommand command) @@ -40,5 +59,19 @@ namespace Pixiview.Illust } StartLoad(true); } + + private void SearchBar_SearchButtonPressed(object sender, EventArgs e) + { + var key = Keywords; + if (key != null) + { + key = key.Trim().ToLower(); + } + + if (!string.IsNullOrEmpty(key)) + { + Task.Run(() => App.OpenUrl(new Uri("pixiview://example.com/artworks/" + key))); + } + } } } diff --git a/Pixiview/Illust/RankingPage.xaml b/Pixiview/Illust/RankingPage.xaml index f6abfb8..d373d93 100644 --- a/Pixiview/Illust/RankingPage.xaml +++ b/Pixiview/Illust/RankingPage.xaml @@ -7,20 +7,24 @@ x:Class="Pixiview.Illust.RankingPage" BackgroundColor="{DynamicResource WindowColor}"> - + - +