Android listview cell background set via drawable so that we can retain the selected state coloring. Adjustments to style separator for tableview cells.

This commit is contained in:
Kyle Spearrin 2016-08-26 18:42:28 -04:00
parent d729f93b17
commit 3807f185d6
7 changed files with 73 additions and 40 deletions

View file

@ -717,6 +717,9 @@
<ItemGroup>
<AndroidResource Include="Resources\drawable\tools.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\list_selector.xml" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Import Project="..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

View file

@ -22,7 +22,15 @@ namespace Bit.Android.Controls
if(View != null)
{
View.SetBackgroundColor(extendedCell.BackgroundColor.ToAndroid());
if(extendedCell.BackgroundColor != Color.White)
{
View.SetBackgroundColor(extendedCell.BackgroundColor.ToAndroid());
}
else
{
View.SetBackgroundResource(Resource.Drawable.list_selector);
}
if(item.IsEnabled)
{
View.SetMainTextColor(Color.Black);

View file

@ -61,7 +61,6 @@ namespace Bit.Android.Controls
{
private readonly ExtendedTableView _view;
private readonly AListView _listView;
private bool _removedHeader;
public CustomTableViewModelRenderer(Context context, AListView listView, TableView view)
: base(context, listView, view)
@ -93,8 +92,7 @@ namespace Bit.Android.Controls
if(isHeader)
{
layout.SetBackgroundColor(Color.Transparent.ToAndroid());
var textCell = layout?.GetChildAt(0) as BaseCellView;
var textCell = layout.GetChildAt(0) as BaseCellView;
if(textCell != null)
{
if(position == 0 && _view.NoHeader)
@ -108,9 +106,11 @@ namespace Bit.Android.Controls
}
}
}
else
var bline = layout.GetChildAt(1);
if(bline != null)
{
layout.SetBackgroundColor(_view.SeparatorColor.ToAndroid());
bline.SetBackgroundColor(_view.SeparatorColor.ToAndroid());
}
return layout;

View file

@ -23,7 +23,14 @@ namespace Bit.Android.Controls
if(View != null)
{
View.SetBackgroundColor(extendedCell.BackgroundColor.ToAndroid());
if(extendedCell.BackgroundColor != Color.White)
{
View.SetBackgroundColor(extendedCell.BackgroundColor.ToAndroid());
}
else
{
View.SetBackgroundResource(Resource.Drawable.list_selector);
}
if(extendedCell.ShowDisclousure)
{

View file

@ -21,7 +21,14 @@ namespace Bit.Android.Controls
if(View != null)
{
View.SetBackgroundColor(extendedCell.BackgroundColor.ToAndroid());
if(extendedCell.BackgroundColor != Color.White)
{
View.SetBackgroundColor(extendedCell.BackgroundColor.ToAndroid());
}
else
{
View.SetBackgroundResource(Resource.Drawable.list_selector);
}
}
return View;

View file

@ -2672,94 +2672,97 @@ namespace Bit.Android
public const int lightbulb = 2130837708;
// aapt resource value: 0x7f0200cd
public const int @lock = 2130837709;
public const int list_selector = 2130837709;
// aapt resource value: 0x7f0200ce
public const int logo = 2130837710;
public const int @lock = 2130837710;
// aapt resource value: 0x7f0200cf
public const int more = 2130837711;
public const int logo = 2130837711;
// aapt resource value: 0x7f0200d0
public const int mr_dialog_material_background_dark = 2130837712;
public const int more = 2130837712;
// aapt resource value: 0x7f0200d1
public const int mr_dialog_material_background_light = 2130837713;
public const int mr_dialog_material_background_dark = 2130837713;
// aapt resource value: 0x7f0200d2
public const int mr_ic_audiotrack_light = 2130837714;
public const int mr_dialog_material_background_light = 2130837714;
// aapt resource value: 0x7f0200d3
public const int mr_ic_cast_dark = 2130837715;
public const int mr_ic_audiotrack_light = 2130837715;
// aapt resource value: 0x7f0200d4
public const int mr_ic_cast_light = 2130837716;
public const int mr_ic_cast_dark = 2130837716;
// aapt resource value: 0x7f0200d5
public const int mr_ic_close_dark = 2130837717;
public const int mr_ic_cast_light = 2130837717;
// aapt resource value: 0x7f0200d6
public const int mr_ic_close_light = 2130837718;
public const int mr_ic_close_dark = 2130837718;
// aapt resource value: 0x7f0200d7
public const int mr_ic_media_route_connecting_mono_dark = 2130837719;
public const int mr_ic_close_light = 2130837719;
// aapt resource value: 0x7f0200d8
public const int mr_ic_media_route_connecting_mono_light = 2130837720;
public const int mr_ic_media_route_connecting_mono_dark = 2130837720;
// aapt resource value: 0x7f0200d9
public const int mr_ic_media_route_mono_dark = 2130837721;
public const int mr_ic_media_route_connecting_mono_light = 2130837721;
// aapt resource value: 0x7f0200da
public const int mr_ic_media_route_mono_light = 2130837722;
public const int mr_ic_media_route_mono_dark = 2130837722;
// aapt resource value: 0x7f0200db
public const int mr_ic_pause_dark = 2130837723;
public const int mr_ic_media_route_mono_light = 2130837723;
// aapt resource value: 0x7f0200dc
public const int mr_ic_pause_light = 2130837724;
public const int mr_ic_pause_dark = 2130837724;
// aapt resource value: 0x7f0200dd
public const int mr_ic_play_dark = 2130837725;
public const int mr_ic_pause_light = 2130837725;
// aapt resource value: 0x7f0200de
public const int mr_ic_play_light = 2130837726;
// aapt resource value: 0x7f0200ea
public const int notification_template_icon_bg = 2130837738;
public const int mr_ic_play_dark = 2130837726;
// aapt resource value: 0x7f0200df
public const int plus = 2130837727;
public const int mr_ic_play_light = 2130837727;
// aapt resource value: 0x7f0200eb
public const int notification_template_icon_bg = 2130837739;
// aapt resource value: 0x7f0200e0
public const int refresh = 2130837728;
public const int plus = 2130837728;
// aapt resource value: 0x7f0200e1
public const int roundedbg = 2130837729;
public const int refresh = 2130837729;
// aapt resource value: 0x7f0200e2
public const int roundedbgdark = 2130837730;
public const int roundedbg = 2130837730;
// aapt resource value: 0x7f0200e3
public const int splash_screen = 2130837731;
public const int roundedbgdark = 2130837731;
// aapt resource value: 0x7f0200e4
public const int star = 2130837732;
public const int splash_screen = 2130837732;
// aapt resource value: 0x7f0200e5
public const int star_selected = 2130837733;
public const int star = 2130837733;
// aapt resource value: 0x7f0200e6
public const int tools = 2130837734;
public const int star_selected = 2130837734;
// aapt resource value: 0x7f0200e7
public const int tools_selected = 2130837735;
public const int tools = 2130837735;
// aapt resource value: 0x7f0200e8
public const int upload = 2130837736;
public const int tools_selected = 2130837736;
// aapt resource value: 0x7f0200e9
public const int user = 2130837737;
public const int upload = 2130837737;
// aapt resource value: 0x7f0200ea
public const int user = 2130837738;
static Drawable()
{

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false" android:drawable="@color/white" />
<item android:drawable="@android:color/transparent" />
</selector>