Added "My CLEAN way" sample
|
@ -0,0 +1,19 @@
|
||||||
|
Any raw assets you want to be deployed with your application can be placed in
|
||||||
|
this directory (and child directories) and given a Build Action of "AndroidAsset".
|
||||||
|
|
||||||
|
These files will be deployed with you package and will be accessible using Android's
|
||||||
|
AssetManager, like this:
|
||||||
|
|
||||||
|
public class ReadAsset : Activity
|
||||||
|
{
|
||||||
|
protected override void OnCreate (Bundle bundle)
|
||||||
|
{
|
||||||
|
base.OnCreate (bundle);
|
||||||
|
|
||||||
|
InputStream input = Assets.Open ("my_asset.txt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Additionally, some Android functions will automatically load asset files:
|
||||||
|
|
||||||
|
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
|
|
@ -0,0 +1,36 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
using Android.App;
|
||||||
|
using Android.Content.PM;
|
||||||
|
using Android.Runtime;
|
||||||
|
using Android.Views;
|
||||||
|
using Android.Widget;
|
||||||
|
using Android.OS;
|
||||||
|
using Prism;
|
||||||
|
using Prism.Ioc;
|
||||||
|
using FFImageLoading.Forms.Droid;
|
||||||
|
|
||||||
|
namespace my_clean_way.Droid
|
||||||
|
{
|
||||||
|
[Activity(Label = "my_clean_way", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||||
|
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||||
|
{
|
||||||
|
protected override void OnCreate(Bundle savedInstanceState)
|
||||||
|
{
|
||||||
|
TabLayoutResource = Resource.Layout.Tabbar;
|
||||||
|
ToolbarResource = Resource.Layout.Toolbar;
|
||||||
|
|
||||||
|
base.OnCreate(savedInstanceState);
|
||||||
|
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
|
||||||
|
CachedImageRenderer.Init(false);
|
||||||
|
LoadApplication(new App(new AndroidInitializer()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class AndroidInitializer : IPlatformInitializer
|
||||||
|
{
|
||||||
|
public void RegisterTypes(IContainerRegistry containerRegistry)
|
||||||
|
{
|
||||||
|
//TODO: Register your service here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?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="giraldez.apps.My_Clean_Way">
|
||||||
|
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="27" />
|
||||||
|
<application android:label="my_clean_way.Android">
|
||||||
|
</application>
|
||||||
|
</manifest>
|
|
@ -0,0 +1,34 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using Android.App;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("my_clean_way.Android")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("my_clean_way.Android")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
|
|
||||||
|
// Add some common permissions, these can be removed if not needed
|
||||||
|
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
|
||||||
|
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
|
|
@ -0,0 +1,50 @@
|
||||||
|
Images, layout descriptions, binary blobs and string dictionaries can be included
|
||||||
|
in your application as resource files. Various Android APIs are designed to
|
||||||
|
operate on the resource IDs instead of dealing with images, strings or binary blobs
|
||||||
|
directly.
|
||||||
|
|
||||||
|
For example, a sample Android app that contains a user interface layout (main.xml),
|
||||||
|
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
|
||||||
|
would keep its resources in the "Resources" directory of the application:
|
||||||
|
|
||||||
|
Resources/
|
||||||
|
drawable-hdpi/
|
||||||
|
icon.png
|
||||||
|
|
||||||
|
drawable-ldpi/
|
||||||
|
icon.png
|
||||||
|
|
||||||
|
drawable-mdpi/
|
||||||
|
icon.png
|
||||||
|
|
||||||
|
layout/
|
||||||
|
main.xml
|
||||||
|
|
||||||
|
values/
|
||||||
|
strings.xml
|
||||||
|
|
||||||
|
In order to get the build system to recognize Android resources, set the build action to
|
||||||
|
"AndroidResource". The native Android APIs do not operate directly with filenames, but
|
||||||
|
instead operate on resource IDs. When you compile an Android application that uses resources,
|
||||||
|
the build system will package the resources for distribution and generate a class called
|
||||||
|
"Resource" that contains the tokens for each one of the resources included. For example,
|
||||||
|
for the above Resources layout, this is what the Resource class would expose:
|
||||||
|
|
||||||
|
public class Resource {
|
||||||
|
public class drawable {
|
||||||
|
public const int icon = 0x123;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class layout {
|
||||||
|
public const int main = 0x456;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class strings {
|
||||||
|
public const int first_string = 0xabc;
|
||||||
|
public const int second_string = 0xbcd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
|
||||||
|
to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
|
||||||
|
string in the dictionary file values/strings.xml.
|
7513
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.Android/Resources/Resource.designer.cs
сгенерированный
Normal file
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.Android/Resources/drawable/fav.png
Normal file
После Ширина: | Высота: | Размер: 354 B |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.Android/Resources/drawable/no_fav.png
Normal file
После Ширина: | Высота: | Размер: 523 B |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.Android/Resources/drawable/star.png
Normal file
После Ширина: | Высота: | Размер: 354 B |
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/sliding_tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/colorPrimary" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:tabIndicatorColor="@android:color/white" app:tabGravity="fill" app:tabMode="fixed" />
|
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/colorPrimary" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" android:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@color/launcher_background" />
|
||||||
|
<foreground android:drawable="@mipmap/launcher_foreground" />
|
||||||
|
</adaptive-icon>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@color/launcher_background" />
|
||||||
|
<foreground android:drawable="@mipmap/launcher_foreground" />
|
||||||
|
</adaptive-icon>
|
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.Android/Resources/mipmap-hdpi/Icon.png
Normal file
После Ширина: | Высота: | Размер: 4.6 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.Android/Resources/mipmap-hdpi/launcher_foreground.png
Normal file
После Ширина: | Высота: | Размер: 11 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.Android/Resources/mipmap-mdpi/icon.png
Normal file
После Ширина: | Высота: | Размер: 2.7 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.Android/Resources/mipmap-mdpi/launcher_foreground.png
Normal file
После Ширина: | Высота: | Размер: 6.3 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.Android/Resources/mipmap-xhdpi/Icon.png
Normal file
После Ширина: | Высота: | Размер: 6.9 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.Android/Resources/mipmap-xhdpi/launcher_foreground.png
Normal file
После Ширина: | Высота: | Размер: 18 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.Android/Resources/mipmap-xxhdpi/Icon.png
Normal file
После Ширина: | Высота: | Размер: 12 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.Android/Resources/mipmap-xxhdpi/launcher_foreground.png
Normal file
После Ширина: | Высота: | Размер: 33 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.Android/Resources/mipmap-xxxhdpi/Icon.png
Normal file
После Ширина: | Высота: | Размер: 19 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png
Normal file
После Ширина: | Высота: | Размер: 51 KiB |
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="launcher_background">#FFFFFF</color>
|
||||||
|
<color name="colorPrimary">#3F51B5</color>
|
||||||
|
<color name="colorPrimaryDark">#303F9F</color>
|
||||||
|
<color name="colorAccent">#FF4081</color>
|
||||||
|
</resources>
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<style name="MainTheme" parent="MainTheme.Base">
|
||||||
|
</style>
|
||||||
|
<!-- Base theme applied no matter what API -->
|
||||||
|
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
|
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
|
||||||
|
<item name="windowNoTitle">true</item>
|
||||||
|
<!--We will be using the toolbar so no need to show ActionBar-->
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
|
||||||
|
<!-- colorPrimary is used for the default action bar background -->
|
||||||
|
<item name="colorPrimary">#2196F3</item>
|
||||||
|
<!-- colorPrimaryDark is used for the status bar -->
|
||||||
|
<item name="colorPrimaryDark">#1976D2</item>
|
||||||
|
<!-- colorAccent is used as the default value for colorControlActivated
|
||||||
|
which is used to tint widgets -->
|
||||||
|
<item name="colorAccent">#FF4081</item>
|
||||||
|
<!-- You can also set colorControlNormal, colorControlActivated
|
||||||
|
colorControlHighlight and colorSwitchThumbNormal. -->
|
||||||
|
<item name="windowActionModeOverlay">true</item>
|
||||||
|
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
|
||||||
|
</style>
|
||||||
|
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
|
||||||
|
<item name="colorAccent">#FF4081</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
|
@ -0,0 +1,110 @@
|
||||||
|
<?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>{CFD18FFF-17C6-47F9-BC3C-A5552EAC06F0}</ProjectGuid>
|
||||||
|
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<TemplateGuid>{c9e5eea5-ca05-42a1-839b-61506e0a37df}</TemplateGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<RootNamespace>my_clean_way.Droid</RootNamespace>
|
||||||
|
<AssemblyName>my_clean_way.Android</AssemblyName>
|
||||||
|
<AndroidApplication>True</AndroidApplication>
|
||||||
|
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||||
|
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||||
|
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||||
|
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||||
|
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||||
|
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
|
||||||
|
<TargetFrameworkVersion>v8.1</TargetFrameworkVersion>
|
||||||
|
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>portable</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AndroidLinkMode>None</AndroidLinkMode>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release</OutputPath>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AndroidManagedSymbols>true</AndroidManagedSymbols>
|
||||||
|
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Mono.Android" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Xamarin.Forms" Version="3.4.0.1008975" />
|
||||||
|
<PackageReference Include="Xamarin.Android.Support.Design" Version="27.0.2.1" />
|
||||||
|
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="27.0.2.1" />
|
||||||
|
<PackageReference Include="Xamarin.Android.Support.v4" Version="27.0.2.1" />
|
||||||
|
<PackageReference Include="Xamarin.Android.Support.v7.CardView" Version="27.0.2.1" />
|
||||||
|
<PackageReference Include="Xamarin.Android.Support.v7.MediaRouter" Version="27.0.2.1" />
|
||||||
|
<PackageReference Include="Prism.Forms">
|
||||||
|
<Version>7.1.0.431</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Xamarin.FFImageLoading.Forms">
|
||||||
|
<Version>2.4.4.859</Version>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="MainActivity.cs" />
|
||||||
|
<Compile Include="Resources\Resource.Designer.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\AboutResources.txt" />
|
||||||
|
<None Include="Assets\AboutAssets.txt" />
|
||||||
|
<None Include="Properties\AndroidManifest.xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AndroidResource Include="Resources\layout\Tabbar.axml" />
|
||||||
|
<AndroidResource Include="Resources\layout\Toolbar.axml" />
|
||||||
|
<AndroidResource Include="Resources\values\styles.xml" />
|
||||||
|
<AndroidResource Include="Resources\values\colors.xml" />
|
||||||
|
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon.xml" />
|
||||||
|
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon_round.xml" />
|
||||||
|
<AndroidResource Include="Resources\mipmap-hdpi\Icon.png" />
|
||||||
|
<AndroidResource Include="Resources\mipmap-hdpi\launcher_foreground.png" />
|
||||||
|
<AndroidResource Include="Resources\mipmap-mdpi\Icon.png" />
|
||||||
|
<AndroidResource Include="Resources\mipmap-mdpi\launcher_foreground.png" />
|
||||||
|
<AndroidResource Include="Resources\mipmap-xhdpi\Icon.png" />
|
||||||
|
<AndroidResource Include="Resources\mipmap-xhdpi\launcher_foreground.png" />
|
||||||
|
<AndroidResource Include="Resources\mipmap-xxhdpi\Icon.png" />
|
||||||
|
<AndroidResource Include="Resources\mipmap-xxhdpi\launcher_foreground.png" />
|
||||||
|
<AndroidResource Include="Resources\mipmap-xxxhdpi\Icon.png" />
|
||||||
|
<AndroidResource Include="Resources\mipmap-xxxhdpi\launcher_foreground.png" />
|
||||||
|
<AndroidResource Include="Resources\drawable\star.png" />
|
||||||
|
<AndroidResource Include="Resources\drawable\fav.png" />
|
||||||
|
<AndroidResource Include="Resources\drawable\no_fav.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Resources\drawable\" />
|
||||||
|
<Folder Include="Resources\drawable-hdpi\" />
|
||||||
|
<Folder Include="Resources\drawable-xhdpi\" />
|
||||||
|
<Folder Include="Resources\drawable-xxhdpi\" />
|
||||||
|
<Folder Include="Resources\drawable-xxxhdpi\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\my_clean_way\my_clean_way.csproj">
|
||||||
|
<Project>{D2242430-4F3A-4DA8-94DF-FF374AB78855}</Project>
|
||||||
|
<Name>my_clean_way</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||||
|
</Project>
|
|
@ -0,0 +1,41 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using FFImageLoading.Forms.Touch;
|
||||||
|
using Foundation;
|
||||||
|
using Prism;
|
||||||
|
using Prism.Ioc;
|
||||||
|
using UIKit;
|
||||||
|
|
||||||
|
namespace my_clean_way.iOS
|
||||||
|
{
|
||||||
|
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||||
|
// User Interface of the application, as well as listening (and optionally responding) to
|
||||||
|
// application events from iOS.
|
||||||
|
[Register("AppDelegate")]
|
||||||
|
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// This method is invoked when the application has loaded and is ready to run. In this
|
||||||
|
// method you should instantiate the window, load the UI into it and then make the window
|
||||||
|
// visible.
|
||||||
|
//
|
||||||
|
// You have 17 seconds to return from this method, or iOS will terminate your application.
|
||||||
|
//
|
||||||
|
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
|
||||||
|
{
|
||||||
|
global::Xamarin.Forms.Forms.Init();
|
||||||
|
LoadApplication(new App(new iOSInitializer()));
|
||||||
|
CachedImageRenderer.Init();
|
||||||
|
return base.FinishedLaunching(app, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class iOSInitializer : IPlatformInitializer
|
||||||
|
{
|
||||||
|
public void RegisterTypes(IContainerRegistry containerRegistry)
|
||||||
|
{
|
||||||
|
//TODO: Register your service here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,117 @@
|
||||||
|
{
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"size": "20x20",
|
||||||
|
"idiom": "iphone",
|
||||||
|
"filename": "Icon40.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"size": "20x20",
|
||||||
|
"idiom": "iphone",
|
||||||
|
"filename": "Icon60.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"size": "29x29",
|
||||||
|
"idiom": "iphone",
|
||||||
|
"filename": "Icon58.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"size": "29x29",
|
||||||
|
"idiom": "iphone",
|
||||||
|
"filename": "Icon87.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"size": "40x40",
|
||||||
|
"idiom": "iphone",
|
||||||
|
"filename": "Icon80.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"size": "40x40",
|
||||||
|
"idiom": "iphone",
|
||||||
|
"filename": "Icon120.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"size": "60x60",
|
||||||
|
"idiom": "iphone",
|
||||||
|
"filename": "Icon120.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"size": "60x60",
|
||||||
|
"idiom": "iphone",
|
||||||
|
"filename": "Icon180.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"size": "20x20",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "Icon20.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"size": "20x20",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "Icon40.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"size": "29x29",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "Icon29.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"size": "29x29",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "Icon58.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"size": "40x40",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "Icon40.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"size": "40x40",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "Icon80.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"size": "76x76",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "Icon76.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"size": "76x76",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "Icon152.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"size": "83.5x83.5",
|
||||||
|
"idiom": "ipad",
|
||||||
|
"filename": "Icon167.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"size": "1024x1024",
|
||||||
|
"idiom": "ios-marketing",
|
||||||
|
"filename": "Icon1024.png"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {},
|
||||||
|
"info": {
|
||||||
|
"version": 1,
|
||||||
|
"author": "xcode"
|
||||||
|
}
|
||||||
|
}
|
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png
Normal file
После Ширина: | Высота: | Размер: 69 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png
Normal file
После Ширина: | Высота: | Размер: 3.7 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png
Normal file
После Ширина: | Высота: | Размер: 4.6 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png
Normal file
После Ширина: | Высота: | Размер: 4.6 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png
Normal file
После Ширина: | Высота: | Размер: 5.1 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png
Normal file
После Ширина: | Высота: | Размер: 1.3 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png
Normal file
После Ширина: | Высота: | Размер: 845 B |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png
Normal file
После Ширина: | Высота: | Размер: 1.1 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png
Normal file
После Ширина: | Высота: | Размер: 1.7 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png
Normal file
После Ширина: | Высота: | Размер: 2.5 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png
Normal file
После Ширина: | Высота: | Размер: 2.3 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png
Normal file
После Ширина: | Высота: | Размер: 2.4 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png
Normal file
После Ширина: | Высота: | Размер: 2.7 KiB |
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>UIDeviceFamily</key>
|
||||||
|
<array>
|
||||||
|
<integer>1</integer>
|
||||||
|
<integer>2</integer>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>MinimumOSVersion</key>
|
||||||
|
<string>8.0</string>
|
||||||
|
<key>CFBundleDisplayName</key>
|
||||||
|
<string>my_clean_way</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>giraldez.apps.My-Clean-Way</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>UILaunchStoryboardName</key>
|
||||||
|
<string>LaunchScreen</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>my_clean_way</string>
|
||||||
|
<key>XSAppIconAssets</key>
|
||||||
|
<string>Assets.xcassets/AppIcon.appiconset</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
|
@ -0,0 +1,21 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
using Foundation;
|
||||||
|
using UIKit;
|
||||||
|
|
||||||
|
namespace my_clean_way.iOS
|
||||||
|
{
|
||||||
|
public class Application
|
||||||
|
{
|
||||||
|
// This is the main entry point of the application.
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||||
|
// you can specify it here.
|
||||||
|
|
||||||
|
UIApplication.Main(args, null, "AppDelegate");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("my_clean_way.iOS")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("my_clean_way.iOS")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Resources/Default-568h@2x.png
Normal file
После Ширина: | Высота: | Размер: 8.7 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Resources/Default-Portrait.png
Normal file
После Ширина: | Высота: | Размер: 10 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Resources/Default-Portrait@2x.png
Normal file
После Ширина: | Высота: | Размер: 34 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Resources/Default.png
Normal file
После Ширина: | Высота: | Размер: 7.1 KiB |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Resources/Default@2x.png
Normal file
После Ширина: | Высота: | Размер: 8.2 KiB |
|
@ -0,0 +1,37 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="X5k-f2-b5h">
|
||||||
|
<dependencies>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
|
||||||
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
|
</dependencies>
|
||||||
|
<scenes>
|
||||||
|
<!--View Controller-->
|
||||||
|
<scene sceneID="gAE-YM-kbH">
|
||||||
|
<objects>
|
||||||
|
<viewController id="X5k-f2-b5h" sceneMemberID="viewController">
|
||||||
|
<layoutGuides>
|
||||||
|
<viewControllerLayoutGuide type="top" id="Y8P-hJ-Z43"/>
|
||||||
|
<viewControllerLayoutGuide type="bottom" id="9ZL-r4-8FZ"/>
|
||||||
|
</layoutGuides>
|
||||||
|
<view key="view" contentMode="scaleToFill" id="yd7-JS-zBw">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<subviews>
|
||||||
|
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" misplaced="YES" image="Icon-60.png" translatesAutoresizingMaskIntoConstraints="NO" id="23" ambiguous="YES">
|
||||||
|
<rect key="frame" x="270" y="270" width="60" height="60"/>
|
||||||
|
<rect key="contentStretch" x="0.0" y="0.0" width="0.0" height="0.0"/>
|
||||||
|
</imageView>
|
||||||
|
</subviews>
|
||||||
|
<color key="backgroundColor" red="0.20392156862745098" green="0.59607843137254901" blue="0.85882352941176465" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstItem="23" firstAttribute="centerY" secondItem="yd7-JS-zBw" secondAttribute="centerY" priority="1" id="39"/>
|
||||||
|
<constraint firstItem="23" firstAttribute="centerX" secondItem="yd7-JS-zBw" secondAttribute="centerX" priority="1" id="41"/>
|
||||||
|
</constraints>
|
||||||
|
</view>
|
||||||
|
</viewController>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="XAI-xm-WK6" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="349" y="339"/>
|
||||||
|
</scene>
|
||||||
|
</scenes>
|
||||||
|
</document>
|
После Ширина: | Высота: | Размер: 354 B |
Двоичные данные
Xamarin 'My CLEAN way'/My CLEAN way/my_clean_way.iOS/Resources/no_fav.png
Normal file
После Ширина: | Высота: | Размер: 523 B |
После Ширина: | Высота: | Размер: 354 B |
|
@ -0,0 +1,171 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
|
||||||
|
<ProductVersion>8.0.30703</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{D53065EA-669B-4EF8-BC3A-615B6A88500E}</ProjectGuid>
|
||||||
|
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<TemplateGuid>{6143fdea-f3c2-4a09-aafa-6e230626515e}</TemplateGuid>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<RootNamespace>my_clean_way.iOS</RootNamespace>
|
||||||
|
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||||
|
<AssemblyName>my_clean_way.iOS</AssemblyName>
|
||||||
|
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<ConsolePause>false</ConsolePause>
|
||||||
|
<MtouchArch>x86_64</MtouchArch>
|
||||||
|
<MtouchLink>None</MtouchLink>
|
||||||
|
<MtouchDebug>true</MtouchDebug>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||||
|
<DebugType>none</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<MtouchLink>None</MtouchLink>
|
||||||
|
<MtouchArch>x86_64</MtouchArch>
|
||||||
|
<ConsolePause>false</ConsolePause>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<ConsolePause>false</ConsolePause>
|
||||||
|
<MtouchArch>ARM64</MtouchArch>
|
||||||
|
<CodesignKey>iPhone Developer</CodesignKey>
|
||||||
|
<MtouchDebug>true</MtouchDebug>
|
||||||
|
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||||
|
<DebugType>none</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<MtouchArch>ARM64</MtouchArch>
|
||||||
|
<ConsolePause>false</ConsolePause>
|
||||||
|
<CodesignKey>iPhone Developer</CodesignKey>
|
||||||
|
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
|
||||||
|
<DebugType>none</DebugType>
|
||||||
|
<Optimize>True</Optimize>
|
||||||
|
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<ConsolePause>False</ConsolePause>
|
||||||
|
<MtouchArch>ARM64</MtouchArch>
|
||||||
|
<BuildIpa>True</BuildIpa>
|
||||||
|
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
|
||||||
|
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||||
|
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
|
||||||
|
<DebugType>none</DebugType>
|
||||||
|
<Optimize>True</Optimize>
|
||||||
|
<OutputPath>bin\iPhone\AppStore</OutputPath>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<ConsolePause>False</ConsolePause>
|
||||||
|
<MtouchArch>ARM64</MtouchArch>
|
||||||
|
<CodesignProvision>Automatic:AppStore</CodesignProvision>
|
||||||
|
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||||
|
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Main.cs" />
|
||||||
|
<Compile Include="AppDelegate.cs" />
|
||||||
|
<None Include="Entitlements.plist" />
|
||||||
|
<None Include="Info.plist" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon1024.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon180.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon167.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon152.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon120.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon87.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon80.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon76.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon60.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon58.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon40.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon29.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon20.png">
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</ImageAsset>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="Xamarin.iOS" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Xamarin.Forms" Version="3.4.0.1008975" />
|
||||||
|
<PackageReference Include="Prism.Forms">
|
||||||
|
<Version>7.1.0.431</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Xamarin.FFImageLoading.Forms">
|
||||||
|
<Version>2.4.4.859</Version>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\my_clean_way\my_clean_way.csproj">
|
||||||
|
<Project>{D2242430-4F3A-4DA8-94DF-FF374AB78855}</Project>
|
||||||
|
<Name>my_clean_way</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<BundleResource Include="Resources\fav.png" />
|
||||||
|
<BundleResource Include="Resources\star.png" />
|
||||||
|
<BundleResource Include="Resources\no_fav.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,71 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 15
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "my_clean_way.Android", "my_clean_way.Android\my_clean_way.Android.csproj", "{CFD18FFF-17C6-47F9-BC3C-A5552EAC06F0}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "my_clean_way.iOS", "my_clean_way.iOS\my_clean_way.iOS.csproj", "{D53065EA-669B-4EF8-BC3A-615B6A88500E}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "my_clean_way", "my_clean_way\my_clean_way.csproj", "{D2242430-4F3A-4DA8-94DF-FF374AB78855}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||||
|
Release|iPhoneSimulator = Release|iPhoneSimulator
|
||||||
|
Debug|iPhone = Debug|iPhone
|
||||||
|
Release|iPhone = Release|iPhone
|
||||||
|
Ad-Hoc|iPhone = Ad-Hoc|iPhone
|
||||||
|
AppStore|iPhone = AppStore|iPhone
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{CFD18FFF-17C6-47F9-BC3C-A5552EAC06F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{CFD18FFF-17C6-47F9-BC3C-A5552EAC06F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{CFD18FFF-17C6-47F9-BC3C-A5552EAC06F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{CFD18FFF-17C6-47F9-BC3C-A5552EAC06F0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{CFD18FFF-17C6-47F9-BC3C-A5552EAC06F0}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||||
|
{CFD18FFF-17C6-47F9-BC3C-A5552EAC06F0}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||||
|
{CFD18FFF-17C6-47F9-BC3C-A5552EAC06F0}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||||
|
{CFD18FFF-17C6-47F9-BC3C-A5552EAC06F0}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||||
|
{CFD18FFF-17C6-47F9-BC3C-A5552EAC06F0}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||||
|
{CFD18FFF-17C6-47F9-BC3C-A5552EAC06F0}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||||
|
{CFD18FFF-17C6-47F9-BC3C-A5552EAC06F0}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||||
|
{CFD18FFF-17C6-47F9-BC3C-A5552EAC06F0}.Release|iPhone.Build.0 = Release|Any CPU
|
||||||
|
{CFD18FFF-17C6-47F9-BC3C-A5552EAC06F0}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
|
||||||
|
{CFD18FFF-17C6-47F9-BC3C-A5552EAC06F0}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
|
||||||
|
{CFD18FFF-17C6-47F9-BC3C-A5552EAC06F0}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
|
||||||
|
{CFD18FFF-17C6-47F9-BC3C-A5552EAC06F0}.AppStore|iPhone.Build.0 = Debug|Any CPU
|
||||||
|
{D53065EA-669B-4EF8-BC3A-615B6A88500E}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
|
||||||
|
{D53065EA-669B-4EF8-BC3A-615B6A88500E}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
|
||||||
|
{D53065EA-669B-4EF8-BC3A-615B6A88500E}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
|
||||||
|
{D53065EA-669B-4EF8-BC3A-615B6A88500E}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
|
||||||
|
{D53065EA-669B-4EF8-BC3A-615B6A88500E}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||||
|
{D53065EA-669B-4EF8-BC3A-615B6A88500E}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||||
|
{D53065EA-669B-4EF8-BC3A-615B6A88500E}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||||
|
{D53065EA-669B-4EF8-BC3A-615B6A88500E}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||||
|
{D53065EA-669B-4EF8-BC3A-615B6A88500E}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||||
|
{D53065EA-669B-4EF8-BC3A-615B6A88500E}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||||
|
{D53065EA-669B-4EF8-BC3A-615B6A88500E}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||||
|
{D53065EA-669B-4EF8-BC3A-615B6A88500E}.Release|iPhone.Build.0 = Release|iPhone
|
||||||
|
{D53065EA-669B-4EF8-BC3A-615B6A88500E}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
|
||||||
|
{D53065EA-669B-4EF8-BC3A-615B6A88500E}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
|
||||||
|
{D53065EA-669B-4EF8-BC3A-615B6A88500E}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
|
||||||
|
{D53065EA-669B-4EF8-BC3A-615B6A88500E}.AppStore|iPhone.Build.0 = AppStore|iPhone
|
||||||
|
{D2242430-4F3A-4DA8-94DF-FF374AB78855}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{D2242430-4F3A-4DA8-94DF-FF374AB78855}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{D2242430-4F3A-4DA8-94DF-FF374AB78855}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{D2242430-4F3A-4DA8-94DF-FF374AB78855}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{D2242430-4F3A-4DA8-94DF-FF374AB78855}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||||
|
{D2242430-4F3A-4DA8-94DF-FF374AB78855}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||||
|
{D2242430-4F3A-4DA8-94DF-FF374AB78855}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||||
|
{D2242430-4F3A-4DA8-94DF-FF374AB78855}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||||
|
{D2242430-4F3A-4DA8-94DF-FF374AB78855}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||||
|
{D2242430-4F3A-4DA8-94DF-FF374AB78855}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||||
|
{D2242430-4F3A-4DA8-94DF-FF374AB78855}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||||
|
{D2242430-4F3A-4DA8-94DF-FF374AB78855}.Release|iPhone.Build.0 = Release|Any CPU
|
||||||
|
{D2242430-4F3A-4DA8-94DF-FF374AB78855}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
|
||||||
|
{D2242430-4F3A-4DA8-94DF-FF374AB78855}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
|
||||||
|
{D2242430-4F3A-4DA8-94DF-FF374AB78855}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
|
||||||
|
{D2242430-4F3A-4DA8-94DF-FF374AB78855}.AppStore|iPhone.Build.0 = Debug|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<prism:PrismApplication xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:prism="clr-namespace:Prism.DryIoc"
|
||||||
|
x:Class="my_clean_way.App">
|
||||||
|
</prism:PrismApplication>
|
|
@ -0,0 +1,52 @@
|
||||||
|
using System;
|
||||||
|
using Prism;
|
||||||
|
using Prism.Ioc;
|
||||||
|
using Prism.DryIoc;
|
||||||
|
using Xamarin.Forms.Xaml;
|
||||||
|
using my_clean_way.movie_list.ui;
|
||||||
|
using my_clean_way.movie_list.repository;
|
||||||
|
using Refit;
|
||||||
|
using my_clean_way.data;
|
||||||
|
using my_clean_way.movie_favorites.repository;
|
||||||
|
using my_clean_way.domain;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using my_clean_way.movies.domain;
|
||||||
|
using my_clean_way.ui;
|
||||||
|
using my_clean_way.movies.ui;
|
||||||
|
using my_clean_way.movie_favorites.domain;
|
||||||
|
using my_clean_way.movie_favorites.ui;
|
||||||
|
|
||||||
|
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
|
||||||
|
namespace my_clean_way
|
||||||
|
{
|
||||||
|
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||||
|
public partial class App : PrismApplication
|
||||||
|
{
|
||||||
|
public App(IPlatformInitializer initializer = null) : base(initializer) { }
|
||||||
|
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
NavigationService.NavigateAsync(new Uri("/" + RootView.Route + "/" +MovieListPage.Route, UriKind.Absolute));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void RegisterTypes(IContainerRegistry containerRegistry)
|
||||||
|
{
|
||||||
|
//TODO: Register your navigation and interfaces here
|
||||||
|
containerRegistry.RegisterForNavigation<RootView>(RootView.Route);
|
||||||
|
containerRegistry.RegisterForNavigation<MovieListPage, MovieListPageViewModel>(MovieListPage.Route);
|
||||||
|
containerRegistry.RegisterForNavigation<MoviePage, MoviePageViewModel>(MoviePage.Route);
|
||||||
|
containerRegistry.RegisterForNavigation<FavoritesPage, FavoritesPageViewModel>(FavoritesPage.Route);
|
||||||
|
|
||||||
|
|
||||||
|
//Interface registration
|
||||||
|
containerRegistry.RegisterSingleton<IMovieListRepository, MovieListRepository>();
|
||||||
|
containerRegistry.RegisterSingleton<IFavoriteMovieRepository, FavoriteMoviesAkavacheDataSource>();
|
||||||
|
containerRegistry.RegisterInstance<IApiMovieDataSource>(RestService.For<IApiMovieDataSource>(ApiUtils.API_URL_BASE));
|
||||||
|
containerRegistry.RegisterSingleton<IUseCase<List<Movie>, bool>, GetPopularMoviesUseCase>();
|
||||||
|
containerRegistry.RegisterSingleton<IUseCase<Movie, Movie>, ChangeFavoriteStatusUseCase>();
|
||||||
|
containerRegistry.RegisterSingleton<IUseCase<bool, Movie>, IsMovieInFavoritesUseCase>();
|
||||||
|
containerRegistry.RegisterSingleton<IUseCase<List<Movie>, EmptyParameter>, GetFavoritesMoviesUseCase>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
using System;
|
||||||
|
using Akavache.Sqlite3;
|
||||||
|
|
||||||
|
namespace my_clean_way
|
||||||
|
{
|
||||||
|
public static class LinkerPreserve
|
||||||
|
{
|
||||||
|
static LinkerPreserve()
|
||||||
|
{
|
||||||
|
var persistentName = typeof(SQLitePersistentBlobCache).FullName;
|
||||||
|
var encryptedName = typeof(SQLiteEncryptedBlobCache).FullName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:local="clr-namespace:my_clean_way"
|
||||||
|
x:Class="my_clean_way.MainPage">
|
||||||
|
<StackLayout>
|
||||||
|
<!-- Place new controls here -->
|
||||||
|
<Label Text="Welcome to Xamarin.Forms2!" HorizontalOptions="Center" VerticalOptions="CenterAndExpand" />
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage>
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace my_clean_way
|
||||||
|
{
|
||||||
|
public partial class MainPage : ContentPage
|
||||||
|
{
|
||||||
|
public MainPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
using System;
|
||||||
|
namespace my_clean_way.data
|
||||||
|
{
|
||||||
|
public class ApiUtils
|
||||||
|
{
|
||||||
|
public static readonly String API_TOKEN = "ffd7581f7d52d6aeb5fe3e8dc7a4bb49";
|
||||||
|
public static readonly String API_URL_BASE = "https://api.themoviedb.org/3";
|
||||||
|
public static readonly String API_IMAGE_BASE_URL = "https://image.tmdb.org/t/p/w500";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
using System;
|
||||||
|
namespace my_clean_way.data
|
||||||
|
{
|
||||||
|
public class DBUtils
|
||||||
|
{
|
||||||
|
public static readonly String DB_NAME = "MyCleanWay";
|
||||||
|
public static readonly String FAVORITES_KEY = "Favorites";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace my_clean_way.data
|
||||||
|
{
|
||||||
|
public class PaginableResponse<T>
|
||||||
|
{
|
||||||
|
[JsonProperty("page")]
|
||||||
|
public long Page { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("results")]
|
||||||
|
public List<T> Results { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("total_results")]
|
||||||
|
public long TotalResults { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("total_pages")]
|
||||||
|
public long TotalPages { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
using System;
|
||||||
|
namespace my_clean_way.domain
|
||||||
|
{
|
||||||
|
public class EmptyParameter
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace my_clean_way.domain
|
||||||
|
{
|
||||||
|
public interface IUseCase<T, V>
|
||||||
|
{
|
||||||
|
Task<Transaction<T>> execute(V parameter);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
using System;
|
||||||
|
namespace my_clean_way.domain
|
||||||
|
{
|
||||||
|
public class Transaction<T>
|
||||||
|
{
|
||||||
|
public TransactionStatus Status { get; set; }
|
||||||
|
public T Result { get; set; }
|
||||||
|
public String ErrorMessage { get; set; }
|
||||||
|
public Boolean IsSuccesfull { get => TransactionStatus.Success.Equals(Status); }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
using System;
|
||||||
|
namespace my_clean_way.domain
|
||||||
|
{
|
||||||
|
public enum TransactionStatus
|
||||||
|
{
|
||||||
|
Success,
|
||||||
|
WithErros,
|
||||||
|
Failure
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using my_clean_way.domain;
|
||||||
|
using my_clean_way.movie_favorites.repository;
|
||||||
|
using my_clean_way.movies.domain;
|
||||||
|
|
||||||
|
namespace my_clean_way.movie_favorites.domain
|
||||||
|
{
|
||||||
|
public class ChangeFavoriteStatusUseCase : IUseCase<Movie, Movie>
|
||||||
|
{
|
||||||
|
readonly IFavoriteMovieRepository _favoriteMovieRepository;
|
||||||
|
public ChangeFavoriteStatusUseCase(IFavoriteMovieRepository favoriteMovieRepository)
|
||||||
|
{
|
||||||
|
_favoriteMovieRepository = favoriteMovieRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Transaction<Movie>> execute(Movie parameter)
|
||||||
|
{
|
||||||
|
var transaction = new Transaction<Movie>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
parameter.IsFavorite = !parameter.IsFavorite;
|
||||||
|
if(parameter.IsFavorite){
|
||||||
|
await _favoriteMovieRepository.AddToFavorites(parameter);
|
||||||
|
} else {
|
||||||
|
await _favoriteMovieRepository.RemoveFavorite(parameter);
|
||||||
|
}
|
||||||
|
transaction.Result = parameter;
|
||||||
|
transaction.Status = TransactionStatus.Success;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
transaction.Status = TransactionStatus.Failure;
|
||||||
|
transaction.ErrorMessage = ex.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return transaction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using my_clean_way.domain;
|
||||||
|
using my_clean_way.movie_favorites.repository;
|
||||||
|
using my_clean_way.movies.domain;
|
||||||
|
|
||||||
|
namespace my_clean_way.movie_favorites.domain
|
||||||
|
{
|
||||||
|
public class GetFavoritesMoviesUseCase : IUseCase<List<Movie>,EmptyParameter>
|
||||||
|
{
|
||||||
|
readonly IFavoriteMovieRepository _favoriteMovieRepository;
|
||||||
|
public GetFavoritesMoviesUseCase(IFavoriteMovieRepository favoriteMovieRepository)
|
||||||
|
{
|
||||||
|
_favoriteMovieRepository = favoriteMovieRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Transaction<List<Movie>>> execute(EmptyParameter parameter)
|
||||||
|
{
|
||||||
|
var transaction = new Transaction<List<Movie>>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var favorites = await _favoriteMovieRepository.GetFavoritesMovies();
|
||||||
|
transaction.Result = favorites;
|
||||||
|
transaction.Status = TransactionStatus.Success;
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
transaction.Status = TransactionStatus.Failure;
|
||||||
|
transaction.ErrorMessage = ex.Message;
|
||||||
|
}
|
||||||
|
return transaction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Akavache;
|
||||||
|
using my_clean_way.data;
|
||||||
|
using my_clean_way.movies.domain;
|
||||||
|
using System.Reactive.Linq;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace my_clean_way.movie_favorites.repository
|
||||||
|
{
|
||||||
|
public class FavoriteMoviesAkavacheDataSource : IFavoriteMovieRepository
|
||||||
|
{
|
||||||
|
public FavoriteMoviesAkavacheDataSource()
|
||||||
|
{
|
||||||
|
BlobCache.ApplicationName = DBUtils.DB_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Movie> AddToFavorites(Movie movie)
|
||||||
|
{
|
||||||
|
await BlobCache.LocalMachine.InsertObject<Movie>(movie.Id.ToString(), movie);
|
||||||
|
return movie;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<Movie>> GetFavoritesMovies()
|
||||||
|
{
|
||||||
|
var storedObjects = await BlobCache.LocalMachine.GetAllObjects<Movie>();
|
||||||
|
return new List<Movie>(storedObjects);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> IsMovieFavorite(Movie movie)
|
||||||
|
{
|
||||||
|
var result = false;
|
||||||
|
var stored = await BlobCache.LocalMachine
|
||||||
|
.GetObject<Movie>(movie.Id.ToString())
|
||||||
|
.Catch(Observable.Return( default(Movie)));
|
||||||
|
if(stored != null) {
|
||||||
|
result = stored.IsFavorite;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> RemoveFavorite(Movie movie)
|
||||||
|
{
|
||||||
|
await BlobCache.LocalMachine.InvalidateObject<Movie>(movie.Id.ToString());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using my_clean_way.movies.domain;
|
||||||
|
|
||||||
|
namespace my_clean_way.movie_favorites.repository
|
||||||
|
{
|
||||||
|
public interface IFavoriteMovieRepository
|
||||||
|
{
|
||||||
|
Task<List<Movie>> GetFavoritesMovies();
|
||||||
|
Task<bool> IsMovieFavorite(Movie movie);
|
||||||
|
Task<Movie> AddToFavorites(Movie movie);
|
||||||
|
Task<Boolean> RemoveFavorite(Movie movie);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="my_clean_way.movie_favorites.ui.FavoritesPage" xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms" xmlns:prismbehavior="clr-namespace:Prism.Behaviors;assembly=Prism.Forms" prism:ViewModelLocator.AutowireViewModel="True" xmlns:ffi="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms" Title="Favoritos">
|
||||||
|
<ContentPage.Content>
|
||||||
|
<ListView ItemsSource="{Binding Movies}" SelectionMode="None" SeparatorVisibility="None" HasUnevenRows="true">
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
|
||||||
|
<ViewCell>
|
||||||
|
<Frame Padding="4" Margin="8">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<ffi:CachedImage HeightRequest="100" Source="{Binding PosterPath}" />
|
||||||
|
<Label VerticalTextAlignment="Center" Margin="8" Text="{Binding Title}" FontSize="Large" FontAttributes="Bold" />
|
||||||
|
</StackLayout>
|
||||||
|
</Frame>
|
||||||
|
</ViewCell>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
</ListView>
|
||||||
|
</ContentPage.Content>
|
||||||
|
</ContentPage>
|
|
@ -0,0 +1,16 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace my_clean_way.movie_favorites.ui
|
||||||
|
{
|
||||||
|
public partial class FavoritesPage : ContentPage
|
||||||
|
{
|
||||||
|
public static readonly String Route = "FavoritesPageRoute";
|
||||||
|
public FavoritesPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using my_clean_way.domain;
|
||||||
|
using my_clean_way.movies.domain;
|
||||||
|
using my_clean_way.ui;
|
||||||
|
using Prism.Navigation;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace my_clean_way.movie_favorites.ui
|
||||||
|
{
|
||||||
|
public class FavoritesPageViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
readonly IUseCase<List<Movie>, EmptyParameter> _getFavoriteMoviesUseCase;
|
||||||
|
|
||||||
|
ObservableCollection<Movie> movies;
|
||||||
|
public ObservableCollection<Movie> Movies { get => movies; set { movies = value; RaisePropertyChanged(); } }
|
||||||
|
|
||||||
|
|
||||||
|
public FavoritesPageViewModel(IUseCase<List<Movie>, EmptyParameter> getFavoriteMoviesUseCase)
|
||||||
|
{
|
||||||
|
_getFavoriteMoviesUseCase = getFavoriteMoviesUseCase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async override void OnNavigatedTo(INavigationParameters parameters)
|
||||||
|
{
|
||||||
|
var transaction = await _getFavoriteMoviesUseCase.execute(new EmptyParameter());
|
||||||
|
if(transaction.IsSuccesfull){
|
||||||
|
Device.BeginInvokeOnMainThread(()=> Movies = new ObservableCollection<Movie>(transaction.Result));
|
||||||
|
}
|
||||||
|
base.OnNavigatedTo(parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
using System;
|
||||||
|
using my_clean_way.movies.domain;
|
||||||
|
using my_clean_way.domain;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using my_clean_way.movie_list.repository;
|
||||||
|
using my_clean_way.movie_favorites.repository;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace my_clean_way.movies.domain
|
||||||
|
{
|
||||||
|
public class GetPopularMoviesUseCase : IUseCase<List<Movie>,bool>
|
||||||
|
{
|
||||||
|
readonly IMovieListRepository _movieListRepository;
|
||||||
|
public GetPopularMoviesUseCase(IMovieListRepository movieListRepository)
|
||||||
|
{
|
||||||
|
_movieListRepository = movieListRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Transaction<List<Movie>>> execute(bool needMoreItems)
|
||||||
|
{
|
||||||
|
var transaction = new Transaction<List<Movie>>();
|
||||||
|
try{
|
||||||
|
var storedList = await _movieListRepository.GetPopularMovies(needMoreItems);
|
||||||
|
transaction.Result = storedList;
|
||||||
|
transaction.Status = TransactionStatus.Success;
|
||||||
|
}catch(Exception ex) {
|
||||||
|
transaction.ErrorMessage = ex.Message;
|
||||||
|
transaction.Status = TransactionStatus.Failure;
|
||||||
|
}
|
||||||
|
|
||||||
|
return transaction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using my_clean_way.data;
|
||||||
|
using my_clean_way.movies.data;
|
||||||
|
using Refit;
|
||||||
|
|
||||||
|
namespace my_clean_way.movie_list.repository
|
||||||
|
{
|
||||||
|
public interface IApiMovieDataSource
|
||||||
|
{
|
||||||
|
[Get("/movie/popular?page={pageNumber}&language=es-ES&api_key={apiKey}")]
|
||||||
|
Task<PaginableResponse<ApiMovie>> GetPopularMovies([AliasAs("pageNumber")] int pageNumber,[AliasAs("apiKey")] string apiKey);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using my_clean_way.movies.domain;
|
||||||
|
|
||||||
|
namespace my_clean_way.movie_list.repository
|
||||||
|
{
|
||||||
|
public interface IMovieListRepository
|
||||||
|
{
|
||||||
|
Task<List<Movie>> GetPopularMovies(Boolean needMore);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using my_clean_way.data;
|
||||||
|
using my_clean_way.movie_favorites.repository;
|
||||||
|
using my_clean_way.movies.data;
|
||||||
|
using my_clean_way.movies.domain;
|
||||||
|
|
||||||
|
namespace my_clean_way.movie_list.repository
|
||||||
|
{
|
||||||
|
public class MovieListRepository : IMovieListRepository
|
||||||
|
{
|
||||||
|
readonly IApiMovieDataSource _apiMovieDataSource;
|
||||||
|
readonly IFavoriteMovieRepository _favoriteMovieRepository;
|
||||||
|
int lastPage;
|
||||||
|
public MovieListRepository(IApiMovieDataSource apiMovieDataSource,
|
||||||
|
IFavoriteMovieRepository favoriteMovieRepository)
|
||||||
|
{
|
||||||
|
lastPage = 1;
|
||||||
|
_apiMovieDataSource = apiMovieDataSource;
|
||||||
|
_favoriteMovieRepository = favoriteMovieRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<List<Movie>> GetPopularMovies(bool needMore)
|
||||||
|
{
|
||||||
|
if(needMore){
|
||||||
|
lastPage++;
|
||||||
|
} else {
|
||||||
|
lastPage = 1;
|
||||||
|
}
|
||||||
|
var Apiresponse = await _apiMovieDataSource.GetPopularMovies(lastPage, ApiUtils.API_TOKEN);
|
||||||
|
var storedFavorites = await _favoriteMovieRepository.GetFavoritesMovies();
|
||||||
|
return Apiresponse.Results.Select((x) => {
|
||||||
|
var domain = x.toDomain();
|
||||||
|
// domain.IsFavorite = _favoriteMovieRepository.IsMovieFavorite(domain).Result;
|
||||||
|
return domain;
|
||||||
|
}).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace my_clean_way.movie_list.ui
|
||||||
|
{
|
||||||
|
public class ItemTappedConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
var itemTappedEventArgs = value as ItemTappedEventArgs;
|
||||||
|
if (itemTappedEventArgs == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Expected value to be of type ItemTappedEventArgs", nameof(value));
|
||||||
|
}
|
||||||
|
return itemTappedEventArgs.Item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="my_clean_way.movie_list.ui.MovieListPage"
|
||||||
|
xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
|
||||||
|
xmlns:prismbehavior="clr-namespace:Prism.Behaviors;assembly=Prism.Forms"
|
||||||
|
prism:ViewModelLocator.AutowireViewModel="True"
|
||||||
|
xmlns:ffi="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
|
||||||
|
Title="Populares">
|
||||||
|
<ContentPage.ToolbarItems>
|
||||||
|
<ToolbarItem Text="Favoritos" Command="{Binding NavigateToFavoritesCommand}" />
|
||||||
|
</ContentPage.ToolbarItems>
|
||||||
|
<ContentPage.Content>
|
||||||
|
<ListView ItemsSource="{Binding Movies}" SeparatorVisibility="None" HasUnevenRows="true">
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ViewCell>
|
||||||
|
<Frame Padding="4" Margin="8">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<ffi:CachedImage HeightRequest="100" Source="{Binding PosterPath}" />
|
||||||
|
<Label VerticalTextAlignment="Center" Margin="8" Text="{Binding Title}" FontSize="Large" FontAttributes="Bold" />
|
||||||
|
</StackLayout>
|
||||||
|
</Frame>
|
||||||
|
</ViewCell>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
<ListView.Behaviors>
|
||||||
|
<prismbehavior:EventToCommandBehavior EventName="ItemTapped" Command="{Binding MovieSelectedCommand}" EventArgsParameterPath="Item" />
|
||||||
|
<prismbehavior:EventToCommandBehavior EventName="ItemAppearing" Command="{Binding MovieAppearingCommand}" EventArgsParameterPath="Item" />
|
||||||
|
</ListView.Behaviors>
|
||||||
|
</ListView>
|
||||||
|
</ContentPage.Content>
|
||||||
|
</ContentPage>
|
|
@ -0,0 +1,18 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Xamarin.Forms.Xaml;
|
||||||
|
|
||||||
|
namespace my_clean_way.movie_list.ui
|
||||||
|
{
|
||||||
|
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||||
|
public partial class MovieListPage : ContentPage
|
||||||
|
{
|
||||||
|
public readonly static String Route = "MovieListPageRoute";
|
||||||
|
public MovieListPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using my_clean_way.ui;
|
||||||
|
using Prism;
|
||||||
|
using Prism.Navigation;
|
||||||
|
using my_clean_way.domain;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using my_clean_way.movies.domain;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using System.Linq;
|
||||||
|
using my_clean_way.movies.ui;
|
||||||
|
using my_clean_way.movie_favorites.ui;
|
||||||
|
|
||||||
|
namespace my_clean_way.movie_list.ui
|
||||||
|
{
|
||||||
|
public class MovieListPageViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
readonly IUseCase<List<Movie>, bool> _getPopularMovieList;
|
||||||
|
readonly INavigationService _navigationService;
|
||||||
|
|
||||||
|
ObservableCollection<Movie> movies;
|
||||||
|
public ObservableCollection<Movie> Movies { get => movies; set { movies = value; RaisePropertyChanged(); } }
|
||||||
|
|
||||||
|
public ICommand MovieSelectedCommand => new Command<Movie>(MovieSelected,(movie) => !IsBusy);
|
||||||
|
public ICommand SearchMoviesCommand => new Command(SearchMovies,() => !IsBusy);
|
||||||
|
public ICommand MovieAppearingCommand => new Command<Movie>(MovieAppearing, (movie) => !IsBusy);
|
||||||
|
public ICommand NavigateToFavoritesCommand => new Command(() => _navigationService.NavigateAsync(FavoritesPage.Route));
|
||||||
|
|
||||||
|
public MovieListPageViewModel(IUseCase<List<Movie>, bool> getPopularMovieList,
|
||||||
|
INavigationService navigationService)
|
||||||
|
{
|
||||||
|
_getPopularMovieList = getPopularMovieList;
|
||||||
|
_navigationService = navigationService;
|
||||||
|
Movies = new ObservableCollection<Movie>(new List<Movie>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async void SearchMovies(){
|
||||||
|
IsBusy = true;
|
||||||
|
var transaction = await _getPopularMovieList.execute(false);
|
||||||
|
if (transaction.IsSuccesfull)
|
||||||
|
{
|
||||||
|
Device.BeginInvokeOnMainThread(() => Movies = new ObservableCollection<Movie>(transaction.Result));
|
||||||
|
}
|
||||||
|
IsBusy = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MovieSelected(Movie movie){
|
||||||
|
NavigationParameters parameter = new NavigationParameters();
|
||||||
|
parameter.Add(PageParameters.MOVIE_PARAMETER, movie);
|
||||||
|
_navigationService.NavigateAsync(MoviePage.Route,parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
async void MovieAppearing(Movie movie)
|
||||||
|
{
|
||||||
|
var lastMovie = Movies.LastOrDefault();
|
||||||
|
if(movie.Id.Equals(lastMovie.Id)){
|
||||||
|
IsBusy = true;
|
||||||
|
var transaction = await _getPopularMovieList.execute(true);
|
||||||
|
if (transaction.IsSuccesfull)
|
||||||
|
{
|
||||||
|
|
||||||
|
Device.BeginInvokeOnMainThread(() =>{
|
||||||
|
Movies = new ObservableCollection<Movie>(Movies.ToList().Concat(transaction.Result));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
IsBusy = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnNavigatedTo(INavigationParameters parameters)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("MovieListPageViewModel - OnNavigatedTo");
|
||||||
|
if (Movies.Count == 0)
|
||||||
|
{
|
||||||
|
SearchMoviesCommand.Execute(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
base.OnNavigatedFrom(parameters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
using System;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace my_clean_way.movies.data
|
||||||
|
{
|
||||||
|
public class ApiMovie
|
||||||
|
{
|
||||||
|
[JsonProperty("poster_path")]
|
||||||
|
public string PosterPath { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("adult")]
|
||||||
|
public bool Adult { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("overview")]
|
||||||
|
public string Overview { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("release_date")]
|
||||||
|
public DateTimeOffset ReleaseDate { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("genre_ids")]
|
||||||
|
public long[] GenreIds { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("id")]
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("original_title")]
|
||||||
|
public string OriginalTitle { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("original_language")]
|
||||||
|
public string OriginalLanguage { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("title")]
|
||||||
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("backdrop_path")]
|
||||||
|
public string BackdropPath { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("popularity")]
|
||||||
|
public double Popularity { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("vote_count")]
|
||||||
|
public long VoteCount { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("video")]
|
||||||
|
public bool Video { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("vote_average")]
|
||||||
|
public double VoteAverage { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
using System;
|
||||||
|
using my_clean_way.data;
|
||||||
|
using my_clean_way.movies.domain;
|
||||||
|
|
||||||
|
namespace my_clean_way.movies.data
|
||||||
|
{
|
||||||
|
public static class ApiMovieMapper
|
||||||
|
{
|
||||||
|
|
||||||
|
public static Movie toDomain(this ApiMovie movie)
|
||||||
|
{
|
||||||
|
return new Movie()
|
||||||
|
{
|
||||||
|
IsFavorite = false,
|
||||||
|
BackdropPath = ApiUtils.API_IMAGE_BASE_URL + movie.BackdropPath,
|
||||||
|
Id = movie.Id,
|
||||||
|
Overview = movie.Overview,
|
||||||
|
Popularity = movie.Popularity,
|
||||||
|
PosterPath = ApiUtils.API_IMAGE_BASE_URL + movie.PosterPath,
|
||||||
|
Title = movie.Title,
|
||||||
|
VoteAverage = movie.VoteAverage,
|
||||||
|
VoteCount = movie.VoteCount
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using my_clean_way.domain;
|
||||||
|
using my_clean_way.movie_favorites.repository;
|
||||||
|
|
||||||
|
namespace my_clean_way.movies.domain
|
||||||
|
{
|
||||||
|
public class IsMovieInFavoritesUseCase : IUseCase<bool,Movie>
|
||||||
|
{
|
||||||
|
readonly IFavoriteMovieRepository _favoriteMovieRepository;
|
||||||
|
public IsMovieInFavoritesUseCase(IFavoriteMovieRepository favoriteMovieRepository)
|
||||||
|
{
|
||||||
|
_favoriteMovieRepository = favoriteMovieRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Transaction<bool>> execute(Movie parameter)
|
||||||
|
{
|
||||||
|
var transaction = new Transaction<bool>();
|
||||||
|
try{
|
||||||
|
transaction.Result =await _favoriteMovieRepository.IsMovieFavorite(parameter);
|
||||||
|
transaction.Status = TransactionStatus.Success;
|
||||||
|
}catch(Exception ex) {
|
||||||
|
transaction.ErrorMessage = ex.Message;
|
||||||
|
transaction.Status = TransactionStatus.Failure;
|
||||||
|
}
|
||||||
|
return transaction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
using System;
|
||||||
|
namespace my_clean_way.movies.domain
|
||||||
|
{
|
||||||
|
// Domain Entity
|
||||||
|
public class Movie
|
||||||
|
{
|
||||||
|
public bool IsFavorite { get; set; }
|
||||||
|
|
||||||
|
public string PosterPath { get; set; }
|
||||||
|
|
||||||
|
public string Overview { get; set; }
|
||||||
|
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
public string BackdropPath { get; set; }
|
||||||
|
|
||||||
|
public double Popularity { get; set; }
|
||||||
|
|
||||||
|
public long VoteCount { get; set; }
|
||||||
|
|
||||||
|
public double VoteAverage { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="my_clean_way.movies.ui.MoviePage" xmlns:ffi="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms" Title="{Binding Movie.Title}">
|
||||||
|
<ContentPage.ToolbarItems>
|
||||||
|
<ToolbarItem Icon="{Binding FavIcon}" Command="{Binding FavCommand}" />
|
||||||
|
</ContentPage.ToolbarItems>
|
||||||
|
<ContentPage.Content>
|
||||||
|
<ScrollView>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="120" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="200" />
|
||||||
|
<RowDefinition Height="100" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<ffi:CachedImage Grid.Row="0" Grid.ColumnSpan="3" Source="{Binding Movie.BackdropPath}" />
|
||||||
|
<ffi:CachedImage Grid.Row="1" Margin="24,-130,0,0" HeightRequest="150" Source="{Binding Movie.PosterPath}" />
|
||||||
|
<StackLayout Grid.Row="1" Grid.Column="1" Grid.RowSpan="2" Grid.ColumnSpan="2">
|
||||||
|
<Label Text="{Binding Movie.Overview}" Margin="8" />
|
||||||
|
</StackLayout>
|
||||||
|
<StackLayout Grid.Row="2" Grid.ColumnSpan="2" Margin="16,-50" Orientation="Horizontal">
|
||||||
|
<Label Text="Nota" Margin="8" />
|
||||||
|
<Label Text="{Binding Movie.VoteAverage}" Margin="8" />
|
||||||
|
</StackLayout>
|
||||||
|
</Grid>
|
||||||
|
</ScrollView>
|
||||||
|
</ContentPage.Content>
|
||||||
|
</ContentPage>
|
|
@ -0,0 +1,18 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Xamarin.Forms.Xaml;
|
||||||
|
|
||||||
|
namespace my_clean_way.movies.ui
|
||||||
|
{
|
||||||
|
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||||
|
public partial class MoviePage : ContentPage
|
||||||
|
{
|
||||||
|
public readonly static String Route = "MoviePageRoute";
|
||||||
|
public MoviePage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using my_clean_way.domain;
|
||||||
|
using my_clean_way.movies.domain;
|
||||||
|
using my_clean_way.ui;
|
||||||
|
using Prism.Navigation;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace my_clean_way.movies.ui
|
||||||
|
{
|
||||||
|
public class MoviePageViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
readonly IUseCase<Movie, Movie> _changeFavoriteStatusUseCase;
|
||||||
|
readonly IUseCase<bool, Movie> _isFavoriteMovieInFavoritesUseCase;
|
||||||
|
|
||||||
|
String NoFavIconName = "no_fav.png";
|
||||||
|
String FavIconName = "fav.png";
|
||||||
|
|
||||||
|
Movie movie;
|
||||||
|
public Movie Movie { get => movie; set { movie = value; RaisePropertyChanged(); } }
|
||||||
|
|
||||||
|
String favIcon;
|
||||||
|
public String FavIcon { get => favIcon; set { favIcon = value; RaisePropertyChanged(); } }
|
||||||
|
|
||||||
|
public ICommand FavCommand => new Command(ChangeFavoriteStatus, () => !IsBusy);
|
||||||
|
|
||||||
|
public MoviePageViewModel(IUseCase<Movie, Movie> changeFavoriteStatusUseCase,
|
||||||
|
IUseCase<bool, Movie> isFavoriteMovieInFavoritesUseCase)
|
||||||
|
{
|
||||||
|
FavIcon = NoFavIconName;
|
||||||
|
_changeFavoriteStatusUseCase = changeFavoriteStatusUseCase;
|
||||||
|
_isFavoriteMovieInFavoritesUseCase = isFavoriteMovieInFavoritesUseCase;
|
||||||
|
}
|
||||||
|
|
||||||
|
async void ChangeFavoriteStatus() {
|
||||||
|
var transaction = await _changeFavoriteStatusUseCase.execute(Movie);
|
||||||
|
if(transaction.IsSuccesfull) {
|
||||||
|
Movie = transaction.Result;
|
||||||
|
FavIcon = Movie.IsFavorite ? FavIconName : NoFavIconName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public async override void OnNavigatedTo(INavigationParameters parameters)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("MovieListPageViewModel - OnNavigatedTo");
|
||||||
|
Movie = parameters.GetValue<Movie>(PageParameters.MOVIE_PARAMETER);
|
||||||
|
var transaction = await _isFavoriteMovieInFavoritesUseCase.execute(Movie);
|
||||||
|
FavIcon = transaction.Result ? FavIconName : NoFavIconName;
|
||||||
|
base.OnNavigatedFrom(parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Xamarin.Forms" Version="3.4.0.1008975" />
|
||||||
|
<PackageReference Include="Prism.Forms" Version="7.1.0.431" />
|
||||||
|
<PackageReference Include="akavache" Version="6.0.31" />
|
||||||
|
<PackageReference Include="LiveXAML" Version="2.1.50" />
|
||||||
|
<PackageReference Include="Refit" Version="4.6.58" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||||
|
<PackageReference Include="Prism.DryIoc.Forms" Version="7.1.0.431" />
|
||||||
|
<PackageReference Include="Xamarin.FFImageLoading.Forms" Version="2.4.4.859" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="movie_list\" />
|
||||||
|
<Folder Include="movie_favorites\" />
|
||||||
|
<Folder Include="movie_list\ui\" />
|
||||||
|
<Folder Include="movie_list\domain\" />
|
||||||
|
<Folder Include="movie_list\repository\" />
|
||||||
|
<Folder Include="movies\" />
|
||||||
|
<Folder Include="movies\domain\" />
|
||||||
|
<Folder Include="movie_favorites\domain\" />
|
||||||
|
<Folder Include="movie_favorites\repository\" />
|
||||||
|
<Folder Include="movie_favorites\ui\" />
|
||||||
|
<Folder Include="data\" />
|
||||||
|
<Folder Include="movies\data\" />
|
||||||
|
<Folder Include="ui\" />
|
||||||
|
<Folder Include="domain\" />
|
||||||
|
<Folder Include="movies\ui\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="movie_list\repository\LocalDataSource.cs" />
|
||||||
|
<Compile Remove="movies\ui\HomePage.xaml.cs" />
|
||||||
|
<Compile Remove="ui\TabPageViewModelBase.cs" />
|
||||||
|
<Compile Remove="MainPage.xaml.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Remove="movies\ui\HomePage.xaml" />
|
||||||
|
<EmbeddedResource Remove="MainPage.xaml" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,8 @@
|
||||||
|
using System;
|
||||||
|
namespace my_clean_way.ui
|
||||||
|
{
|
||||||
|
public class PageParameters
|
||||||
|
{
|
||||||
|
public static readonly String MOVIE_PARAMETER = "movie_parameter";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace my_clean_way.ui
|
||||||
|
{
|
||||||
|
public class RootView : NavigationPage
|
||||||
|
{
|
||||||
|
public static readonly String Route = "NavigationPage";
|
||||||
|
public RootView()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System;
|
||||||
|
using Prism;
|
||||||
|
|
||||||
|
namespace my_clean_way.ui
|
||||||
|
{
|
||||||
|
public class TabPageViewModelBase : ViewModelBase, IActiveAware
|
||||||
|
{
|
||||||
|
bool _IsActive;
|
||||||
|
public bool IsActive
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _IsActive;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _IsActive, value, RaiseIsActiveChanged);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler IsActiveChanged;
|
||||||
|
|
||||||
|
|
||||||
|
protected virtual void RaiseIsActiveChanged()
|
||||||
|
{
|
||||||
|
IsActiveChanged?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
public virtual void Destroy()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Prism.Mvvm;
|
||||||
|
using Prism.Navigation;
|
||||||
|
|
||||||
|
namespace my_clean_way.ui
|
||||||
|
{
|
||||||
|
public class ViewModelBase : BindableBase, INavigationAware
|
||||||
|
{
|
||||||
|
Boolean _isBusy;
|
||||||
|
protected Boolean IsBusy { get => _isBusy; set { _isBusy = value; RaisePropertyChanged(); }}
|
||||||
|
|
||||||
|
public virtual void OnNavigatedFrom(INavigationParameters parameters)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("OnNavigatedFrom");
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnNavigatedTo(INavigationParameters parameters)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("OnNavigatedTo");
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnNavigatingTo(INavigationParameters parameters)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("OnNavigatingTo");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|