Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make CarouselLayout Compatible with PCL project #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/CustomLayouts.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CustomLayouts", "CustomLayouts\CustomLayouts.shproj", "{77990895-4247-4E5A-9474-E3456B62A28D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomLayouts.iOS", "iOS\CustomLayouts.iOS.csproj", "{E97C5E1F-83A0-4CD5-B1E1-91897B8C9F86}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomLayouts.Droid", "Droid\CustomLayouts.Droid.csproj", "{26422919-3EAD-440B-B516-E41B10D2AC56}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomLayouts", "CustomLayouts\CustomLayouts.csproj", "{DF4E0FFF-BF2D-4BCB-BFB8-14F7CE6D1660}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Expand Down Expand Up @@ -41,5 +41,17 @@ Global
{E97C5E1F-83A0-4CD5-B1E1-91897B8C9F86}.Release|iPhone.Build.0 = Release|iPhone
{E97C5E1F-83A0-4CD5-B1E1-91897B8C9F86}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{E97C5E1F-83A0-4CD5-B1E1-91897B8C9F86}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{DF4E0FFF-BF2D-4BCB-BFB8-14F7CE6D1660}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{DF4E0FFF-BF2D-4BCB-BFB8-14F7CE6D1660}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{DF4E0FFF-BF2D-4BCB-BFB8-14F7CE6D1660}.Release|iPhone.ActiveCfg = Release|Any CPU
{DF4E0FFF-BF2D-4BCB-BFB8-14F7CE6D1660}.Release|iPhone.Build.0 = Release|Any CPU
{DF4E0FFF-BF2D-4BCB-BFB8-14F7CE6D1660}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{DF4E0FFF-BF2D-4BCB-BFB8-14F7CE6D1660}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{DF4E0FFF-BF2D-4BCB-BFB8-14F7CE6D1660}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{DF4E0FFF-BF2D-4BCB-BFB8-14F7CE6D1660}.Debug|iPhone.Build.0 = Debug|Any CPU
{DF4E0FFF-BF2D-4BCB-BFB8-14F7CE6D1660}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DF4E0FFF-BF2D-4BCB-BFB8-14F7CE6D1660}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF4E0FFF-BF2D-4BCB-BFB8-14F7CE6D1660}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF4E0FFF-BF2D-4BCB-BFB8-14F7CE6D1660}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
19 changes: 4 additions & 15 deletions src/CustomLayouts/Controls/CarouselLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Timers;
using Xamarin.Forms;

namespace CustomLayouts.Controls
Expand All @@ -17,7 +16,6 @@ public enum IndicatorStyleEnum
}

readonly StackLayout _stack;
Timer _selectedItemTimer;

int _selectedIndex;

Expand All @@ -31,13 +29,6 @@ public CarouselLayout ()
};

Content = _stack;

_selectedItemTimer = new Timer {
AutoReset = false,
Interval = 300
};

_selectedItemTimer.Elapsed += SelectedItemTimerElapsed;
}

public IndicatorStyleEnum IndicatorStyle { get; set; }
Expand Down Expand Up @@ -80,12 +71,10 @@ protected override void LayoutChildren (double x, double y, double width, double

void UpdateSelectedItem ()
{
_selectedItemTimer.Stop ();
_selectedItemTimer.Start ();
}

void SelectedItemTimerElapsed (object sender, ElapsedEventArgs e) {
SelectedItem = SelectedIndex > -1 ? Children [SelectedIndex].BindingContext : null;
Device.StartTimer (TimeSpan.FromMilliseconds (300), () => {
SelectedItem = SelectedIndex > -1 ? Children [SelectedIndex].BindingContext : null;
return false;
});
}

public static readonly BindableProperty ItemsSourceProperty =
Expand Down
58 changes: 58 additions & 0 deletions src/CustomLayouts/CustomLayouts.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DF4E0FFF-BF2D-4BCB-BFB8-14F7CE6D1660}</ProjectGuid>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<UseMSBuildEngine>true</UseMSBuildEngine>
<OutputType>Library</OutputType>
<RootNamespace>CustomLayouts</RootNamespace>
<AssemblyName>CustomLayouts</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
</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>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="App.cs" />
<Compile Include="HomePage.cs" />
<Compile Include="HomeView.cs" />
<Compile Include="PagerIndicatorDots.cs" />
<Compile Include="PagerIndicatorTabs.cs" />
<Compile Include="SwitcherPage.cs" />
<Compile Include="Controls\CarouselLayout.cs" />
<Compile Include="ViewModels\BaseViewModel.cs" />
<Compile Include="ViewModels\SwitcherPageViewModel.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Xamarin.Forms.Core">
<HintPath>..\packages\Xamarin.Forms.1.4.2.6359\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.1.4.2.6359\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.1.4.2.6359\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\packages\Xamarin.Forms.1.4.2.6359\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.1.4.2.6359\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
</Project>
26 changes: 0 additions & 26 deletions src/CustomLayouts/CustomLayouts.projitems

This file was deleted.

11 changes: 0 additions & 11 deletions src/CustomLayouts/CustomLayouts.shproj

This file was deleted.

26 changes: 26 additions & 0 deletions src/CustomLayouts/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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("CustomLayouts")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Junian.Net")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("(c) Junian Triajianto")]
[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("")]
5 changes: 1 addition & 4 deletions src/CustomLayouts/ViewModels/BaseViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
using System;
using System.ComponentModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xamarin.Forms;
using System.Security.Cryptography;
using System.Text;

namespace CustomLayouts.ViewModels
{
Expand Down
4 changes: 4 additions & 0 deletions src/CustomLayouts/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Xamarin.Forms" version="1.4.2.6359" targetFramework="portable45-net45+win8+wp8+wpa81" />
</packages>
6 changes: 3 additions & 3 deletions src/Droid/CustomLayouts.Droid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<AndroidApplication>True</AndroidApplication>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
<AssemblyName>CustomLayouts.Droid</AssemblyName>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v7.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -85,7 +85,7 @@
<AndroidResource Include="Resources\drawable-xxhdpi\icon.png" />
<AndroidResource Include="Resources\drawable\pin.png" />
</ItemGroup>
<Import Project="..\CustomLayouts\CustomLayouts.projitems" Label="Shared" Condition="Exists('..\CustomLayouts\CustomLayouts.projitems')" />
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
<Import Project="..\CustomLayouts\CustomLayouts.Shared.projitems" Label="Shared" Condition="Exists('..\CustomLayouts\CustomLayouts.Shared.projitems')" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Import Project="..\packages\Xamarin.Forms.1.4.2.6359\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.1.4.2.6359\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
</Project>
2 changes: 1 addition & 1 deletion src/Droid/Resources/Resource.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/iOS/CustomLayouts.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,15 @@
<ITunesArtwork Include="ITunesArtwork" />
<ITunesArtwork Include="ITunesArtwork%402x" />
</ItemGroup>
<Import Project="..\CustomLayouts\CustomLayouts.projitems" Label="Shared" Condition="Exists('..\CustomLayouts\CustomLayouts.projitems')" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<Import Project="..\packages\Xamarin.Forms.1.4.2.6359\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.1.4.2.6359\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
<ItemGroup>
<Folder Include="Renderers\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CustomLayouts\CustomLayouts.csproj">
<Project>{DF4E0FFF-BF2D-4BCB-BFB8-14F7CE6D1660}</Project>
<Name>CustomLayouts</Name>
</ProjectReference>
</ItemGroup>
</Project>