Skip to content

Commit

Permalink
Delete ExtendedSplash, Fix author animation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremie Corpinot committed Apr 10, 2017
1 parent fa9ee23 commit f47a882
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 259 deletions.
12 changes: 6 additions & 6 deletions Citations 365/Citations 365/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using citations365.Controllers;
using citations365.Views;
using System;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation.Metadata;
using Windows.Phone.UI.Input;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Navigation;

namespace citations365 {
Expand Down Expand Up @@ -92,11 +92,11 @@ protected override void OnLaunched(LaunchActivatedEventArgs e) {
}

// Display an extended splash screen if app was not previously running.
if (e.PreviousExecutionState != ApplicationExecutionState.Running) {
bool loadState = (e.PreviousExecutionState == ApplicationExecutionState.Terminated);
ExtendedSplash extendedSplash = new ExtendedSplash(e.SplashScreen, loadState, shell, shell.Content);
shell.Content = extendedSplash;
}
//if (e.PreviousExecutionState != ApplicationExecutionState.Running) {
// bool loadState = (e.PreviousExecutionState == ApplicationExecutionState.Terminated);
//}

//shell.RootFrame.Navigate(typeof(TodayPage));

UpdateBackButtonVisibility();
}
Expand Down
7 changes: 0 additions & 7 deletions Citations 365/Citations 365/Citations 365.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@
<Compile Include="Converters\ShareSwypeColor.cs" />
<Compile Include="Converters\TextVisibility.cs" />
<Compile Include="Converters\UpperText.cs" />
<Compile Include="ExtendedSplash.xaml.cs">
<DependentUpon>ExtendedSplash.xaml</DependentUpon>
</Compile>
<Compile Include="Helpers\ImageHelper.cs" />
<Compile Include="Helpers\VisualTreeExtensions.cs" />
<Compile Include="Presentation\Extensions.cs" />
Expand Down Expand Up @@ -230,10 +227,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="ExtendedSplash.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Shell.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down
41 changes: 0 additions & 41 deletions Citations 365/Citations 365/ExtendedSplash.xaml

This file was deleted.

148 changes: 0 additions & 148 deletions Citations 365/Citations 365/ExtendedSplash.xaml.cs

This file was deleted.

7 changes: 3 additions & 4 deletions Citations 365/Citations 365/Shell.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ public Shell() {
Label = "Settings",
PageType = typeof(Views.SettingsPage)
});

// Prevent automatic navigation to 1st page
// Navigation will be done in ExtendedSplash.xaml.cs
// vm.SelectedMenuItem = vm.MenuItems.First();

// Comment the next line to avoid auto navigation
vm.SelectedMenuItem = vm.MenuItems.First();
ViewModel = vm;

// add entry animations
Expand Down
38 changes: 25 additions & 13 deletions Citations 365/Citations 365/Views/AuthorsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
using Windows.UI.Xaml.Navigation;
using Windows.UI.Xaml.Shapes;

// Pour plus d'informations sur le modèle d'élément Page vierge, voir la page http://go.microsoft.com/fwlink/?LinkId=234238

namespace citations365.Views {
public sealed partial class AuthorsPage : Page {
private static AuthorsController _authorController;

private static Author _LastSelectedAuthor { get; set; }

public static AuthorsController AuthorsController {
get {
if (_authorController == null) {
Expand Down Expand Up @@ -53,8 +53,11 @@ private void AuthorsPage_KeyDown(CoreWindow sender, KeyEventArgs args) {
}

private async void Populate() {
bool loaded = await AuthorsController.LoadData();
if (!loaded) return;
AuthorsGrid.Loaded += (s, v) => {
RestorViewPosition();
};

await AuthorsController.LoadData();

HideLoading();
BindCollectionToView();
Expand All @@ -80,22 +83,31 @@ orderby firstLetter.Key
AuthorsKeys.ItemsSource = this.groupedAuthors.View.CollectionGroups;
}

void RestorViewPosition() {
var animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("EllipseAuthor");
if (animation == null || _LastSelectedAuthor == null) return;

AuthorsGrid.ScrollIntoView(_LastSelectedAuthor);
AuthorsGrid.UpdateLayout();

var container = (GridViewItem)AuthorsGrid.ContainerFromItem(_LastSelectedAuthor);
var root = (StackPanel)container.ContentTemplateRoot;
var ellipse = (Ellipse)root.FindName("EllipseAuthor");

animation.TryStart(ellipse);
}

private void Authors_Tapped(object sender, TappedRoutedEventArgs e) {
StackPanel panel = (StackPanel)sender;
Author author = (Author)panel.DataContext;

_LastSelectedAuthor = author;

var EllipseAuthor = (UIElement)panel.FindName("EllipseAuthor");

var matrice = EllipseAuthor.TransformToVisual(Window.Current.Content);
Point EllipseAuthorCoords = matrice.TransformPoint(new Point(0, 0));
ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("EllipseAuthor", EllipseAuthor);

//ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("EllipseAuthor", EllipseAuthor);
//Frame.Navigate(typeof(DetailAuthorPage), author, new DrillInNavigationTransitionInfo());
var payload = new Dictionary<string, object>() {
{ "AuthorPayload", author },
{ "EllipseAuthorCoords", EllipseAuthorCoords }
};
Frame.Navigate(typeof(DetailAuthorPage), payload, new DrillInNavigationTransitionInfo());
Frame.Navigate(typeof(DetailAuthorPage), author);
}

private void Author_Loaded(object sender, RoutedEventArgs e) {
Expand Down
Loading

0 comments on commit f47a882

Please sign in to comment.