Skip to content

Commit

Permalink
Fix updating of another android property
Browse files Browse the repository at this point in the history
  • Loading branch information
martijn00 committed Jul 2, 2019
1 parent 95b20b0 commit 4602517
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<RepositoryType>git</RepositoryType>
<Product>$(AssemblyName) ($(TargetFramework))</Product>
<NeutralLanguage>en</NeutralLanguage>
<Version>0.6.8</Version>
<Version>0.6.9</Version>

<LangVersion>latest</LangVersion>
<NoWarn>$(NoWarn);1591;1701;1702;1705;VSX1000;NU1603</NoWarn>
Expand Down
7 changes: 6 additions & 1 deletion MediaManager/MediaManagerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public MediaManagerBase()

public bool IsInitialized { get; protected set; }

public Timer Timer { get; } = new Timer(1000);
public Timer Timer { get; protected set; } = new Timer(1000);

private TimeSpan _stepSize = TimeSpan.FromSeconds(10);
public virtual TimeSpan StepSize
Expand Down Expand Up @@ -211,6 +211,10 @@ public virtual Task StepForward()
internal void OnStateChanged(object sender, StateChangedEventArgs e)
{
StateChanged?.Invoke(sender, e);

//TODO: Find a better way to trigger some changes.
OnPropertyChanged(nameof(Duration));

NotificationManager?.UpdateNotification();
}

Expand Down Expand Up @@ -241,6 +245,7 @@ protected virtual void Timer_Elapsed(object sender, ElapsedEventArgs e)
if (PreviousPosition != Position)
{
PreviousPosition = Position;
//OnPropertyChanged(nameof(Position));
OnPositionChanged(this, new PositionChangedEventArgs(Position));
}
}
Expand Down
7 changes: 6 additions & 1 deletion MediaManager/Platforms/Android/MediaManagerImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ public virtual Context Context
public int NotificationIconResource
{
get => _notificationIconResource;
set => SetProperty(ref _notificationIconResource, value);
set
{
SetProperty(ref _notificationIconResource, value);
var playerNotificationManager = (NotificationManager as MediaManager.Platforms.Android.Notifications.NotificationManager)?.PlayerNotificationManager;
playerNotificationManager?.SetSmallIcon(_notificationIconResource);
}
}

private MediaSessionCompat _mediaSession;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected virtual void PrepareNotificationManager()
PlayerNotificationManager.SetRewindIncrementMs((long)MediaManager.StepSize.TotalMilliseconds);
PlayerNotificationManager.SetNotificationListener(NotificationListener);
PlayerNotificationManager.SetMediaSessionToken(SessionToken);
PlayerNotificationManager.SetOngoing(false);
PlayerNotificationManager.SetOngoing(true);
PlayerNotificationManager.SetUsePlayPauseActions(MediaManager.NotificationManager.ShowPlayPauseControls);
PlayerNotificationManager.SetUseNavigationActions(MediaManager.NotificationManager.ShowNavigationControls);

Expand Down

0 comments on commit 4602517

Please sign in to comment.