new icons for ios. new renderers for editor, picker, table view. android style changes.

This commit is contained in:
Kyle Spearrin 2016-05-12 00:09:06 -04:00
parent 6fd81fc40e
commit 2ece75b2c0
46 changed files with 309 additions and 36 deletions

View File

@ -196,6 +196,8 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Controls\ExtendedEditorRenderer.cs" />
<Compile Include="Controls\ExtendedPickerRenderer.cs" />
<Compile Include="Controls\ExtendedEntryRenderer.cs" />
<Compile Include="Resources\Resource.Designer.cs" />
<Compile Include="Services\ClipboardService.cs" />

View File

@ -0,0 +1,48 @@
using System;
using System.ComponentModel;
using Bit.Android.Controls;
using Bit.App.Controls;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(ExtendedEditor), typeof(ExtendedEditorRenderer))]
namespace Bit.Android.Controls
{
public class ExtendedEditorRenderer : EditorRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Editor> e)
{
base.OnElementChanged(e);
var view = (ExtendedEditor)Element;
SetBorder(view);
}
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
var view = (ExtendedEditor)Element;
if(e.PropertyName == ExtendedEditor.HasBorderProperty.PropertyName)
{
SetBorder(view);
}
else
{
base.OnElementPropertyChanged(sender, e);
if(e.PropertyName == VisualElement.BackgroundColorProperty.PropertyName)
{
Control.SetBackgroundColor(view.BackgroundColor.ToAndroid());
}
}
}
private void SetBorder(ExtendedEditor view)
{
if(!view.HasBorder)
{
Control.SetBackgroundColor(global::Android.Graphics.Color.Transparent);
}
}
}
}

View File

@ -51,7 +51,14 @@ namespace Bit.Android.Controls
private void SetBorder(ExtendedEntry view)
{
//Not suported on Android
if(!view.HasBorder)
{
Control.SetBackgroundColor(global::Android.Graphics.Color.Transparent);
}
else
{
Control.SetBackgroundColor(view.BottomBorderColor.ToAndroid());
}
}
private void SetMaxLength(ExtendedEntry view)

View File

@ -0,0 +1,48 @@
using System;
using System.ComponentModel;
using Bit.Android.Controls;
using Bit.App.Controls;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(ExtendedPicker), typeof(ExtendedPickerRenderer))]
namespace Bit.Android.Controls
{
public class ExtendedPickerRenderer : PickerRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
{
base.OnElementChanged(e);
var view = (ExtendedPicker)Element;
SetBorder(view);
}
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
var view = (ExtendedPicker)Element;
if(e.PropertyName == ExtendedPicker.HasBorderProperty.PropertyName)
{
SetBorder(view);
}
else
{
base.OnElementPropertyChanged(sender, e);
if(e.PropertyName == VisualElement.BackgroundColorProperty.PropertyName)
{
Control.SetBackgroundColor(view.BackgroundColor.ToAndroid());
}
}
}
private void SetBorder(ExtendedPicker view)
{
if(!view.HasBorder)
{
Control.SetBackgroundColor(global::Android.Graphics.Color.Transparent);
}
}
}
}

View File

