Skip to content

Commit

Permalink
Fix issue dewango#89 and change PCL to netstandard
Browse files Browse the repository at this point in the history
  • Loading branch information
mario-velasco committed Mar 16, 2018
1 parent 77fd676 commit ceb867d
Show file tree
Hide file tree
Showing 11 changed files with 478 additions and 159 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Components
[Pp]ackages
*.userprefs
Resource.designer.cs

\.vs/
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

Expand Down
142 changes: 104 additions & 38 deletions BottomBar.Droid/BottomBar.Droid.csproj

Large diffs are not rendered by default.

26 changes: 15 additions & 11 deletions BottomBar.Droid/Renderers/BottomBarPageRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,19 @@ public class BottomBarPageRenderer : VisualElementRenderer<BottomBarPage>, IOnTa
FrameLayout _frameLayout;
IPageController _pageController;
IDictionary<Page, BottomBarBadge> _badges;
Android.Content.Context _context;

public BottomBarPageRenderer ()
{
public BottomBarPageRenderer (Android.Content.Context context) : base(context)
{
AutoPackage = false;
}
_context = context;
}

#region IOnTabClickListener
public virtual void OnTabSelected (int position)
{
//Do we need this call? It's also done in OnElementPropertyChanged
SwitchContent(Element.Children [position]);
//SwitchContent(Element.Children [position]);
var bottomBarPage = Element as BottomBarPage;
bottomBarPage.CurrentPage = Element.Children[position];
//bottomBarPage.RaiseCurrentPageChanged();
Expand All @@ -75,7 +77,7 @@ protected override void Dispose (bool disposing)
IVisualElementRenderer pageRenderer = Platform.GetRenderer (pageToRemove);

if (pageRenderer != null) {
pageRenderer.ViewGroup.RemoveFromParent ();
pageRenderer.View.RemoveFromParent ();
pageRenderer.Dispose ();
}

Expand Down Expand Up @@ -132,10 +134,12 @@ protected override void OnElementChanged (ElementChangedEventArgs<BottomBarPage>
if (_bottomBar == null) {
_pageController = PageController.Create (bottomBarPage);

// create a view which will act as container for Page's
_frameLayout = new FrameLayout (Forms.Context);
_frameLayout.LayoutParameters = new FrameLayout.LayoutParams (LayoutParams.MatchParent, LayoutParams.MatchParent, GravityFlags.Fill);
AddView (_frameLayout, 0);
// create a view which will act as container for Page's
_frameLayout = new FrameLayout(_context)
{
LayoutParameters = new FrameLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent, GravityFlags.Fill)
};
AddView (_frameLayout, 0);

// create bottomBar control
_bottomBar = BottomNavigationBar.BottomBar.Attach (_frameLayout, null);
Expand Down Expand Up @@ -197,10 +201,10 @@ protected virtual void SwitchContent (Page view)
}

if (Platform.GetRenderer (view) == null) {
Platform.SetRenderer (view, Platform.CreateRenderer (view));
Platform.SetRenderer (view, Platform.CreateRendererWithContext (view, _context));
}

_frameLayout.AddView (Platform.GetRenderer (view).ViewGroup);
_frameLayout.AddView (Platform.GetRenderer (view).View);
}

