a better layout, + start of app state imple
This commit is contained in:
parent
7b3340cbc3
commit
90155fe8da
14 changed files with 94 additions and 62 deletions
|
|
@ -6,10 +6,6 @@ using Android.OS;
|
||||||
using Android.Speech.Tts;
|
using Android.Speech.Tts;
|
||||||
using Android.Util;
|
using Android.Util;
|
||||||
using Android.Widget;
|
using Android.Widget;
|
||||||
using BookAStar.Droid.OAuth;
|
|
||||||
using BookAStar.Helpers;
|
|
||||||
using BookAStar.Interfaces;
|
|
||||||
using BookAStar.Model.Auth.Account;
|
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Plugin.DeviceInfo;
|
using Plugin.DeviceInfo;
|
||||||
using SQLite.Net;
|
using SQLite.Net;
|
||||||
|
|
@ -41,6 +37,11 @@ using Yavsc.Models.Identity;
|
||||||
|
|
||||||
namespace BookAStar.Droid
|
namespace BookAStar.Droid
|
||||||
{
|
{
|
||||||
|
using Data;
|
||||||
|
using Droid.OAuth;
|
||||||
|
using Helpers;
|
||||||
|
using Interfaces;
|
||||||
|
using Model.Auth.Account;
|
||||||
[Activity(Name="fr.pschneider.bas.MainActivity", Label = "BookAStar", Theme = "@style/MainTheme", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
[Activity(Name="fr.pschneider.bas.MainActivity", Label = "BookAStar", Theme = "@style/MainTheme", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||||
public class MainActivity :
|
public class MainActivity :
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,18 @@
|
||||||
|
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
|
|
||||||
<Color x:Key="PageBackgroundColor">#30FAFAFA</Color>
|
<Color x:Key="PageBackgroundColor">#FFAAAAFF</Color>
|
||||||
<Color x:Key="ContentBackgroundColor">#ffffff</Color>
|
<Color x:Key="ContentBackgroundColor">#80AFAFAF</Color>
|
||||||
|
<Color x:Key="BackgroundColor">#FFFFFFFF</Color>
|
||||||
|
<Color x:Key="LabelBackgroundColor">#FFFFFFFF</Color>
|
||||||
|
|
||||||
<Color x:Key="PageForegroundColor">#000000</Color>
|
<Color x:Key="PageForegroundColor">#000000</Color>
|
||||||
|
<Color x:Key="TextColor">#000000</Color>
|
||||||
|
<Color x:Key="LabelColor">#000000</Color>
|
||||||
<Color x:Key="HeadingTextColor">Black</Color>
|
<Color x:Key="HeadingTextColor">Black</Color>
|
||||||
<Color x:Key="NormalTextColor">Blue</Color>
|
<Color x:Key="NormalTextColor">Blue</Color>
|
||||||
<Color x:Key="GroupingTextColor">#5050ff</Color>
|
<Color x:Key="GroupingTextColor">#5050ff</Color>
|
||||||
|
<Color x:Key="OddColor">#207AFAFA</Color>
|
||||||
|
|
||||||
<OnPlatform x:TypeArguments="Font" Android="Large" iOS="Large" WinPhone="Large" x:Key="HeaderFont" />
|
<OnPlatform x:TypeArguments="Font" Android="Large" iOS="Large" WinPhone="Large" x:Key="HeaderFont" />
|
||||||
<OnPlatform x:TypeArguments="Color" Android="Red" iOS="Red" WinPhone="Red" x:Key="EmphasisTextColor" />
|
<OnPlatform x:TypeArguments="Color" Android="Red" iOS="Red" WinPhone="Red" x:Key="EmphasisTextColor" />
|
||||||
|
|
@ -22,13 +28,6 @@
|
||||||
<OnPlatform x:TypeArguments="Font" Android="40" iOS="40" WinPhone="40" x:Key="SmallFontSize" />
|
<OnPlatform x:TypeArguments="Font" Android="40" iOS="40" WinPhone="40" x:Key="SmallFontSize" />
|
||||||
<OnPlatform x:TypeArguments="x:Double" Android="130" iOS="130" WinPhone="130" x:Key="BigUserAvatarSize" />
|
<OnPlatform x:TypeArguments="x:Double" Android="130" iOS="130" WinPhone="130" x:Key="BigUserAvatarSize" />
|
||||||
|
|
||||||
|
|
||||||
<Color x:Key="BackgroundColor">#30AAAAFA</Color>
|
|
||||||
<Color x:Key="LabelBackgroundColor">#30FAFAFA</Color>
|
|
||||||
<Color x:Key="OddColor">#207AFAFA</Color>
|
|
||||||
<Color x:Key="TextColor">#FF103010</Color>
|
|
||||||
<Color x:Key="LabelColor">#FF303010</Color>
|
|
||||||
|
|
||||||
<Style x:Key="LabelPageHeadingStyle" TargetType="Label">
|
<Style x:Key="LabelPageHeadingStyle" TargetType="Label">
|
||||||
<Setter Property="FontAttributes" Value="Bold" />
|
<Setter Property="FontAttributes" Value="Bold" />
|
||||||
<Setter Property="HorizontalOptions" Value="Center" />
|
<Setter Property="HorizontalOptions" Value="Center" />
|
||||||
|
|
@ -46,10 +45,7 @@
|
||||||
|
|
||||||
<Style x:Key="LabelStyle" TargetType="Label">
|
<Style x:Key="LabelStyle" TargetType="Label">
|
||||||
<Setter Property="TextColor" Value="{StaticResource LabelColor}" />
|
<Setter Property="TextColor" Value="{StaticResource LabelColor}" />
|
||||||
<Setter Property="BackgroundColor" Value="{StaticResource LabelBackgroundColor}" />
|
|
||||||
|
|
||||||
<Setter Property="LineBreakMode" Value="WordWrap" />
|
<Setter Property="LineBreakMode" Value="WordWrap" />
|
||||||
<Setter Property="Margin" Value="2,4,2,4" />
|
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="BigLabel" BasedOn="{StaticResource LabelStyle}" TargetType="Label">
|
<Style x:Key="BigLabel" BasedOn="{StaticResource LabelStyle}" TargetType="Label">
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,13 @@ using XLabs.Enums;
|
||||||
|
|
||||||
namespace BookAStar
|
namespace BookAStar
|
||||||
{
|
{
|
||||||
|
using Data;
|
||||||
using Interfaces;
|
using Interfaces;
|
||||||
using Model;
|
using Model;
|
||||||
|
using Model.UI;
|
||||||
using Pages;
|
using Pages;
|
||||||
using ViewModels;
|
using ViewModels;
|
||||||
|
|
||||||
public partial class App : Application // superclass new in 1.3
|
public partial class App : Application // superclass new in 1.3
|
||||||
{
|
{
|
||||||
public static IPlatform PlatformSpecificInstance { get; set; }
|
public static IPlatform PlatformSpecificInstance { get; set; }
|
||||||
|
|
@ -73,7 +76,7 @@ namespace BookAStar
|
||||||
// called on app startup, not on rotation
|
// called on app startup, not on rotation
|
||||||
private void OnStartup(object sender, EventArgs e)
|
private void OnStartup(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// TODO special starup pages as
|
// TODO special startup pages as
|
||||||
// notification details or wizard setup page
|
// notification details or wizard setup page
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -81,6 +84,19 @@ namespace BookAStar
|
||||||
private void OnSuspended(object sender, EventArgs e)
|
private void OnSuspended(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// TODO save the navigation stack
|
// TODO save the navigation stack
|
||||||
|
int position = 0;
|
||||||
|
foreach (Page page in MainPage.Navigation.NavigationStack)
|
||||||
|
{
|
||||||
|
|
||||||
|
DataManager.Current.AppState.Add(
|
||||||
|
new PageState
|
||||||
|
{
|
||||||
|
Position = position++,
|
||||||
|
PageType = page.GetType().FullName,
|
||||||
|
BindingContext = page.BindingContext
|
||||||
|
});
|
||||||
|
}
|
||||||
|
DataManager.Current.AppState.SaveCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
// called on app startup, after OnStartup, not on rotation
|
// called on app startup, after OnStartup, not on rotation
|
||||||
|
|
@ -88,6 +104,14 @@ namespace BookAStar
|
||||||
{
|
{
|
||||||
// TODO restore the navigation stack
|
// TODO restore the navigation stack
|
||||||
base.OnResume();
|
base.OnResume();
|
||||||
|
foreach (var pageState in DataManager.Current.AppState)
|
||||||
|
{
|
||||||
|
var pageType = Type.GetType(pageState.PageType);
|
||||||
|
NavigationService.NavigateTo(
|
||||||
|
pageType, true, pageState.BindingContext);
|
||||||
|
}
|
||||||
|
DataManager.Current.AppState.Clear();
|
||||||
|
DataManager.Current.AppState.SaveCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME Not called?
|
// FIXME Not called?
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@
|
||||||
<Compile Include="Behaviors\PickerBehavior.cs" />
|
<Compile Include="Behaviors\PickerBehavior.cs" />
|
||||||
<Compile Include="Behaviors\StarBehavior.cs" />
|
<Compile Include="Behaviors\StarBehavior.cs" />
|
||||||
<Compile Include="Constants.cs" />
|
<Compile Include="Constants.cs" />
|
||||||
|
<Compile Include="Model\UI\PageState.cs" />
|
||||||
<Compile Include="Views\EnumPicker.cs" />
|
<Compile Include="Views\EnumPicker.cs" />
|
||||||
<Compile Include="Converters\BooleanToObjectConverter.cs" />
|
<Compile Include="Converters\BooleanToObjectConverter.cs" />
|
||||||
<Compile Include="Converters\EnumConverter.cs" />
|
<Compile Include="Converters\EnumConverter.cs" />
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,16 @@ namespace BookAStar.Data
|
||||||
using Model;
|
using Model;
|
||||||
using Model.Blog;
|
using Model.Blog;
|
||||||
using Model.Workflow;
|
using Model.Workflow;
|
||||||
|
using Model.UI;
|
||||||
|
|
||||||
public class DataManager
|
public class DataManager
|
||||||
{
|
{
|
||||||
// TODO userinfo estimatetemplate rating service product tag
|
// TODO estimatetemplate rating service product tag
|
||||||
public RemoteEntityRO<BookQueryData, long> BookQueries { get; set; }
|
public RemoteEntityRO<BookQueryData, long> BookQueries { get; set; }
|
||||||
public RemoteEntity<Estimate, long> Estimates { get; set; }
|
public RemoteEntity<Estimate, long> Estimates { get; set; }
|
||||||
public RemoteEntity<Blog, long> Blogspot { get; set; }
|
public RemoteEntity<Blog, long> Blogspot { get; set; }
|
||||||
public LocalEntity<ClientProviderInfo,string> Contacts { get; set; }
|
public LocalEntity<ClientProviderInfo,string> Contacts { get; set; }
|
||||||
|
internal LocalEntity<PageState, int> AppState { get; set; }
|
||||||
protected static DataManager current = new DataManager();
|
protected static DataManager current = new DataManager();
|
||||||
public static DataManager Current
|
public static DataManager Current
|
||||||
{
|
{
|
||||||
|
|
@ -31,10 +33,13 @@ namespace BookAStar.Data
|
||||||
Blogspot = new RemoteEntity<Blog, long>("blog",
|
Blogspot = new RemoteEntity<Blog, long>("blog",
|
||||||
x=>x.Id);
|
x=>x.Id);
|
||||||
Contacts = new LocalEntity<ClientProviderInfo, string>(c => c.UserId);
|
Contacts = new LocalEntity<ClientProviderInfo, string>(c => c.UserId);
|
||||||
|
AppState = new LocalEntity<PageState, int>(s => s.Position);
|
||||||
|
|
||||||
BookQueries.Load();
|
BookQueries.Load();
|
||||||
Estimates.Load();
|
Estimates.Load();
|
||||||
Blogspot.Load();
|
Blogspot.Load();
|
||||||
Contacts.Load();
|
Contacts.Load();
|
||||||
|
AppState.Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<BookQueryData> GetBookQuery(long bookQueryId)
|
public async Task<BookQueryData> GetBookQuery(long bookQueryId)
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ using System.Net;
|
||||||
|
|
||||||
namespace BookAStar.Data
|
namespace BookAStar.Data
|
||||||
{
|
{
|
||||||
|
using Helpers;
|
||||||
|
|
||||||
public class RemoteEntity<V,K> : LocalEntity<V, K>, ICommand where K : IEquatable<K>
|
public class RemoteEntity<V,K> : LocalEntity<V, K>, ICommand where K : IEquatable<K>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
10
BookAStar/BookAStar/Model/UI/PageState.cs
Normal file
10
BookAStar/BookAStar/Model/UI/PageState.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
namespace BookAStar.Model.UI
|
||||||
|
{
|
||||||
|
internal class PageState
|
||||||
|
{
|
||||||
|
internal int Position { get; set; }
|
||||||
|
internal object BindingContext { get; set; }
|
||||||
|
internal string PageType { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using BookAStar.Helpers;
|
using BookAStar.Data;
|
||||||
|
using BookAStar.Helpers;
|
||||||
using BookAStar.Model.Interfaces;
|
using BookAStar.Model.Interfaces;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,9 @@
|
||||||
<Label Text="{Binding Location.Address}" />
|
<Label Text="{Binding Location.Address}" />
|
||||||
<Label Text="{Binding Previsional}" />
|
<Label Text="{Binding Previsional}" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand">
|
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" >
|
||||||
<maps:Map x:Name="map" VerticalOptions="FillAndExpand"></maps:Map>
|
<maps:Map x:Name="map" VerticalOptions="FillAndExpand"></maps:Map>
|
||||||
<Button Text="Faire un devis" Clicked="MakeAnEstimate" />
|
<Button Text="Faire un devis" Clicked="MakeAnEstimate" VerticalOptions="End" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
|
|
@ -1,19 +1,13 @@
|
||||||
|
using System;
|
||||||
using System;
|
|
||||||
|
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using Xamarin.Forms.Maps;
|
using Xamarin.Forms.Maps;
|
||||||
|
|
||||||
namespace BookAStar.Pages
|
namespace BookAStar.Pages
|
||||||
{
|
{
|
||||||
using Helpers;
|
using Data;
|
||||||
using Model;
|
using Model;
|
||||||
using Model.Workflow;
|
using Model.Workflow;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ViewModels;
|
using ViewModels;
|
||||||
using XLabs.Forms.Mvvm;
|
|
||||||
using XLabs.Ioc;
|
|
||||||
using XLabs.Platform.Services;
|
|
||||||
|
|
||||||
public partial class BookQueryPage : ContentPage
|
public partial class BookQueryPage : ContentPage
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,26 +20,25 @@
|
||||||
</ContentPage.Resources>
|
</ContentPage.Resources>
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<StackLayout Orientation="Vertical" >
|
<StackLayout Orientation="Vertical" >
|
||||||
|
|
||||||
<Label Text="Compte utilisateur" StyleClass="Header">
|
|
||||||
</Label>
|
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
<lc:GesturesContentView ExcludeChildren="false" VisualElement.HeightRequest="{StaticResource BigUserAvatarSize}">
|
|
||||||
<Frame VisualElement.HeightRequest="{StaticResource BigUserAvatarSize}">
|
<Frame VisualElement.HeightRequest="{StaticResource BigUserAvatarSize}">
|
||||||
<lb:Gestures.Interests>
|
<lc:GesturesContentView ExcludeChildren="false" VisualElement.HeightRequest="{StaticResource BigUserAvatarSize}">
|
||||||
<lb:GestureCollection>
|
|
||||||
<lb:GestureInterest GestureType="LongPress"
|
<lb:Gestures.Interests>
|
||||||
GestureCommand="{Binding UserNameGesture}"
|
<lb:GestureCollection>
|
||||||
|
<lb:GestureInterest GestureType="LongPress"
|
||||||
|
GestureCommand="{Binding UserNameGesture}"
|
||||||
/>
|
/>
|
||||||
</lb:GestureCollection>
|
</lb:GestureCollection>
|
||||||
</lb:Gestures.Interests>
|
</lb:Gestures.Interests>
|
||||||
<Image Source="{Binding Avatar}" Aspect="AspectFit"
|
<Image Source="{Binding Avatar}" Aspect="AspectFit"
|
||||||
VisualElement.HeightRequest="{StaticResource BigUserAvatarSize}" />
|
VisualElement.HeightRequest="{StaticResource BigUserAvatarSize}" />
|
||||||
|
|
||||||
|
</lc:GesturesContentView>
|
||||||
</Frame>
|
</Frame>
|
||||||
</lc:GesturesContentView>
|
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<views:RatingView Rating="{Binding Rating, Mode=TwoWay}" x:Name="ratingView"/>
|
<views:RatingView Rating="{Binding Rating, Mode=TwoWay}" x:Name="ratingView"/>
|
||||||
|
|
||||||
<Label Text="{Binding UserName}" Style="{StaticResource LabelPageHeadingStyle}"
|
<Label Text="{Binding UserName}" Style="{StaticResource LabelPageHeadingStyle}"
|
||||||
HorizontalTextAlignment="Center"
|
HorizontalTextAlignment="Center"
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,10 @@
|
||||||
using BookAStar.Helpers;
|
using System.Collections.ObjectModel;
|
||||||
using BookAStar.Model;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace BookAStar.ViewModels
|
namespace BookAStar.ViewModels
|
||||||
{
|
{
|
||||||
|
using Data;
|
||||||
|
using Model;
|
||||||
public class BookQueriesViewModel : XLabs.Forms.Mvvm.ViewModel
|
public class BookQueriesViewModel : XLabs.Forms.Mvvm.ViewModel
|
||||||
{
|
{
|
||||||
public BookQueriesViewModel()
|
public BookQueriesViewModel()
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
using BookAStar.Helpers;
|
using System.Collections.ObjectModel;
|
||||||
using BookAStar.Model.Auth.Account;
|
|
||||||
using BookAStar.Pages;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using XLabs.Forms.Behaviors;
|
using XLabs.Forms.Behaviors;
|
||||||
|
|
@ -12,6 +9,10 @@ using XLabs.Platform.Services;
|
||||||
|
|
||||||
namespace BookAStar.ViewModels
|
namespace BookAStar.ViewModels
|
||||||
{
|
{
|
||||||
|
using Data;
|
||||||
|
using Helpers;
|
||||||
|
using Model.Auth.Account;
|
||||||
|
using Pages;
|
||||||
|
|
||||||
internal class DashboardViewModel : ViewModel
|
internal class DashboardViewModel : ViewModel
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,13 @@
|
||||||
xmlns:behaviors="clr-namespace:BookAStar.Behaviors;assembly=BookAStar"
|
xmlns:behaviors="clr-namespace:BookAStar.Behaviors;assembly=BookAStar"
|
||||||
xmlns:converters="clr-namespace:BookAStar.Converters;assembly=BookAStar"
|
xmlns:converters="clr-namespace:BookAStar.Converters;assembly=BookAStar"
|
||||||
x:Class="BookAStar.Views.RatingView">
|
x:Class="BookAStar.Views.RatingView">
|
||||||
|
<ContentView.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<Style TargetType="Label">
|
||||||
|
<Setter Property="Style" Value="{StaticResource LabelStyle}" />
|
||||||
|
</Style>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ContentView.Resources>
|
||||||
<ContentView.Content>
|
<ContentView.Content>
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
<StackLayout Orientation="Horizontal" HeightRequest="70">
|
<StackLayout Orientation="Horizontal" HeightRequest="70">
|
||||||
|
|
@ -74,9 +81,6 @@
|
||||||
<StackLayout.Resources>
|
<StackLayout.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<converters:RatingText x:Key="ratingText" />
|
<converters:RatingText x:Key="ratingText" />
|
||||||
<Style TargetType="Label" BasedOn="{StaticResource LabelStyle}">
|
|
||||||
<Setter Property="TextColor" Value="#4CAF50" />
|
|
||||||
</Style>
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</StackLayout.Resources>
|
</StackLayout.Resources>
|
||||||
<Label Text="{Binding Source={x:Reference starFive}, Path=Rating, Converter={StaticResource ratingText}}" ></Label>
|
<Label Text="{Binding Source={x:Reference starFive}, Path=Rating, Converter={StaticResource ratingText}}" ></Label>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue