Skip to content

Commit

Permalink
remove all margin in video view
Browse files Browse the repository at this point in the history
  • Loading branch information
insomniachi committed Aug 19, 2022
1 parent 01850f8 commit ca8f25b
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 21 deletions.
8 changes: 4 additions & 4 deletions AnimDL.WinUI/Services/DiscordRichPresense.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class DiscordRichPresense : IDiscordRichPresense
public void SetPresense(AnimeModel anime, int episode, TimeSpan duration)
{
var message = new RichPresence()
.WithDetails("Watching")
.WithState($"{anime.Title} - Episode {episode}")
.WithDetails(anime.Title)
.WithState($"Episode {episode}")
.WithAssets(new Assets() { LargeImageKey = "icon" })
.WithTimestamps(Timestamps.FromTimeSpan(duration));

Expand All @@ -27,8 +27,8 @@ public void SetPresense(AnimeModel anime, int episode, TimeSpan duration)
public void SetPresense(string title, int episode, TimeSpan duration)
{
var message = new RichPresence()
.WithDetails("Watching")
.WithState($"{title} - Episode {episode}")
.WithDetails(title)
.WithState($"Episode {episode}")
.WithAssets(new Assets() { LargeImageKey = "icon" })
.WithTimestamps(Timestamps.FromTimeSpan(duration));

Expand Down
2 changes: 1 addition & 1 deletion AnimDL.WinUI/Styles/Thickness.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<CornerRadius x:Key="NavigationViewContentGridCornerRadius">8,0,0,0</CornerRadius>
<Thickness x:Key="NavigationViewContentMargin">0,48,0,0</Thickness>
<Thickness x:Key="NavigationViewHeaderMargin">56,-56,0,0</Thickness>
<Thickness x:Key="NavigationViewPageContentMargin">12,0,12,0</Thickness>
<Thickness x:Key="NavigationViewPageContentMargin">0,0,0,0</Thickness>

<Thickness x:Key="MenuBarContentMargin">36,24,0,0</Thickness>

Expand Down
16 changes: 9 additions & 7 deletions AnimDL.WinUI/ViewModels/WatchViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public WatchViewModel(IProviderFactory providerFactory,

messageBus
.Listen<WebMessage>()
.Where(x => x.MessageType == WebMessageType.Seeked)
.Where(x => x.MessageType is WebMessageType.Seeked or WebMessageType.Play)
.Subscribe(_ => TryDiscordRpcStartWatching())
.DisposeWith(Garbage);

Expand Down Expand Up @@ -183,7 +183,7 @@ public WatchViewModel(IProviderFactory providerFactory,
this.ObservableForProperty(x => x.CurrentEpisode, x => x)
.Where(x => x > 0)
.ObserveOn(RxApp.TaskpoolScheduler)
.SelectMany(FetchUrlForEp)
.SelectMany(FetchEpUrl)
.ToProperty(this, nameof(Url), out _url, () => string.Empty);
}

Expand All @@ -198,13 +198,13 @@ public WatchViewModel(IProviderFactory providerFactory,
[Reactive] public SearchResult SelectedAudio { get; set; }
public IProvider Provider => _provider.Value;
public bool HasSubAndDub => _hasSubAndDub.Value;
public ReadOnlyObservableCollection<int> Episodes => _episodes;
public string Url => _url.Value;
public double CurrentPlayerTime => _currentPlayerTime.Value;
public double CurrentMediaDuration => _currentMediaDuration.Value;
public AnimeModel Anime { get; set; }
public List<ProviderType> Providers { get; } = Enum.GetValues<ProviderType>().Cast<ProviderType>().ToList();
public ICommand SearchResultPicked { get; }
public ReadOnlyObservableCollection<int> Episodes => _episodes;
public ReadOnlyObservableCollection<SearchResult> SearchResult => _searchResults;
public TimeSpan TimeRemaining => TimeSpan.FromSeconds(CurrentMediaDuration - CurrentPlayerTime);

Expand Down Expand Up @@ -271,11 +271,13 @@ private List<SearchResult> FilterDubsIfEnabled(List<SearchResult> results)
return results;
}

private async Task<string> FetchUrlForEp(int? episode)
private IObservable<string> FetchEpUrl(int? episode)
{
var ep = episode ?? 1;
var epStream = await Provider.StreamProvider.GetStreams(SelectedAudio.Url, ep..ep).ToListAsync();
return epStream[0].Qualities.Values.ElementAt(0).Url;
return Provider.StreamProvider
.GetStreams(SelectedAudio.Url, episode.Value..episode.Value)
.ToListAsync().AsTask()
.ToObservable()
.Select(x => x[0].Qualities.Values.ElementAt(0).Url);
}

private void UpdateTracking()
Expand Down
1 change: 1 addition & 0 deletions AnimDL.WinUI/Views/DiscoverPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewmodels="using:AnimDL.WinUI.ViewModels"
xmlns:views="using:AnimDL.WinUI.Views"
Margin="{StaticResource MediumLeftRightMargin}"
d:DataContext="{d:DesignInstance Type=viewmodels:DiscoverViewModel}"
mc:Ignorable="d">

Expand Down
1 change: 1 addition & 0 deletions AnimDL.WinUI/Views/SchedulePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
xmlns:model="using:AnimDL.WinUI.Models"
xmlns:uc="using:AnimDL.WinUI.UserControls"
xmlns:views="using:AnimDL.WinUI.Views"
Margin="{StaticResource MediumLeftRightMargin}"
mc:Ignorable="d">

<Grid Margin="0,10">
Expand Down
1 change: 1 addition & 0 deletions AnimDL.WinUI/Views/SeasonalPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
xmlns:uc="using:AnimDL.WinUI.UserControls"
xmlns:views="using:AnimDL.WinUI.Views"
x:Name="Page"
Margin="{ThemeResource MediumLeftRightMargin}"
mc:Ignorable="d">

<views:SeasonalPageBase.Resources>
Expand Down
3 changes: 2 additions & 1 deletion AnimDL.WinUI/Views/SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
xmlns:views="using:AnimDL.WinUI.Views"
xmlns:vm="using:AnimDL.WinUI.ViewModels"
Name="Page"
Margin="24"
mc:Ignorable="d">
<Grid Margin="20">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
Expand Down
1 change: 1 addition & 0 deletions AnimDL.WinUI/Views/UserListPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
xmlns:viewmodels="using:AnimDL.WinUI.ViewModels"
xmlns:views="using:AnimDL.WinUI.Views"
Name="Page"
Margin="{StaticResource MediumLeftRightMargin}"
d:DataContext="{d:DesignInstance Type=viewmodels:UserListViewModel}"
mc:Ignorable="d">
<v:UserListPageBase.Resources>
Expand Down
11 changes: 3 additions & 8 deletions AnimDL.WinUI/Views/WatchPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,14 @@
</Grid.RowDefinitions>
<Expander
Grid.Row="1"
Margin="{StaticResource SmallTopBottomMargin}"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
HorizontalContentAlignment="Stretch"
ExpandDirection="Up"
IsExpanded="True">
<Expander.Header>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="0,0,50,0"
VerticalAlignment="Center"
FontSize="15"
FontWeight="Bold"
Expand All @@ -89,7 +84,7 @@
OffContent="Sub"
OnContent="Dub"
Visibility="{x:Bind help:Converters.BooleanToVisibility(ViewModel.HasSubAndDub), Mode=OneWay}" />
</Grid>
</StackPanel>
</Expander.Header>
<Grid>
<ListView
Expand Down

0 comments on commit ca8f25b

Please sign in to comment.