Fixed SplashScreen implementation on Android. Fixes #355
The MainTheme set the splash screen image as the window background. I’ve removed this and ensured that the SplashActivity is the launch activity. Also did some code tidy up on the Campaign page classes.
This commit is contained in:
parent
0348d882f3
commit
2e463f4b25
@ -1,12 +1,12 @@
|
|||||||
namespace eShopOnContainers.Core.Services.Marketing
|
using System;
|
||||||
{
|
using System.Collections.ObjectModel;
|
||||||
using System;
|
using System.Threading.Tasks;
|
||||||
using System.Collections.ObjectModel;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using Xamarin.Forms;
|
||||||
using Models.Marketing;
|
using eShopOnContainers.Core.Models.Marketing;
|
||||||
using Xamarin.Forms;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
|
namespace eShopOnContainers.Core.Services.Marketing
|
||||||
|
{
|
||||||
public class CampaignMockService : ICampaignService
|
public class CampaignMockService : ICampaignService
|
||||||
{
|
{
|
||||||
private readonly ObservableCollection<CampaignItem> _mockCampaign = new ObservableCollection<CampaignItem>
|
private readonly ObservableCollection<CampaignItem> _mockCampaign = new ObservableCollection<CampaignItem>
|
||||||
@ -39,14 +39,12 @@
|
|||||||
public async Task<ObservableCollection<CampaignItem>> GetAllCampaignsAsync(string token)
|
public async Task<ObservableCollection<CampaignItem>> GetAllCampaignsAsync(string token)
|
||||||
{
|
{
|
||||||
await Task.Delay(500);
|
await Task.Delay(500);
|
||||||
|
|
||||||
return _mockCampaign;
|
return _mockCampaign;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<CampaignItem> GetCampaignByIdAsync(int campaignId, string token)
|
public async Task<CampaignItem> GetCampaignByIdAsync(int campaignId, string token)
|
||||||
{
|
{
|
||||||
await Task.Delay(500);
|
await Task.Delay(500);
|
||||||
|
|
||||||
return _mockCampaign.SingleOrDefault(c => c.Id == campaignId);
|
return _mockCampaign.SingleOrDefault(c => c.Id == campaignId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
namespace eShopOnContainers.Core.Services.Marketing
|
using System;
|
||||||
{
|
using System.Collections.ObjectModel;
|
||||||
using System;
|
using System.Threading.Tasks;
|
||||||
using System.Collections.ObjectModel;
|
using eShopOnContainers.Core.Models.Marketing;
|
||||||
using System.Threading.Tasks;
|
using eShopOnContainers.Core.Services.RequestProvider;
|
||||||
using Models.Marketing;
|
using eShopOnContainers.Core.Extensions;
|
||||||
using RequestProvider;
|
using eShopOnContainers.Core.Helpers;
|
||||||
using Extensions;
|
|
||||||
using Helpers;
|
|
||||||
|
|
||||||
|
namespace eShopOnContainers.Core.Services.Marketing
|
||||||
|
{
|
||||||
public class CampaignService : ICampaignService
|
public class CampaignService : ICampaignService
|
||||||
{
|
{
|
||||||
private readonly IRequestProvider _requestProvider;
|
private readonly IRequestProvider _requestProvider;
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
namespace eShopOnContainers.Core.Services.Marketing
|
using System.Collections.ObjectModel;
|
||||||
{
|
using System.Threading.Tasks;
|
||||||
using System.Collections.ObjectModel;
|
using eShopOnContainers.Core.Models.Marketing;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Models.Marketing;
|
|
||||||
|
|
||||||
|
namespace eShopOnContainers.Core.Services.Marketing
|
||||||
|
{
|
||||||
public interface ICampaignService
|
public interface ICampaignService
|
||||||
{
|
{
|
||||||
Task<ObservableCollection<CampaignItem>> GetAllCampaignsAsync(string token);
|
Task<ObservableCollection<CampaignItem>> GetAllCampaignsAsync(string token);
|
||||||
|
|
||||||
Task<CampaignItem> GetCampaignByIdAsync(int id, string token);
|
Task<CampaignItem> GetCampaignByIdAsync(int id, string token);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,13 +1,13 @@
|
|||||||
namespace eShopOnContainers.Core.ViewModels
|
using System.Threading.Tasks;
|
||||||
{
|
using System.Windows.Input;
|
||||||
using System.Threading.Tasks;
|
using Xamarin.Forms;
|
||||||
using Helpers;
|
using eShopOnContainers.Core.ViewModels.Base;
|
||||||
using Models.Marketing;
|
using eShopOnContainers.Core.Helpers;
|
||||||
using Services.Marketing;
|
using eShopOnContainers.Core.Models.Marketing;
|
||||||
using Base;
|
using eShopOnContainers.Core.Services.Marketing;
|
||||||
using System.Windows.Input;
|
|
||||||
using Xamarin.Forms;
|
|
||||||
|
|
||||||
|
namespace eShopOnContainers.Core.ViewModels
|
||||||
|
{
|
||||||
public class CampaignDetailsViewModel : ViewModelBase
|
public class CampaignDetailsViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
private CampaignItem _campaign;
|
private CampaignItem _campaign;
|
||||||
@ -46,9 +46,9 @@
|
|||||||
IsBusy = true;
|
IsBusy = true;
|
||||||
|
|
||||||
// Get campaign by id
|
// Get campaign by id
|
||||||
Campaign = await _campaignService.GetCampaignByIdAsync((int) navigationData, Settings.AuthAccessToken);
|
Campaign = await _campaignService.GetCampaignByIdAsync((int)navigationData, Settings.AuthAccessToken);
|
||||||
|
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
namespace eShopOnContainers.Core.ViewModels
|
using System.Threading.Tasks;
|
||||||
{
|
using System.Windows.Input;
|
||||||
using System.Threading.Tasks;
|
using Xamarin.Forms;
|
||||||
using System.Windows.Input;
|
using System.Collections.ObjectModel;
|
||||||
using Xamarin.Forms;
|
using eShopOnContainers.Core.Models.Marketing;
|
||||||
using System.Collections.ObjectModel;
|
using eShopOnContainers.Core.Services.Marketing;
|
||||||
using Models.Marketing;
|
using eShopOnContainers.Core.ViewModels.Base;
|
||||||
using Services.Marketing;
|
using eShopOnContainers.Core.Helpers;
|
||||||
using Base;
|
|
||||||
using Helpers;
|
|
||||||
|
|
||||||
|
namespace eShopOnContainers.Core.ViewModels
|
||||||
|
{
|
||||||
public class CampaignViewModel : ViewModelBase
|
public class CampaignViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
private ObservableCollection<CampaignItem> _campaigns;
|
private ObservableCollection<CampaignItem> _campaigns;
|
||||||
@ -29,7 +29,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICommand GetCampaignDetailsCommand => new Command<CampaignItem>(async (item) => await GetCampaignDetails(item));
|
public ICommand GetCampaignDetailsCommand => new Command<CampaignItem>(async (item) => await GetCampaignDetailsAsync(item));
|
||||||
|
|
||||||
public override async Task InitializeAsync(object navigationData)
|
public override async Task InitializeAsync(object navigationData)
|
||||||
{
|
{
|
||||||
@ -41,7 +41,7 @@
|
|||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task GetCampaignDetails(CampaignItem campaign)
|
private async Task GetCampaignDetailsAsync(CampaignItem campaign)
|
||||||
{
|
{
|
||||||
await NavigationService.NavigateToAsync<CampaignDetailsViewModel>(campaign.Id);
|
await NavigationService.NavigateToAsync<CampaignDetailsViewModel>(campaign.Id);
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@
|
|||||||
Style="{StaticResource CampaignAvailabilityDescriptionStyle}"/>
|
Style="{StaticResource CampaignAvailabilityDescriptionStyle}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<AbsoluteLayout
|
<AbsoluteLayout
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Grid.RowSpan="3"
|
Grid.RowSpan="3"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
namespace eShopOnContainers.Core.Views
|
using Xamarin.Forms;
|
||||||
{
|
|
||||||
using Xamarin.Forms;
|
|
||||||
|
|
||||||
public partial class CampaignView: ContentPage
|
namespace eShopOnContainers.Core.Views
|
||||||
|
{
|
||||||
|
public partial class CampaignView : ContentPage
|
||||||
{
|
{
|
||||||
|
|
||||||
public CampaignView()
|
public CampaignView()
|
||||||
|
@ -17,7 +17,6 @@ namespace eShopOnContainers.Droid.Activities
|
|||||||
Label = "eShopOnContainers",
|
Label = "eShopOnContainers",
|
||||||
Icon = "@drawable/icon",
|
Icon = "@drawable/icon",
|
||||||
Theme = "@style/MainTheme",
|
Theme = "@style/MainTheme",
|
||||||
MainLauncher = true,
|
|
||||||
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||||
public class MainActivity : FormsAppCompatActivity
|
public class MainActivity : FormsAppCompatActivity
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,7 @@ namespace eShopOnContainers.Droid.Activities
|
|||||||
Icon = "@drawable/icon",
|
Icon = "@drawable/icon",
|
||||||
Theme = "@style/Theme.Splash",
|
Theme = "@style/Theme.Splash",
|
||||||
NoHistory = true,
|
NoHistory = true,
|
||||||
|
MainLauncher = true,
|
||||||
ScreenOrientation = ScreenOrientation.Portrait)]
|
ScreenOrientation = ScreenOrientation.Portrait)]
|
||||||
public class SplashActivity : AppCompatActivity
|
public class SplashActivity : AppCompatActivity
|
||||||
{
|
{
|
||||||
@ -23,8 +24,7 @@ namespace eShopOnContainers.Droid.Activities
|
|||||||
|
|
||||||
private void InvokeMainActivity()
|
private void InvokeMainActivity()
|
||||||
{
|
{
|
||||||
var mainActivityIntent = new Intent(this, typeof(MainActivity));
|
StartActivity(new Intent(this, typeof(MainActivity)));
|
||||||
StartActivity(mainActivityIntent);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
using Android.App;
|
using Android.App;
|
||||||
using Android.OS;
|
using Android.OS;
|
||||||
using Android.Runtime;
|
using Android.Runtime;
|
||||||
@ -7,12 +6,11 @@ using Plugin.CurrentActivity;
|
|||||||
|
|
||||||
namespace eShopOnContainers.Droid
|
namespace eShopOnContainers.Droid
|
||||||
{
|
{
|
||||||
//You can specify additional application information in this attribute
|
|
||||||
[Application]
|
[Application]
|
||||||
public class MainApplication : Application, Application.IActivityLifecycleCallbacks
|
public class MainApplication : Application, Application.IActivityLifecycleCallbacks
|
||||||
{
|
{
|
||||||
public MainApplication(IntPtr handle, JniHandleOwnership transer)
|
public MainApplication(IntPtr handle, JniHandleOwnership transer)
|
||||||
:base(handle, transer)
|
: base(handle, transer)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,7 +18,6 @@ namespace eShopOnContainers.Droid
|
|||||||
{
|
{
|
||||||
base.OnCreate();
|
base.OnCreate();
|
||||||
RegisterActivityLifecycleCallbacks(this);
|
RegisterActivityLifecycleCallbacks(this);
|
||||||
//A great place to initialize Xamarin.Insights and Dependency Services!
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnTerminate()
|
public override void OnTerminate()
|
||||||
|
@ -2340,8 +2340,8 @@ namespace eShopOnContainers.Droid
|
|||||||
// aapt resource value: 0x7f0200b4
|
// aapt resource value: 0x7f0200b4
|
||||||
public const int noimage = 2130837684;
|
public const int noimage = 2130837684;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200bb
|
// aapt resource value: 0x7f0200ba
|
||||||
public const int notification_template_icon_bg = 2130837691;
|
public const int notification_template_icon_bg = 2130837690;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200b5
|
// aapt resource value: 0x7f0200b5
|
||||||
public const int product_add = 2130837685;
|
public const int product_add = 2130837685;
|
||||||
@ -2353,13 +2353,10 @@ namespace eShopOnContainers.Droid
|
|||||||
public const int roundedbgdark = 2130837687;
|
public const int roundedbgdark = 2130837687;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200b8
|
// aapt resource value: 0x7f0200b8
|
||||||
public const int splash_drawable = 2130837688;
|
public const int switch_off = 2130837688;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200b9
|
// aapt resource value: 0x7f0200b9
|
||||||
public const int switch_off = 2130837689;
|
public const int switch_on = 2130837689;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200ba
|
|
||||||
public const int switch_on = 2130837690;
|
|
||||||
|
|
||||||
static Drawable()
|
static Drawable()
|
||||||
{
|
{
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item>
|
|
||||||
<bitmap
|
|
||||||
android:gravity="fill"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<bitmap
|
|
||||||
android:gravity="center"/>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
@ -1,38 +1,32 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
<style name="MainTheme" parent="MainTheme.Base">
|
||||||
<style name="MainTheme" parent="MainTheme.Base">
|
</style>
|
||||||
</style>
|
<!-- Base theme applied no matter what API -->
|
||||||
|
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
<!-- Base theme applied no matter what API -->
|
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
|
||||||
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
|
<item name="windowNoTitle">true</item>
|
||||||
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
|
<!--We will be using the toolbar so no need to show ActionBar-->
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="windowActionBar">false</item>
|
||||||
<!--We will be using the toolbar so no need to show ActionBar-->
|
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
|
||||||
<item name="windowActionBar">false</item>
|
<!-- colorPrimary is used for the default action bar background -->
|
||||||
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
|
<item name="colorPrimary">#00a69c</item>
|
||||||
<!-- colorPrimary is used for the default action bar background -->
|
<!-- colorPrimaryDark is used for the status bar -->
|
||||||
<item name="colorPrimary">#00a69c</item>
|
<item name="colorPrimaryDark">#00857D</item>
|
||||||
<!-- colorPrimaryDark is used for the status bar -->
|
<!-- colorAccent is used as the default value for colorControlActivated
|
||||||
<item name="colorPrimaryDark">#00857D</item>
|
|
||||||
<!-- colorAccent is used as the default value for colorControlActivated
|
|
||||||
which is used to tint widgets -->
|
which is used to tint widgets -->
|
||||||
<item name="colorAccent">#00857D</item>
|
<item name="colorAccent">#00857D</item>
|
||||||
<!-- You can also set colorControlNormal, colorControlActivated
|
<!-- You can also set colorControlNormal, colorControlActivated
|
||||||
colorControlHighlight and colorSwitchThumbNormal. -->
|
colorControlHighlight and colorSwitchThumbNormal. -->
|
||||||
<item name="windowActionModeOverlay">true</item>
|
<item name="windowActionModeOverlay">true</item>
|
||||||
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
|
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
|
||||||
<item name="android:windowBackground">@drawable/background</item>
|
</style>
|
||||||
</style>
|
<style name="Theme.Splash" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
|
<item name="windowNoTitle">true</item>
|
||||||
<style name="Theme.Splash" parent="Theme.AppCompat.Light.NoActionBar">
|
<item name="android:windowFullscreen">true</item>
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="android:windowBackground">@drawable/background</item>
|
||||||
<item name="android:background">@drawable/splash_drawable</item>
|
</style>
|
||||||
<item name="colorPrimaryDark">#00857D</item>
|
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
|
||||||
</style>
|
<item name="colorAccent">#00857D</item>
|
||||||
|
</style>
|
||||||
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
|
|
||||||
<item name="colorAccent">#00857D</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -221,7 +221,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Activities\MainActivity.cs" />
|
<Compile Include="Activities\MainActivity.cs" />
|
||||||
<Compile Include="Activities\SplashActivity.cs" />
|
|
||||||
<Compile Include="Effects\EntryLineColorEffect.cs" />
|
<Compile Include="Effects\EntryLineColorEffect.cs" />
|
||||||
<Compile Include="Extensions\ViewExtensions.cs" />
|
<Compile Include="Extensions\ViewExtensions.cs" />
|
||||||
<Compile Include="Helpers\Settings.cs" />
|
<Compile Include="Helpers\Settings.cs" />
|
||||||
@ -234,6 +233,7 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Effects\CircleEffect.cs" />
|
<Compile Include="Effects\CircleEffect.cs" />
|
||||||
<Compile Include="Effects\BaseContainerEffect.cs" />
|
<Compile Include="Effects\BaseContainerEffect.cs" />
|
||||||
|
<Compile Include="Activities\SplashActivity.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidAsset Include="..\CommonResources\Fonts\Montserrat-Bold.ttf">
|
<AndroidAsset Include="..\CommonResources\Fonts\Montserrat-Bold.ttf">
|
||||||
@ -279,9 +279,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidResource Include="Resources\values\styles.xml" />
|
<AndroidResource Include="Resources\values\styles.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<AndroidResource Include="Resources\drawable\splash_drawable.xml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidResource Include="Resources\drawable\fake_product_01.png" />
|
<AndroidResource Include="Resources\drawable\fake_product_01.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user