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.Util;
|
||||
using Android.Widget;
|
||||
using BookAStar.Droid.OAuth;
|
||||
using BookAStar.Helpers;
|
||||
using BookAStar.Interfaces;
|
||||
using BookAStar.Model.Auth.Account;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Plugin.DeviceInfo;
|
||||
using SQLite.Net;
|
||||
|
|
@ -41,6 +37,11 @@ using Yavsc.Models.Identity;
|
|||
|
||||
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)]
|
||||
public class MainActivity :
|
||||
|
||||
|
|
|
|||
|
|
@ -8,12 +8,18 @@
|
|||
|
||||
<ResourceDictionary>
|
||||
|
||||
<Color x:Key="PageBackgroundColor">#30FAFAFA</Color>
|
||||
<Color x:Key="ContentBackgroundColor">#ffffff</Color>
|
||||
<Color x:Key="PageBackgroundColor">#FFAAAAFF</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="TextColor">#000000</Color>
|
||||
<Color x:Key="LabelColor">#000000</Color>
|
||||
<Color x:Key="HeadingTextColor">Black</Color>
|
||||
<Color x:Key="NormalTextColor">Blue</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="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="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">
|
||||
<Setter Property="FontAttributes" Value="Bold" />
|
||||
<Setter Property="HorizontalOptions" Value="Center" />
|
||||
|
|
@ -46,10 +45,7 @@
|
|||
|
||||
<Style x:Key="LabelStyle" TargetType="Label">
|
||||
<Setter Property="TextColor" Value="{StaticResource LabelColor}" />
|
||||
<Setter Property="BackgroundColor" Value="{StaticResource LabelBackgroundColor}" />
|
||||
|
||||
<Setter Property="LineBreakMode" Value="WordWrap" />
|
||||
<Setter Property="Margin" Value="2,4,2,4" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="BigLabel" BasedOn="{StaticResource LabelStyle}" TargetType="Label">
|
||||
|
|
|
|||
|
|
@ -12,10 +12,13 @@ using XLabs.Enums;
|
|||
|
||||
namespace BookAStar
|
||||
{
|
||||
using Data;
|
||||
using Interfaces;
|
||||
using Model;
|
||||
using Model.UI;
|
||||
using Pages;
|
||||
using ViewModels;
|
||||
|
||||
public partial class App : Application // superclass new in 1.3
|
||||
{
|
||||
public static IPlatform PlatformSpecificInstance { get; set; }
|
||||
|
|
@ -73,7 +76,7 @@ namespace BookAStar
|
|||
// called on app startup, not on rotation
|
||||
private void OnStartup(object sender, EventArgs e)
|
||||
{
|
||||
// TODO special starup pages as
|
||||
// TODO special startup pages as
|
||||
// notification details or wizard setup page
|
||||
}
|
||||
|
||||
|
|
@ -81,6 +84,19 @@ namespace BookAStar
|
|||
private void OnSuspended(object sender, EventArgs e)
|
||||
{
|
||||
// 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
|
||||
|
|
@ -88,6 +104,14 @@ namespace BookAStar
|
|||
{
|
||||
// TODO restore the navigation stack
|
||||
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?
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
<Compile Include="Behaviors\PickerBehavior.cs" />
|
||||
<Compile Include="Behaviors\StarBehavior.cs" />
|
||||
<Compile Include="Constants.cs" />
|
||||
<Compile Include="Model\UI\PageState.cs" />
|
||||
<Compile Include="Views\EnumPicker.cs" />
|
||||
<Compile Include="Converters\BooleanToObjectConverter.cs" />
|
||||
<Compile Include="Converters\EnumConverter.cs" />
|
||||
|
|
|
|||
|
|
@ -5,14 +5,16 @@ namespace BookAStar.Data
|
|||
using Model;
|
||||
using Model.Blog;
|
||||
using Model.Workflow;
|
||||
|
||||
using Model.UI;
|
||||
|
||||
public class DataManager
|
||||
{
|
||||
// TODO userinfo estimatetemplate rating service product tag
|
||||
// TODO estimatetemplate rating service product tag
|
||||
public RemoteEntityRO<BookQueryData, long> BookQueries { get; set; }
|
||||
public RemoteEntity<Estimate, long> Estimates { get; set; }
|
||||
public RemoteEntity<Blog, long> Blogspot { get; set; }
|
||||
public LocalEntity<ClientProviderInfo,string> Contacts { get; set; }
|
||||
internal LocalEntity<PageState, int> AppState { get; set; }
|
||||
protected static DataManager current = new DataManager();
|
||||
public static DataManager Current
|
||||
{
|
||||
|
|
@ -31,10 +33,13 @@ namespace BookAStar.Data
|
|||
Blogspot = new RemoteEntity<Blog, long>("blog",
|
||||
x=>x.Id);
|
||||
Contacts = new LocalEntity<ClientProviderInfo, string>(c => c.UserId);
|
||||
AppState = new LocalEntity<PageState, int>(s => s.Position);
|
||||
|
||||
BookQueries.Load();
|
||||
Estimates.Load();
|
||||
Blogspot.Load();
|
||||
Contacts.Load();
|
||||
AppState.Load();
|
||||
}
|
||||
|
||||
public async Task<BookQueryData> GetBookQuery(long bookQueryId)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using System.Net;
|
|||
|
||||
namespace BookAStar.Data
|
||||
{
|
||||
using Helpers;
|
||||
|
||||
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 System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@
|
|||
<Label Text="{Binding Location.Address}" />
|
||||
<Label Text="{Binding Previsional}" />
|
||||
</StackLayout>
|
||||
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand">
|
||||
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" >
|
||||
<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>
|
||||
</ContentPage>
|
||||
|
|
@ -1,19 +1,13 @@
|
|||
|
||||
using System;
|
||||
|
||||
using System;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Maps;
|
||||
|
||||
namespace BookAStar.Pages
|
||||
{
|
||||
using Helpers;
|
||||
using Data;
|
||||
using Model;
|
||||
using Model.Workflow;
|
||||
using System.Threading.Tasks;
|
||||
using ViewModels;
|
||||
using XLabs.Forms.Mvvm;
|
||||
using XLabs.Ioc;
|
||||
using XLabs.Platform.Services;
|
||||
|
||||
public partial class BookQueryPage : ContentPage
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,26 +20,25 @@
|
|||
</ContentPage.Resources>
|
||||
<ScrollView>
|
||||
<StackLayout Orientation="Vertical" >
|
||||
|
||||
<Label Text="Compte utilisateur" StyleClass="Header">
|
||||
</Label>
|
||||
<StackLayout>
|
||||
<StackLayout>
|
||||
<lc:GesturesContentView ExcludeChildren="false" VisualElement.HeightRequest="{StaticResource BigUserAvatarSize}">
|
||||
<Frame VisualElement.HeightRequest="{StaticResource BigUserAvatarSize}">
|
||||
<lb:Gestures.Interests>
|
||||
<lb:GestureCollection>
|
||||
<lb:GestureInterest GestureType="LongPress"
|
||||
GestureCommand="{Binding UserNameGesture}"
|
||||
<lc:GesturesContentView ExcludeChildren="false" VisualElement.HeightRequest="{StaticResource BigUserAvatarSize}">
|
||||
|
||||
<lb:Gestures.Interests>
|
||||
<lb:GestureCollection>
|
||||
<lb:GestureInterest GestureType="LongPress"
|
||||
GestureCommand="{Binding UserNameGesture}"
|
||||
/>
|
||||
</lb:GestureCollection>
|
||||
</lb:Gestures.Interests>
|
||||
<Image Source="{Binding Avatar}" Aspect="AspectFit"
|
||||
VisualElement.HeightRequest="{StaticResource BigUserAvatarSize}" />
|
||||
</lb:GestureCollection>
|
||||
</lb:Gestures.Interests>
|
||||
<Image Source="{Binding Avatar}" Aspect="AspectFit"
|
||||
VisualElement.HeightRequest="{StaticResource BigUserAvatarSize}" />
|
||||
|
||||
</lc:GesturesContentView>
|
||||
</Frame>
|
||||
</lc:GesturesContentView>
|
||||
</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}"
|
||||
HorizontalTextAlignment="Center"
|
||||
|
|
@ -48,7 +47,7 @@
|
|||
</StackLayout>
|
||||
|
||||
<Button Text="{Binding PerformerStatus}" Clicked="OnViewPerformerStatus" />
|
||||
<Button Text="{Binding UserQueries}" Clicked="OnViewUserQueries"
|
||||
<Button Text="{Binding UserQueries}" Clicked="OnViewUserQueries"
|
||||
VisualElement.IsVisible="{Binding UserIsPro}"/>
|
||||
<StackLayout Orientation="Horizontal" VisualElement.IsVisible="{Binding HaveAnUser}">
|
||||
<Label Text="Recevoir les notifications push" StyleClass="Header" />
|
||||
|
|
@ -59,7 +58,7 @@
|
|||
<Label Text="Utiliser ma position" StyleClass="Header" />
|
||||
<Switch HorizontalOptions="End" IsToggled="{Binding AllowUseMyPosition, Mode=TwoWay}"/>
|
||||
</StackLayout>
|
||||
<StackLayout Orientation="Horizontal" VerticalOptions="Start"
|
||||
<StackLayout Orientation="Horizontal" VerticalOptions="Start"
|
||||
VisualElement.IsVisible="{Binding UserIsPro}">
|
||||
<Label Text="Ne recevoir de demande de devis que de la part de professionnels uniquement"
|
||||
StyleClass="Header"/>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,10 @@
|
|||
using BookAStar.Helpers;
|
||||
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.Collections.ObjectModel;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace BookAStar.ViewModels
|
||||
{
|
||||
using Data;
|
||||
using Model;
|
||||
public class BookQueriesViewModel : XLabs.Forms.Mvvm.ViewModel
|
||||
{
|
||||
public BookQueriesViewModel()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
using BookAStar.Helpers;
|
||||
using BookAStar.Model.Auth.Account;
|
||||
using BookAStar.Pages;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Xamarin.Forms;
|
||||
using XLabs.Forms.Behaviors;
|
||||
|
|
@ -12,7 +9,11 @@ using XLabs.Platform.Services;
|
|||
|
||||
namespace BookAStar.ViewModels
|
||||
{
|
||||
|
||||
using Data;
|
||||
using Helpers;
|
||||
using Model.Auth.Account;
|
||||
using Pages;
|
||||
|
||||
internal class DashboardViewModel : ViewModel
|
||||
{
|
||||
int rating;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,13 @@
|
|||
xmlns:behaviors="clr-namespace:BookAStar.Behaviors;assembly=BookAStar"
|
||||
xmlns:converters="clr-namespace:BookAStar.Converters;assembly=BookAStar"
|
||||
x:Class="BookAStar.Views.RatingView">
|
||||
<ContentView.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="Label">
|
||||
<Setter Property="Style" Value="{StaticResource LabelStyle}" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</ContentView.Resources>
|
||||
<ContentView.Content>
|
||||
<StackLayout>
|
||||
<StackLayout Orientation="Horizontal" HeightRequest="70">
|
||||
|
|
@ -74,9 +81,6 @@
|
|||
<StackLayout.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:RatingText x:Key="ratingText" />
|
||||
<Style TargetType="Label" BasedOn="{StaticResource LabelStyle}">
|
||||
<Setter Property="TextColor" Value="#4CAF50" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</StackLayout.Resources>
|
||||
<Label Text="{Binding Source={x:Reference starFive}, Path=Rating, Converter={StaticResource ratingText}}" ></Label>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue