* Pixiview/UI/OptionCell.cs:
* Pixiview/UI/AdaptedPage.cs: * Pixiview/Utils/FileStore.cs: * Pixiview/Utils/IllustData.cs: * Pixiview/Illust/MainPage.xaml: * Pixiview/UI/Theme/LightTheme.cs: * Pixiview/Illust/MainPage.xaml.cs: * Pixiview.iOS/GlobalSuppressions.cs: * Pixiview/Illust/ViewIllustPage.xaml: * Pixiview.Android/GlobalSuppressions.cs: * Pixiview/Illust/ViewIllustPage.xaml.cs: * Pixiview/Illust/IllustCollectionPage.cs: * Pixiview.iOS/Renderers/SegmentedControlRenderer.cs: * Pixiview/Illust/RankingPage.xaml: * Pixiview/Illust/RankingPage.xaml.cs: * Pixiview.Android/Pixiview.Android.csproj: * Pixiview.Android/Resources/values/colors.xml: * Pixiview.Android/Resources/Resource.designer.cs: * Pixiview.Android/Resources/layout/RadioGroup.xml: * Pixiview.Android/Renderers/BlurryPanelRenderer.cs: * Pixiview.Android/Resources/layout/RadioButton.xml: * Pixiview.Android/Renderers/SegmentedControlRenderer.cs: * Pixiview.Android/Resources/color/segmented_control_text.xml: * Pixiview.Android/Resources/drawable/segmented_control_background.xml: * Pixiview.Android/Resources/drawable/segmented_control_last_background.xml: * Pixiview.Android/Resources/drawable/segmented_control_first_background.xml: segmented control for Android
This commit is contained in:
		| @@ -6,4 +6,6 @@ | ||||
| using System.Diagnostics.CodeAnalysis; | ||||
|  | ||||
| [assembly: SuppressMessage("Style", "IDE0056:Use index operator", Justification = "<Pending>")] | ||||
| [assembly: SuppressMessage("Style", "IDE0057:Use range operator", Justification = "<Pending>")] | ||||
| [assembly: SuppressMessage("Style", "IDE0063:Use simple 'using' statement", Justification = "<Pending>")] | ||||
| [assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "<Pending>")] | ||||
|   | ||||
| @@ -68,6 +68,8 @@ | ||||
|     <Compile Include="Effects\LongPressEffectImplement.cs" /> | ||||
|     <Compile Include="Renderers\CircleImageRenderer.cs" /> | ||||
|     <Compile Include="Renderers\CardViewRenderer.cs" /> | ||||
|     <Compile Include="Renderers\BlurryPanelRenderer.cs" /> | ||||
|     <Compile Include="Renderers\SegmentedControlRenderer.cs" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <None Include="Resources\AboutResources.txt" /> | ||||
| @@ -155,6 +157,30 @@ | ||||
|       <SubType></SubType> | ||||
|       <Generator></Generator> | ||||
|     </AndroidResource> | ||||
|     <AndroidResource Include="Resources\color\segmented_control_text.xml"> | ||||
|       <SubType></SubType> | ||||
|       <Generator></Generator> | ||||
|     </AndroidResource> | ||||
|     <AndroidResource Include="Resources\drawable\segmented_control_background.xml"> | ||||
|       <SubType></SubType> | ||||
|       <Generator></Generator> | ||||
|     </AndroidResource> | ||||
|     <AndroidResource Include="Resources\drawable\segmented_control_first_background.xml"> | ||||
|       <SubType></SubType> | ||||
|       <Generator></Generator> | ||||
|     </AndroidResource> | ||||
|     <AndroidResource Include="Resources\drawable\segmented_control_last_background.xml"> | ||||
|       <SubType></SubType> | ||||
|       <Generator></Generator> | ||||
|     </AndroidResource> | ||||
|     <AndroidResource Include="Resources\layout\RadioButton.xml"> | ||||
|       <SubType></SubType> | ||||
|       <Generator></Generator> | ||||
|     </AndroidResource> | ||||
|     <AndroidResource Include="Resources\layout\RadioGroup.xml"> | ||||
|       <SubType></SubType> | ||||
|       <Generator></Generator> | ||||
|     </AndroidResource> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <Folder Include="Resources\drawable\" /> | ||||
| @@ -166,6 +192,7 @@ | ||||
|     <Folder Include="Resources\mipmap-xxhdpi\" /> | ||||
|     <Folder Include="Resources\mipmap-xxxhdpi\" /> | ||||
|     <Folder Include="Renderers\" /> | ||||
|     <Folder Include="Resources\color\" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <AndroidAsset Include="Assets\fa-light-300.ttf" /> | ||||
|   | ||||
							
								
								
									
										23
									
								
								Pixiview.Android/Renderers/BlurryPanelRenderer.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								Pixiview.Android/Renderers/BlurryPanelRenderer.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -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<View> e) | ||||
