Skip to content

Commit

Permalink
Feedback sounds
Browse files Browse the repository at this point in the history
Co-authored-by: Apates
  • Loading branch information
ShortDevelopment committed Jan 5, 2024
1 parent 14dc810 commit a6397c9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Credits
## Contributions
- Lukas Kurz (@ShortDevelopment)

## Audio Design
- @Apates

## Translations
- Guille (@Sappstal) (Spanish) & (Catalan (Valencian))
Expand Down
Binary file added Nearby Sharing Windows/Resources/raw/ding.mp3
Binary file not shown.
Binary file added Nearby Sharing Windows/Resources/raw/pop.mp3
Binary file not shown.
3 changes: 2 additions & 1 deletion Nearby Sharing Windows/SendActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ private void Platform_DeviceDiscovered(ICdpTransport sender, CdpDevice device)
RemoteSystems.Insert(newIndex, device);
_dialog.FindViewById<View>(Resource.Id.emptyDeviceListView)!.Visibility = ViewStates.Gone;
this.PlaySound(Resource.Raw.pop);
}
});

Expand Down Expand Up @@ -260,7 +261,7 @@ private async void SendData(CdpDevice remoteSystem)
]);

StatusTextView.Text = this.Localize(Resource.String.status_done);
readyButton.Visibility = ViewStates.Visible;
this.PlaySound(Resource.Raw.ding);
}
catch (TaskCanceledException)
{
Expand Down
7 changes: 7 additions & 0 deletions Nearby Sharing Windows/UIHelper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Android.Animation;
using Android.Content;
using Android.Content.PM;
using Android.Media;
using Android.Text;
using Android.Util;
using Android.Views;
Expand Down Expand Up @@ -195,4 +196,10 @@ public static int GetColorAttr(this Context context, int attr)
errorDialogBuilder.SetNeutralButton("Ok", (s, e) => { });
return errorDialogBuilder.Show();
}

public static void PlaySound(this Context context, int soundId)
{
MediaPlayer player = MediaPlayer.Create(context, soundId) ?? throw new NullReferenceException("Could not create MediaPlayer");
player.Start();
}
}

0 comments on commit a6397c9

Please sign in to comment.