1
0
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:
Kyle Spearrin 2017-12-22 09:30:30 -05:00
parent be3ed16d3c
commit d0257df134
4 changed files with 691 additions and 672 deletions

View File

@ -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>

View 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);
}
}
}
}

File diff suppressed because it is too large Load Diff

View 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>