diff --git a/src/Android/Renderers/BoxedView/Cells/BaseCellRenderer.cs b/src/Android/Renderers/BoxedView/Cells/BaseCellRenderer.cs index f97fa31ff..2a8c57343 100644 --- a/src/Android/Renderers/BoxedView/Cells/BaseCellRenderer.cs +++ b/src/Android/Renderers/BoxedView/Cells/BaseCellRenderer.cs @@ -20,7 +20,6 @@ namespace Bit.Droid.Renderers.BoxedView { nativeCell = InstanceCreator.Create(context, item); } - ClearPropertyChanged(nativeCell); nativeCell.Cell = item; SetUpPropertyChanged(nativeCell); diff --git a/src/Android/Renderers/BoxedView/Cells/BaseCellView.cs b/src/Android/Renderers/BoxedView/Cells/BaseCellView.cs index edb2e86cf..d8972f4c5 100644 --- a/src/Android/Renderers/BoxedView/Cells/BaseCellView.cs +++ b/src/Android/Renderers/BoxedView/Cells/BaseCellView.cs @@ -38,9 +38,10 @@ namespace Bit.Droid.Renderers.BoxedView public Element Element => Cell; protected BaseCell CellBase => Cell as BaseCell; public App.Controls.BoxedView.BoxedView CellParent => Cell.Parent as App.Controls.BoxedView.BoxedView; - public TextView TitleLabel { get; set; } - public LinearLayout ContentStack { get; set; } - public LinearLayout AccessoryStack { get; set; } + public TextView CellTitle { get; set; } + public LinearLayout CellTitleContent { get; set; } + public LinearLayout CellContent { get; set; } + public LinearLayout CellAccessory { get; set; } private void CreateContentView() { @@ -50,9 +51,10 @@ namespace Bit.Droid.Renderers.BoxedView contentView.LayoutParameters = new ViewGroup.LayoutParams(-1, -1); - TitleLabel = contentView.FindViewById(Resource.Id.CellTitle); - ContentStack = contentView.FindViewById(Resource.Id.CellContentStack); - AccessoryStack = contentView.FindViewById(Resource.Id.CellAccessoryView); + CellTitle = contentView.FindViewById(Resource.Id.CellTitle); + CellContent = contentView.FindViewById(Resource.Id.CellContent); + CellTitleContent = contentView.FindViewById(Resource.Id.CellTitleContent); + CellAccessory = contentView.FindViewById(Resource.Id.CellAccessory); _backgroundColor = new ColorDrawable(); _selectedColor = new ColorDrawable(Android.Graphics.Color.Argb(125, 180, 180, 180)); @@ -72,8 +74,8 @@ namespace Bit.Droid.Renderers.BoxedView _ripple = RendererUtils.CreateRipple(rippleColor, sel); Background = _ripple; - _defaultTextColor = new Android.Graphics.Color(TitleLabel.CurrentTextColor); - _defaultFontSize = TitleLabel.TextSize; + _defaultTextColor = new Android.Graphics.Color(CellTitle.CurrentTextColor); + _defaultFontSize = CellTitle.TextSize; } public virtual void CellPropertyChanged(object sender, PropertyChangedEventArgs e) @@ -184,24 +186,24 @@ namespace Bit.Droid.Renderers.BoxedView private void UpdateTitleText() { - TitleLabel.Text = CellBase.Title; + CellTitle.Text = CellBase.Title; // Hide TextView right padding when TextView.Text empty. - TitleLabel.Visibility = string.IsNullOrEmpty(TitleLabel.Text) ? ViewStates.Gone : ViewStates.Visible; + CellTitle.Visibility = string.IsNullOrEmpty(CellTitle.Text) ? ViewStates.Gone : ViewStates.Visible; } private void UpdateTitleColor() { if(CellBase.TitleColor != Color.Default) { - TitleLabel.SetTextColor(CellBase.TitleColor.ToAndroid()); + CellTitle.SetTextColor(CellBase.TitleColor.ToAndroid()); } else if(CellParent != null && CellParent.CellTitleColor != Color.Default) { - TitleLabel.SetTextColor(CellParent.CellTitleColor.ToAndroid()); + CellTitle.SetTextColor(CellParent.CellTitleColor.ToAndroid()); } else { - TitleLabel.SetTextColor(_defaultTextColor); + CellTitle.SetTextColor(_defaultTextColor); } } @@ -209,15 +211,15 @@ namespace Bit.Droid.Renderers.BoxedView { if(CellBase.TitleFontSize > 0) { - TitleLabel.SetTextSize(ComplexUnitType.Sp, (float)CellBase.TitleFontSize); + CellTitle.SetTextSize(ComplexUnitType.Sp, (float)CellBase.TitleFontSize); } else if(CellParent != null) { - TitleLabel.SetTextSize(ComplexUnitType.Sp, (float)CellParent.CellTitleFontSize); + CellTitle.SetTextSize(ComplexUnitType.Sp, (float)CellParent.CellTitleFontSize); } else { - TitleLabel.SetTextSize(ComplexUnitType.Sp, _defaultFontSize); + CellTitle.SetTextSize(ComplexUnitType.Sp, _defaultFontSize); } } @@ -232,7 +234,7 @@ namespace Bit.Droid.Renderers.BoxedView { Focusable = false; DescendantFocusability = DescendantFocusability.AfterDescendants; - TitleLabel.Alpha = 1f; + CellTitle.Alpha = 1f; } else { @@ -240,7 +242,7 @@ namespace Bit.Droid.Renderers.BoxedView Focusable = true; DescendantFocusability = DescendantFocusability.BlockDescendants; // to turn like disabled - TitleLabel.Alpha = 0.3f; + CellTitle.Alpha = 0.3f; } } @@ -257,12 +259,12 @@ namespace Bit.Droid.Renderers.BoxedView CellBase.Section = null; } - TitleLabel?.Dispose(); - TitleLabel = null; - ContentStack?.Dispose(); - ContentStack = null; - AccessoryStack?.Dispose(); - AccessoryStack = null; + CellTitle?.Dispose(); + CellTitle = null; + CellTitleContent?.Dispose(); + CellTitleContent = null; + CellAccessory?.Dispose(); + CellAccessory = null; Cell = null; _iconTokenSource?.Dispose(); diff --git a/src/Android/Renderers/BoxedView/Cells/LabelCellRenderer.cs b/src/Android/Renderers/BoxedView/Cells/LabelCellRenderer.cs index 083f80b63..1337d5f0a 100644 --- a/src/Android/Renderers/BoxedView/Cells/LabelCellRenderer.cs +++ b/src/Android/Renderers/BoxedView/Cells/LabelCellRenderer.cs @@ -31,7 +31,7 @@ namespace Bit.Droid.Renderers.BoxedView ViewGroup.LayoutParams.WrapContent); using(textParams) { - ContentStack.AddView(ValueLabel, textParams); + CellContent.AddView(ValueLabel, textParams); } } diff --git a/src/Android/Resources/Resource.designer.cs b/src/Android/Resources/Resource.designer.cs index 8cb4763ed..7fe112f18 100644 --- a/src/Android/Resources/Resource.designer.cs +++ b/src/Android/Resources/Resource.designer.cs @@ -6535,17 +6535,17 @@ namespace Bit.Droid public const int CTRL = 2131361850; // aapt resource value: 0x7f0a00a8 - public const int CellAccessoryView = 2131361960; + public const int CellAccessory = 2131361960; // aapt resource value: 0x7f0a00a5 - public const int CellBody = 2131361957; - - // aapt resource value: 0x7f0a00a6 - public const int CellContentStack = 2131361958; + public const int CellContent = 2131361957; // aapt resource value: 0x7f0a00a7 public const int CellTitle = 2131361959; + // aapt resource value: 0x7f0a00a6 + public const int CellTitleContent = 2131361958; + // aapt resource value: 0x7f0a00a9 public const int ContentCellBody = 2131361961; diff --git a/src/Android/Resources/layout/CellBaseView.axml b/src/Android/Resources/layout/CellBaseView.axml index 4dda6c7db..92d939e6f 100644 --- a/src/Android/Resources/layout/CellBaseView.axml +++ b/src/Android/Resources/layout/CellBaseView.axml @@ -8,13 +8,14 @@ android:paddingTop="4dp" android:paddingBottom="4dp"> + android:layout_height="wrap_content" + android:gravity="center_vertical">