mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 10:28:28 +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);
|
nativeCell = InstanceCreator<Context, Xamarin.Forms.Cell, TNativeCell>.Create(context, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearPropertyChanged(nativeCell);
|
ClearPropertyChanged(nativeCell);
|
||||||
nativeCell.Cell = item;
|
nativeCell.Cell = item;
|
||||||
SetUpPropertyChanged(nativeCell);
|
SetUpPropertyChanged(nativeCell);
|
||||||
|
|
|
@ -38,9 +38,10 @@ namespace Bit.Droid.Renderers.BoxedView
|
||||||
public Element Element => Cell;
|
public Element Element => Cell;
|
||||||
protected BaseCell CellBase => Cell as BaseCell;
|
protected BaseCell CellBase => Cell as BaseCell;
|
||||||
public App.Controls.BoxedView.BoxedView CellParent => Cell.Parent as App.Controls.BoxedView.BoxedView;
|
public App.Controls.BoxedView.BoxedView CellParent => Cell.Parent as App.Controls.BoxedView.BoxedView;
|
||||||
public TextView TitleLabel { get; set; }
|
public TextView CellTitle { get; set; }
|
||||||
public LinearLayout ContentStack { get; set; }
|
public LinearLayout CellTitleContent { get; set; }
|
||||||
public LinearLayout AccessoryStack { get; set; }
|
public LinearLayout CellContent { get; set; }
|
||||||
|
public LinearLayout CellAccessory { get; set; }
|
||||||
|
|
||||||
private void CreateContentView()
|
private void CreateContentView()
|
||||||
{
|
{
|
||||||
|
@ -50,9 +51,10 @@ namespace Bit.Droid.Renderers.BoxedView
|
||||||
|
|
||||||
contentView.LayoutParameters = new ViewGroup.LayoutParams(-1, -1);
|
contentView.LayoutParameters = new ViewGroup.LayoutParams(-1, -1);
|
||||||
|
|
||||||
TitleLabel = contentView.FindViewById<TextView>(Resource.Id.CellTitle);
|
CellTitle = contentView.FindViewById<TextView>(Resource.Id.CellTitle);
|
||||||
ContentStack = contentView.FindViewById<LinearLayout>(Resource.Id.CellContentStack);
|
CellContent = contentView.FindViewById<LinearLayout>(Resource.Id.CellContent);
|
||||||
AccessoryStack = contentView.FindViewById<LinearLayout>(Resource.Id.CellAccessoryView);
|
CellTitleContent = contentView.FindViewById<LinearLayout>(Resource.Id.CellTitleContent);
|
||||||
|
CellAccessory = contentView.FindViewById<LinearLayout>(Resource.Id.CellAccessory);
|
||||||
|
|
||||||
_backgroundColor = new ColorDrawable();
|
_backgroundColor = new ColorDrawable();
|
||||||
_selectedColor = new ColorDrawable(Android.Graphics.Color.Argb(125, 180, 180, 180));
|
_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);
|
_ripple = RendererUtils.CreateRipple(rippleColor, sel);
|
||||||
Background = _ripple;
|
Background = _ripple;
|
||||||
|
|
||||||
_defaultTextColor = new Android.Graphics.Color(TitleLabel.CurrentTextColor);
|
_defaultTextColor = new Android.Graphics.Color(CellTitle.CurrentTextColor);
|
||||||
_defaultFontSize = TitleLabel.TextSize;
|
_defaultFontSize = CellTitle.TextSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void CellPropertyChanged(object sender, PropertyChangedEventArgs e)
|
public virtual void CellPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||||
|
@ -184,24 +186,24 @@ namespace Bit.Droid.Renderers.BoxedView
|
||||||
|
|
||||||
private void UpdateTitleText()
|
private void UpdateTitleText()
|
||||||
{
|
{
|
||||||
TitleLabel.Text = CellBase.Title;
|
CellTitle.Text = CellBase.Title;
|
||||||
// Hide TextView right padding when TextView.Text empty.
|
// 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()
|
private void UpdateTitleColor()
|
||||||
{
|
{
|
||||||
if(CellBase.TitleColor != Color.Default)
|
if(CellBase.TitleColor != Color.Default)
|
||||||
{
|
{
|
||||||
TitleLabel.SetTextColor(CellBase.TitleColor.ToAndroid());
|
CellTitle.SetTextColor(CellBase.TitleColor.ToAndroid());
|
||||||
}
|
}
|
||||||
else if(CellParent != null && CellParent.CellTitleColor != Color.Default)
|
else if(CellParent != null && CellParent.CellTitleColor != Color.Default)
|
||||||
{
|
{
|
||||||
TitleLabel.SetTextColor(CellParent.CellTitleColor.ToAndroid());
|
CellTitle.SetTextColor(CellParent.CellTitleColor.ToAndroid());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TitleLabel.SetTextColor(_defaultTextColor);
|
CellTitle.SetTextColor(_defaultTextColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,15 +211,15 @@ namespace Bit.Droid.Renderers.BoxedView
|
||||||
{
|
{
|
||||||
if(CellBase.TitleFontSize > 0)
|
if(CellBase.TitleFontSize > 0)
|
||||||
{
|
{
|
||||||
TitleLabel.SetTextSize(ComplexUnitType.Sp, (float)CellBase.TitleFontSize);
|
CellTitle.SetTextSize(ComplexUnitType.Sp, (float)CellBase.TitleFontSize);
|
||||||
}
|
}
|
||||||
else if(CellParent != null)
|
else if(CellParent != null)
|
||||||
{
|
{
|
||||||
TitleLabel.SetTextSize(ComplexUnitType.Sp, (float)CellParent.CellTitleFontSize);
|
CellTitle.SetTextSize(ComplexUnitType.Sp, (float)CellParent.CellTitleFontSize);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TitleLabel.SetTextSize(ComplexUnitType.Sp, _defaultFontSize);
|
CellTitle.SetTextSize(ComplexUnitType.Sp, _defaultFontSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +234,7 @@ namespace Bit.Droid.Renderers.BoxedView
|
||||||
{
|
{
|
||||||
Focusable = false;
|
Focusable = false;
|
||||||
DescendantFocusability = DescendantFocusability.AfterDescendants;
|
DescendantFocusability = DescendantFocusability.AfterDescendants;
|
||||||
TitleLabel.Alpha = 1f;
|
CellTitle.Alpha = 1f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -240,7 +242,7 @@ namespace Bit.Droid.Renderers.BoxedView
|
||||||
Focusable = true;
|
Focusable = true;
|
||||||
DescendantFocusability = DescendantFocusability.BlockDescendants;
|
DescendantFocusability = DescendantFocusability.BlockDescendants;
|
||||||
// to turn like disabled
|
// to turn like disabled
|
||||||
TitleLabel.Alpha = 0.3f;
|
CellTitle.Alpha = 0.3f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,12 +259,12 @@ namespace Bit.Droid.Renderers.BoxedView
|
||||||
CellBase.Section = null;
|
CellBase.Section = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
TitleLabel?.Dispose();
|
CellTitle?.Dispose();
|
||||||
TitleLabel = null;
|
CellTitle = null;
|
||||||
ContentStack?.Dispose();
|
CellTitleContent?.Dispose();
|
||||||
ContentStack = null;
|
CellTitleContent = null;
|
||||||
AccessoryStack?.Dispose();
|
CellAccessory?.Dispose();
|
||||||
AccessoryStack = null;
|
CellAccessory = null;
|
||||||
Cell = null;
|
Cell = null;
|
||||||
|
|
||||||
_iconTokenSource?.Dispose();
|
_iconTokenSource?.Dispose();
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace Bit.Droid.Renderers.BoxedView
|
||||||
ViewGroup.LayoutParams.WrapContent);
|
ViewGroup.LayoutParams.WrapContent);
|
||||||
using(textParams)
|
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;
|
public const int CTRL = 2131361850;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0a00a8
|
// aapt resource value: 0x7f0a00a8
|
||||||
public const int CellAccessoryView = 2131361960;
|
public const int CellAccessory = 2131361960;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0a00a5
|
// aapt resource value: 0x7f0a00a5
|
||||||
public const int CellBody = 2131361957;
|
public const int CellContent = 2131361957;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0a00a6
|
|
||||||
public const int CellContentStack = 2131361958;
|
|
||||||
|
|
||||||
// aapt resource value: 0x7f0a00a7
|
// aapt resource value: 0x7f0a00a7
|
||||||
public const int CellTitle = 2131361959;
|
public const int CellTitle = 2131361959;
|
||||||
|
|
||||||
|
// aapt resource value: 0x7f0a00a6
|
||||||
|
public const int CellTitleContent = 2131361958;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0a00a9
|
// aapt resource value: 0x7f0a00a9
|
||||||
public const int ContentCellBody = 2131361961;
|
public const int ContentCellBody = 2131361961;
|
||||||
|
|
||||||
|
|
|
@ -8,13 +8,14 @@
|
||||||
android:paddingTop="4dp"
|
android:paddingTop="4dp"
|
||||||
android:paddingBottom="4dp">
|
android:paddingBottom="4dp">
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/CellBody"
|
android:id="@+id/CellContent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical">
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/CellContentStack"
|
android:id="@+id/CellTitleContent"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -33,7 +34,7 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/CellAccessoryView"
|
android:id="@+id/CellAccessory"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace Bit.App.Controls.BoxedView
|
||||||
defaultBindingMode: BindingMode.OneWay);
|
defaultBindingMode: BindingMode.OneWay);
|
||||||
|
|
||||||
public static BindableProperty ValueTextFontSizeProperty = BindableProperty.Create(
|
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);
|
defaultBindingMode: BindingMode.OneWay);
|
||||||
|
|
||||||
public string ValueText
|
public string ValueText
|
||||||
|
|
Loading…
Reference in a new issue