@ -1166,32 +1166,32 @@ namespace Bit.Android
public partial class Color
{
// aapt resource value: 0x7f0b004d
public const int abc_background_cache_hint_selector_material_dark = 2131427405;
// aapt resource value: 0x7f0b004e
public const int abc_background_cache_hint_selector_material_light = 2131427406;
public const int abc_background_cache_hint_selector_material_dark = 2131427406;
// aapt resource value: 0x7f0b004f
public const int abc_color_highlight_material = 2131427407;
public const int abc_background_cache_hint_selector_material_light = 2131427407;
// aapt resource value: 0x7f0b0050
public const int abc_color_highlight_material = 2131427408;
// aapt resource value: 0x7f0b0004
public const int abc_input_method_navigation_guard = 2131427332;
// aapt resource value: 0x7f0b0050
public const int abc_primary_text_disable_only_material_dark = 2131427408;
// aapt resource value: 0x7f0b0051
public const int abc_primary_text_disable_only_material_light = 2131427409;
public const int abc_primary_text_disable_only_material_dark = 2131427409;
// aapt resource value: 0x7f0b0052
public const int abc_primary_text_material_dark = 2131427410;
public const int abc_primary_text_disable_only_material_light = 2131427410;
// aapt resource value: 0x7f0b0053
public const int abc_primary_text_material_light = 2131427411;
public const int abc_primary_text_material_dark = 2131427411;
// aapt resource value: 0x7f0b0054
public const int abc_search_url_text = 2131427412;
public const int abc_primary_text_material_light = 2131427412;
// aapt resource value: 0x7f0b0055
public const int abc_search_url_text = 2131427413;
// aapt resource value: 0x7f0b0005
public const int abc_search_url_text_normal = 2131427333;
@ -1202,14 +1202,14 @@ namespace Bit.Android
// aapt resource value: 0x7f0b0007
public const int abc_search_url_text_selected = 2131427335;
// aapt resource value: 0x7f0b0055
public const int abc_secondary_text_material_dark = 2131427413;
// aapt resource value: 0x7f0b0056
public const int abc_secondary_text_material_light = 2131427414;
public const int abc_secondary_text_material_dark = 2131427414;
// aapt resource value: 0x7f0b004c
public const int accent = 2131427404;
// aapt resource value: 0x7f0b0057
public const int abc_secondary_text_material_light = 2131427415;
// aapt resource value: 0x7f0b004d
public const int accent = 2131427405;
// aapt resource value: 0x7f0b0008
public const int accent_material_dark = 2131427336;
@ -1331,6 +1331,9 @@ namespace Bit.Android
// aapt resource value: 0x7f0b001f
public const int hint_foreground_material_light = 2131427359;
// aapt resource value: 0x7f0b004b
public const int lightgray = 2131427403;
// aapt resource value: 0x7f0b0020
public const int material_blue_grey_800 = 2131427360;
@ -1367,8 +1370,8 @@ namespace Bit.Android
// aapt resource value: 0x7f0b002b
public const int material_grey_900 = 2131427371;
// aapt resource value: 0x7f0b004b
public const int primary = 2131427403;
// aapt resource value: 0x7f0b004c
public const int primary = 2131427404;
// aapt resource value: 0x7f0b002c
public const int primary_dark_material_dark = 2131427372;
@ -1418,11 +1421,11 @@ namespace Bit.Android
// aapt resource value: 0x7f0b003b
public const int switch_thumb_disabled_material_light = 2131427387;
// aapt resource value: 0x7f0b0057
public const int switch_thumb_material_dark = 2131427415;
// aapt resource value: 0x7f0b0058
public const int switch_thumb_material_light = 2131427416;
public const int switch_thumb_material_dark = 2131427416;
// aapt resource value: 0x7f0b0059
public const int switch_thumb_material_light = 2131427417;
// aapt resource value: 0x7f0b003c
public const int switch_thumb_normal_material_dark = 2131427388;

View File

@ -4,6 +4,6 @@
<item name="android:colorPrimary">@color/primary</item>
<item name="android:textColorPrimary">@color/darkgray</item>
<item name="android:colorAccent">@color/accent</item>
<item name="android:windowBackground">@color/white</item>
<item name="android:windowBackground">@color/lightgray</item>
</style>
</resources>

View File

@ -3,6 +3,7 @@
<color name="white">#FFFFFF</color>
<color name="darkgray">#333333</color>
<color name="gray">#738182</color>
<color name="lightgray">#ecf0f5</color>
<color name="primary">#222d32</color>
<color name="accent">#3c8dbc</color>
</resources>

View File

@ -4,6 +4,6 @@
<item name="android:colorPrimary">@color/primary</item>
<item name="android:textColorPrimary">@color/darkgray</item>
<item name="android:colorAccent">@color/accent</item>
<item name="android:windowBackground">@color/white</item>
<item name="android:windowBackground">@color/lightgray</item>
</style>
</resources>

View File

@ -45,6 +45,8 @@
<Compile Include="Behaviors\ConnectivityBehavior.cs" />
<Compile Include="Behaviors\RequiredValidationBehavior.cs" />
<Compile Include="Controls\EntryLabel.cs" />
<Compile Include="Controls\ExtendedEditor.cs" />
<Compile Include="Controls\ExtendedTableView.cs" />
<Compile Include="Controls\ExtendedPicker.cs" />
<Compile Include="Controls\ExtendedEntry.cs" />
<Compile Include="Controls\ExtendedTabbedPage.cs" />

View File

@ -0,0 +1,17 @@
using System;
using Xamarin.Forms;
namespace Bit.App.Controls
{
public class ExtendedEditor : Editor
{
public static readonly BindableProperty HasBorderProperty =
BindableProperty.Create(nameof(HasBorder), typeof(bool), typeof(ExtendedEditor), true);
public bool HasBorder
{
get { return (bool)GetValue(HasBorderProperty); }
set { SetValue(HasBorderProperty, value); }
}
}
}

View File

@ -0,0 +1,9 @@
using System;
using Xamarin.Forms;
namespace Bit.App.Controls
{
public class ExtendedTableView : TableView
{
}
}

View File

@ -43,7 +43,7 @@ namespace Bit.App.Pages
}
var usernameEntry = new ExtendedEntry { HasBorder = false };
var passwordEntry = new ExtendedEntry { IsPassword = true, HasBorder = false };
var notesEditor = new Editor { HeightRequest = 75 };
var notesEditor = new ExtendedEditor { HeightRequest = Device.OS == TargetPlatform.iOS ? 70 : 90, HasBorder = false };
var uriStackLayout = new FormEntryStackLayout();
uriStackLayout.Children.Add(new EntryLabel { Text = AppResources.URI });
@ -76,15 +76,13 @@ namespace Bit.App.Pages
passwordCell.View = passwordStackLayout;
var notesStackLayout = new FormEntryStackLayout();
notesStackLayout.Children.Add(new EntryLabel { Text = AppResources.Notes });
notesStackLayout.Children.Add(notesEditor);
var notesCell = new ViewCell();
notesCell.View = notesStackLayout;
var table = new TableView
var mainTable = new ExtendedTableView
{
Intent = TableIntent.Form,
RowHeight = 65,
Intent = TableIntent.Settings,
HasUnevenRows = true,
Root = new TableRoot
{
@ -94,15 +92,37 @@ namespace Bit.App.Pages
nameCell,
folderCell,
usernameCell,
passwordCell,
passwordCell
}
}
};
var notesTable = new ExtendedTableView
{
Intent = TableIntent.Settings,
HasUnevenRows = true,
Root = new TableRoot
{
new TableSection(AppResources.Notes)
{
notesCell
}
}
};
if(Device.OS == TargetPlatform.iOS)
{
mainTable.RowHeight = 70;
notesTable.RowHeight = 90;
}
var tablesStackLayout = new StackLayout();
tablesStackLayout.Children.Add(mainTable);
tablesStackLayout.Children.Add(notesTable);
var scrollView = new ScrollView
{
Content = table,
Content = tablesStackLayout,
Orientation = ScrollOrientation.Vertical
};
@ -169,6 +189,7 @@ namespace Bit.App.Pages
public FormEntryStackLayout()
{
Padding = new Thickness(15, 15, 15, 0);
BackgroundColor = Color.White;
}
}
}

