mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-26 12:16:07 +01:00
custom thumb on slider for android
This commit is contained in:
parent
be3ed16d3c
commit
d0257df134
@ -81,6 +81,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="AutofillActivity.cs" />
|
||||
<Compile Include="AutofillCredentials.cs" />
|
||||
<Compile Include="Controls\CustomSliderRenderer.cs" />
|
||||
<Compile Include="FirebaseInstanceIdService.cs" />
|
||||
<Compile Include="FirebaseMessagingService.cs" />
|
||||
<Compile Include="Autofill\Field.cs" />
|
||||
@ -134,6 +135,9 @@
|
||||
<None Include="increment-version.ps1" />
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
<None Include="Assets\AboutAssets.txt" />
|
||||
<AndroidResource Include="Resources\drawable\slider_thumb.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\layout\tabs.axml">
|
||||
<SubType>AndroidResource</SubType>
|
||||
</AndroidResource>
|
||||
|
27
src/Android/Controls/CustomSliderRenderer.cs
Normal file
27
src/Android/Controls/CustomSliderRenderer.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using Bit.Android.Controls;
|
||||
using Xamarin.Forms;
|
||||
using Android.Content;
|
||||
using Xamarin.Forms.Platform.Android;
|
||||
using Android.Support.V4.Content.Res;
|
||||
|
||||
[assembly: ExportRenderer(typeof(Slider), typeof(CustomSliderRenderer))]
|
||||
namespace Bit.Android.Controls
|
||||
{
|
||||
public class CustomSliderRenderer : SliderRenderer
|
||||
{
|
||||
public CustomSliderRenderer(Context context)
|
||||
: base(context)
|
||||
{ }
|
||||
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<Slider> e)
|
||||
{
|
||||
base.OnElementChanged(e);
|
||||
if(Control != null)
|
||||
{
|
||||
var thumb = ResourcesCompat.GetDrawable(Resources, Resource.Drawable.slider_thumb, null);
|
||||
Control.SetThumb(thumb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1326
src/Android/Resources/Resource.Designer.cs
generated
1326
src/Android/Resources/Resource.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
6
src/Android/Resources/drawable/slider_thumb.xml
Normal file
6
src/Android/Resources/drawable/slider_thumb.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
|
||||
<solid android:color="@color/white"/>
|
||||
<stroke android:width="2dp" android:color="#B5B5B5"/>
|
||||
<size android:width="28dp" android:height="28dp"/>
|
||||
</shape>
|
Loading…
Reference in New Issue
Block a user