2016-06-15 07:36:50 +03:00
|
|
|
|
using System;
|
|
|
|
|
using Xamarin.Forms;
|
2016-05-17 05:47:36 +03:00
|
|
|
|
|
|
|
|
|
namespace Bit.App.Controls
|
|
|
|
|
{
|
|
|
|
|
public class ExtendedTextCell : TextCell
|
|
|
|
|
{
|
2016-06-17 07:01:25 +03:00
|
|
|
|
public ExtendedTextCell()
|
|
|
|
|
{
|
2017-05-30 21:13:53 +03:00
|
|
|
|
if(Device.RuntimePlatform == Device.Android)
|
2016-08-14 04:43:15 +03:00
|
|
|
|
{
|
|
|
|
|
TextColor = Color.Black;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-17 07:01:25 +03:00
|
|
|
|
DetailColor = Color.FromHex("777777");
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-17 05:47:36 +03:00
|
|
|
|
public static readonly BindableProperty BackgroundColorProperty =
|
2016-05-18 04:28:19 +03:00
|
|
|
|
BindableProperty.Create(nameof(BackgroundColor), typeof(Color), typeof(ExtendedTextCell), Color.White);
|
|
|
|
|
|
|
|
|
|
public static readonly BindableProperty ShowDisclousureProperty =
|
2016-07-01 07:03:54 +03:00
|
|
|
|
BindableProperty.Create(nameof(ShowDisclousure), typeof(bool), typeof(ExtendedTextCell), false);
|
2016-05-18 04:28:19 +03:00
|
|
|
|
|
|
|
|
|
public static readonly BindableProperty DisclousureImageProperty =
|
|
|
|
|
BindableProperty.Create(nameof(DisclousureImage), typeof(string), typeof(ExtendedTextCell), string.Empty);
|
2016-05-17 05:47:36 +03:00
|
|
|
|
|
|
|
|
|
public Color BackgroundColor
|
|
|
|
|
{
|
|
|
|
|
get { return (Color)GetValue(BackgroundColorProperty); }
|
|
|
|
|
set { SetValue(BackgroundColorProperty, value); }
|
|
|
|
|
}
|
2016-05-18 04:28:19 +03:00
|
|
|
|
|
|
|
|
|
public bool ShowDisclousure
|
|
|
|
|
{
|
|
|
|
|
get { return (bool)GetValue(ShowDisclousureProperty); }
|
|
|
|
|
set { SetValue(ShowDisclousureProperty, value); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string DisclousureImage
|
|
|
|
|
{
|
|
|
|
|
get { return (string)GetValue(DisclousureImageProperty); }
|
|
|
|
|
set { SetValue(DisclousureImageProperty, value); }
|
|
|
|
|
}
|
2016-06-15 07:36:50 +03:00
|
|
|
|
|
2016-08-23 05:59:42 +03:00
|
|
|
|
public LineBreakMode DetailLineBreakMode { get; set; } = LineBreakMode.TailTruncation;
|
|
|
|
|
|
2016-06-15 07:36:50 +03:00
|
|
|
|
public event EventHandler DisclousureTapped;
|
|
|
|
|
|
|
|
|
|
public void OnDisclousureTapped()
|
|
|
|
|
{
|
2016-08-14 04:43:15 +03:00
|
|
|
|
if(DisclousureTapped == null)
|
|
|
|
|
{
|
|
|
|
|
OnTapped();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DisclousureTapped.Invoke(this, EventArgs.Empty);
|
2016-06-15 07:36:50 +03:00
|
|
|
|
}
|
2016-05-17 05:47:36 +03:00
|
|
|
|
}
|
|
|
|
|
}
|