View File

@ -0,0 +1,39 @@
using System;
using System.ComponentModel;
using Bit.App.Controls;
using Bit.iOS.Controls;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
[assembly: ExportRenderer(typeof(ExtendedTableView), typeof(ExtendedTableViewRenderer))]
namespace Bit.iOS.Controls
{
public class ExtendedTableViewRenderer : TableViewRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<TableView> e)
{
base.OnElementChanged(e);
var view = e.NewElement as ExtendedTableView;
if(view != null)
{
CorrectMargins(view);
}
}
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
var view = (ExtendedTableView)Element;
CorrectMargins(view);
}
private void CorrectMargins(ExtendedTableView view)
{
Control.ContentInset = new UIEdgeInsets(-10, 0, -100, 0);
}
}
}

View File

@ -31,6 +31,10 @@
<string>1.0</string>
<key>CFBundleIconFiles</key>
<array>
<string>Icon-72@2x.png</string>
<string>Icon-72.png</string>
<string>Icon@2x.png</string>
<string>Icon.png</string>
<string>Icon-60@2x.png</string>
<string>Icon-76.png</string>
<string>Icon-76@2x.png</string>
@ -39,6 +43,8 @@
<string>Default-568h@2x.png</string>
<string>Default-Portrait.png</string>
<string>Default-Portrait@2x.png</string>
<string>Icon-Small-50@2x.png</string>
<string>Icon-Small-50.png</string>
<string>Icon-Small-40.png</string>
<string>Icon-Small-40@2x.png</string>
<string>Icon-Small.png</string>
@ -48,5 +54,19 @@
<string>LaunchScreen</string>
<key>CFBundleShortVersionString</key>
<string>0.0.1</string>
<key>UIMainStoryboardFile~ipad</key>
<string>LaunchScreen</string>
<key>UIStatusBarTintParameters</key>
<dict>
<key>UINavigationBar</key>
<dict>
<key>Style</key>
<string>UIBarStyleDefault</string>
<key>Translucent</key>
<false/>
<key>BackgroundImage</key>
<string></string>
</dict>
</dict>
</dict>
</plist>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 729 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 955 B

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
src/iOS/Resources/Icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -101,6 +101,7 @@
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<ItemGroup>
<Compile Include="Controls\ExtendedTableViewRenderer.cs" />
<Compile Include="Controls\ExtendedPickerRenderer.cs" />
<Compile Include="Controls\ExtendedEntryRenderer.cs" />
<Compile Include="Controls\ExtendedTabbedPageRenderer.cs" />
@ -112,8 +113,6 @@
<None Include="Entitlements.plist" />
<None Include="Info.plist" />
<Compile Include="Properties\AssemblyInfo.cs" />
<ITunesArtwork Include="iTunesArtwork" />
<ITunesArtwork Include="iTunesArtwork@2x" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
@ -273,6 +272,63 @@
<ItemGroup>
<BundleResource Include="Resources\ion-plus%403x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Icon-120.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Icon-60.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Icon-40%403x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Icon-40%402x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Icon-40.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Icon-32.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Icon-16.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Icon-152.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Icon-24.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Icon-64.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Icon-72.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Icon-72%402x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Icon-Small-50.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Icon-Small-50%402x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Icon.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Icon%402x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Icon%403x.png" />
</ItemGroup>
<ItemGroup>
<ITunesArtwork Include="Resources\iTunesArtwork.png" />
</ItemGroup>
<ItemGroup>
<ITunesArtwork Include="Resources\iTunesArtwork%402x.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB