mirror of
https://github.com/bitwarden/mobile
synced 2025-12-26 05:03:39 +00:00
ExtendedTextCell and ExtendedViewCell for iOS and Android. BackgroundColor and Disclousure Indicators
This commit is contained in:
@@ -6,6 +6,7 @@ using Bit.App.Controls;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.Android;
|
||||
using AView = Android.Views.View;
|
||||
using Android.Widget;
|
||||
|
||||
[assembly: ExportRenderer(typeof(ExtendedTextCell), typeof(ExtendedTextCellRenderer))]
|
||||
namespace Bit.Android.Controls
|
||||
@@ -16,11 +17,29 @@ namespace Bit.Android.Controls
|
||||
|
||||
protected override AView GetCellCore(Cell item, AView convertView, ViewGroup parent, Context context)
|
||||
{
|
||||
var View = base.GetCellCore(item, convertView, parent, context);
|
||||
var View = (BaseCellView)base.GetCellCore(item, convertView, parent, context);
|
||||
var extendedCell = (ExtendedTextCell)item;
|
||||
|
||||
var cell = (ExtendedTextCell)item;
|
||||
if(View != null)
|
||||
{
|
||||
View.SetBackgroundColor(extendedCell.BackgroundColor.ToAndroid());
|
||||
|
||||
View.SetBackgroundColor(cell.BackgroundColor.ToAndroid());
|
||||
if(extendedCell.ShowDisclousure)
|
||||
{
|
||||
// TODO: different image
|
||||
var resourceId = Resource.Drawable.fa_folder_open;
|
||||
if(!string.IsNullOrWhiteSpace(extendedCell.DisclousureImage))
|
||||
{
|
||||
var fileName = System.IO.Path.GetFileNameWithoutExtension(extendedCell.DisclousureImage);
|
||||
resourceId = context.Resources.GetIdentifier(fileName, "drawable", context.PackageName);
|
||||
}
|
||||
|
||||
var image = new ImageView(context);
|
||||
image.SetImageResource(resourceId);
|
||||
image.SetPadding(0, 0, 30, 0);
|
||||
View.SetAccessoryView(image);
|
||||
}
|
||||
}
|
||||
|
||||
return View;
|
||||
}
|
||||
@@ -35,6 +54,8 @@ namespace Bit.Android.Controls
|
||||
{
|
||||
View.SetBackgroundColor(cell.BackgroundColor.ToAndroid());
|
||||
}
|
||||
|
||||
// TODO: other properties
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user