protected override void OnLayout (bool changed, int l, int t, int r, int b)
Expand Down
11 changes: 11 additions & 0 deletions BottomBar.Droid/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
30 changes: 19 additions & 11 deletions BottomBar.Droid/packages.config
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BottomNavigationBar" version="1.4.0.2" targetFramework="monoandroid70" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="MonoAndroid60" />
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="23.3.0" targetFramework="MonoAndroid60" />
<package id="Xamarin.Android.Support.Design" version="23.3.0" targetFramework="MonoAndroid60" />
<package id="Xamarin.Android.Support.v4" version="23.3.0" targetFramework="MonoAndroid60" />
<package id="Xamarin.Android.Support.v7.AppCompat" version="23.3.0" targetFramework="MonoAndroid60" />
<package id="Xamarin.Android.Support.v7.CardView" version="23.3.0" targetFramework="MonoAndroid60" />
<package id="Xamarin.Android.Support.v7.MediaRouter" version="23.3.0" targetFramework="MonoAndroid60" />
<package id="Xamarin.Android.Support.v7.RecyclerView" version="23.3.0" targetFramework="MonoAndroid60" />
<package id="Xamarin.Android.Support.Vector.Drawable" version="23.3.0" targetFramework="MonoAndroid60" />
<package id="Xamarin.Forms" version="2.3.2.127" targetFramework="monoandroid70" />
<package id="BottomNavigationBar" version="1.4.0.3" targetFramework="monoandroid81" />
<package id="Newtonsoft.Json" version="11.0.1" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="25.4.0.2" targetFramework="monoandroid81" />
<package id="Xamarin.Android.Support.Annotations" version="25.4.0.2" targetFramework="monoandroid81" />
<package id="Xamarin.Android.Support.Compat" version="25.4.0.2" targetFramework="monoandroid81" />
<package id="Xamarin.Android.Support.Core.UI" version="25.4.0.2" targetFramework="monoandroid81" />
<package id="Xamarin.Android.Support.Core.Utils" version="25.4.0.2" targetFramework="monoandroid81" />
<package id="Xamarin.Android.Support.Design" version="25.4.0.2" targetFramework="monoandroid81" />
<package id="Xamarin.Android.Support.Fragment" version="25.4.0.2" targetFramework="monoandroid81" />
<package id="Xamarin.Android.Support.Media.Compat" version="25.4.0.2" targetFramework="monoandroid81" />
<package id="Xamarin.Android.Support.Transition" version="25.4.0.2" targetFramework="monoandroid81" />
<package id="Xamarin.Android.Support.v4" version="25.4.0.2" targetFramework="monoandroid81" />
<package id="Xamarin.Android.Support.v7.AppCompat" version="25.4.0.2" targetFramework="monoandroid81" />
<package id="Xamarin.Android.Support.v7.CardView" version="25.4.0.2" targetFramework="monoandroid81" />
<package id="Xamarin.Android.Support.v7.MediaRouter" version="25.4.0.2" targetFramework="monoandroid81" />
<package id="Xamarin.Android.Support.v7.Palette" version="25.4.0.2" targetFramework="monoandroid81" />
<package id="Xamarin.Android.Support.v7.RecyclerView" version="25.4.0.2" targetFramework="monoandroid81" />
<package id="Xamarin.Android.Support.Vector.Drawable" version="25.4.0.2" targetFramework="monoandroid81" />
<package id="Xamarin.Forms" version="2.5.0.280555" targetFramework="monoandroid81" />
</packages>
58 changes: 5 additions & 53 deletions BottomBar.XamarinForms/BottomBar.XamarinForms.csproj
Original file line number Diff line number Diff line change
@@ -1,57 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BB1D801D-5EC3-471D-B9EA-98C48D785BAA}</ProjectGuid>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<UseMSBuildEngine>true</UseMSBuildEngine>
<OutputType>Library</OutputType>
<RootNamespace>BottomBar.XamarinForms</RootNamespace>
<AssemblyName>BottomBar.XamarinForms</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
<ReleaseVersion>0.8</ReleaseVersion>
<TargetFramework>netstandard2.0</TargetFramework>
<AssetTargetFallback>$(AssetTargetFallback);portable-win+net45+wp8+win81+wpa8</AssetTargetFallback>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="BottomBarPage.cs" />
<Compile Include="BottomBarPageExtensions.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Core">
<HintPath>..\packages\Xamarin.Forms.2.3.2.127\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform">
<HintPath>..\packages\Xamarin.Forms.2.3.2.127\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml">
<HintPath>..\packages\Xamarin.Forms.2.3.2.127\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<PackageReference Include="Xamarin.Forms" Version="2.5.0.280555" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\packages\Xamarin.Forms.2.3.2.127\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.3.2.127\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
</Project>
</Project>
44 changes: 1 addition & 43 deletions BottomBar.XamarinForms/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,43 +1 @@
/*
* BottomNavigationBar for Xamarin Forms
* Copyright (c) 2016 Thrive GmbH and others (https://github.com/thrive-now).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Reflection;
using System.Runtime.CompilerServices;

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle ("BottomBar.XamarinForms")]
[assembly: AssemblyDescription ("Bottom Bar implementation for Xamarin Forms")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("sebs")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion ("1.0.*")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]


Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<OutputType>Library</OutputType>
<RootNamespace>BottomBarXFExampleXaml.Droid</RootNamespace>
<AssemblyName>BottomBarXFExampleXaml.Droid</AssemblyName>
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v8.1</TargetFrameworkVersion>
<AndroidApplication>True</AndroidApplication>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
Expand Down
Loading

0 comments on commit ceb867d

Please sign in to comment.