mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 01:48:25 +03:00
rename cell resources
This commit is contained in:
parent
0a5f9f1b23
commit
1085808867
6 changed files with 38 additions and 36 deletions
|
@ -20,7 +20,6 @@ namespace Bit.Droid.Renderers.BoxedView
|
|||
{
|
||||
nativeCell = InstanceCreator<Context, Xamarin.Forms.Cell, TNativeCell>.Create(context, item);
|
||||
}
|
||||
|
||||
ClearPropertyChanged(nativeCell);
|
||||
nativeCell.Cell = item;
|
||||
SetUpPropertyChanged(nativeCell);
|
||||
|
|
|
@ -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<TextView>(Resource.Id.CellTitle);
|
||||
ContentStack = contentView.FindViewById<LinearLayout>(Resource.Id.CellContentStack);
|
||||
AccessoryStack = contentView.FindViewById<LinearLayout>(Resource.Id.CellAccessoryView);
|
||||
CellTitle = contentView.FindViewById<TextView>(Resource.Id.CellTitle);
|
||||
CellContent = contentView.FindViewById<LinearLayout>(Resource.Id.CellContent);
|
||||
CellTitleContent = contentView.FindViewById<LinearLayout>(Resource.Id.CellTitleContent);
|
||||
CellAccessory = contentView.FindViewById<LinearLayout>(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();
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Bit.Droid.Renderers.BoxedView
|
|||
ViewGroup.LayoutParams.WrapContent);
|
||||
using(textParams)
|
||||
{
|
||||
ContentStack.AddView(ValueLabel, textParams);
|
||||
CellContent.AddView(ValueLabel, textParams);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
10
src/Android/Resources/Resource.designer.cs
generated
10
src/Android/Resources/Resource.designer.cs
generated
|
@ -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;
|
||||
|
||||
|
|
|
@ -8,13 +8,14 @@
|
|||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp">
|
||||
<LinearLayout
|
||||
android:id="@+id/CellBody"
|
||||
android:id="@+id/CellContent"
|
||||
android:orientation="vertical"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
<LinearLayout
|
||||
android:id="@+id/CellContentStack"
|
||||
android:id="@+id/CellTitleContent"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -33,7 +34,7 @@
|
|||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/CellAccessoryView"
|
||||
android:id="@+id/CellAccessory"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Bit.App.Controls.BoxedView
|
|||
defaultBindingMode: BindingMode.OneWay);
|
||||
|
||||
public static BindableProperty ValueTextFontSizeProperty = BindableProperty.Create(
|
||||
nameof(ValueTextFontSize), typeof(double), typeof(LabelCell), -1.0d,
|
||||
nameof(ValueTextFontSize), typeof(double), typeof(LabelCell), -1.0,
|
||||
defaultBindingMode: BindingMode.OneWay);
|
||||
|
||||
public string ValueText
|
||||
|
|
Loading…
Reference in a new issue