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.Threading.Tasks;
|
||||
using Models.Marketing;
|
||||
using Xamarin.Forms;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
using Xamarin.Forms;
|
||||
using eShopOnContainers.Core.Models.Marketing;
|
||||
|
||||
namespace eShopOnContainers.Core.Services.Marketing
|
||||
{
|
||||
public class CampaignMockService : ICampaignService
|
||||
{
|
||||
private readonly ObservableCollection<CampaignItem> _mockCampaign = new ObservableCollection<CampaignItem>
|
||||
@ -39,14 +39,12 @@
|
||||
public async Task<ObservableCollection<CampaignItem>> GetAllCampaignsAsync(string token)
|
||||
{
|
||||
await Task.Delay(500);
|
||||
|
||||
return _mockCampaign;
|
||||
}
|
||||
|
||||
public async Task<CampaignItem> GetCampaignByIdAsync(int campaignId, string token)
|
||||
{
|
||||
await Task.Delay(500);
|
||||
|
||||
return _mockCampaign.SingleOrDefault(c => c.Id == campaignId);
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
namespace eShopOnContainers.Core.Services.Marketing
|
||||
{
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
using Models.Marketing;
|
||||
using RequestProvider;
|
||||
using Extensions;
|
||||
using Helpers;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
using eShopOnContainers.Core.Models.Marketing;
|
||||
using eShopOnContainers.Core.Services.RequestProvider;
|
||||
using eShopOnContainers.Core.Extensions;
|
||||
using eShopOnContainers.Core.Helpers;
|
||||
|
||||
namespace eShopOnContainers.Core.Services.Marketing
|
||||
{
|
||||
public class CampaignService : ICampaignService
|
||||
{
|
||||
private readonly IRequestProvider _requestProvider;
|
||||
|
@ -1,13 +1,12 @@
|
||||
namespace eShopOnContainers.Core.Services.Marketing
|
||||
{
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
using Models.Marketing;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
using eShopOnContainers.Core.Models.Marketing;
|
||||
|
||||
namespace eShopOnContainers.Core.Services.Marketing
|
||||
{
|
||||
public interface ICampaignService
|
||||
{
|
||||
Task<ObservableCollection<CampaignItem>> GetAllCampaignsAsync(string token);
|
||||
|
||||
Task<CampaignItem> GetCampaignByIdAsync(int id, string token);
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
namespace eShopOnContainers.Core.ViewModels
|
||||
{
|
||||
using System.Threading.Tasks;
|
||||
using Helpers;
|
||||
using Models.Marketing;
|
||||
using Services.Marketing;
|
||||
using Base;
|
||||
using System.Windows.Input;
|
||||
using Xamarin.Forms;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
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
|
||||
{
|
||||
private CampaignItem _campaign;
|
||||
@ -46,9 +46,9 @@
|
||||
IsBusy = true;
|
||||
|
||||
// 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 Xamarin.Forms;
|
||||
using System.Collections.ObjectModel;
|
||||
using Models.Marketing;
|
||||
using Services.Marketing;
|
||||
using Base;
|
||||
using Helpers;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using Xamarin.Forms;
|
||||
using System.Collections.ObjectModel;
|
||||
using eShopOnContainers.Core.Models.Marketing;
|
||||
using eShopOnContainers.Core.Services.Marketing;
|
||||
using eShopOnContainers.Core.ViewModels.Base;
|
||||
using eShopOnContainers.Core.Helpers;
|
||||
|
||||
namespace eShopOnContainers.Core.ViewModels
|
||||
{
|
||||
public class CampaignViewModel : ViewModelBase
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -41,7 +41,7 @@
|
||||
IsBusy = false;
|
||||
}
|
||||
|
||||
private async Task GetCampaignDetails(CampaignItem campaign)
|
||||
private async Task GetCampaignDetailsAsync(CampaignItem campaign)
|
||||
{
|
||||
await NavigationService.NavigateToAsync<CampaignDetailsViewModel>(campaign.Id);
|
||||
}
|
||||
|
@ -150,7 +150,7 @@
|
||||
Style="{StaticResource CampaignAvailabilityDescriptionStyle}"/>
|
||||
</Grid>
|
||||
|
||||
<AbsoluteLayout
|
||||
<AbsoluteLayout
|
||||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
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()
|
||||
|
@ -17,7 +17,6 @@ namespace eShopOnContainers.Droid.Activities
|
||||
Label = "eShopOnContainers",
|
||||
Icon = "@drawable/icon",
|
||||
Theme = "@style/MainTheme",
|
||||
MainLauncher = true,
|
||||
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||
public class MainActivity : FormsAppCompatActivity
|
||||
{
|
||||
|
@ -11,6 +11,7 @@ namespace eShopOnContainers.Droid.Activities
|
||||
Icon = "@drawable/icon",
|
||||
Theme = "@style/Theme.Splash",
|
||||
NoHistory = true,
|
||||
MainLauncher = true,
|
||||
ScreenOrientation = ScreenOrientation.Portrait)]
|
||||
public class SplashActivity : AppCompatActivity
|
||||
{
|
||||
@ -23,8 +24,7 @@ namespace eShopOnContainers.Droid.Activities
|
||||
|
||||
private void InvokeMainActivity()
|
||||
{
|
||||
var mainActivityIntent = new Intent(this, typeof(MainActivity));
|
||||
StartActivity(mainActivityIntent);
|
||||
StartActivity(new Intent(this, typeof(MainActivity)));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
|
||||
using Android.App;
|
||||
using Android.OS;
|
||||
using Android.Runtime;
|
||||
@ -7,12 +6,11 @@ using Plugin.CurrentActivity;
|
||||
|
||||
namespace eShopOnContainers.Droid
|
||||
{
|
||||
//You can specify additional application information in this attribute
|
||||
[Application]
|
||||
public class MainApplication : Application, Application.IActivityLifecycleCallbacks
|
||||
{
|
||||
public MainApplication(IntPtr handle, JniHandleOwnership transer)
|
||||
:base(handle, transer)
|
||||
: base(handle, transer)
|
||||
{
|
||||
}
|
||||
|
||||
@ -20,7 +18,6 @@ namespace eShopOnContainers.Droid
|
||||
{
|
||||
base.OnCreate();
|
||||
RegisterActivityLifecycleCallbacks(this);
|
||||
//A great place to initialize Xamarin.Insights and Dependency Services!
|
||||
}
|
||||
|
||||
public override void OnTerminate()
|
||||
|
@ -2340,8 +2340,8 @@ namespace eShopOnContainers.Droid
|
||||
// aapt resource value: 0x7f0200b4
|
||||
public const int noimage = 2130837684;
|
||||
|
||||
// aapt resource value: 0x7f0200bb
|
||||
public const int notification_template_icon_bg = 2130837691;
|
||||
// aapt resource value: 0x7f0200ba
|
||||
public const int notification_template_icon_bg = 2130837690;
|
||||
|
||||
// aapt resource value: 0x7f0200b5
|
||||
public const int product_add = 2130837685;
|
||||
@ -2353,13 +2353,10 @@ namespace eShopOnContainers.Droid
|
||||
public const int roundedbgdark = 2130837687;
|
||||
|
||||
// aapt resource value: 0x7f0200b8
|
||||
public const int splash_drawable = 2130837688;
|
||||
public const int switch_off = 2130837688;
|
||||
|
||||
// aapt resource value: 0x7f0200b9
|
||||
public const int switch_off = 2130837689;
|
||||
|
||||
// aapt resource value: 0x7f0200ba
|
||||
public const int switch_on = 2130837690;
|
||||
public const int switch_on = 2130837689;
|
||||
|
||||
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>
|
||||
|
||||
<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">#00a69c</item>
|
||||
<!-- colorPrimaryDark is used for the status bar -->
|
||||
<item name="colorPrimaryDark">#00857D</item>
|
||||
<!-- colorAccent is used as the default value for colorControlActivated
|
||||
<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">#00a69c</item>
|
||||
<!-- colorPrimaryDark is used for the status bar -->
|
||||
<item name="colorPrimaryDark">#00857D</item>
|
||||
<!-- colorAccent is used as the default value for colorControlActivated
|
||||
which is used to tint widgets -->
|
||||
<item name="colorAccent">#00857D</item>
|
||||
<!-- You can also set colorControlNormal, colorControlActivated
|
||||
<item name="colorAccent">#00857D</item>
|
||||
<!-- You can also set colorControlNormal, colorControlActivated
|
||||
colorControlHighlight and colorSwitchThumbNormal. -->
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
|
||||
<item name="android:windowBackground">@drawable/background</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Splash" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="android:background">@drawable/splash_drawable</item>
|
||||
<item name="colorPrimaryDark">#00857D</item>
|
||||
</style>
|
||||
|
||||
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
|
||||
<item name="colorAccent">#00857D</item>
|
||||
</style>
|
||||
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
|
||||
</style>
|
||||
<style name="Theme.Splash" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
<item name="android:windowBackground">@drawable/background</item>
|
||||
</style>
|
||||
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
|
||||
<item name="colorAccent">#00857D</item>
|
||||
</style>
|
||||
</resources>
|
@ -221,7 +221,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Activities\MainActivity.cs" />
|
||||
<Compile Include="Activities\SplashActivity.cs" />
|
||||
<Compile Include="Effects\EntryLineColorEffect.cs" />
|
||||
<Compile Include="Extensions\ViewExtensions.cs" />
|
||||
<Compile Include="Helpers\Settings.cs" />
|
||||
@ -234,6 +233,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Effects\CircleEffect.cs" />
|
||||
<Compile Include="Effects\BaseContainerEffect.cs" />
|
||||
<Compile Include="Activities\SplashActivity.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidAsset Include="..\CommonResources\Fonts\Montserrat-Bold.ttf">
|
||||
@ -279,9 +279,6 @@
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\values\styles.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\splash_drawable.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\fake_product_01.png" />
|
||||
</ItemGroup>
|
||||
|
Loading…
x
Reference in New Issue
Block a user