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;
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Models.Marketing;
|
|
||||||
using Xamarin.Forms;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using eShopOnContainers.Core.Models.Marketing;
|
||||||
|
|
||||||
|
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;
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Models.Marketing;
|
using eShopOnContainers.Core.Models.Marketing;
|
||||||
using RequestProvider;
|
using eShopOnContainers.Core.Services.RequestProvider;
|
||||||
using Extensions;
|
using eShopOnContainers.Core.Extensions;
|
||||||
using Helpers;
|
using eShopOnContainers.Core.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.Collections.ObjectModel;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Models.Marketing;
|
using eShopOnContainers.Core.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.Threading.Tasks;
|
|
||||||
using Helpers;
|
|
||||||
using Models.Marketing;
|
|
||||||
using Services.Marketing;
|
|
||||||
using Base;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
using eShopOnContainers.Core.ViewModels.Base;
|
||||||
|
using eShopOnContainers.Core.Helpers;
|
||||||
|
using eShopOnContainers.Core.Models.Marketing;
|
||||||
|
using eShopOnContainers.Core.Services.Marketing;
|
||||||
|
|
||||||
|
namespace eShopOnContainers.Core.ViewModels
|
||||||
|
{
|
||||||
public class CampaignDetailsViewModel : ViewModelBase
|
public class CampaignDetailsViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
private CampaignItem _campaign;
|
private CampaignItem _campaign;
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
namespace eShopOnContainers.Core.ViewModels
|
using System.Threading.Tasks;
|
||||||
{
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using Models.Marketing;
|
using eShopOnContainers.Core.Models.Marketing;
|
||||||
using Services.Marketing;
|
using eShopOnContainers.Core.Services.Marketing;
|
||||||
using Base;
|
using eShopOnContainers.Core.ViewModels.Base;
|
||||||
using Helpers;
|
using eShopOnContainers.Core.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);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
namespace eShopOnContainers.Core.Views
|
using Xamarin.Forms;
|
||||||
{
|
|
||||||
using Xamarin.Forms;
|
|
||||||
|
|
||||||
|
namespace eShopOnContainers.Core.Views
|
||||||
|
{
|
||||||
public partial class CampaignView : ContentPage
|
public partial class CampaignView : ContentPage
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -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,7 +6,6 @@ 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
|
||||||
{
|
{
|
||||||
@ -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,9 +1,7 @@
|
|||||||
<?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 -->
|
<!-- Base theme applied no matter what API -->
|
||||||
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
|
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
|
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
|
||||||
@ -22,17 +20,13 @@
|
|||||||
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">
|
<style name="Theme.Splash" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
<item name="android:background">@drawable/splash_drawable</item>
|
<item name="android:windowFullscreen">true</item>
|
||||||
<item name="colorPrimaryDark">#00857D</item>
|
<item name="android:windowBackground">@drawable/background</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
|
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
|
||||||
<item name="colorAccent">#00857D</item>
|
<item name="colorAccent">#00857D</item>
|
||||||
</style>
|
</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