<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Delaire Damien on Medium]]></title>
        <description><![CDATA[Stories by Delaire Damien on Medium]]></description>
        <link>https://medium.com/@damiendelaire?source=rss-e3dfe05837a8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*wSu3zQ4yspDiE7ZU.</url>
            <title>Stories by Delaire Damien on Medium</title>
            <link>https://medium.com/@damiendelaire?source=rss-e3dfe05837a8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 02:50:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@damiendelaire/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Last step before releasing, the final design review for dark theme on the application using…]]></title>
            <link>https://damiendelaire.medium.com/last-step-before-releasing-the-final-design-review-for-dark-theme-on-the-application-using-db244cb8d2b3?source=rss-e3dfe05837a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/db244cb8d2b3</guid>
            <category><![CDATA[desktop-app]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[dark-mode]]></category>
            <category><![CDATA[xaml]]></category>
            <category><![CDATA[uwp]]></category>
            <dc:creator><![CDATA[Delaire Damien]]></dc:creator>
            <pubDate>Wed, 09 Feb 2022 09:03:53 GMT</pubDate>
            <atom:updated>2022-02-09T09:03:53.392Z</atom:updated>
            <content:encoded><![CDATA[<h3>Last step before releasing, the final design review for dark theme on the application using Figma[4/4]</h3><p>In these articles I will go over my journey of updating all of the UI of an UWP application. The original application is a UWP XAML/C# application that runs on Xbox and Windows 10 Desktop that only had one design theme.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gbFz78vq-N5SHDm1tBqXWQ.png" /><figcaption>On the left the application with Light theme and on the right with Dark theme</figcaption></figure><p>The aim of these articles is to go over the different steps that were needed to correctly convert this application so that it could support a Light and Dark theme. As point of reference this application is used on Xbox and Windows 10 Desktop and has 90k lines of C# code and 29 XAML views.</p><p><strong>This article was broken into 4 parts:</strong></p><ul><li><a href="https://medium.com/@damiendelaire/adding-a-dark-theme-to-your-uwp-xaml-application-1-4-8e6927898da9">[Part 1] Setting up your app to handle the new Dark Theme, managing your assets with the different themes.</a></li><li><a href="https://damiendelaire.medium.com/dark-theme-to-your-uwp-xaml-application-setting-up-you-design-system-2-4-cf746d02c180">[Part 2] creating a design system view which will allow you have a quick overview of how the different element look like in the different themes. Selecting you dark theme colors.</a></li><li><a href="https://damiendelaire.medium.com/dark-theme-to-your-uwp-xaml-application-migrating-datatemplate-and-ui-elements-3-4-9e0cc7077ae8">[Part 3] Migrating different application UI Elements (buttons, headers, etc) and DataTemplates</a></li><li><strong>[Part 4] Final design review on the application with Figma</strong></li></ul><h3>Dark Themed UI Elements</h3><p>Here is an example of the Figma elements I received and worked with our design team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*9HrGMEKDTJx2luJg5pjzkA.png" /></figure><p>The idea was to have each view already converted to a dark theme on Figma to make sure sure that it would work on the real application.</p><p>We also tried to look into specific elements of the application like our loading states and making sure that if would be compatible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*PDL39utsiBCkJMdJO-ks-A.png" /></figure><p>Here is a closer look at what Home screen Figma looked like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*8IB4l6KDeb49NAPB1JZeFw.png" /></figure><p>In the end having the UWP app in Figma has been a great help in better selecting the color for the dark theme of the application. It also allowed us to easily compare what was done on the iOS and Android apps and make sure that the Windows App was follow our company color guidelines. If you are looking into adding dark theme in your application I highly recommended of trying it out and see if this works for you.</p><p>If you are interested in seeing the final results dont hesitate to go on the Microsoft Store and download the <a href="https://www.microsoft.com/en-us/p/dailymotion-all-the-videos-that-matter/9wzdncrfhx2x">dailymotion app</a></p><p><a href="https://www.microsoft.com/en-us/p/dailymotion-all-the-videos-that-matter/9wzdncrfhx2x">Get Dailymotion - all the videos that matter - Microsoft Store</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db244cb8d2b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dark Theme to your UWP XAML application, migrating DataTemplate and UI Elements[3/4]]]></title>
            <link>https://damiendelaire.medium.com/dark-theme-to-your-uwp-xaml-application-migrating-datatemplate-and-ui-elements-3-4-9e0cc7077ae8?source=rss-e3dfe05837a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e0cc7077ae8</guid>
            <category><![CDATA[windows-app-development]]></category>
            <category><![CDATA[windows-10]]></category>
            <category><![CDATA[uwp]]></category>
            <category><![CDATA[dark-mode]]></category>
            <dc:creator><![CDATA[Delaire Damien]]></dc:creator>
            <pubDate>Thu, 02 Sep 2021 08:36:13 GMT</pubDate>
            <atom:updated>2022-02-09T09:04:19.211Z</atom:updated>
            <content:encoded><![CDATA[<p>In these articles I will go over my journey of updating all of the UI of an UWP application. The original application is a UWP XAML/C# application that runs on Xbox and Windows 10 Desktop that only had one design theme.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Qvdigox-VSienYCz.png" /><figcaption>On the left the application with Light theme and on the right with Dark theme</figcaption></figure><p>On the left the application with Light theme and on the right with Dark theme</p><p>The aim of these articles are to go over the different steps that were needed to correctly convert this application so that it could support a Light and Dark theme. As point of reference this application is used on Xbox and Windows 10 Desktop and has 90k lines of C# code and 29 XAML views.</p><p><strong>This article was broken into 4 parts:</strong></p><ul><li><a href="https://medium.com/@damiendelaire/adding-a-dark-theme-to-your-uwp-xaml-application-1-4-8e6927898da9">[Part 1] Setting up your app to handle the new Dark Theme, managing your assets with the different themes.</a></li><li><a href="https://damiendelaire.medium.com/dark-theme-to-your-uwp-xaml-application-setting-up-you-design-system-2-4-b9bcfd42a10c">[Part 2] creating a design system view which will allow you have a quick overview of how the different element look like in the different themes. Selecting you dark theme colors.</a></li><li><strong>[Part 3] Migrating different application UI Elements (buttons, headers, etc) and DataTemplates</strong></li><li><a href="https://damiendelaire.medium.com/last-step-before-releasing-the-final-design-review-for-dark-theme-on-the-application-using-db244cb8d2b3">[Part 4] Final design review on the application</a></li></ul><h3>Dark Themed UI Elements</h3><p>In our design view we decided to round up all of the different headers, textbox styles, input box , date picker, combo box and buttons we are using in the application which gave us this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2RcNyTcwjPfQj2p2.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xTqJAPGbgvP8ECA_.png" /></figure><p>The only major issue that we had was with the different colors of our text depending on what background it was on.</p><p>And as most application will be using DataTemplates to template data in your GridView or ListView we hope that we could use a ContentPresenter with generated data to see how it would look like in dark or light mode</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hMME7TA-DXIT3MZn.png" /></figure><p>However as you can see the RequestedTheme never seemed to use our Dark values on my different ContentPresenters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wTtO2R2VNV2y9qX6.png" /></figure><p>To be 100% honest I did not dig deeper why this was happening, we ended up creating a new view called DataTemplatesDesignSystem.xaml that held all of our different DataTemplates, forced the app to DarkTheme and voila:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JJfJpypCxR9xbGwA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*syy69aoT2eLeq5vE.png" /></figure><p>Quick and dirty.. as it did not respond to my initial need to have everything in one view… but we needed to keep moving so sadly that was that.</p><p>When we get the chance to work on the DarkTheme design mode, we will check to see how we can improve the Dark theme request on ContentPresenter but as of today we did not update this.</p><p>Lastly, we will go over [Part 4] Final design review on the application with Figma.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e0cc7077ae8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dark Theme to your UWP XAML application, setting up you design system [2/4]]]></title>
            <link>https://damiendelaire.medium.com/dark-theme-to-your-uwp-xaml-application-setting-up-you-design-system-2-4-cf746d02c180?source=rss-e3dfe05837a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf746d02c180</guid>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[desktop-app]]></category>
            <category><![CDATA[dark-mode]]></category>
            <category><![CDATA[uwp]]></category>
            <dc:creator><![CDATA[Delaire Damien]]></dc:creator>
            <pubDate>Wed, 23 Jun 2021 05:53:07 GMT</pubDate>
            <atom:updated>2021-06-23T05:53:07.129Z</atom:updated>
            <content:encoded><![CDATA[<p>In these articles I will go over my journey of updating all of the UI of an UWP application. The original application is a UWP XAML/C# application that runs on Xbox and Windows 10 Desktop that only had one design theme.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ybk-3ktQZ8-ytbDN.png" /></figure><p>On the left the application with Light theme and on the right with Dark theme</p><p>On the left the application with Light theme and on the right with Dark theme</p><p>The aim of these articles is to go over the different steps that were needed to correctly convert this application so that it could support a Light and Dark theme. As a point of reference this application is used on Xbox and Windows 10 Desktop and has 90k lines of C# code and 29 XAML views.</p><p><strong>This article was broken into 4 parts:</strong></p><ul><li><a href="https://medium.com/@damiendelaire/adding-a-dark-theme-to-your-uwp-xaml-application-1-4-8e6927898da9">[Part 1] Setting up your app to handle the new Dark Theme, managing your assets with the different themes.</a></li><li><a href="https://damiendelaire.medium.com/dark-theme-to-your-uwp-xaml-application-setting-up-you-design-system-2-4-b9bcfd42a10c"><strong>[Part 2] creating a design system view which will allow you have a quick overview of how the different element look like in the different themes. Selecting you dark theme colors.</strong></a></li><li><a href="https://damiendelaire.medium.com/dark-theme-to-your-uwp-xaml-application-migrating-datatemplate-and-ui-elements-3-4-daae30e95253">[Part 3] Selecting you dark theme colors and migrating different application UI Elements (buttons, headers, etc) and DataTemplates</a></li><li>[Part 4] Final design review on the application with Figma</li></ul><h3>Selecting your Dark theme colors</h3><p>It’s important to plan and think about the new dark theme colors you are about to add to your app. We are lucky and have a team of UI and UX designers that gave us the different Dark theme palettes to use.</p><p>Another option would have been to look at Color Hunt to find your new palettes.</p><p><a href="https://colorhunt.co/palettes/dark">Dark Color Palettes - Color Hunt</a></p><blockquote>Color Hunt: Get some color inspiration with Color Hunt’s dark palettes collection and find the perfect scheme for your design or…</blockquote><p>You can also use Fluent XAML Theme Editor from Microsoft</p><p><a href="https://github.com/microsoft/fluent-xaml-theme-editor">microsoft/fluent-xaml-theme-editor</a></p><blockquote>Fluent XAML Theme: A tool and sample app that shows you how to theme your app effortlessly.</blockquote><p>which can also help you quickly select your new theme colors.</p><p>Now that we have our color palettes we can start creating our design view.</p><h3>System Design view with all of your headers, buttons, UI Element, DataTemplates</h3><p>In our Design view it was decided to create 2 panes, each have the same UI elements but one is set with RequestedTheme=Light and the other as Dark.</p><p>Here is what it looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2z_Bg4ObVao7YZCa.png" /></figure><p>Here is the XAML code which will allow us to have two scrollable panes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7DsDzRp7PMlxlsFP.png" /></figure><p>Creating a dedicated view for our design view would be greatly beneficial for us as it allowed us to make sure that the colors selected work as expected with our dark theme. And also that we did not break our Light theme colors.</p><p>Next we will go over <a href="https://damiendelaire.medium.com/dark-theme-to-your-uwp-xaml-application-migrating-datatemplate-and-ui-elements-3-4-daae30e95253">[Part 3] Migrating different application UI Elements (buttons, headers, etc) and DataTemplates to my Dark theme.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf746d02c180" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Our journey about adding Dark Theme to our UWP XAML application [1/4]]]></title>
            <link>https://damiendelaire.medium.com/our-journey-about-adding-dark-theme-to-our-uwp-xaml-application-1-4-bd60901ad91?source=rss-e3dfe05837a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd60901ad91</guid>
            <category><![CDATA[uwp]]></category>
            <category><![CDATA[desktop-app]]></category>
            <category><![CDATA[dark-theme]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[xaml]]></category>
            <dc:creator><![CDATA[Delaire Damien]]></dc:creator>
            <pubDate>Thu, 17 Jun 2021 14:41:40 GMT</pubDate>
            <atom:updated>2022-02-09T09:05:05.021Z</atom:updated>
            <content:encoded><![CDATA[<p>In these articles I will go over my journey of updating all of the UI of an UWP application. The original application is a UWP XAML/C# application that runs on Xbox and Windows 10 Desktop that only had one design theme.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*f_AHb2brSUTCJ8yY.png" /></figure><p>On the left the application with Light theme and on the right with Dark theme</p><p>The aim of these articles is to go over the different steps that were needed to correctly convert this application so that it could support a Light and Dark theme. As a point of reference this application is used on Xbox and Windows 10 Desktop and has 90k lines of C# code and 29 XAML views.</p><p><strong>This article was broken into 4 parts:</strong></p><ul><li><a href="https://medium.com/@damiendelaire/adding-a-dark-theme-to-your-uwp-xaml-application-1-4-8e6927898da9"><strong>[Part 1] Setting up your app to handle the new Dark Theme, managing your assets with the different themes.</strong></a></li><li><a href="https://damiendelaire.medium.com/dark-theme-to-your-uwp-xaml-application-setting-up-you-design-system-2-4-b9bcfd42a10c">[Part 2] creating a design system view which will allow you have a quick overview of how the different element look like in the different themes. Selecting you dark theme colors.</a></li><li><a href="https://damiendelaire.medium.com/dark-theme-to-your-uwp-xaml-application-migrating-datatemplate-and-ui-elements-3-4-daae30e95253">[Part 3] Selecting you dark theme colors and migrating different application UI Elements (buttons, headers, etc) and DataTemplates</a></li><li><a href="https://damiendelaire.medium.com/last-step-before-releasing-the-final-design-review-for-dark-theme-on-the-application-using-db244cb8d2b3">[Part 4] Final design review on the application with Figma</a></li></ul><p>Adding a Dark theme to an application is more than just inversing all of your whites to blacks and blacks to whites, or setting the background of your application to black =)</p><p>Here is what the current application looked like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3ayXx1JsdDzo8ypV1_DvTQ.png" /><figcaption>Home screen</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Dhtr8N6ACIpRfF0lKOc4Q.png" /><figcaption>Following video feed</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*0uh8lslVUXCeKEYxpkcp4Q.png" /><figcaption>Search</figcaption></figure><p>The application has a horizontal navigation bar at the top that allows users to navigate these and has different kinds of listview and gridviews that are horizontal and vertical.</p><h3>Setting up our application to handle our new dark theme.</h3><p>The first step was to remove in the xaml code all of the references to <em>RequestedTheme=’’Light’’ (</em>ctrl+shift + F replace RequestedTheme=’’Light’’ by “” look for Entire Solution). Next we needed to have a way to store which theme is being used by the user. For our application is was decided that we would create the property <strong>IsDarkTheme </strong>under our app settings properties.</p><p>In our App.xaml.cs file we added a new method called <strong>UpdateAppTheme()</strong> that would manage which theme is loaded when the application loads.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_HAjeuUqyREpuNR5qQ9APw.png" /></figure><p>Next, we started setting up our <strong>Style.xaml</strong> file with<br><em>&lt;ResourceDictionary x:Key=”Light”&gt;</em></p><p>and</p><p><em>&lt;ResourceDictionary x:Key=”Dark”&gt;</em></p><p>which will hold our different styles depending which theme the user selects to use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*riIJYXjR0qL4Dvj8y2Xp_g.png" /></figure><h3>Creating new SolidColorBrush Keys</h3><p>It was decided to create new SolidColorBrush keys with the prefix <strong>Default </strong>which would allow us to:</p><ul><li>Quickly see if this property is Light/Dark theme compliant</li><li>Create a new layer of SolidColorBrush which can be applied only where it was needed. This allowed us to not break the whole UI application. If we had decided to change all of the whites to blacks then we would have broken all of the UI colors of elements that used this key, which was not what we wished.</li></ul><p>Here is a quick example of what out new Style.xaml file looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uhBPXPoCVIiAKkErkUYbBQ.png" /></figure><h3>Selecting Assets depending on the theme</h3><p>Next, came the issue of selecting the correct Assets depending on the application theme.</p><p>First, we believed that because we were loading navigation assets depending on what the user had access to we could also change our assets on the go as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CtJpCx34afP1CWjaO-RHqA.png" /></figure><p>This ended up being bad idea, as on our navigation items we have multiple actions that can happen, and it ended up giving us this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xs2lWHJTcqQpiYZRRalUkQ.png" /></figure><p>We also did not wish to have go over every assets with a foreach to change our Assets.</p><p>It was decided that we would create a Class that would hold the assets that needed to change when the application theme changed. DmAppAssets was born, this would allow to easily access the needed assets in C# code and XAML code if needed.</p><p>Here is a sample of what our DmAppAssets looks like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c8897a732ae088ec3a94341a1471fc1c/href">https://medium.com/media/c8897a732ae088ec3a94341a1471fc1c/href</a></iframe><p>Here is how we load our navigation assets in C#:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*npH0Ry8TjOEwBVxuXAxw_A.png" /></figure><p>In XAML we can use the Binding property to correctly bind the correct Asset as follows:</p><pre>C#:<br>public DmAppAssets _aAppAssets = new DmAppAssets();<br>public DmAppAssets AppAssets<br>{<br> get<br> {<br>  return _aAppAssets;<br> }<br> set<br> {<br>  Set(ref _aAppAssets, value);<br> }<br>}XAML:<br>&lt;Image Height=”10&quot; Source=”{Binding AppAssets.ActionsCrossClose}” /&gt;</pre><p>the only trick was that we needed to add the DmAppAssets property to our Mvvm ViewModel.</p><p>As you can see preparing our application to support a Dark Theme is mainly time consuming as you must be careful to not over complexify your current application.</p><p>Next, we will go over <a href="https://damiendelaire.medium.com/dark-theme-to-your-uwp-xaml-application-setting-up-you-design-system-2-4-b9bcfd42a10c">[Part 2] creating a design system view which will allow you have a quick overview of how the different element look like in the different themes.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd60901ad91" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From UWP/Xamarin Forms to Xamarin Android building an MVP ( Release Build) [Part 3]]]></title>
            <link>https://damiendelaire.medium.com/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-release-build-part-3-71a12b7622b?source=rss-e3dfe05837a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/71a12b7622b</guid>
            <category><![CDATA[xamarin-android]]></category>
            <category><![CDATA[xamarin]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Delaire Damien]]></dc:creator>
            <pubDate>Wed, 05 Feb 2020 08:52:42 GMT</pubDate>
            <atom:updated>2020-02-05T08:52:42.959Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PBpZWzIkmksERAaQ.png" /><figcaption>Xamarin Android</figcaption></figure><p>In these articles I will go over my journey of building an application that runs on multiple platforms. My original application was a classic UWP application, next I built the same application but with Xamarin Forms XAML which you can find <a href="https://medium.com/@damiendelaire/from-uwp-development-to-using-xamarin-forms-to-release-an-application-to-the-android-play-store-48ae4868a2e0">here</a>.</p><p>The aim of these articles is to go over the different steps that were needed for my application to work. The application needed to have a horizontal listview , database/caching, audio and tracking.</p><p>This audio application was built using <strong>Xamarin.Android</strong> and will release it to the Google Play Store. We already have all of the C# code in a .Net Standard library which allows us to already have the API call, the caching mechanisms, our ViewModels and our Models.</p><p>We will finish the application by adding a <strong>splash screen, error tracking, tracking of views</strong> and lastly <strong>releasing </strong>it to the Google Play Store.</p><p><strong>This article is broken into 3 parts:</strong></p><ul><li><a href="https://medium.com/@damiendelaire/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-horizontal-lists-database-part-1-c5aaa778b496">[Part 1] Migrating my UWP / Xamarin Forms application to Xamarin Android building an MVP — Horizontal lists &amp; Database</a></li><li><a href="https://medium.com/@damiendelaire/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-audio-player-fragments-part-2-9a6df90cc6ac">[Part 2] Migrating my UWP / Xamarin Forms application to Xamarin Android building an MVP — Audio player &amp; Fragments</a></li><li><a href="https://medium.com/@damiendelaire/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-release-build-part-3-71a12b7622b"><strong>[Part 3] From MVP to Release Build, migrating a UWP / Xamarin Forms application to Xamarin Android and submitting it to the Google Play Store</strong></a></li></ul><p><strong>This article is part of a part of a bigger series of articles that walk through the different steps that I went through to migrate an Audio application. </strong>You can find the articles <a href="https://medium.com/@damiendelaire/my-trip-from-uwp-development-to-cross-platform-development-for-a-small-audio-application-part-1-f6798bed483f">here</a>.</p><h3><strong>Creating a Splash screen as an Activity</strong></h3><p>Adding a Splash screen was a bit harder then on an UWP application, however it does give you a lot more control on how you wish your splash screen to look like. Microsoft did a great tutorial on how to implement a splash screen here :</p><p><a href="https://github.com/MicrosoftDocs/xamarin-docs/blob/live/docs/android/user-interface/splash-screen.md">MicrosoftDocs/xamarin-docs</a></p><p>I followed the Microsoft documentation above a which gave me this, my MVP had 3 UI elements that were located in Layout folder as follows:</p><pre>Resources<br>   /drawable<br>   /drawable-XXXX<br>       - splashscreen.png</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/224/1*3-N6AhMIfUAiyIKHrB-KeA.png" /></figure><p>My splashscreen.xml file looking as follows:</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;<br>&lt;layer-list xmlns:android=&quot;<a href="http://schemas.android.com/apk/res/android">http://schemas.android.com/apk/res/android</a>&quot;&gt;<br>  &lt;item&gt;<br>    &lt;!--&lt;color android:color=&quot;<a href="http://twitter.com/color/splash_background">@color/splash_background</a>&quot;/&gt;--&gt;<br>    &lt;shape android:shape=&quot;rectangle&quot;&gt;<br>      &lt;solid android:color=&quot;<a href="http://twitter.com/color/splash_background">@color/splash_background</a>&quot; /&gt;<br>    &lt;/shape&gt;<br>  &lt;/item&gt;<br>  &lt;item  &gt;<br>    &lt;bitmap     <br>        android:src=&quot;<a href="http://twitter.com/drawable/splashscreen">@drawable/splashscreen</a>&quot;        <br>        android:tileMode=&quot;disabled&quot;<br>        android:gravity=&quot;center&quot;/&gt;<br>  &lt;/item&gt;<br>&lt;/layer-list&gt;</pre><p>My splash screen is linked to an <strong>Activity </strong>that is set as the main launcher, once the splash screen is shown we will load our main <strong>Activity</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f270a371528c801289a239ba5b476889/href">https://medium.com/media/f270a371528c801289a239ba5b476889/href</a></iframe><h3>Tracking and Error handling</h3><p>On any application it is usually important to know what is happening on your application and being able to track errors happening.</p><p>First, I added Microsoft AppCenter for error handling calling</p><pre>AppCenter.Start(&quot;63e4821b-3fe3-45eb-810c-8cb044f5f96e&quot;, typeof(Analytics), typeof(Crashes));</pre><p>in my SplashActivity class in the <strong>OnCreate</strong>.</p><p>Now to report error we will just need to using <strong>Crashes.TrackError(exception);</strong></p><p>To track view we can now use:</p><p><strong>Analytics.TrackEvent(pageName);</strong></p><h3>Building for Release</h3><p>The main advantage of using <strong>Xamarin.Android</strong> is that the build package size is reduced compared to the package sizes I got for Xamarin.Froms.</p><p>Here is the build specification that worked perfectly for me:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*Ga8sZFfcaiyGFmKwKkWW_Q.png" /></figure><p>This created a 61.2 MB package size. Next, I created an Archive of my solution and manually uploaded my application the store.</p><h3>All in all</h3><p>After having use both <strong>Xamarin.Forms</strong> and<strong> Xamarin.Android </strong>briefly, I can definitively say that that the look and feel from using <strong>Xamarin.Android</strong> does make you feel that you are using native components which feel more natural. The learning curve for a UWP developer is a bit harder as you need to understand how the Android UI works, understanding how it works improved the look and feel of my application.</p><p>Having never worked with <strong>Form </strong>and <strong>Xamarin.Android</strong> before I had my reservation about these frameworks. After building this application and being able to reuse some of my UWP code in my <strong>Xamarin.Android </strong>application I can clearly see the advantage of sharing code and also keeping native specific components. My <strong>Xamarin.Android</strong> application had a faster startup time and better UI responses then the <strong>Forms </strong>app, and both applications look 90% the sane and have implement the exact same features.</p><p>Here is quick recap of my mini-articles:</p><ul><li><a href="https://medium.com/@damiendelaire/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-horizontal-lists-database-part-1-c5aaa778b496">[Part 1] Migrating my UWP / Xamarin Forms application to Xamarin Android building an MVP — Horizontal lists &amp; Database</a></li><li><a href="https://medium.com/@damiendelaire/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-audio-player-fragments-part-2-9a6df90cc6ac">[Part 2] Migrating my UWP / Xamarin Forms application to Xamarin Android building an MVP — Audio player &amp; Fragments</a></li><li><a href="https://medium.com/@damiendelaire/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-release-build-part-3-71a12b7622b"><strong>[Part 3] From MVP to Release Build, migrating a UWP / Xamarin Forms application to Xamarin Android and submitting it to the Google Play Store</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71a12b7622b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From UWP/Xamarin Forms to Xamarin Android building an MVP ( Audio Player & Fragments ) [Part 2]]]></title>
            <link>https://damiendelaire.medium.com/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-audio-player-fragments-part-2-9a6df90cc6ac?source=rss-e3dfe05837a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a6df90cc6ac</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[xamarin-android]]></category>
            <category><![CDATA[uwp]]></category>
            <category><![CDATA[xamarin]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <dc:creator><![CDATA[Delaire Damien]]></dc:creator>
            <pubDate>Sun, 26 Jan 2020 16:47:24 GMT</pubDate>
            <atom:updated>2020-02-05T08:51:51.378Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PBpZWzIkmksERAaQ.png" /><figcaption>Xamarin Android</figcaption></figure><p>In these articles I will go over my journey of building an application that runs on multiple platforms. My original application was a classic UWP application, next I built the same application but with Xamarin Forms XAML which you can find <a href="https://medium.com/@damiendelaire/from-uwp-development-to-using-xamarin-forms-to-release-an-application-to-the-android-play-store-48ae4868a2e0">here</a>.</p><p>The aim of these articles is to go over the different steps that were needed for my application to work. The application needed to have a horizontal listview , database/caching, audio and tracking.</p><p>This audio application was built using <strong>Xamarin.Android</strong> and will release it to the Google Play Store. We already have all of the C# code in a .Net Standard library which allows us to already have the API call, the caching mechanisms, our ViewModels and our Models.</p><p>We will start by try to get the <strong>audio player</strong> working and will work with <strong>fragments</strong>.</p><p><strong>This article is broken into 3 parts:</strong></p><ul><li><a href="https://medium.com/@damiendelaire/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-horizontal-lists-database-part-1-c5aaa778b496">[Part 1] Migrating my UWP / Xamarin Forms application to Xamarin Android building an MVP — Horizontal lists &amp; Database</a></li><li><a href="https://medium.com/@damiendelaire/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-audio-player-fragments-part-2-9a6df90cc6ac"><strong>[Part 2] Migrating my UWP / Xamarin Forms application to Xamarin Android building an MVP — Audio player &amp; Fragments</strong></a></li><li><a href="https://medium.com/@damiendelaire/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-release-build-part-3-71a12b7622b">[Part 3] From MVP to Release Build, migrating a UWP / Xamarin Forms application to Xamarin Android and submitting it to the Google Play Store</a></li></ul><p><strong>This article is part of a part of a bigger series of articles that walk through the different steps that I went through to migrate an Audio application. </strong>You can find the articles <a href="https://medium.com/@damiendelaire/my-trip-from-uwp-development-to-cross-platform-development-for-a-small-audio-application-part-1-f6798bed483f">here</a>.</p><h3>Audio player using LibVLC</h3><p>For this time around we will be using the <a href="https://www.nuget.org/packages/VideoLAN.LibVLC.Android/"><strong>VideoLAN.LibVLC.Android</strong></a> &amp; <a href="https://www.nuget.org/packages/LibVLCSharp/"><strong>LibVLCSharp</strong></a>. I could have used the default <strong>MediaPlayer </strong>which can be found <a href="https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/android-audio">here</a> with no additional plugins like VLC, however I did find that VLC allowed the application to better manage HLS streams.</p><p>Next we need to initialize the VLC library as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2fa70525c8b98f24dab2f3cd119acbbb/href">https://medium.com/media/2fa70525c8b98f24dab2f3cd119acbbb/href</a></iframe><p>Full GitHub source here :</p><p><a href="https://github.com/videolan/libvlcsharp">videolan/libvlcsharp</a></p><p>And with that my audio player is able to play my audio files.</p><h3>Using Fragments</h3><p>Here is quick description of what a fragment is:</p><blockquote>A <a href="https://developer.android.com/reference/androidx/fragment/app/Fragment.html">Fragment</a> represents a behavior or a portion of user interface in a <a href="https://developer.android.com/reference/androidx/fragment/app/FragmentActivity.html">FragmentActivity</a>. You can combine multiple fragments in a single activity to build a multi-pane UI and reuse a fragment in multiple activities. You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own input events, and which you can add or remove while the activity is running (sort of like a &quot;sub activity&quot; that you can reuse in different activities).</blockquote><p>Here is what the life cycle of a fragment look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/317/1*k8839LeZl-LV03NwPEPRyw.png" /></figure><p>I have decided to use two fragments one that will hold my Listviews from the Home/Search/Favorite and the other fragment will hold the UI for the audio player. Here is what my <a href="https://gist.github.com/Delaire/bc12ab28f4fed1ecb77e9775c00ca372#file-activity_main-xml">activity_main.xml</a> looks like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f53b348b7f6f30f1434da3f4fe01b555/href">https://medium.com/media/f53b348b7f6f30f1434da3f4fe01b555/href</a></iframe><h3>Adding Home and Search in a Fragment</h3><p>We are going to look at how to setup a <strong>ListFragment </strong>and a normal <strong>fragment</strong>.</p><h4>ListFragment</h4><p>My public class HomeFragment is inheriting from <strong>Android.Support.V4.App. ListFragment</strong>, the method <strong>OnActivityCreated </strong>will call the ViewModel <strong>HomePageViewModel() </strong>which allow us to query our API and get our recommended radios. Next we will need to set our data onto a BaseAdapter that will then need to be set into the <strong>ListAdapter </strong>property of the <strong>ListFragment.</strong></p><p>The advantage that I found was that a class that is based on a <strong>ListFragment </strong>doesn’t need to bind it to a view, the <strong>ListFragment </strong>already has its own Listview.</p><p>Here is the end result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*kWnLkDyvOoKLrlPcZFPTMg.png" /></figure><p>And it looks exactly like before which was the intended expectation!</p><h4>Fragment</h4><p>Next, we are going to use a classic Fragment that will hold our search, the search view is called fragment_search.xml. In our SearchFragment class on the method <strong>OnCreate</strong> we will initialize our <strong>SearchPageViewModel </strong>which will allow us to search and query our API to get search results. This class is different from the <strong>ListFragment </strong>class in the <strong>OnCreateView </strong>method we will need to inflate our view and bind our data to the different elements in our view like our <strong>SearchView </strong>and our<strong> ListView. </strong>What this means is that in my <strong>OnCreateView </strong>I used FindViewById as follows:</p><pre>//get searchview<br>_searchView = view.FindViewById&lt;SearchView&gt;(Resource.Id.search_view_radio);</pre><pre>//get listview<br>_listView = view.FindViewById&lt;ListView&gt;(Resource.Id.listview_search);</pre><p>In the <strong>MVP Release</strong> I will finish the application by adding tracking, a splash screen and release it to the Google Play Store.</p><p>Here is quick recap of my mini-articles:</p><ul><li><a href="https://medium.com/@damiendelaire/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-horizontal-lists-database-part-1-c5aaa778b496">[Part 1] Migrating my UWP / Xamarin Forms application to Xamarin Android building an MVP — Horizontal lists &amp; Database</a></li><li><a href="https://medium.com/@damiendelaire/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-audio-player-fragments-part-2-9a6df90cc6ac"><strong>[Part 2] Migrating my UWP / Xamarin Forms application to Xamarin Android building an MVP — Audio player &amp; Fragments</strong></a></li><li><a href="https://medium.com/@damiendelaire/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-release-build-part-3-71a12b7622b">[Part 3] From MVP to Release Build, migrating a UWP / Xamarin Forms application to Xamarin Android and submitting it to the Google Play Store</a></li></ul><p>Here is the full list of what I plan on working on and writing about:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a237ce850c1c325590f8a0bb945f189e/href">https://medium.com/media/a237ce850c1c325590f8a0bb945f189e/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a6df90cc6ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From  UWP/Xamarin Forms to Xamarin Android building an MVP ( Horizontal lists & Database) [Part 1]]]></title>
            <link>https://damiendelaire.medium.com/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-horizontal-lists-database-part-1-c5aaa778b496?source=rss-e3dfe05837a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5aaa778b496</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[xamarin]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[xamarin-android]]></category>
            <category><![CDATA[csharp]]></category>
            <dc:creator><![CDATA[Delaire Damien]]></dc:creator>
            <pubDate>Thu, 23 Jan 2020 08:57:57 GMT</pubDate>
            <atom:updated>2020-02-05T08:52:10.942Z</atom:updated>
            <content:encoded><![CDATA[<h3>From UWP/Xamarin Forms to Xamarin Android building an MVP ( Horizontal lists &amp; Database) [Part 1]</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PBpZWzIkmksERAaQ.png" /><figcaption>Xamarin Android</figcaption></figure><p>In these articles I will go over my journey of building an application that runs on multiple platforms. My original application was a classic UWP application, next I built the same application but with Xamarin Forms XAML which you can find <a href="https://medium.com/@damiendelaire/from-uwp-development-to-using-xamarin-forms-to-release-an-application-to-the-android-play-store-48ae4868a2e0">here</a>.</p><p>The aim of these articles is to go over the different steps that were needed for my application to work. The application needed to have a horizontal listview , database/caching, audio and tracking.</p><p>This audio application was built using <strong>Xamarin.Android</strong> and will release it to the Google Play Store. We already have all of the C# code in a .Net Standard library which allows us to already have the API call, the caching mechanisms, our ViewModels and our Models.</p><p>We will start by again trying to build a Horizontal list and getting the database working.</p><p><strong>This article is be broken into 3 parts:</strong></p><ul><li><a href="https://medium.com/@damiendelaire/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-horizontal-lists-database-part-1-c5aaa778b496"><strong>[Part 1] Migrating my UWP / Xamarin Forms application to Xamarin Android building an MVP — Horizontal lists &amp; Database</strong></a></li><li><a href="https://medium.com/@damiendelaire/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-audio-player-fragments-part-2-9a6df90cc6ac">[Part 2] Migrating my UWP / Xamarin Forms application to Xamarin Android building an MVP — Audio player &amp; Fragments</a></li><li><a href="https://medium.com/@damiendelaire/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-release-build-part-3-71a12b7622b">[Part 3] From MVP to Release Build, migrating a UWP / Xamarin Forms application to Xamarin Android and submitting it to the Google Play Store</a></li></ul><p><strong>This article is part of a part of a bigger series of articles that walk through the different steps that I went through to migrate an Audio application. </strong>You can find the articles <a href="https://medium.com/@damiendelaire/my-trip-from-uwp-development-to-cross-platform-development-for-a-small-audio-application-part-1-f6798bed483f">here</a>.</p><p>Here are the features that the application will have:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1fbbd6d5db32938cef24daf827bbb16c/href">https://medium.com/media/1fbbd6d5db32938cef24daf827bbb16c/href</a></iframe><p>Building this MVP allowed me to learn and use <strong>Xamarin.Android</strong>, it allowed me to better understand how to use the Android Designer, how styling worked and how to integrate C# with our Android UI. Also we will see the hurtles and the small issues I stumbled upon.</p><h3>Building a ListView with Horizontal Listview Items</h3><p>Having all of the C# backend code for the application I was able to mainly focus on how to bind the data to the UI. Having worked mainly with MVVM bindings I had to learn how Android binding worked.</p><p>I learned that to set data inside a ListView you needed to use</p><pre>Android.Widget.BaseAdapter</pre><p>Also, I learned that I needed looked for the element in the UI, I need to the method called <strong>FindViewById</strong>&lt;element type&gt; (element id).</p><p>To bind data I must search with <strong>FindViewById </strong>and look for my UI Element by its id, here is what my RadioItemAdapterViewHolder looks like</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/985f05eeec8c1da103cb041748883e6a/href">https://medium.com/media/985f05eeec8c1da103cb041748883e6a/href</a></iframe><p>Creating a double ListView, means that we have the main ListView that has for data template another ListView that is horizontal, to achieve this I added 2 new files in the layout folder (horizontal_item &amp; audio_item).</p><p>Current my MVP had 3 UI elements that were located in Layout folder as follows:</p><pre>Resources<br>   /Layout<br>       - activity_main.xml<br>       - horizontal_item.xml<br>       - audio_item.xml</pre><p>My initial horizontal_item.xml code looked as follows</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/36d9e6376eb204cf7575f1b8683d0090/href">https://medium.com/media/36d9e6376eb204cf7575f1b8683d0090/href</a></iframe><p>However this was what it produced:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*8Uu57KgfVBpd5IKrgLS7SA.png" /></figure><p>Which is not what was desired, because the radios here are listed vertically and not horizontal. Basically all I did was add a vertical list view with a fixed height in a vertical list view which is not great.</p><p>I learned that by replacing my <strong>ListView </strong>by a <strong>RecyclerView </strong>inside a <strong>HorizontalScrollView </strong>it would allow me to have a Horizontal ListView.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/119f743f541d89a7aef02da45fdd3103/href">https://medium.com/media/119f743f541d89a7aef02da45fdd3103/href</a></iframe><p>Yes it now looks much better, here is what I got:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*kWnLkDyvOoKLrlPcZFPTMg.png" /></figure><p>Which is what I wanted! I tweaked the UI of the radio cards so that it would look better. I am still getting the hang of how to use the Android Designer but I do feel that it is more natural to use. It did take me quite a while to understand how to set data templates, set data to these data template and how to design the elements. But being new the platform this is normal.</p><h3>Database in Xamarin.Android</h3><p>Getting the database to work in Xamarin Forms was a bit touchy, I really thought that I was going to encounter the same issue, however it literally took me 10 minutes to get the database working. Finding and downloading the nuget packages might have been the most time consuming.</p><p>First I installed the nuget <strong>Microsoft.EntityFrameworkCore.Sqlite</strong></p><p><a href="https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Sqlite/3.1.0">Microsoft.EntityFrameworkCore.Sqlite 3.1.0</a></p><p>Next, I added my <strong>DbStorageContext </strong>initialized at the start of my application and I was almost ready to go.</p><pre>using (var db = new DbStorageContext())<br>{<br>    db.Database.EnsureCreated();<br>}</pre><p>Next I needed to the the real database package for SQLite and not just the ORM which can be found here:</p><p><a href="https://www.nuget.org/packages/SQLitePCLRaw.lib.e_sqlite3.android/2.0.2">SQLitePCLRaw.lib.e_sqlite3.android 2.0.2</a></p><p>By adding these 2 packages my caching mechanism worked out of the box. Of course all of the logic was already done in my Net Standard library but it always amaze me how much code can be shared with .Net Standard.</p><p>In the <strong>MVP v2</strong> I will try to implement the second important part of my application which is to be able to play audio and use fragments.</p><p>Here is quick recap of my mini-articles:</p><ul><li><a href="https://medium.com/@damiendelaire/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-horizontal-lists-database-part-1-c5aaa778b496"><strong>[Part 1] Migrating my UWP / Xamarin Forms application to Xamarin Android building an MVP — Horizontal lists &amp; Database</strong></a></li><li><a href="https://medium.com/@damiendelaire/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-audio-player-fragments-part-2-9a6df90cc6ac">[Part 2] Migrating my UWP / Xamarin Forms application to Xamarin Android building an MVP — Audio player &amp; Fragments</a></li><li><a href="https://medium.com/@damiendelaire/from-uwp-xamarin-forms-to-xamarin-android-building-an-mvp-release-build-part-3-71a12b7622b">[Part 3] From MVP to Release Build, migrating a UWP / Xamarin Forms application to Xamarin Android and submitting it to the Google Play Store</a></li></ul><p>Here is the full list of what I plan on working on and writing about:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a237ce850c1c325590f8a0bb945f189e/href">https://medium.com/media/a237ce850c1c325590f8a0bb945f189e/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5aaa778b496" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From UWP development to using Xamarin Forms to release an application to the Android Play Store…]]></title>
            <link>https://damiendelaire.medium.com/from-uwp-development-to-using-xamarin-forms-to-release-an-application-to-the-android-play-store-48ae4868a2e0?source=rss-e3dfe05837a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/48ae4868a2e0</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[xaml]]></category>
            <category><![CDATA[mobile-development]]></category>
            <category><![CDATA[xamarin-forms]]></category>
            <dc:creator><![CDATA[Delaire Damien]]></dc:creator>
            <pubDate>Thu, 02 Jan 2020 14:41:01 GMT</pubDate>
            <atom:updated>2020-01-21T08:56:15.859Z</atom:updated>
            <content:encoded><![CDATA[<h3>From UWP development to using Xamarin Forms to release an application to the Android Play Store [Part 5]</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*S1QDXZgbeY7lfiJT.png" /></figure><p>In my previous articles I went over my journey of building an application that runs on multiple platforms. My original application was a classic UWP application, I tried to build the same application on different platforms to in a 4 hours time box.</p><p>Also in the previous articles we went over the different steps/issues/bugs that I encountered and now I tried to over come them, in the end because I am a XAML/C# developer going with Xamarin Forms XAML was my best bet to try and get a working application going. I am sure that someone with a different skill set would a have taken another path, as they say all roads lead to Rome.</p><p><strong>This story was broken into 5 parts:</strong></p><ul><li><a href="https://medium.com/@damiendelaire/my-trip-from-uwp-development-to-cross-platform-development-for-a-small-audio-application-part-1-f6798bed483f">[Part 1] What I originally had: one UWP application migrated to one UWP app with a .NetStandard 2.0 library</a></li><li><a href="https://medium.com/@damiendelaire/uwp-development-to-blazor-for-cross-platform-development-for-a-small-audio-application-part-2-5e44835ab50b">[Part 2] Building a Web Assemble application using Blazor Preview 8</a></li><li><a href="https://medium.com/@damiendelaire/uwp-development-to-using-uno-platform-framework-for-cross-platform-development-part-3-9c9ca5953230">[Part 3] Using the Uno Framework</a></li><li><a href="https://medium.com/@damiendelaire/from-uwp-development-to-using-xamarin-forms-for-cross-platform-development-for-a-small-audio-6475a4ea3291">[Part 4] Using Xamarin Forms to build an Android App</a></li><li><strong>[Part 5 ]From UWP development to using Xamarin Forms to release an application to the Android Play Store</strong></li></ul><p>As must of you know building an MVP is easy however releasing it to production is harder :)</p><p><strong>Here is the list of the features that I needed to add before I could release it to the Google Play Store:</strong></p><ul><li>Audio player</li><li>db for cache, and saved favorite radios from user</li><li>Settings view</li><li>Search</li><li>Tracking</li><li>Ads</li><li>Build for Release</li></ul><p><strong>Getting the rest of the application working:</strong></p><h3>Audio for Android XF</h3><p>Being able to read a stream was not as easy as I would have hoped, but the Xamarin Team has created a <strong>MediaManager </strong>Plugin for Xamarin which can be found <a href="https://devblogs.microsoft.com/xamarin/play-audio-and-video-with-the-mediamanager-plugin-for-xamarin/">here</a>. I also played with Google <strong>ExoPlayer </strong>library for Xamarin which can be found <a href="https://github.com/Baseflow/ExoPlayerXamarin">here</a>. (FYI MediaManager is based on top of ExoPlayer for Android).</p><p>I ended up using Google <strong>ExoPlayer</strong> library for Xamarin as I only needed it to work for my Android application, I did not need to extra layer that was added by the <strong>MediaManager </strong>Plugin for Xamarin.</p><h3><strong>Database</strong></h3><p>My UWP app was using Entity framework, getting it to work for Xamarin Android Forms was strait forward. In my <strong>DbStorageContext</strong> which is located in my <strong>MyAudio.Common </strong>(.Net Standard library)<strong> </strong>I just reworked the <strong>OnConfiguring </strong>method and added a service using dependency injection to get the correct db path depending on which platform I was on (in other words nothing crazy) .</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/22a032efb37318a4134f35c2f2cf7073/href">https://medium.com/media/22a032efb37318a4134f35c2f2cf7073/href</a></iframe><p>Here is the GetDatabasePath method that returns the correct path for Android (I have not tested for IOS). The DatabaseService class is located in my shared Xamarin solution.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e41d7e98efbac13f83c454d6a4fae8c/href">https://medium.com/media/8e41d7e98efbac13f83c454d6a4fae8c/href</a></iframe><h3><strong>Tracking — Xamarin.Firebase.Analytics</strong></h3><p>After adding the Xamarin plugin to correctly use Firebase Analytics in my Android app I had to use the Xamarin dependency injector and not MVVMLight because this needed to be initialized in the MainActivity.cs file as follows:</p><pre>DependencyService.Get&lt;IAnalyticsService&gt;().SendInitData(FirebaseAnalytics.GetInstance(this));</pre><p>In the CS of my views on the method <strong>OnAppearing</strong> I also had to use the classic Xamarin Forms dependency as follow to log a page view:</p><pre>protected override void OnAppearing()<br>{<br>     base.OnAppearing();<br>     DependencyService.Get&lt;IAnalyticsService&gt;()<br>                      .LogPageView(AppConstants.Pages.MainPage);<br>}</pre><h3>Ads — <strong>ViewRenderer</strong></h3><p>Adding ads allowed me to create custom <strong>ViewRenderer </strong>which I had not done before. Here is quick view of what my AdMobViewRenderer.cs file looks like.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7e94d0cec89b128bc22ce327be934657/href">https://medium.com/media/7e94d0cec89b128bc22ce327be934657/href</a></iframe><p>Which was base on this <a href="https://xamarininsider.com/2019/04/10/monetising-your-xamarin-forms-app-with-admob/">one</a>.</p><p>And here is the View which allows me to show ads in my app</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0e1fe161bc715ee753ff379dfb2c8723/href">https://medium.com/media/0e1fe161bc715ee753ff379dfb2c8723/href</a></iframe><p>by calling this:</p><pre>&lt;ads:AdMobView Grid.Row=&quot;0&quot; AdUnitId=&quot;ca-app-pub-6723289/1423225&quot; /&gt;</pre><h3>Build for Release — DEX / code shrinker / linking — wait/what?!?</h3><p>Google Play Store does not allow you to upload an application that is more then 100 MB which is an AWESOME idea, however for me it means that my tiny Radio app was to fat by 20 MB.</p><p>And here is were it got quite complicated me, R8 / DEX / Progard/ code shrinker / linker are my new horror words… After a lot of reading and testing I am just starting to understand how these work.</p><p>It was a lot of trial and error to see which best configuration worked for me but long story short activating the code shrinker would always generate an error when launching the app in release mode.</p><p>Here is a screenshot of what works for me and my application:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*c9F9EayXRFSSYxN0kOhmmQ.png" /></figure><p>By generating one package per ABI (armeabi-v7a/arm64-v8a/x86/x86_64) I was able to create smaller packages (of about 70MB) that I could upload to the store.</p><p>And this is my story of how I started porting my audio application to other platforms. However the story will not end here as this has given me lots of new idea and things that I wish to test. Now that my audio application is the the Google Play Store can I build a Release version of the same application but with Xamarin Android (not Forms) and what about Blazor?</p><h3>[Update 21 jan 2020] App Bundle</h3><p>Ask and you shall be served here is another way to reduce your application size by as much as 50% by using Android App Bundle on App Center, you can fidn the full post here:</p><p><a href="https://devblogs.microsoft.com/xamarin/android-app-bundles-azure-devops/">DevOps for Android App Bundles | Xamarin Blog</a></p><h4>More</h4><p>Here is the full list of what I plan on working on and writing about:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a237ce850c1c325590f8a0bb945f189e/href">https://medium.com/media/a237ce850c1c325590f8a0bb945f189e/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48ae4868a2e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From UWP development to using Xamarin Forms for cross-platform development for a small audio…]]></title>
            <link>https://damiendelaire.medium.com/from-uwp-development-to-using-xamarin-forms-for-cross-platform-development-for-a-small-audio-6475a4ea3291?source=rss-e3dfe05837a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/6475a4ea3291</guid>
            <category><![CDATA[xamarin-forms]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[uwp]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Delaire Damien]]></dc:creator>
            <pubDate>Tue, 31 Dec 2019 12:49:10 GMT</pubDate>
            <atom:updated>2020-01-02T14:45:39.041Z</atom:updated>
            <content:encoded><![CDATA[<h3>From UWP development to using Xamarin Forms for cross-platform development for a small audio application [Part 4]</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PBpZWzIkmksERAaQ.png" /><figcaption>Xamarin Forms for Android</figcaption></figure><p>In this article I will go over my journey of building an application that runs on multiple platforms. My original application was a classic UWP application, in this part we will go over my attempt to try and use Xamarin Forms XAML in a 4 hours time box.</p><p><strong>This article will be broken into 5 parts:</strong></p><ul><li><a href="https://medium.com/@damiendelaire/my-trip-from-uwp-development-to-cross-platform-development-for-a-small-audio-application-part-1-f6798bed483f">[Part 1] What I originally had: one UWP application migrated to one UWP app with a .NetStandard 2.0 library</a></li><li><a href="https://medium.com/@damiendelaire/uwp-development-to-blazor-for-cross-platform-development-for-a-small-audio-application-part-2-5e44835ab50b">[Part 2] Building a Web Assemble application using Blazor Preview 8</a></li><li><a href="https://medium.com/@damiendelaire/uwp-development-to-using-uno-platform-framework-for-cross-platform-development-part-3-9c9ca5953230">[Part 3] Using the Uno Framework</a></li><li><strong>[Part 4] Using Xamarin Forms to build an Android App</strong></li><li><a href="https://medium.com/@damiendelaire/from-uwp-development-to-using-xamarin-forms-to-release-an-application-to-the-android-play-store-48ae4868a2e0">[Part 5 ]From UWP development to using Xamarin Forms to release an application to the Android Play Store</a></li></ul><h3>Building my Xamarin Forms app</h3><p>After having build the demo app multiple times I was getting quite proficient at this.</p><p>The biggest hurtles that I got this time was getting the correct naming for my elements. The naming of some attributes also change however it is nothing that you shouldn’t be able to get over.</p><p>Here is what my final solution looked like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*y23VsbQSACQSy-oADVIDKg.png" /></figure><p>Again, I used my shared library <strong>MyAudio.Common </strong>to share as much code as possible and in my Xamarin Forms project added the necessary code to get the demo app working.</p><p>In the Xamarin Forms project I copied and reworked the following code:</p><ul><li>My HomeViewModel and ItemsViewModel</li><li>My app Helpers and my Services folder</li><li>My Styles, but this quickly became a problem as <strong>Xamarin Forms XAML != Microsoft XAML</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*KWL6B_7NwfxdrR0bZFvnCA.jpeg" /><figcaption><strong>Xamarin Forms XAML != Microsoft XAML</strong></figcaption></figure><h3><strong>Home view development</strong></h3><p>On my home view I used a ListView that had for <strong>ItemTemplate </strong>a <strong>CollectionView</strong>. You can find more information about the collection view <a href="https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/collectionview/">here</a>.</p><p>My collection view was set with <strong>ItemsLayout=”HorizontalList”</strong> which then allowed me to have my items set Horizontally.</p><p>Next, I needed to rewrite the XAML for the Horizontal Items because the naming from Microsoft XAML is not the same as Xamarin Forms XAML.</p><p>Here is a very quick overview of what I had to change:</p><ul><li>Border became <strong>BoxView</strong></li><li>TextBlock became <strong>Label</strong></li><li>StackPanel became <strong>StackLayout</strong></li><li>Rounded Images needs to be encapsulated in a <strong>Frame </strong>to keep the rounded effect</li><li>FYI in Xamarin Forms there are no SolidColorBrush only <strong>Color</strong></li></ul><p>Finally, this is what I was able to get to in under 4 hours :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hEMysyQhU00R1JP1j3rwDw.png" /></figure><p>The application was running and I could navigate. To be honest I did not think that I could get the application running this fast.</p><p>The overall experience of using Xamarin Forms for Android was pretty good (apart from the fake XAML naming) however the only issue that I have with Xamarin Forms and my radio app is that it is very sluggish.</p><p>This did make me want to create 2 more articles on the side:</p><ul><li>One where I will only create a <strong>Xamarin Android</strong> application to test and see if the application is sluggish, compared to a Xamarin Forms.</li><li>One where I will release the <strong>Xamarin Forms Android</strong> application to the store, and see how to use the Android Audio player.</li></ul><p>Lastly we will see:</p><ul><li><a href="https://medium.com/@damiendelaire/from-uwp-development-to-using-xamarin-forms-to-release-an-application-to-the-android-play-store-48ae4868a2e0">[Part 5 ]From UWP development to using Xamarin Forms to release an application to the Android Play Store</a></li></ul><p>Happy coding</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6475a4ea3291" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UWP development to using Uno Platform framework for cross-platform development [Part 3]]]></title>
            <link>https://damiendelaire.medium.com/uwp-development-to-using-uno-platform-framework-for-cross-platform-development-part-3-9c9ca5953230?source=rss-e3dfe05837a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c9ca5953230</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[uno-platform]]></category>
            <category><![CDATA[xaml]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[xamarin]]></category>
            <dc:creator><![CDATA[Delaire Damien]]></dc:creator>
            <pubDate>Fri, 08 Nov 2019 14:18:21 GMT</pubDate>
            <atom:updated>2020-01-02T14:45:18.355Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9hL0gYirx8WnmCaw.png" /></figure><p>In this article I will go over my journey of building an application that runs on multiple platforms. My original application was a classic UWP application, in this part we will go over my attempt to try and use <a href="https://github.com/unoplatform/uno">UNO </a>in a 4 hours time box.</p><p><strong>This article will be broken into 4 parts:</strong></p><ul><li><a href="https://medium.com/@damiendelaire/my-trip-from-uwp-development-to-cross-platform-development-for-a-small-audio-application-part-1-f6798bed483f">[Part 1] What I originally had: one UWP application migrated to one UWP app with a .NetStandard 2.0 library</a></li><li><a href="https://medium.com/@damiendelaire/uwp-development-to-blazor-for-cross-platform-development-for-a-small-audio-application-part-2-5e44835ab50b">[Part 2] Building a Web Assemble application using Blazor Preview 8</a></li><li><strong>[Part 3] Using the Uno Framework</strong></li><li><a href="https://medium.com/@damiendelaire/from-uwp-development-to-using-xamarin-forms-for-cross-platform-development-for-a-small-audio-6475a4ea3291">[Part 4] Using Xamarin Forms to build an Android App</a></li><li><a href="https://medium.com/@damiendelaire/from-uwp-development-to-using-xamarin-forms-to-release-an-application-to-the-android-play-store-48ae4868a2e0">[Part 5 ]From UWP development to using Xamarin Forms to release an application to the Android Play Store</a></li></ul><h3><strong>Uno Framework — attempt 1</strong></h3><p>My original idea was to re-use all <strong>Audio.Shared </strong>library and my <strong>MyAudio.Common,</strong> I however ended up spending to much time trying to figuring out why my app was not building and removing/editing controls that my 4 hours flew right by me. I ended with having an application that doesn&#39;t run… huge fail on my part lets go over why.</p><p>Here the project solution:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*jTNbH1gxLiD4AtuiDimYzQ.png" /></figure><p>I thought lets load all of the nuget packages that I am missing to build my android app and go for it (bulldozer mode activated).</p><p>4 hours later still not compiling because compared to Blazor where I started small and built something to make it work, here I piled on all my code into the Android app and wanted it to work, which was clearly not my best idea of the day.</p><h3>Uno Framework — attempt 2 (the smarter way)</h3><p>This time I decided to only use <strong>MyAudio.Common </strong>and copy only the home screen XAML &amp; C# code into Uno, After some hoop jumping I got it to work!</p><p>It was much faster to recompile and build the app using the UWP project then the android one.</p><p>Here are the parts of my code that I migrated over to my UNO project:</p><ul><li>My HomeViewModel and ItemsViewModel</li><li>My app Helpers and my Services folder</li><li>My TemplateSelectors</li><li>My Styles</li></ul><p>The biggest issues I got were when I was using a library that was not supported by Android, but I could live without the libraries that were not working as expected.</p><p>Here is what I was able to get done in under 4 hours, on <strong>UWP</strong> we had this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gpQxhUjfolE1fMhKA5M1ZQ.png" /></figure><p><strong>Android </strong>was a bit more tricky as it would seem that it doesn&#39;t like:</p><ul><li>When you try to in brick a Horizontal GridView inside a ListView.</li><li>It doesn&#39;t like ItemTemplateSelector on a ListView or a Gridview.</li><li>I encountered a weird issue where the application would not update correctly in the emulator (rebuild and Deploy), if I changed to banner color to red I might need to clean/rebuild/redeploy the app 3 or 4 times before the correct color would show up in the emulator (I am guessing that I have not setup something correctly).</li></ul><p>Here is what the Emulator would give me, it doesn&#39;t seem to render the my ItemTemplate correctly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jZnNNcgNAzt91ijG0CvpVg.png" /></figure><p>I tried setting my ItemTemplate directly inside if my ListView but got the same result, here is a sample of my code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5110c3b7d31e59d007979b7c9fca6ad6/href">https://medium.com/media/5110c3b7d31e59d007979b7c9fca6ad6/href</a></iframe><p>And that is how far I got in 4 hours, my UNO UWP is working, but I will need to find a solution for my Android app. I could not test on iOS because I need a Mac thank you apple… (ill see if I cant get a macbook from work to test this).</p><p>Ill try to update this article with why the template was not rendering in a follow up Article.</p><p>In the next parts we will see:</p><ul><li><a href="https://medium.com/@damiendelaire/from-uwp-development-to-using-xamarin-forms-for-cross-platform-development-for-a-small-audio-6475a4ea3291">[Part 4] Using Xamarin Forms to build an Android App</a></li><li><a href="https://medium.com/@damiendelaire/from-uwp-development-to-using-xamarin-forms-to-release-an-application-to-the-android-play-store-48ae4868a2e0">[Part 5 ]From UWP development to using Xamarin Forms to release an application to the Android Play Store</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c9ca5953230" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>