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

Flight Searching #43

Open
wants to merge 1 commit 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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v8.1</TargetFrameworkVersion>
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
Expand Down Expand Up @@ -93,6 +92,11 @@
<AndroidResource Include="Resources\drawable\xamarin_logo.png" />
<AndroidResource Include="Resources\drawable\tab_about.png" />
<AndroidResource Include="Resources\drawable\tab_feed.png" />
<AndroidResource Include="Resources\drawable\dashed_line_5.png" />
<AndroidResource Include="Resources\drawable\icon_alert_circle.png" />
<AndroidResource Include="Resources\drawable\icon_plane.png" />
<AndroidResource Include="Resources\drawable\shadow_1.png" />
<AndroidResource Include="Resources\drawable\unknown_airline.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\drawable-hdpi\" />
Expand All @@ -102,7 +106,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CollectionViewChallenge\CollectionViewChallenge.csproj">
<Project>{BA39825E-3CF8-4A31-B120-782B2A651542}</Project>
<Project>{9A9DDEE5-8C48-4274-82D7-22EB79C97206}</Project>
<Name>CollectionViewChallenge</Name>
</ProjectReference>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.CollectionViewChallenge">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="27" />
<application android:label="CollectionViewChallenge.Android"></application>
</manifest>
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="27" />
<application android:label="CollectionViewChallenge.Android"></application>
</manifest>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@
<BundleResource Include="Resources\xamarin_logo%402x.png" />
<BundleResource Include="Resources\xamarin_logo%403x.png" />
<InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
<BundleResource Include="Resources\unknown_airline.png" />
<BundleResource Include="Resources\dashed_line_5.png" />
<BundleResource Include="Resources\icon_alert_circle.png" />
<BundleResource Include="Resources\icon_plane.png" />
<BundleResource Include="Resources\shadow_1.png" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
Expand All @@ -139,7 +144,7 @@
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\CollectionViewChallenge\CollectionViewChallenge.csproj">
<Project>{BA39825E-3CF8-4A31-B120-782B2A651542}</Project>
<Project>{9A9DDEE5-8C48-4274-82D7-22EB79C97206}</Project>
<Name>CollectionViewChallenge</Name>
</ProjectReference>
</ItemGroup>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
<ItemGroup>
<Folder Include="Models\" />
<Folder Include="ViewModels\" />
<Folder Include="Converters\" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Globalization;
using Xamarin.Forms;
namespace CollectionViewChallenge.Converters {
public class RupiahFormatConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
long curval = System.Convert.ToInt64(value);
if (curval == -1) return "-";
var dd = curval.ToString("C", System.Globalization.CultureInfo.GetCultureInfo("id-ID"));
return ("IDR " + dd.ToLower().Replace("rp", "")).Trim();
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
var dd = (value is long ? (long)value : 0).ToString("C", System.Globalization.CultureInfo.GetCultureInfo("id-ID"));
return dd.ToLower().Replace("rp", "");
}
}
}
18 changes: 18 additions & 0 deletions CollectionViewChallenge/CollectionViewChallenge/ItemSelector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using Xamarin.Forms;
using CollectionViewChallenge.Models;

namespace CollectionViewChallenge {
public class ItemSelector : DataTemplateSelector {

protected override DataTemplate OnSelectTemplate(object item, BindableObject container) {
var ticket = (FlightTicket)item;
if (ticket.IsFooter) return BlankFooter;
else if (ticket.IsHeader) return BlankHeader;
else return FlightTemplate;
}
public DataTemplate FlightTemplate { get; set; }
public DataTemplate BlankHeader { get; set; }
public DataTemplate BlankFooter { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
namespace CollectionViewChallenge.Models {
public class FlightTicket {
public string BoardingTime { get; set; }
public string DepartureTime { get; set; }
public string BoardingAirport { get; set; }
public string DepartureAirport { get; set; }
public string FlightTime { get; set; }
public int Stops { get; set; }
public long Price { get; set; }
public long PriceCoret {
get {
return Price + 100000;
}
}
public string AirlineLogo { get; set; }
public bool IsHeader { get; set; }
public bool IsFooter { get; set; }
public bool IsTicket { get; set; }
}
}
Loading