mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 23:25:45 +03:00
stylesheets
This commit is contained in:
parent
a1c853d7fc
commit
fe52324eea
10 changed files with 92 additions and 34 deletions
|
@ -3,6 +3,6 @@
|
|||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Bit.App.App">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
</Application>
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
using Bit.App.Pages;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.StyleSheets;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
|
@ -11,6 +13,23 @@ namespace Bit.App
|
|||
public App()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// TODO: Load theme?
|
||||
if(false)
|
||||
{
|
||||
#pragma warning disable CS0162 // Unreachable code detected
|
||||
Resources.Add(
|
||||
#pragma warning restore CS0162 // Unreachable code detected
|
||||
StyleSheet.FromAssemblyResource(IntrospectionExtensions.GetTypeInfo(typeof(App)).Assembly,
|
||||
"Bit.App.Css.dark.css"));
|
||||
}
|
||||
Resources.Add(
|
||||
StyleSheet.FromAssemblyResource(IntrospectionExtensions.GetTypeInfo(typeof(App)).Assembly,
|
||||
"Bit.App.Css.styles.css"));
|
||||
Resources.Add(
|
||||
StyleSheet.FromAssemblyResource(IntrospectionExtensions.GetTypeInfo(typeof(App)).Assembly,
|
||||
$"Bit.App.Css.{Device.RuntimePlatform.ToLowerInvariant()}.css"));
|
||||
|
||||
MainPage = new TabsPage();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Bit.App.Controls.CipherViewCell"
|
||||
xmlns:controls="clr-namespace:Bit.App.Controls">
|
||||
|
||||
<ViewCell.View>
|
||||
|
||||
<StackLayout x:Name="_layout"
|
||||
Padding="10"
|
||||
x:DataType="controls:CipherViewCellViewModel">
|
||||
|
||||
<StackLayout.BindingContext>
|
||||
<controls:CipherViewCellViewModel />
|
||||
</StackLayout.BindingContext>
|
||||
|
@ -16,8 +15,7 @@
|
|||
<Label Text="{Binding Cipher.Name}"
|
||||
LineBreakMode="NoWrap"
|
||||
FontSize="16" />
|
||||
|
||||
</StackLayout>
|
||||
</ViewCell.View>
|
||||
|
||||
</ViewCell.View>
|
||||
</ViewCell>
|
||||
|
|
20
src/App/Controls/FaLabel.cs
Normal file
20
src/App/Controls/FaLabel.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Controls
|
||||
{
|
||||
public class FaLabel : Label
|
||||
{
|
||||
public FaLabel()
|
||||
{
|
||||
switch(Device.RuntimePlatform)
|
||||
{
|
||||
case Device.iOS:
|
||||
FontFamily = "FontAwesome";
|
||||
break;
|
||||
case Device.Android:
|
||||
FontFamily = "FontAwesome.ttf#FontAwesome";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
3
src/App/Css/android.css
Normal file
3
src/App/Css/android.css
Normal file
|
@ -0,0 +1,3 @@
|
|||
^Label, ^Entry, ^Editor {
|
||||
font-size: 16;
|
||||
}
|
3
src/App/Css/dark.css
Normal file
3
src/App/Css/dark.css
Normal file
|
@ -0,0 +1,3 @@
|
|||
^contentpage {
|
||||
background-color: gray;
|
||||
}
|
3
src/App/Css/ios.css
Normal file
3
src/App/Css/ios.css
Normal file
|
@ -0,0 +1,3 @@
|
|||
^Label, ^Entry, ^Editor {
|
||||
font-size: 14;
|
||||
}
|
12
src/App/Css/styles.css
Normal file
12
src/App/Css/styles.css
Normal file
|
@ -0,0 +1,12 @@
|
|||
^ContentPage {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
StackLayout.list-cell {
|
||||
padding: 10;
|
||||
-xf-orientation: horizontal;
|
||||
}
|
||||
|
||||
StackLayout.list-cell > FaLabel {
|
||||
font-size: 22;
|
||||
}
|
|
@ -21,10 +21,14 @@
|
|||
<DataTemplate x:Key="folderTemplate"
|
||||
x:DataType="pages:GroupingsPageListItem">
|
||||
<ViewCell>
|
||||
<StackLayout Padding="10">
|
||||
<StackLayout StyleClass="list-cell">
|
||||
<controls:FaLabel Text=""
|
||||
HorizontalOptions="Start"
|
||||
VerticalOptions="CenterAndExpand" />
|
||||
<Label Text="{Binding Folder.Name}"
|
||||
LineBreakMode="NoWrap"
|
||||
FontSize="16" />
|
||||
LineBreakMode="TailTruncation"
|
||||
HorizontalOptions="StartAndExpand"
|
||||
VerticalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
|
@ -32,10 +36,14 @@
|
|||
<DataTemplate x:Key="collectionTemplate"
|
||||
x:DataType="pages:GroupingsPageListItem">
|
||||
<ViewCell>
|
||||
<StackLayout Padding="10">
|
||||
<StackLayout StyleClass="list-cell">
|
||||
<controls:FaLabel Text=""
|
||||
HorizontalOptions="Start"
|
||||
VerticalOptions="CenterAndExpand" />
|
||||
<Label Text="{Binding Collection.Name}"
|
||||
LineBreakMode="NoWrap"
|
||||
FontSize="16" />
|
||||
LineBreakMode="TailTruncation"
|
||||
HorizontalOptions="StartAndExpand"
|
||||
VerticalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
|
|
|
@ -1,32 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Bit.App.Pages.SettingsPage"
|
||||
xmlns:pages="clr-namespace:Bit.App.Pages"
|
||||
x:DataType="pages:SettingsPageViewModel"
|
||||
Title="{Binding PageTitle}">
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Bit.App.Pages.SettingsPage"
|
||||
xmlns:pages="clr-namespace:Bit.App.Pages"
|
||||
xmlns:controls="clr-namespace:Bit.App.Controls"
|
||||
x:DataType="pages:SettingsPageViewModel"
|
||||
Title="{Binding PageTitle}">
|
||||
<ContentPage.BindingContext>
|
||||
<pages:SettingsPageViewModel />
|
||||
</ContentPage.BindingContext>
|
||||
|
||||
<StackLayout>
|
||||
<!-- Place new controls here -->
|
||||
<Label
|
||||
Text="Settings!"
|
||||
HorizontalOptions="Center"
|
||||
VerticalOptions="CenterAndExpand" />
|
||||
<Label
|
||||
Text=""
|
||||
HorizontalOptions="Center"
|
||||
VerticalOptions="CenterAndExpand">
|
||||
|
||||
<Label.FontFamily>
|
||||
<OnPlatform x:TypeArguments="x:String"
|
||||
Android="FontAwesome.ttf#FontAwesome"
|
||||
iOS="FontAwesome" />
|
||||
</Label.FontFamily>
|
||||
</Label>
|
||||
<Label Text="Settings!"
|
||||
HorizontalOptions="Center"
|
||||
VerticalOptions="CenterAndExpand" />
|
||||
<controls:FaLabel Text=""
|
||||
HorizontalOptions="Center"
|
||||
VerticalOptions="CenterAndExpand">
|
||||
</controls:FaLabel>
|
||||
</StackLayout>
|
||||
|
||||
</ContentPage>
|
||||
|
|
Loading…
Reference in a new issue