|         { | ||||
|             base.OnElementChanged(e); | ||||
|  | ||||
|             SetBackgroundColor(Color.Black.MultiplyAlpha(.92).ToAndroid()); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										234
									
								
								Pixiview.Android/Renderers/SegmentedControlRenderer.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										234
									
								
								Pixiview.Android/Renderers/SegmentedControlRenderer.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -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<SegmentedControl, RadioGroup> | ||||
|     { | ||||
|         RadioGroup nativeControl; | ||||
|         RadioButton _rb; | ||||
|         readonly Context context; | ||||
|  | ||||
|         public SegmentedControlRenderer(Context context) : base(context) | ||||
|         { | ||||
|             this.context = context; | ||||
|         } | ||||
|  | ||||
|         protected override void OnElementChanged(ElementChangedEventArgs<SegmentedControl> 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; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										660
									
								
								Pixiview.Android/Resources/Resource.designer.cs
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										660
									
								
								Pixiview.Android/Resources/Resource.designer.cs
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -0,0 +1,5 @@ | ||||
| <?xml version="1.0" encoding="UTF-8" ?> | ||||
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <item android:state_checked="true" android:color="@color/normal"/> | ||||
|     <item android:color="@color/selected" /> | ||||
| </selector> | ||||
| @@ -0,0 +1,19 @@ | ||||
| <?xml version="1.0" encoding="UTF-8" ?> | ||||
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <item android:state_checked="true"> | ||||
|         <inset android:insetRight="-1dp"> | ||||
|             <shape android:id="@+id/shape_id" xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> | ||||
|                 <solid android:color="@color/selected" /> | ||||
|                 <stroke android:width="1dp" android:color="@color/selected" /> | ||||
|             </shape> | ||||
|         </inset> | ||||
|     </item> | ||||
|     <item android:state_checked="false"> | ||||
|         <inset android:insetRight="-1dp"> | ||||
|             <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> | ||||
|                 <solid android:color="@color/normal" /> | ||||
|                 <stroke android:width="1dp" android:color="@color/selected" /> | ||||
|             </shape> | ||||
|         </inset> | ||||
|     </item> | ||||
| </selector> | ||||
| @@ -0,0 +1,21 @@ | ||||
| <?xml version="1.0" encoding="UTF-8" ?> | ||||
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <item android:state_checked="true"> | ||||
|         <inset android:insetRight="-1dp"> | ||||
|             <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> | ||||
|                 <solid android:color="@color/selected" /> | ||||
|                 <stroke android:width="1dp" android:color="@color/selected" /> | ||||
|                 <corners android:topLeftRadius="2sp" android:bottomLeftRadius="2sp" /> | ||||
|             </shape> | ||||
|         </inset> | ||||
|     </item> | ||||
|     <item android:state_checked="false"> | ||||
|         <inset android:insetRight="-1dp"> | ||||
|             <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> | ||||
|                 <solid android:color="@color/normal" /> | ||||
|                 <stroke android:width="1dp" android:color="@color/selected" /> | ||||
|                 <corners android:topLeftRadius="2sp" android:bottomLeftRadius="2sp" /> | ||||
|             </shape> | ||||
|         </inset> | ||||
|     </item> | ||||
| </selector> | ||||
| @@ -0,0 +1,17 @@ | ||||
| <?xml version="1.0" encoding="UTF-8" ?> | ||||
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <item android:state_checked="true"> | ||||
|         <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> | ||||
|             <solid android:color="@color/selected" /> | ||||
|             <stroke android:width="1dp" android:color="@color/selected" /> | ||||
|             <corners android:topRightRadius="2sp" android:bottomRightRadius="2sp" /> | ||||
|         </shape> | ||||
|     </item> | ||||
|     <item android:state_checked="false"> | ||||
|         <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> | ||||
|             <solid android:color="@color/normal" /> | ||||
|             <stroke android:width="1dp" android:color="@color/selected" /> | ||||
|             <corners android:topRightRadius="2sp" android:bottomRightRadius="2sp" /> | ||||
|         </shape> | ||||
|     </item> | ||||
| </selector> | ||||
							
								
								
									
										13
									
								
								Pixiview.Android/Resources/layout/RadioButton.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								Pixiview.Android/Resources/layout/RadioButton.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| <?xml version="1.0" encoding="UTF-8" ?> | ||||
| <RadioButton xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:button="@null" | ||||
|     android:gravity="center" | ||||
|     android:background="@drawable/segmented_control_background" | ||||
|     android:textColor="@color/segmented_control_text" | ||||
|     android:layout_width="0dp" | ||||
|     android:layout_height="wrap_content" | ||||
|     android:layout_weight="1" | ||||
|     android:paddingLeft="10dp" | ||||
|     android:paddingRight="10dp" | ||||
|     android:minHeight="30dp" | ||||
|     android:textSize="12sp" /> | ||||
							
								
								
									
										6
									
								
								Pixiview.Android/Resources/layout/RadioGroup.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								Pixiview.Android/Resources/layout/RadioGroup.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| <?xml version="1.0" encoding="UTF-8" ?> | ||||
| <RadioGroup xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     android:orientation="horizontal" | ||||
|     android:id="@+id/SegControl" /> | ||||
| @@ -4,4 +4,6 @@ | ||||
|     <color name="colorPrimary">#3F51B5</color> | ||||
|     <color name="colorPrimaryDark">#303F9F</color> | ||||
|     <color name="colorAccent">#FF4081</color> | ||||
|     <color name="normal">@android:color/transparent</color> | ||||
|     <color name="selected">#007AFF</color> | ||||
| </resources> | ||||
| @@ -5,6 +5,7 @@ | ||||
|  | ||||
| using System.Diagnostics.CodeAnalysis; | ||||
|  | ||||
| [assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "<Pending>")] | ||||
| [assembly: SuppressMessage("Style", "IDE0056:Use index operator", Justification = "<Pending>")] | ||||
| [assembly: SuppressMessage("Style", "IDE0057:Use range operator", Justification = "<Pending>")] | ||||
| [assembly: SuppressMessage("Style", "IDE0063:Use simple 'using' statement", Justification = "<Pending>")] | ||||
| [assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "<Pending>")] | ||||
|   | ||||
| @@ -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(); | ||||
|                 //} | ||||
|             } | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -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] | ||||
|   | ||||
| @@ -15,9 +15,24 @@ | ||||
|         <ScrollView HorizontalOptions="Fill" HorizontalScrollBarVisibility="Never"> | ||||
|             <u:FlowLayout ItemsSource="{Binding Illusts}" | ||||
|                           HorizontalOptions="Fill" Column="{Binding Columns}" | ||||
|                           Margin="16" RowSpacing="16" ColumnSpacing="16" | ||||
|                           ItemTemplate="{StaticResource cardView}"/> | ||||
|                           RowSpacing="16" ColumnSpacing="16" | ||||
|                           ItemTemplate="{StaticResource cardView}"> | ||||
|                 <u:FlowLayout.Margin> | ||||
|                     <OnPlatform x:TypeArguments="Thickness" | ||||
|                                 iOS="16, 66, 16, 16" | ||||
|                                 Android="16, 56, 16, 16"/> | ||||
|                 </u:FlowLayout.Margin> | ||||
|             </u:FlowLayout> | ||||
|         </ScrollView> | ||||
|         <u:BlurryPanel VerticalOptions="Start" HeightRequest="{OnPlatform Android=40, iOS=50}" | ||||
|                        Margin="{Binding PanelTopMargin}"/> | ||||
|         <SearchBar x:Name="searchBar" Placeholder="{r:Text Search}" | ||||
|                    HeightRequest="{OnPlatform Android=40, iOS=50}" | ||||
|                    VerticalOptions="Start" | ||||
|                    Margin="{Binding PageTopMargin}" | ||||
|                    CancelButtonColor="{DynamicResource TintColor}" | ||||
|                    Text="{Binding Keywords, Mode=TwoWay}" | ||||
|                    SearchButtonPressed="SearchBar_SearchButtonPressed"/> | ||||
|         <Frame HasShadow="False" Margin="0" Padding="20" CornerRadius="8" | ||||
|                IsVisible="{Binding IsLoading}" | ||||
|                HorizontalOptions="Center" VerticalOptions="Center" | ||||
|   | ||||
| @@ -1,17 +1,36 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Threading.Tasks; | ||||
| using System.Windows.Input; | ||||
| using Pixiview.Utils; | ||||
| using Xamarin.Forms; | ||||
|  | ||||
| namespace Pixiview.Illust | ||||
| { | ||||
|     public partial class MainPage : IllustDataCollectionPage | ||||
|     { | ||||
|         public static readonly BindableProperty KeywordsProperty = BindableProperty.Create( | ||||
|             nameof(Keywords), typeof(string), typeof(MainPage)); | ||||
|  | ||||
|         public string Keywords | ||||
|         { | ||||
|             get => (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<IllustItem> 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))); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -7,20 +7,24 @@ | ||||
|                                    x:Class="Pixiview.Illust.RankingPage" | ||||
|                                    BackgroundColor="{DynamicResource WindowColor}"> | ||||
|     <Shell.TitleView> | ||||
|         <Grid VerticalOptions="Fill" HorizontalOptions="Fill" ColumnSpacing="6"> | ||||
|         <Grid VerticalOptions="Fill" ColumnSpacing="6" | ||||
|                HorizontalOptions="{x:OnPlatform Android=Start, iOS=Fill}"> | ||||
|             <Grid.ColumnDefinitions> | ||||
|                 <ColumnDefinition/> | ||||
|                 <ColumnDefinition Width="{OnPlatform Android=Auto}"/> | ||||
|                 <ColumnDefinition Width="Auto"/> | ||||
|                 <ColumnDefinition Width="Auto"/> | ||||
|                 <ColumnDefinition/> | ||||
|             </Grid.ColumnDefinitions> | ||||
|             <Label Grid.Column="1" Text="{Binding Title}" | ||||
|                    TextColor="{DynamicResource TextColor}" | ||||
|                    FontSize="{OnPlatform Android=18}" | ||||
|                    VerticalTextAlignment="Center" FontAttributes="Bold"> | ||||
|                 <Label.GestureRecognizers> | ||||
|                     <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/> | ||||
|                 </Label.GestureRecognizers> | ||||
|             </Label> | ||||
|             <Label Grid.Column="2" Text="{Binding PanelState}" | ||||
|                    TextColor="{DynamicResource TextColor}" | ||||
|                    FontFamily="{DynamicResource IconSolidFontFamily}" | ||||
|                    FontSize="Small" | ||||
|                    VerticalTextAlignment="Center"/> | ||||
| @@ -38,14 +42,6 @@ | ||||
|                           Margin="16, 16, 16, 16" RowSpacing="16" ColumnSpacing="16" | ||||
|                           ItemTemplate="{StaticResource cardView}"/> | ||||
|         </ScrollView> | ||||
|         <!--<u:BlurryPanel VerticalOptions="Start" HeightRequest="50" Margin="{Binding PanelTopMargin}"/> | ||||
|         <SearchBar x:Name="searchBar" Placeholder="{r:Text Search}" HeightRequest="50" | ||||
|                    VerticalOptions="Start" | ||||
|                    Margin="{Binding PageTopMargin}" | ||||
|                    CancelButtonColor="{DynamicResource TintColor}" | ||||
|                    Text="{Binding Keywords, Mode=TwoWay}" | ||||
|                    SearchButtonPressed="SearchBar_SearchButtonPressed" | ||||
|                    Unfocused="SearchBar_Unfocused"/>--> | ||||
|         <u:BlurryPanel x:Name="panelFilter" VerticalOptions="Start" Opacity="0" | ||||
|                        Margin="{Binding PanelTopMargin}" | ||||
|                        HeightRequest="{Binding Height, Source={x:Reference gridFilter}}"/> | ||||
| @@ -57,7 +53,9 @@ | ||||
|                     <RowDefinition Height="Auto"/> | ||||
|                 </Grid.RowDefinitions> | ||||
|                 <u:SegmentedControl Margin="6, 6, 6, 3" VerticalOptions="Center" | ||||
|                                     SelectedSegmentIndex="{Binding SegmentDate, Mode=TwoWay}"> | ||||
|                                     SelectedSegmentIndex="{Binding SegmentDate, Mode=TwoWay}" | ||||
|                                     SelectedTextColor="{DynamicResource TextColor}" | ||||
|                                     TintColor="{DynamicResource CardBackgroundColor}"> | ||||
|                     <u:SegmentedControl.Children> | ||||
|                         <u:SegmentedControlOption Text="{r:Text Daily}"/> | ||||
|                         <u:SegmentedControlOption Text="{r:Text Weekly}"/> | ||||
| @@ -67,7 +65,9 @@ | ||||
|                 </u:SegmentedControl> | ||||
|                 <u:SegmentedControl Grid.Row="1" HorizontalOptions="Start" | ||||
|                                     Margin="6, 3, 6, 6" VerticalOptions="Center" | ||||
|                                     SelectedSegmentIndex="{Binding SegmentType, Mode=TwoWay}"> | ||||
|                                     SelectedSegmentIndex="{Binding SegmentType, Mode=TwoWay}" | ||||
|                                     SelectedTextColor="{DynamicResource TextColor}" | ||||
|                                     TintColor="{DynamicResource CardBackgroundColor}"> | ||||
|                     <u:SegmentedControl.Children> | ||||
|                         <u:SegmentedControlOption Text="{r:Text General}"/> | ||||
|                         <u:SegmentedControlOption Text="{r:Text R18}"/> | ||||
| @@ -76,6 +76,7 @@ | ||||
|                 <Button Grid.Row="1" HorizontalOptions="End" VerticalOptions="Center" | ||||
|                         Text="{DynamicResource IconCircleCheck}" | ||||
|                         FontFamily="{DynamicResource IconSolidFontFamily}" | ||||
|                         BackgroundColor="Transparent" | ||||
|                         TextColor="{DynamicResource TintColor}" | ||||
|                         FontSize="20" Margin="0, 0, 6, 0" | ||||
|                         Clicked="Filter_Clicked"/> | ||||
|   | ||||
| @@ -16,8 +16,6 @@ namespace Pixiview.Illust | ||||
|         private static readonly string[] segmentDates = { "daily", "weekly", "monthly", "male" }; | ||||
|         private static readonly object sync = new object(); | ||||
|  | ||||
|         public static readonly BindableProperty KeywordsProperty = BindableProperty.Create( | ||||
|             nameof(Keywords), typeof(string), typeof(RankingPage)); | ||||
|         public static readonly BindableProperty PanelStateProperty = BindableProperty.Create( | ||||
|             nameof(PanelState), typeof(string), typeof(RankingPage), StyleDefinition.IconCaretDown); | ||||
|         public static readonly BindableProperty SegmentDateProperty = BindableProperty.Create( | ||||
| @@ -56,11 +54,6 @@ namespace Pixiview.Illust | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         public string Keywords | ||||
|         { | ||||
|             get => (string)GetValue(KeywordsProperty); | ||||
|             set => SetValue(KeywordsProperty, value); | ||||
|         } | ||||
|         public string PanelState | ||||
|         { | ||||
|             get => (string)GetValue(PanelStateProperty); | ||||
| @@ -93,14 +86,6 @@ namespace Pixiview.Illust | ||||
|             gridFilter.TranslationY = -100; | ||||
|             panelFilter.TranslationY = -100; | ||||
|  | ||||
| //#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 | ||||
|  | ||||
|             lastQueryKey = QueryKey; | ||||
|             queryDate = null; // $"{now.Year}{now.Month:00}{now.Day:00}"; | ||||
|             currentPage = 1; | ||||
| @@ -223,35 +208,6 @@ 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)) | ||||
|             { | ||||
|                 Illusts = IllustCollection; | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 var list = IllustCollection.Where(i => | ||||
|                     (i.UserName != null && i.UserName.ToLower().Contains(key)) || | ||||
|                     (i.Title != null && i.Title.ToLower().Contains(key))); | ||||
|                 Illusts = new IllustCollection(list); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private void SearchBar_Unfocused(object sender, FocusEventArgs e) | ||||
|         { | ||||
|             if (!e.IsFocused) | ||||
|             { | ||||
|                 SearchBar_SearchButtonPressed(sender, e); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private void TapGestureRecognizer_Tapped(object sender, EventArgs e) | ||||
|         { | ||||
|             ToggleFilterPanel(!isFilterVisible); | ||||
|   | ||||
| @@ -16,11 +16,12 @@ | ||||
|     </ContentPage.ToolbarItems> | ||||
|     <Grid Padding="{Binding PageTopMargin}"> | ||||
|         <CarouselView ItemsSource="{Binding Illusts}" HorizontalScrollBarVisibility="Never" | ||||
|                       ItemTemplate="{StaticResource carouselView}" | ||||
|                       PositionChanged="CarouselView_PositionChanged"> | ||||
|             <CarouselView.ItemsLayout> | ||||
|                 <LinearItemsLayout Orientation="Vertical" ItemSpacing="20"/> | ||||
|             </CarouselView.ItemsLayout> | ||||
|             <CarouselView.ItemTemplate> | ||||
|             <!--<CarouselView.ItemTemplate> | ||||
|                 <DataTemplate x:DataType="mdl:IllustDetailItem"> | ||||
|                     <Grid> | ||||
|                         <Image Source="{Binding Image}" | ||||
| @@ -48,7 +49,7 @@ | ||||
|                                            Color="{DynamicResource TextColor}"/> | ||||
|                     </Grid> | ||||
|                 </DataTemplate> | ||||
|             </CarouselView.ItemTemplate> | ||||
|             </CarouselView.ItemTemplate>--> | ||||
|         </CarouselView> | ||||
|  | ||||
|         <u:RoundLabel Text="{Binding PagePositionText}" | ||||
|   | ||||
| @@ -77,6 +77,8 @@ namespace Pixiview.Illust | ||||
|                 ? fontIconLove | ||||
|                 : fontIconNotLove; | ||||
|  | ||||
|             Resources.Add("carouselView", GetCarouseTemplate()); | ||||
|  | ||||
|             InitializeComponent(); | ||||
|  | ||||
|             if (illust != null) | ||||
| @@ -113,6 +115,70 @@ namespace Pixiview.Illust | ||||
|             Screen.SetHomeIndicatorAutoHidden(Shell.Current, false); | ||||
|         } | ||||
|  | ||||
|         private DataTemplate GetCarouseTemplate() | ||||
|         { | ||||
|             var isAnime = IllustItem.IllustType == IllustType.Anime; | ||||
|             var tap = new TapGestureRecognizer(); | ||||
|             tap.Tapped += Image_Tapped; | ||||
|  | ||||
|             return new DataTemplate(() => | ||||
|             { | ||||
|                 var image = new Image | ||||
|                 { | ||||
|                     HorizontalOptions = LayoutOptions.Fill, | ||||
|                     VerticalOptions = LayoutOptions.Fill, | ||||
|                     Aspect = Aspect.AspectFit | ||||
|                 } | ||||
|                 .Binding(Image.SourceProperty, nameof(IllustDetailItem.Image)); | ||||
|                 if (isAnime) | ||||
|                 { | ||||
|                     image.GestureRecognizers.Add(tap); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     image.SetBinding(LongPressEffect.CommandProperty, nameof(IllustDetailItem.LongPressed)); | ||||
|                     image.SetBinding(LongPressEffect.CommandParameterProperty, "."); | ||||
|                     image.Effects.Add(new LongPressEffect()); | ||||
|                 } | ||||
|  | ||||
|                 return new Grid | ||||
|                 { | ||||
|                     Children = | ||||
|                     { | ||||
|                         image, | ||||
|  | ||||
|                         new Frame | ||||
|                         { | ||||
|                             HasShadow = false, | ||||
|                             Margin = default, | ||||
|                             Padding = new Thickness(20), | ||||
|                             CornerRadius = 8, | ||||
|                             HorizontalOptions = LayoutOptions.Center, | ||||
|                             VerticalOptions = LayoutOptions.Center, | ||||
|                             Content = new ActivityIndicator | ||||
|                             { | ||||
|                                 IsRunning = true, | ||||
|                                 IsVisible = true | ||||
|                             } | ||||
|                             .DynamicResource(ActivityIndicator.ColorProperty, ThemeBase.WindowColor) | ||||
|                         } | ||||
|                         .Binding(IsVisibleProperty, nameof(IllustDetailItem.Loading)) | ||||
|                         .DynamicResource(BackgroundColorProperty, ThemeBase.MaskColor), | ||||
|  | ||||
|                         new ActivityIndicator | ||||
|                         { | ||||
|                             IsRunning = true, | ||||
|                             Margin = new Thickness(10), | ||||
|                             HorizontalOptions = LayoutOptions.Start, | ||||
|                             VerticalOptions = LayoutOptions.Start | ||||
|                         } | ||||
|                         .Binding(IsVisibleProperty, nameof(IllustDetailItem.Downloading)) | ||||
|                         .DynamicResource(ActivityIndicator.ColorProperty, ThemeBase.TextColor) | ||||
|                     } | ||||
|                 }; | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|         private void LoadIllust(IllustItem illust) | ||||
|         { | ||||
|             if (illust == null) | ||||
| @@ -395,7 +461,7 @@ namespace Pixiview.Illust | ||||
|             { | ||||
|                 MainThread.BeginInvokeOnMainThread(async () => | ||||
|                 { | ||||
|                     var result = await FileStore.SaveImageToGalleryAsync(image, item.OriginalUrl); | ||||
|                     var result = await FileStore.SaveImageToGalleryAsync(image); | ||||
|  | ||||
|                     string message = result ?? ResourceHelper.SaveSuccess; | ||||
|                     await DisplayAlert(ResourceHelper.Title, message, ResourceHelper.Ok); | ||||
|   | ||||
| @@ -55,7 +55,11 @@ namespace Pixiview.UI | ||||
|             switch (orientation) | ||||
|             { | ||||
|                 case Orientation.Portrait: | ||||
| #if __IOS__ | ||||
|                     newMargin = AppShell.TotalBarOffset; | ||||
| #elif __ANDROID__ | ||||
|                     newMargin = default; | ||||
| #endif | ||||
|                     break; | ||||
|                 case Orientation.PortraitUpsideDown: | ||||
|                 case Orientation.Unknown: | ||||
| @@ -68,7 +72,11 @@ namespace Pixiview.UI | ||||
|                     } | ||||
|                     else | ||||
|                     { | ||||
| #if __IOS__ | ||||
|                         newMargin = isPhone ? StyleDefinition.TopOffset32 : AppShell.TotalBarOffset; | ||||
| #elif __ANDROID__ | ||||
|                         newMargin = default; | ||||
| #endif | ||||
|                     } | ||||
|                     break; | ||||
|             } | ||||
|   | ||||
| @@ -101,6 +101,7 @@ namespace Pixiview.UI | ||||
|         .Binding(InputView.KeyboardProperty, nameof(Keyboard)) | ||||
|         .Binding(Entry.PlaceholderProperty, nameof(Placeholder)) | ||||
|         .DynamicResource(Entry.TextColorProperty, ThemeBase.TextColor) | ||||
|         .DynamicResource(Entry.PlaceholderColorProperty, ThemeBase.SubTextColor) | ||||
|         .DynamicResource(VisualElement.BackgroundColorProperty, ThemeBase.OptionTintColor); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -32,7 +32,7 @@ namespace Pixiview.UI.Theme | ||||
|             Add(TintColor, Color.FromRgb(0x87, 0x87, 0x8b));    // 0x7f, 0x99, 0xc6 | ||||
|             Add(TextColor, Color.Black); | ||||
|             Add(SubTextColor, Color.DimGray); | ||||
|             Add(CardBackgroundColor, Color.FromRgb(0xf0, 0xf3, 0xf3)); | ||||
|             Add(CardBackgroundColor, Color.FromRgb(0xf3, 0xf3, 0xf3)); | ||||
|             Add(MaskColor, Color.FromRgba(0, 0, 0, 0x50)); | ||||
|             Add(NavColor, Color.FromRgb(0xf0, 0xf0, 0xf0)); | ||||
|             Add(NavSelectedColor, Color.LightGray); | ||||
|   | ||||
| @@ -13,7 +13,7 @@ namespace Pixiview.Utils | ||||
| { | ||||
|     public class FileStore | ||||
|     { | ||||
|         public static Task<string> SaveImageToGalleryAsync(ImageSource image, string url = null) | ||||
|         public static Task<string> SaveImageToGalleryAsync(ImageSource image) | ||||
|         { | ||||
| #if __IOS__ | ||||
|             IImageSourceHandler renderer; | ||||
| @@ -57,9 +57,10 @@ namespace Pixiview.Utils | ||||
|             { | ||||
|                 camera.Mkdirs(); | ||||
|             } | ||||
|             var filename = Path.GetFileName(url); | ||||
|             var original = ((FileImageSource)image).File; | ||||
|             var filename = Path.GetFileName(original); | ||||
|             var imgFile = new Java.IO.File(camera, filename).AbsolutePath; | ||||
|             File.Copy(((FileImageSource)image).File, imgFile); | ||||
|             File.Copy(original, imgFile); | ||||
|  | ||||
|             var uri = Uri.FromFile(new Java.IO.File(imgFile)); | ||||
|             var intent = new Intent(Intent.ActionMediaScannerScanFile); | ||||
|   | ||||
| @@ -50,6 +50,7 @@ namespace Pixiview.Utils | ||||
|             { | ||||
|                 Id = illustId, | ||||
|                 Title = illustTitle, | ||||
|                 RankTitle = illustTitle, | ||||
|                 IllustType = (IllustType)illustType, | ||||
|                 ImageUrl = urls?.x360 ?? url, | ||||
|                 IsRestrict = xRestrict == 1, | ||||
| @@ -166,6 +167,7 @@ namespace Pixiview.Utils | ||||
|             public IllustItem CopyToItem(IllustItem item) | ||||
|             { | ||||
|                 item.Title = illustTitle; | ||||
|                 item.RankTitle = illustTitle; | ||||
|                 item.IllustType = (IllustType)illustType; | ||||
|                 item.ImageUrl = urls?.regular; | ||||
|                 item.IsRestrict = xRestrict == 1; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user