mirror of
https://github.com/bitwarden/android.git
synced 2024-12-19 07:41:52 +03:00
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:
parent
d729f93b17
commit
3807f185d6
7 changed files with 73 additions and 40 deletions
|
@ -717,6 +717,9 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidResource Include="Resources\drawable\tools.png" />
|
<AndroidResource Include="Resources\drawable\tools.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AndroidResource Include="Resources\drawable\list_selector.xml" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
<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')" />
|
<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">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
|
|
@ -22,7 +22,15 @@ namespace Bit.Android.Controls
|
||||||
|
|
||||||
if(View != null)
|
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)
|
if(item.IsEnabled)
|
||||||
{
|
{
|
||||||
View.SetMainTextColor(Color.Black);
|
View.SetMainTextColor(Color.Black);
|
||||||
|
|
|
@ -61,7 +61,6 @@ namespace Bit.Android.Controls
|
||||||
{
|
{
|
||||||
private readonly ExtendedTableView _view;
|
private readonly ExtendedTableView _view;
|
||||||
private readonly AListView _listView;
|
private readonly AListView _listView;
|
||||||
private bool _removedHeader;
|
|
||||||
|
|
||||||
public CustomTableViewModelRenderer(Context context, AListView listView, TableView view)
|
public CustomTableViewModelRenderer(Context context, AListView listView, TableView view)
|
||||||
: base(context, listView, view)
|
: base(context, listView, view)
|
||||||
|
@ -93,8 +92,7 @@ namespace Bit.Android.Controls
|
||||||
|
|
||||||
if(isHeader)
|
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(textCell != null)
|
||||||
{
|
{
|
||||||
if(position == 0 && _view.NoHeader)
|
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;
|
return layout;
|
||||||
|
|
|
@ -23,7 +23,14 @@ namespace Bit.Android.Controls
|
||||||
|
|
||||||
if(View != null)
|
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)
|
if(extendedCell.ShowDisclousure)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,14 @@ namespace Bit.Android.Controls
|
||||||
|
|
||||||
if(View != null)
|
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;
|
return View;
|
||||||
|
|
67
src/Android/Resources/Resource.Designer.cs
generated
67
src/Android/Resources/Resource.Designer.cs
generated
|
@ -2672,94 +2672,97 @@ namespace Bit.Android
|
||||||
public const int lightbulb = 2130837708;
|
public const int lightbulb = 2130837708;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200cd
|
// aapt resource value: 0x7f0200cd
|
||||||
public const int @lock = 2130837709;
|
public const int list_selector = 2130837709;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200ce
|
// aapt resource value: 0x7f0200ce
|
||||||
public const int logo = 2130837710;
|
public const int @lock = 2130837710;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200cf
|
// aapt resource value: 0x7f0200cf
|
||||||
public const int more = 2130837711;
|
public const int logo = 2130837711;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200d0
|
// aapt resource value: 0x7f0200d0
|
||||||
public const int mr_dialog_material_background_dark = 2130837712;
|
public const int more = 2130837712;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200d1
|
// 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
|
// 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
|
// aapt resource value: 0x7f0200d3
|
||||||
public const int mr_ic_cast_dark = 2130837715;
|
public const int mr_ic_audiotrack_light = 2130837715;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200d4
|
// aapt resource value: 0x7f0200d4
|
||||||
public const int mr_ic_cast_light = 2130837716;
|
public const int mr_ic_cast_dark = 2130837716;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200d5
|
// aapt resource value: 0x7f0200d5
|
||||||
public const int mr_ic_close_dark = 2130837717;
|
public const int mr_ic_cast_light = 2130837717;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200d6
|
// aapt resource value: 0x7f0200d6
|
||||||
public const int mr_ic_close_light = 2130837718;
|
public const int mr_ic_close_dark = 2130837718;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200d7
|
// 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
|
// 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
|
// 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
|
// 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
|
// 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
|
// aapt resource value: 0x7f0200dc
|
||||||
public const int mr_ic_pause_light = 2130837724;
|
public const int mr_ic_pause_dark = 2130837724;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200dd
|
// aapt resource value: 0x7f0200dd
|
||||||
public const int mr_ic_play_dark = 2130837725;
|
public const int mr_ic_pause_light = 2130837725;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200de
|
// aapt resource value: 0x7f0200de
|
||||||
public const int mr_ic_play_light = 2130837726;
|
public const int mr_ic_play_dark = 2130837726;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200ea
|
|
||||||
public const int notification_template_icon_bg = 2130837738;
|
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200df
|
// 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
|
// aapt resource value: 0x7f0200e0
|
||||||
public const int refresh = 2130837728;
|
public const int plus = 2130837728;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e1
|
// aapt resource value: 0x7f0200e1
|
||||||
public const int roundedbg = 2130837729;
|
public const int refresh = 2130837729;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e2
|
// aapt resource value: 0x7f0200e2
|
||||||
public const int roundedbgdark = 2130837730;
|
public const int roundedbg = 2130837730;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e3
|
// aapt resource value: 0x7f0200e3
|
||||||
public const int splash_screen = 2130837731;
|
public const int roundedbgdark = 2130837731;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e4
|
// aapt resource value: 0x7f0200e4
|
||||||
public const int star = 2130837732;
|
public const int splash_screen = 2130837732;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e5
|
// aapt resource value: 0x7f0200e5
|
||||||
public const int star_selected = 2130837733;
|
public const int star = 2130837733;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e6
|
// aapt resource value: 0x7f0200e6
|
||||||
public const int tools = 2130837734;
|
public const int star_selected = 2130837734;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e7
|
// aapt resource value: 0x7f0200e7
|
||||||
public const int tools_selected = 2130837735;
|
public const int tools = 2130837735;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e8
|
// aapt resource value: 0x7f0200e8
|
||||||
public const int upload = 2130837736;
|
public const int tools_selected = 2130837736;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e9
|
// 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()
|
static Drawable()
|
||||||
{
|
{
|
||||||
|
|
5
src/Android/Resources/drawable/list_selector.xml
Normal file
5
src/Android/Resources/drawable/list_selector.xml
Normal 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>
|
Loading…
Reference in a new issue