Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add play, pause and stop buttons.
  • Loading branch information
ilanolkies committed May 22, 2018
1 parent ef9d408 commit 3fd6485
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 7,008 deletions.
7,003 changes: 0 additions & 7,003 deletions Droid/Resources/Resource.designer.cs

This file was deleted.

Binary file added Droid/Resources/drawable/pause.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Droid/Resources/drawable/play.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Droid/Resources/drawable/stop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Droid/StreamingExample.Droid.csproj
Expand Up @@ -131,6 +131,9 @@
<AndroidResource Include="Resources\drawable-hdpi\icon.png" />
<AndroidResource Include="Resources\drawable-xhdpi\icon.png" />
<AndroidResource Include="Resources\drawable-xxhdpi\icon.png" />
<AndroidResource Include="Resources\drawable\stop.png" />
<AndroidResource Include="Resources\drawable\pause.png" />
<AndroidResource Include="Resources\drawable\play.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Assets\" />
Expand Down
7 changes: 6 additions & 1 deletion README.md
@@ -1 +1,6 @@
# XamarinRadioStreamingExample
# XamarinRadioStreamingExample


## Resources
- Icons: [FlatIcon](https://www.flaticon.com/packs/music)
- Streaming: [Radio Zonica](http://radiozonica.com.ar)
72 changes: 71 additions & 1 deletion StreamingExample/StreamingExamplePage.xaml
@@ -1,4 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:StreamingExample" x:Class="StreamingExample.StreamingExamplePage">
<Label Text="My first radio streaming app!" VerticalOptions="Center" HorizontalOptions="Center" />
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<!-- Simple header label -->
<Label Grid.Row="0" Grid.Column="0"
Text="My first radio streaming app!"
VerticalOptions="Center" HorizontalOptions="Center"
FontSize="Large"
Margin="10" />

<!-- Use Grid to keep sizing -->
<Grid x:Name="Play"
Grid.Row="1" Grid.Column="0" IsVisible="true"
HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<Image Grid.Row="0" Grid.Column="1"
Source="play.png"
VerticalOptions="Center" HorizontalOptions="Center"
Margin="10">

<!-- Calls function with name described in Tapped when the image is tapped -->
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="Play_tapped" />
</Image.GestureRecognizers>
</Image>
</Grid>

<Grid x:Name="PauseStop"
Grid.Row="1" Grid.Column="0" IsVisible="false"
HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<Image Grid.Row="0" Grid.Column="0"
Source="pause.png"
VerticalOptions="Center" HorizontalOptions="Center"
Margin="10">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="Pause_tapped" />
</Image.GestureRecognizers>
</Image>

<Image Grid.Row="0" Grid.Column="1"
Source="stop.png"
VerticalOptions="Center" HorizontalOptions="Center"
Margin="10">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="Stop_tapped" />
</Image.GestureRecognizers>
</Image>
</Grid>
</Grid>
</ContentPage>
26 changes: 24 additions & 2 deletions StreamingExample/StreamingExamplePage.xaml.cs
@@ -1,12 +1,34 @@
using Xamarin.Forms;
using System;
using Xamarin.Forms;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;

namespace StreamingExample
{
public partial class StreamingExamplePage : ContentPage
{
public StreamingExamplePage()
{
InitializeComponent();
InitializeComponent();
On<Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true);
}

// Callbacks to images tapped
private void Play_tapped(object sender, EventArgs e)
{
Play.IsVisible = false;
PauseStop.IsVisible = true;
}

private void Pause_tapped(object sender, EventArgs e)
{
Play.IsVisible = true;
PauseStop.IsVisible = false;
}

private void Stop_tapped(object sender, EventArgs e)
{
Play.IsVisible = true;
PauseStop.IsVisible = false;
}
}
}
2 changes: 1 addition & 1 deletion iOS/Info.plist
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
Expand Down
Binary file added iOS/Resources/pause.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added iOS/Resources/play.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added iOS/Resources/stop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions iOS/StreamingExample.iOS.csproj
Expand Up @@ -120,6 +120,11 @@
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\stop.png" />
<BundleResource Include="Resources\pause.png" />
<BundleResource Include="Resources\play.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<Import Project="..\packages\Xamarin.Forms.2.5.0.121934\build\netstandard1.0\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.5.0.121934\build\netstandard1.0\Xamarin.Forms.targets')" />
</Project>

0 comments on commit 3fd6485

Please sign in to comment.