Skip to content

Commit

Permalink
v2021.1, mouse wheel volume
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-ward committed Feb 22, 2021
1 parent 3a7a5ac commit 53c040d
Show file tree
Hide file tree
Showing 15 changed files with 80 additions and 96 deletions.
23 changes: 11 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
# Changelog
All notable changes to this project will be documented in this file.

## 2.9.5 - 2021-01-31
## 2021.1 - 2021-02-21

### Added
- Mouse wheel controls volume when playing videos

### Changed
- Version numbers are year the revision based
- Image viewer uses media element for videos only. Other images use image element
- Update packages and SDK to latest releases
- Removed cache hinting option from profile images

## 2.9.5 - 2021-01-31

### Changed
- Change link colors
- Extend timeout to 5 seconds for reverse lookup of short urls

## 2.9.4 - 2021-01-12

### Changed

- UI tweaks

## 2.9.3 - 2021-01-05

### Fixed

- [Menu takes up 2 rows since 2.9.1 #64](https://github.com/mike-ward/tweetz/issues/64)

## 2.9.2 - 2021-01-05

### Added

- "Hide translate link" option

## 2.9.1 - 2021-01-04

### Fixed

- Use new service provider for translations #61

## 2.9.0 - 2020-12-05

### Added

- Translate tweets on demand

### Changed

- Improved image layout for multiple images

## 2.8.6 - 2020-11-11

### Changed

- Update to .Net 5.0

## 2.8.5 - 2020-09-27

### Changed

- Smooth scrolling [688ab45](https://github.com/mike-ward/tweetz/commit/688ab45e49f5aeb5d7d14fa02e4e1c738c5e2020)

## 2.8.4 - 2020-09-13

### Fixed

- Move ColorConverter reference to theme files to avoid crash [a245e42](https://github.com/mike-ward/tweetz/commit/a245e424da8f2bc0aa1fc3ac636a2a8e9b544142)

## 2.8.3 - 2020-09-13

### Fixed

- Follow/Followed By statuses didn't sync sometimes [759c07f](https://github.com/mike-ward/tweetz/commit/759c07f845e379f348ab6479b522d50c8960cf09)
- Custom color not working in Nord and Dark themes [55449d0](https://github.com/mike-ward/tweetz/commit/55449d08acf1980ea6bf021efac2db4aa4661cc5)

Expand Down Expand Up @@ -98,7 +98,6 @@ All notable changes to this project will be documented in this file.
### Fixed
- Fix line height issue [#35](https://github.com/mike-ward/tweetz/issues/35)


## 2.7.1 - 2020-06-30

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion src/tweetz.core/Converters/IsNotNullConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace tweetz.core.Converters
{
public class IsNotNullConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object Convert(object? value, Type targetType, object parameter, CultureInfo culture)
{
return value is not null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/tweetz.core/Converters/IsNullConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace tweetz.core.Converters
{
public class IsNullConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object Convert(object? value, Type targetType, object parameter, CultureInfo culture)
{
return value is null;
}
Expand Down
1 change: 0 additions & 1 deletion src/tweetz.core/Converters/NotBooleanConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace tweetz.core.Converters
{
public class NotBooleanConverter : IValueConverter
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Major Code Smell", "S2589:Boolean expressions should not be gratuitous", Justification = "https://github.com/SonarSource/sonar-dotnet/issues/3123")]
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace tweetz.core.Converters
{
public class NotBooleanToVisibilityConverter : IValueConverter
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Major Code Smell", "S2589:Boolean expressions should not be gratuitous", Justification = "https://github.com/SonarSource/sonar-dotnet/issues/3123")]
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is true
Expand Down
8 changes: 4 additions & 4 deletions src/tweetz.core/Converters/NotNullToVisibilityConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ namespace tweetz.core.Converters
{
public class NotNullToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object Convert(object? value, Type targetType, object parameter, CultureInfo culture)
{
return string.IsNullOrWhiteSpace(value as string)
? Visibility.Collapsed
: Visibility.Visible;
return value is not null
? Visibility.Visible
: Visibility.Collapsed;
}

[System.Diagnostics.CodeAnalysis.SuppressMessage("General", "RCS1079:Throwing of new NotImplementedException.")]
Expand Down
4 changes: 2 additions & 2 deletions src/tweetz.core/Converters/NullToVisibilityConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ namespace tweetz.core.Converters
{
public class NullToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object Convert(object? value, Type targetType, object parameter, CultureInfo culture)
{
return string.IsNullOrWhiteSpace(value as string)
return value is null
? Visibility.Visible
: Visibility.Collapsed;
}
Expand Down
2 changes: 1 addition & 1 deletion src/tweetz.core/Models/VersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
public static class VersionInfo
{
public static string Version => "v2.9.5";
public static string Version => "v2021.1";
public static string Copyright => "Copyright 2021, Mike Ward";
}
}
62 changes: 12 additions & 50 deletions src/tweetz.core/Views/MediaViewerBlock/MediaViewerBlock.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
KeyDown="Popup_KeyDown"
MouseDown="Popup_MouseDown"
MouseWheel="Popup_OnMouseWheel"
Opened="Popup_Opened"
Placement="Center"
PopupAnimation="Fade"
SnapsToDevicePixels="True"
Expand All @@ -40,6 +39,7 @@
IsIndeterminate="True" />

<TextBlock
Grid.Row="0"
MinWidth="200"
MinHeight="100"
Padding="30"
Expand All @@ -52,60 +52,22 @@
Visibility="{Binding ErrorMessage, Mode=OneWay, Converter={StaticResource NotNullToVisibilityConverter}}" />

<MediaElement
Grid.Row="0"
x:Name="MediaElement"
Visibility="Collapsed"
LoadedBehavior="Manual"
MediaFailed="MediaElement_MediaFailed"
MediaOpened="MediaElement_MediaOpened"
Source="{Binding Uri, Mode=OneWay}">

<MediaElement.RenderTransform>
<ScaleTransform ScaleX="1.25" ScaleY="1.25" />
</MediaElement.RenderTransform>

<MediaElement.RenderTransformOrigin>
<Point
X="0.5"
Y="0.5" />
</MediaElement.RenderTransformOrigin>

<MediaElement.Triggers>
<EventTrigger RoutedEvent="MediaElement.MediaOpened">
<BeginStoryboard>
<Storyboard
Storyboard.TargetName="MediaElement"
Storyboard.TargetProperty="RenderTransform.ScaleX">
<DoubleAnimation
From="0"
To="1"
Duration="0:0:0.1" />
</Storyboard>
</BeginStoryboard>

<BeginStoryboard>
<Storyboard
Storyboard.TargetName="MediaElement"
Storyboard.TargetProperty="RenderTransform.ScaleY">
<DoubleAnimation
From="0"
To="1"
Duration="0:0:0.1" />
</Storyboard>
</BeginStoryboard>

<BeginStoryboard>
<Storyboard
Storyboard.TargetName="MediaElement"
Storyboard.TargetProperty="Opacity">
<DoubleAnimation
From="0"
To="1"
Duration="0:0:0.1" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</MediaElement.Triggers>
MediaOpened="MediaElement_MediaOpened">
</MediaElement>

<Image
Grid.Row="0"
x:Name="ImageElement"
Visibility="Collapsed"
Source="{Binding Uri, IsAsync=True}"
Stretch="UniformToFill">
</Image>

<local:MediaViewerBlockControls
x:Name="MediaControls"
Grid.Row="1"
Expand Down
48 changes: 34 additions & 14 deletions src/tweetz.core/Views/MediaViewerBlock/MediaViewerBlock.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using tweetz.core.Extensions;
Expand All @@ -16,7 +17,7 @@ public MediaViewerBlock()

private MediaViewerBlockViewModel ViewModel => (MediaViewerBlockViewModel)DataContext;

private void UpdateDataContext(object _, System.Windows.DependencyPropertyChangedEventArgs e)
private void UpdateDataContext(object _, DependencyPropertyChangedEventArgs e)
{
MediaControls.DataContext = e.NewValue;
ViewModel.PropertyChanged += (_, ea) =>
Expand All @@ -28,15 +29,31 @@ private void UpdateDataContext(object _, System.Windows.DependencyPropertyChange
private void ShowLoadingIndicator()
{
MediaElement.Stop();
MediaElement.Source = null;
MediaElement.Visibility = Visibility.Collapsed;
ImageElement.Visibility = Visibility.Collapsed;
MediaControls.Visibility = Visibility.Collapsed;
MediaControls.SetControlVisibilities(Visibility.Collapsed);
ViewModel.ErrorMessage = null;
MediaControls.Visibility = System.Windows.Visibility.Collapsed;
LoadingIndicator.Visibility = System.Windows.Visibility.Visible;
LoadingIndicator.Visibility = Visibility.Collapsed;

var uri = ((MediaViewerBlockViewModel)DataContext).Uri;
if (Services.ImageViewerService.IsMp4(uri?.ToString()))
{
MediaElement.Source = uri;
LoadingIndicator.Visibility = Visibility.Visible;
}
else
{
ImageElement.Visibility = Visibility.Visible;
MediaControls.Visibility = Visibility.Visible;
}
}

private void ShowMediaControls()
{
LoadingIndicator.Visibility = System.Windows.Visibility.Collapsed;
MediaControls.Visibility = System.Windows.Visibility.Visible;
LoadingIndicator.Visibility = Visibility.Collapsed;
MediaControls.Visibility = Visibility.Visible;
}

private void Popup_MouseDown(object sender, MouseButtonEventArgs e)
Expand All @@ -45,11 +62,6 @@ private void Popup_MouseDown(object sender, MouseButtonEventArgs e)
e.Handled = true;
}

private void Popup_Opened(object sender, EventArgs e)
{
ShowLoadingIndicator();
}

private void Popup_Closed(object sender, EventArgs e)
{
Close();
Expand All @@ -61,22 +73,30 @@ private void Popup_KeyDown(object sender, KeyEventArgs e)
e.Handled = true;
}

private void MediaElement_MediaOpened(object sender, System.Windows.RoutedEventArgs e)
private void MediaElement_MediaOpened(object sender, RoutedEventArgs e)
{
ShowMediaControls();
MediaElement.Play();
MediaElement.Visibility = Visibility.Visible;
}

private void MediaElement_MediaFailed(object sender, System.Windows.ExceptionRoutedEventArgs e)
private void MediaElement_MediaFailed(object sender, ExceptionRoutedEventArgs e)
{
LoadingIndicator.Visibility = System.Windows.Visibility.Collapsed;
LoadingIndicator.Visibility = Visibility.Collapsed;
ViewModel.ErrorMessage = e.ErrorException.Message;
}

private void Close()
{
ViewModel.Uri = null;
MediaElement?.Close();
if (MediaElement is not null)
{
MediaElement.Close();
MediaElement.Source = null;
MediaElement.Visibility = Visibility.Collapsed;
}

ImageElement.Visibility = Visibility.Collapsed;
}

private void Popup_OnMouseWheel(object sender, MouseWheelEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ private void OnMediaOpened(object _, RoutedEventArgs __)
? Visibility.Visible
: Visibility.Collapsed;

SetControlVisibilities(visibility);
}

public void SetControlVisibilities(Visibility visibility)
{
RewindButton.Visibility = visibility;
TenSecRewindButton.Visibility = visibility;
PlayPauseButton.Visibility = visibility;
Expand Down
2 changes: 1 addition & 1 deletion src/tweetz.core/app.manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="2.9.5.0" name="tweetz.core.exe" />
<assemblyIdentity version="2021.1.0.0" name="tweetz.core.exe" />
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
Expand Down
6 changes: 3 additions & 3 deletions src/tweetz.core/tweetz.core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
</PropertyGroup>

<PropertyGroup>
<AssemblyVersion>2.9.5</AssemblyVersion>
<FileVersion>2.9.5</FileVersion>
<Version>2.9.5</Version>
<AssemblyVersion>2021.1</AssemblyVersion>
<FileVersion>2021.1</FileVersion>
<Version>2021.1</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
Expand Down
6 changes: 3 additions & 3 deletions src/twitter.core/twitter.core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
</PropertyGroup>

<PropertyGroup>
<AssemblyVersion>2.9.5</AssemblyVersion>
<FileVersion>2.9.5</FileVersion>
<Version>2.9.5</Version>
<AssemblyVersion>2021.1</AssemblyVersion>
<FileVersion>2021.1</FileVersion>
<Version>2021.1</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
Expand Down
Loading

0 comments on commit 53c040d

Please sign in to comment.