added "more" disclosure image for vault listing cell "more options" action sheet.
|
@ -299,6 +299,21 @@
|
|||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable-xxhdpi\bg.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\more.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable-hdpi\more.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable-mdpi\more.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable-xhdpi\more.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable-xxhdpi\more.png" />
|
||||
</ItemGroup>
|
||||
<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')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
|
|
|
@ -33,9 +33,9 @@ namespace Bit.Android.Controls
|
|||
resourceId = context.Resources.GetIdentifier(fileName, "drawable", context.PackageName);
|
||||
}
|
||||
|
||||
var image = new ImageView(context);
|
||||
var image = new DisclosureImage(context, extendedCell);
|
||||
image.SetImageResource(resourceId);
|
||||
image.SetPadding(0, 0, 30, 0);
|
||||
image.SetPadding(10, 10, 30, 10);
|
||||
View.SetAccessoryView(image);
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,30 @@ namespace Bit.Android.Controls
|
|||
return View;
|
||||
}
|
||||
|
||||
private class DisclosureImage : ImageView
|
||||
{
|
||||
private ExtendedTextCell _cell;
|
||||
|
||||
public DisclosureImage(Context context, ExtendedTextCell cell) : base(context)
|
||||
{
|
||||
_cell = cell;
|
||||
}
|
||||
|
||||
public override bool OnTouchEvent(MotionEvent e)
|
||||
{
|
||||
switch(e.Action)
|
||||
{
|
||||
case MotionEventActions.Up:
|
||||
_cell.OnDisclousureTapped();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs args)
|
||||
{
|
||||
base.OnCellPropertyChanged(sender, args);
|
||||
|
|
43
src/Android/Resources/Resource.Designer.cs
generated
|
@ -2274,58 +2274,61 @@ namespace Bit.Android
|
|||
public const int ion_plus = 2130837656;
|
||||
|
||||
// aapt resource value: 0x7f020099
|
||||
public const int mr_dialog_material_background_dark = 2130837657;
|
||||
public const int more = 2130837657;
|
||||
|
||||
// aapt resource value: 0x7f02009a
|
||||
public const int mr_dialog_material_background_light = 2130837658;
|
||||
public const int mr_dialog_material_background_dark = 2130837658;
|
||||
|
||||
// aapt resource value: 0x7f02009b
|
||||
public const int mr_ic_audiotrack_light = 2130837659;
|
||||
public const int mr_dialog_material_background_light = 2130837659;
|
||||
|
||||
// aapt resource value: 0x7f02009c
|
||||
public const int mr_ic_cast_dark = 2130837660;
|
||||
public const int mr_ic_audiotrack_light = 2130837660;
|
||||
|
||||
// aapt resource value: 0x7f02009d
|
||||
public const int mr_ic_cast_light = 2130837661;
|
||||
public const int mr_ic_cast_dark = 2130837661;
|
||||
|
||||
// aapt resource value: 0x7f02009e
|
||||
public const int mr_ic_close_dark = 2130837662;
|
||||
public const int mr_ic_cast_light = 2130837662;
|
||||
|
||||
// aapt resource value: 0x7f02009f
|
||||
public const int mr_ic_close_light = 2130837663;
|
||||
public const int mr_ic_close_dark = 2130837663;
|
||||
|
||||
// aapt resource value: 0x7f0200a0
|
||||
public const int mr_ic_media_route_connecting_mono_dark = 2130837664;
|
||||
public const int mr_ic_close_light = 2130837664;
|
||||
|
||||
// aapt resource value: 0x7f0200a1
|
||||
public const int mr_ic_media_route_connecting_mono_light = 2130837665;
|
||||
public const int mr_ic_media_route_connecting_mono_dark = 2130837665;
|
||||
|
||||
// aapt resource value: 0x7f0200a2
|
||||
public const int mr_ic_media_route_mono_dark = 2130837666;
|
||||
public const int mr_ic_media_route_connecting_mono_light = 2130837666;
|
||||
|
||||
// aapt resource value: 0x7f0200a3
|
||||
public const int mr_ic_media_route_mono_light = 2130837667;
|
||||
public const int mr_ic_media_route_mono_dark = 2130837667;
|
||||
|
||||
// aapt resource value: 0x7f0200a4
|
||||
public const int mr_ic_pause_dark = 2130837668;
|
||||
public const int mr_ic_media_route_mono_light = 2130837668;
|
||||
|
||||
// aapt resource value: 0x7f0200a5
|
||||
public const int mr_ic_pause_light = 2130837669;
|
||||
public const int mr_ic_pause_dark = 2130837669;
|
||||
|
||||
// aapt resource value: 0x7f0200a6
|
||||
public const int mr_ic_play_dark = 2130837670;
|
||||
public const int mr_ic_pause_light = 2130837670;
|
||||
|
||||
// aapt resource value: 0x7f0200a7
|
||||
public const int mr_ic_play_light = 2130837671;
|
||||
|
||||
// aapt resource value: 0x7f0200aa
|
||||
public const int notification_template_icon_bg = 2130837674;
|
||||
public const int mr_ic_play_dark = 2130837671;
|
||||
|
||||
// aapt resource value: 0x7f0200a8
|
||||
public const int roundedbg = 2130837672;
|
||||
public const int mr_ic_play_light = 2130837672;
|
||||
|
||||
// aapt resource value: 0x7f0200ab
|
||||
public const int notification_template_icon_bg = 2130837675;
|
||||
|
||||
// aapt resource value: 0x7f0200a9
|
||||
public const int roundedbgdark = 2130837673;
|
||||
public const int roundedbg = 2130837673;
|
||||
|
||||
// aapt resource value: 0x7f0200aa
|
||||
public const int roundedbgdark = 2130837674;
|
||||
|
||||
static Drawable()
|
||||
{
|
||||
|
|
BIN
src/Android/Resources/drawable-hdpi/more.png
Normal file
After Width: | Height: | Size: 584 B |
BIN
src/Android/Resources/drawable-mdpi/more.png
Normal file
After Width: | Height: | Size: 584 B |
BIN
src/Android/Resources/drawable-xhdpi/more.png
Normal file
After Width: | Height: | Size: 584 B |
BIN
src/Android/Resources/drawable-xxhdpi/more.png
Normal file
After Width: | Height: | Size: 584 B |
BIN
src/Android/Resources/drawable/more.png
Normal file
After Width: | Height: | Size: 584 B |
|
@ -1,4 +1,5 @@
|
|||
using Xamarin.Forms;
|
||||
using System;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Controls
|
||||
{
|
||||
|
@ -30,5 +31,12 @@ namespace Bit.App.Controls
|
|||
get { return (string)GetValue(DisclousureImageProperty); }
|
||||
set { SetValue(DisclousureImageProperty, value); }
|
||||
}
|
||||
|
||||
public event EventHandler DisclousureTapped;
|
||||
|
||||
public void OnDisclousureTapped()
|
||||
{
|
||||
DisclousureTapped?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ using Bit.App.Resources;
|
|||
using Xamarin.Forms;
|
||||
using XLabs.Ioc;
|
||||
using Bit.App.Utilities;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
|
@ -83,8 +84,8 @@ namespace Bit.App.Pages
|
|||
|
||||
private async void MoreClickedAsync(object sender, EventArgs e)
|
||||
{
|
||||
var mi = sender as MenuItem;
|
||||
var site = mi.CommandParameter as VaultListPageModel.Site;
|
||||
var cell = sender as VaultListViewCell;
|
||||
var site = cell.CommandParameter as VaultListPageModel.Site;
|
||||
var selection = await DisplayActionSheet(AppResources.MoreOptions, AppResources.Cancel, null,
|
||||
AppResources.View, AppResources.Edit, AppResources.CopyPassword, AppResources.CopyUsername, AppResources.GoToWebsite);
|
||||
|
||||
|
@ -163,23 +164,32 @@ namespace Bit.App.Pages
|
|||
|
||||
private class VaultListViewCell : ExtendedTextCell
|
||||
{
|
||||
private VaultListSitesPage _page;
|
||||
|
||||
public VaultListViewCell(VaultListSitesPage page)
|
||||
{
|
||||
var moreAction = new MenuItem { Text = AppResources.More };
|
||||
moreAction.SetBinding(MenuItem.CommandParameterProperty, new Binding("."));
|
||||
moreAction.Clicked += page.MoreClickedAsync;
|
||||
_page = page;
|
||||
|
||||
var deleteAction = new MenuItem { Text = AppResources.Delete, IsDestructive = true };
|
||||
deleteAction.SetBinding(MenuItem.CommandParameterProperty, new Binding("."));
|
||||
deleteAction.Clicked += page.DeleteClickedAsync;
|
||||
|
||||
SetBinding(CommandParameterProperty, new Binding("."));
|
||||
this.SetBinding<VaultListPageModel.Site>(TextProperty, s => s.Name);
|
||||
this.SetBinding<VaultListPageModel.Site>(DetailProperty, s => s.Username);
|
||||
ContextActions.Add(moreAction);
|
||||
ContextActions.Add(deleteAction);
|
||||
|
||||
TextColor = Color.FromHex("333333");
|
||||
DetailColor = Color.FromHex("777777");
|
||||
|
||||
DisclousureTapped += VaultListViewCell_DisclousureTapped;
|
||||
ShowDisclousure = true;
|
||||
DisclousureImage = "more";
|
||||
}
|
||||
|
||||
private void VaultListViewCell_DisclousureTapped(object sender, EventArgs e)
|
||||
{
|
||||
_page.MoreClickedAsync(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,14 +25,20 @@ namespace Bit.iOS.Controls
|
|||
{
|
||||
var detailDisclosureButton = UIButton.FromType(UIButtonType.Custom);
|
||||
detailDisclosureButton.SetImage(UIImage.FromBundle(extendedCell.DisclousureImage), UIControlState.Normal);
|
||||
detailDisclosureButton.SetImage(UIImage.FromBundle(extendedCell.DisclousureImage), UIControlState.Selected);
|
||||
|
||||
detailDisclosureButton.Frame = new CGRect(0f, 0f, 30f, 30f);
|
||||
try
|
||||
{
|
||||
detailDisclosureButton.SetImage(UIImage.FromBundle(extendedCell.DisclousureImage + "_selected"), UIControlState.Selected);
|
||||
}
|
||||
catch
|
||||
{
|
||||
detailDisclosureButton.SetImage(UIImage.FromBundle(extendedCell.DisclousureImage), UIControlState.Selected);
|
||||
}
|
||||
|
||||
detailDisclosureButton.Frame = new CGRect(0f, 0f, 30f, 40f);
|
||||
detailDisclosureButton.TouchUpInside += (sender, e) =>
|
||||
{
|
||||
var index = tv.IndexPathForCell(cell);
|
||||
tv.SelectRow(index, true, UITableViewScrollPosition.None);
|
||||
tv.Source.AccessoryButtonTapped(tv, index);
|
||||
extendedCell.OnDisclousureTapped();
|
||||
};
|
||||
cell.AccessoryView = detailDisclosureButton;
|
||||
}
|
||||
|
|
BIN
src/iOS/Resources/more.png
Normal file
After Width: | Height: | Size: 584 B |
BIN
src/iOS/Resources/more@2x.png
Normal file
After Width: | Height: | Size: 479 B |
BIN
src/iOS/Resources/more@3x.png
Normal file
After Width: | Height: | Size: 271 B |
BIN
src/iOS/Resources/more_selected.png
Normal file
After Width: | Height: | Size: 271 B |
BIN
src/iOS/Resources/more_selected@2x.png
Normal file
After Width: | Height: | Size: 479 B |
BIN
src/iOS/Resources/more_selected@3x.png
Normal file
After Width: | Height: | Size: 584 B |
|
@ -375,6 +375,24 @@
|
|||
<ItemGroup>
|
||||
<BundleResource Include="Resources\cogs%403x.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\more.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\more%403x.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\more%402x.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\more_selected.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\more_selected%403x.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\more_selected%402x.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
|
|