1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-22 11:35:21 +01:00

Fixed issue with noheader property in extended table view.

This commit is contained in:
Kyle Spearrin 2016-08-22 00:49:52 -04:00
parent 715b028f47
commit aa880264e3
2 changed files with 14 additions and 11 deletions

View File

@ -72,31 +72,34 @@ namespace Bit.Android.Controls
private ITableViewController Controller => _view; private ITableViewController Controller => _view;
// ref SO post http://bit.ly/2b9cjnQ // ref http://bit.ly/2b9cjnQ
public override AView GetView(int position, AView convertView, ViewGroup parent) public override AView GetView(int position, AView convertView, ViewGroup parent)
{ {
var baseView = base.GetView(position, convertView, parent); var baseView = base.GetView(position, convertView, parent);
var layout = baseView as LinearLayout; var layout = baseView as LinearLayout;
if(layout == null)
{
return baseView;
}
bool isHeader, nextIsHeader; bool isHeader, nextIsHeader;
var item = GetCellForPosition(position, out isHeader, out nextIsHeader); var cell = GetCellForPosition(position, out isHeader, out nextIsHeader);
var aview = CellFactory.GetCell(item, convertView, parent, Context, _view);
if(layout.ChildCount > 0) if(layout.ChildCount > 0)
{ {
layout.RemoveViewAt(0); layout.RemoveViewAt(0);
var cellView = CellFactory.GetCell(cell, convertView, parent, Context, _view);
layout.AddView(cellView, 0);
} }
layout.AddView(aview, 0);
if(isHeader) if(isHeader)
{ {
baseView.SetBackgroundColor(Color.Transparent.ToAndroid()); layout.SetBackgroundColor(Color.Transparent.ToAndroid());
var textCell = aview as BaseCellView; var textCell = layout?.GetChildAt(0) as BaseCellView;
if(textCell != null) if(textCell != null)
{ {
if(!_removedHeader && position == 0 && _view.NoHeader) if(position == 0 && _view.NoHeader)
{ {
textCell.Visibility = ViewStates.Gone; textCell.Visibility = ViewStates.Gone;
_removedHeader = true;
} }
else else
{ {
@ -107,10 +110,10 @@ namespace Bit.Android.Controls
} }
else else
{ {
baseView.SetBackgroundColor(_view.SeparatorColor.ToAndroid()); layout.SetBackgroundColor(_view.SeparatorColor.ToAndroid());
} }
return baseView; return layout;
} }
// Copy/pasted from Xamarin source. Invoke via reflection instead maybe? // Copy/pasted from Xamarin source. Invoke via reflection instead maybe?

View File

@ -180,7 +180,7 @@ namespace Bit.App.Pages
private async void TwoStepCell_Tapped(object sender, EventArgs e) private async void TwoStepCell_Tapped(object sender, EventArgs e)
{ {
if(!await _userDialogs.ConfirmAsync("Two-step login makes your account more secure my requiring you to enter" if(!await _userDialogs.ConfirmAsync("Two-step login makes your account more secure by requiring you to enter"
+ " a security code from an authenticator app whenever you log in. Two-step login can be enabled on the" + " a security code from an authenticator app whenever you log in. Two-step login can be enabled on the"
+ " bitwarden.com web vault. Do you want to visit the website now?", + " bitwarden.com web vault. Do you want to visit the website now?",
null, AppResources.Yes, AppResources.Cancel)) null, AppResources.Yes, AppResources.Cancel))