├── .gitignore
├── DualSplash.Android
├── Activities
│ ├── MainActivity.cs
│ └── SplashActivity.cs
├── Assets
│ └── AboutAssets.txt
├── DualSplash.Android.csproj
├── DualSplash.Android.csproj.user
├── Ioc
│ └── Locator
│ │ └── ViewModelLocator.cs
├── Properties
│ ├── AndroidManifest.xml
│ └── AssemblyInfo.cs
└── Resources
│ ├── AboutResources.txt
│ ├── Resource.Designer.cs
│ ├── drawable-hdpi
│ ├── Icon.png
│ ├── first_screen.png
│ └── splash_logo.png
│ ├── drawable-mdpi
│ ├── Icon.png
│ ├── first_screen.png
│ └── splash_logo.png
│ ├── drawable-tvdpi
│ └── first_screen.png
│ ├── drawable-xhdpi
│ ├── Icon.png
│ ├── first_screen.png
│ └── splash_logo.png
│ ├── drawable-xxhdpi
│ ├── Icon.png
│ ├── first_screen.png
│ └── splash_logo.png
│ ├── drawable-xxxhdpi
│ ├── Icon.png
│ ├── first_screen.png
│ └── splash_logo.png
│ ├── drawable
│ ├── Icon.png
│ ├── first_screen_xml.xml
│ └── splash_screen_xml.xml
│ ├── layout
│ ├── Main.axml
│ ├── Tabbar.axml
│ └── Toolbar.axml
│ ├── values-v21
│ └── styles.xml
│ └── values
│ ├── Strings.xml
│ ├── colors.xml
│ └── styles.xml
├── DualSplash.Core
├── DualSplash.Core.csproj
├── DualSplashApp.cs
├── Ioc
│ └── AppContainer.cs
├── SingleSplashApp.cs
├── Utils
│ └── Constants.cs
├── ViewModels
│ └── SlowPageViewModel.cs
└── Views
│ ├── FastPage.cs
│ ├── SlowPage.xaml
│ └── SlowPage.xaml.cs
├── DualSplash.sln
├── README.md
├── SingleSplash.Android
├── Assets
│ └── AboutAssets.txt
├── FodyWeavers.xml.hide
├── Ioc
│ └── Locator
│ │ └── ViewModelLocator.cs
├── MainActivity.cs
├── MainActivity.orig.cs
├── Properties
│ ├── AndroidManifest.xml
│ └── AssemblyInfo.cs
├── Resources
│ ├── AboutResources.txt
│ ├── Resource.Designer.cs
│ ├── drawable-hdpi
│ │ ├── icon.png
│ │ └── splash_logo.png
│ ├── drawable-mdpi
│ │ ├── Icon.png
│ │ └── splash_logo.png
│ ├── drawable-xhdpi
│ │ ├── icon.png
│ │ └── splash_logo.png
│ ├── drawable-xxhdpi
│ │ ├── icon.png
│ │ └── splash_logo.png
│ ├── drawable-xxxhdpi
│ │ ├── Icon.png
│ │ └── splash_logo.png
│ ├── drawable
│ │ ├── Icon.png
│ │ └── splash_screen_xml.xml
│ ├── layout
│ │ ├── Main.axml
│ │ ├── Tabbar.axml
│ │ └── Toolbar.axml
│ ├── values-v21
│ │ └── styles.xml
│ └── values
│ │ ├── Strings.xml
│ │ ├── colors.xml
│ │ └── styles.xml
├── SingleSplash.Android.csproj
└── SingleSplash.Android.csproj.user
└── WhichIsFaster.png
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | #Ignore thumbnails created by Windows
3 | Thumbs.db
4 | #Ignore files built by Visual Studio
5 | *.obj
6 | *.exe
7 | *.pdb
8 | *.user
9 | *.aps
10 | *.pch
11 | *.vspscc
12 | *_i.c
13 | *_p.c
14 | *.ncb
15 | *.suo
16 | *.tlb
17 | *.tlh
18 | *.bak
19 | *.cache
20 | *.ilk
21 | *.log
22 | [Bb]in
23 | [Dd]ebug*/
24 | *.lib
25 | *.sbr
26 | obj/
27 | [Rr]elease*/
28 | _ReSharper*/
29 | [Tt]est[Rr]esult*
30 | .vs/
31 | #Nuget packages folder
32 | packages/
33 | /DualSplash.Android/obj
34 | /DualSplash/.vs
35 | /DualSplash.Android/DualSplash.Android.csproj.user
36 | /DualSplash/.vs/DualSplash/v15/.suo
37 | /DualSplash.Android/DualSplash.Android.csproj.user
38 | /DualSplash.Android/DualSplash.Android.csproj.user
39 | /DualSplash/.vs/DualSplash/v15/.suo
40 | /SingleSplash.Android/SingleSplash.Android.csproj.user
41 | /DualSplash.Android/DualSplash.Android.csproj.user
42 | /~$Notes.docx
43 | /~WRL0961.tmp
44 | /Notes.docx
45 | /Notes.md
46 | /~$Notes.md
47 |
--------------------------------------------------------------------------------
/DualSplash.Android/Activities/MainActivity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 | using Android.App;
5 | using Android.Content.PM;
6 | using Android.OS;
7 | using Android.Runtime;
8 | using Android.Views;
9 | using DualSplash.Core;
10 | using Xamarin;
11 |
12 |
13 | namespace DualSplash.Android
14 | {
15 |
16 | [Activity(Label = "@string/ApplicationTitle",
17 | Icon = "@drawable/icon",
18 | Theme = "@style/FirstScreen.Before",
19 | MainLauncher = false,
20 | ScreenOrientation = ScreenOrientation.SensorPortrait,
21 | LaunchMode = LaunchMode.SingleInstance,
22 | NoHistory = false,
23 |
24 | ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
25 | [Preserve(AllMembers = true)]
26 | public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity //AppCompatActivity // global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
27 | {
28 | public MainActivity()
29 | {
30 | #if TRACE
31 |
32 | DualSplashApp.stopWatch.Stop();
33 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------------------------------------------------------------" +
34 | $"\n ---------------------------------------------------------------------------------");
35 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------Starting MainActivity Constructor: {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
36 | DualSplashApp.stopWatch.Start();
37 |
38 | #endif
39 | }
40 | private static int Frame_CONTENT_VIEW_ID = 10101010;
41 | protected override async void OnCreate(Bundle bundle)
42 | {
43 |
44 | #if TRACE
45 | DualSplashApp.stopWatch.Stop();
46 | System.Diagnostics.Trace.WriteLine(
47 | $"\n ---------------------------MainActivity ----- OnCreate: {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
48 | DualSplashApp.stopWatch.Start();
49 | #endif
50 |
51 | TabLayoutResource = Resource.Layout.Tabbar;
52 | ToolbarResource = Resource.Layout.Toolbar;
53 |
54 | //set Splash screen and back normal Theme
55 | base.Window.RequestFeature(WindowFeatures.ActionBar);
56 |
57 | // Name of the MainActivity theme you had there before.
58 | // Or you can use global::Android.Resource.Style.ThemeHoloLight
59 |
60 |
61 | base.SetTheme(Resource.Style.FirstScreen_After);
62 | base.OnCreate(bundle);
63 |
64 |
65 | /*
66 | // this if if you don't want to use UserDialogs.ShowLoading/HideLoading and want to use Native ProgressBar
67 |
68 | MainActivity activity = this;
69 |
70 | FrameLayout.LayoutParams fLParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);//ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
71 | fLParams.Gravity = GravityFlags.Center;
72 |
73 | ProgressBar progressBar = new ProgressBar(activity, null, Android.Resource.Attribute.ProgressBarStyleLarge);
74 | progressBar.Indeterminate = true; //.setIndeterminate(true);
75 | progressBar.Visibility = ViewStates.Visible; //setVisibility(View.VISIBLE);
76 |
77 |
78 | FrameLayout frame = new FrameLayout(this);
79 | frame.Id = Frame_CONTENT_VIEW_ID;
80 | this.AddContentView(frame, fLParams);
81 |
82 |
83 |
84 | frame.AddView(progressBar);
85 | */
86 |
87 |
88 |
89 |
90 |
91 |
92 | //Activating UserDialogs
93 | //Acr.UserDialogs.UserDialogs.Init((Activity)Forms.Context);
94 | Acr.UserDialogs.UserDialogs.Instance.ShowLoading();
95 |
96 | #if TRACE
97 | DualSplashApp.stopWatch.Stop();
98 | System.Diagnostics.Trace.WriteLine(
99 | $"\n ---------------------------MainActivity -- OnCreate --After ShowLoading: {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
100 | DualSplashApp.stopWatch.Start();
101 | #endif
102 |
103 |
104 | try
105 | {
106 |
107 |
108 | await Task.Run(() =>
109 | {
110 |
111 |
112 | /*
113 | // Init Code that moved to SplashActivity
114 |
115 | //init Google Analytics for mobile
116 | GATracking_Android.GetGASInstance()
117 | .Initialize_NativeGAS("Stam", this); //"UA-40001613-3", this); //TrackingID first parameter
118 |
119 | etc........
120 |
121 | */
122 |
123 | //init Insights
124 | if (bundle == null && !Insights.IsInitialized)
125 | {
126 | Xamarin.Insights.Initialize("AppID",
127 | ApplicationContext); //"b7015d6e120008cb54e81254b603f354855b059b", ApplicationContext);
128 | //Insights.Initialize("apikey", ApplicationContext);
129 | Insights.DisableCollection = false;
130 | Insights.DisableDataTransmission = false;
131 | Insights.DisableExceptionCatching = false;
132 | }
133 |
134 |
135 |
136 | //await Task.Delay(500); // slow analytics init
137 | Thread.Sleep(500); // 1
138 |
139 |
140 |
141 |
142 |
143 | });
144 |
145 |
146 |
147 |
148 |
149 |
150 | await Task.Run(() =>
151 | {
152 | RunOnUiThread(() =>
153 | {
154 | #if TRACE
155 | DualSplashApp.stopWatch.Stop();
156 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------MainActivity -Reach BEFORE LoadApplication( DualSplashApp.......) -----: {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
157 | DualSplashApp.stopWatch.Start();
158 | #endif
159 |
160 |
161 |
162 |
163 | LoadApplication(new DualSplashApp());
164 | #if TRACE
165 | DualSplashApp.stopWatch.Stop();
166 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------MainActivity - AFTER LoadApplication( DualSplashApp.......) -----: {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
167 | DualSplashApp.stopWatch.Start();
168 | #endif
169 |
170 |
171 | });
172 | });
173 |
174 | #if TRACE
175 | DualSplashApp.stopWatch.Stop();
176 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------MainActivity -finish OnCreate -----: {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
177 | DualSplashApp.stopWatch.Start();
178 | #endif
179 |
180 |
181 |
182 |
183 | }
184 | catch (Exception ex)
185 | {
186 | Insights.Report(ex, Insights.Severity.Error);
187 | // TrackService.Track_App_Exception(String.Format("GA Exception Message: \n {0} \n GA Exception StackTrace: \n {1}", ex.Message, ex.StackTrace), false);
188 |
189 |
190 | }
191 | }
192 |
193 | }
194 | }
195 |
196 |
--------------------------------------------------------------------------------
/DualSplash.Android/Activities/SplashActivity.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 | using Android.App;
5 | using Android.Content;
6 | using Android.Content.PM;
7 | using Android.OS;
8 | using Android.Runtime;
9 | using Android.Support.V7.App;
10 | using DualSplash.Android.Ioc.Locator;
11 | using DualSplash.Core;
12 | using DualSplash.Core.Ioc;
13 | using Xamarin;
14 | using Xamarin.Forms;
15 | using XLabs.Ioc;
16 | using XLabs.Ioc.Autofac;
17 | using Application = Android.App.Application;
18 |
19 | namespace DualSplash.Android
20 | {
21 | [Activity(Label = "@string/ApplicationTitle",
22 | Icon = "@drawable/icon",
23 | Theme = "@style/splashscreen",
24 | MainLauncher = true,
25 | ScreenOrientation = ScreenOrientation.SensorPortrait,
26 | LaunchMode = LaunchMode.SingleTop,
27 | NoHistory = true,
28 | ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
29 | [Preserve(AllMembers = true)]
30 | public class SplashActivity : AppCompatActivity
31 |
32 | {
33 |
34 | public static bool IsInitialized = false;
35 |
36 | static readonly string TAG = "X:" + typeof(SplashActivity).Name;
37 | public IResolver AutofacResolver;
38 |
39 |
40 | public SplashActivity()
41 | {
42 | #if TRACE
43 |
44 |
45 |
46 | DualSplashApp.stopWatch = new Stopwatch();
47 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------------------------------------------------------------" +
48 | $"\n ---------------------------------------------------------------------------------");
49 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------Starting SplashActivity Constructor: {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
50 | DualSplashApp.stopWatch.Start();
51 | #endif
52 | }
53 |
54 | protected override void OnCreate(Bundle savedInstanceState)// ,PersistableBundle persistantState)
55 | {
56 |
57 | #if TRACE
58 | DualSplashApp.stopWatch.Stop();
59 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------SplashActivity Starting From OnCreate: {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
60 | DualSplashApp.stopWatch.Start();
61 | #endif
62 |
63 | base.OnCreate(savedInstanceState); //,persistantState);
64 | System.Diagnostics.Debug.WriteLine(TAG, "SplashActivity.OnCreate");
65 |
66 |
67 | //init Xamarin Forms
68 | global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
69 |
70 | //Activating UserDialogs
71 | Acr.UserDialogs.UserDialogs.Init((Activity)Forms.Context);
72 |
73 | // Slow Init Code only needed at start -- moved to MainActivity on final tweak
74 | if (!IsInitialized)
75 | {
76 | //await Task.Delay(500); // slow analytics init
77 | // Thread.Sleep(500); // 1
78 |
79 |
80 |
81 | }
82 | IsInitialized = true;
83 |
84 |
85 |
86 | #if TRACE
87 | DualSplashApp.stopWatch.Stop();
88 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------SplashActivity OnCreate AFTER FORMS.init and UserDialogs.Init : {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
89 | DualSplashApp.stopWatch.Start();
90 | #endif
91 |
92 |
93 | }
94 |
95 |
96 |
97 | // Launches the startup task
98 | protected override void OnResume()
99 | {
100 | base.OnResume();
101 | Task startupWork = new Task(() => { SimulateStartup(); });
102 |
103 | #if TRACE
104 | DualSplashApp.stopWatch.Stop();
105 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------SplashActivity OnResume Before UserDialogs.ShowLoading : {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
106 | DualSplashApp.stopWatch.Start();
107 | #endif
108 | Acr.UserDialogs.UserDialogs.Instance.ShowLoading();
109 | startupWork.Start();
110 | }
111 |
112 | // Simulates background work that happens behind the splash screen
113 | void SimulateStartup()
114 | {
115 | #if TRACE
116 | DualSplashApp.stopWatch.Stop();
117 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------SplashActivity SimulateStartup Before Slow Init Code : {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
118 | DualSplashApp.stopWatch.Start();
119 | #endif
120 | System.Diagnostics.Debug.WriteLine(TAG, "Performing some startup work that takes a bit of time.");
121 | // await Task.Delay(1000); // Simulate a bit of startup work.
122 |
123 | //Starting all kind of Initialization methods that make delays
124 | //init AutoFac container for DI
125 | if(AppContainer.Container==null)
126 | AppContainer.Container = ViewModelLocator.RegisterDependencies(false);
127 |
128 |
129 | //for XLabs Init
130 | if (AutofacResolver == null)
131 | AutofacResolver = new AutofacResolver(AppContainer.Container);
132 | if (!Resolver.IsSet)
133 | Resolver.SetResolver(AutofacResolver);
134 |
135 | //init Google Analytics for mobile
136 | //GATracking_Android.GetGASInstance()
137 | // .Initialize_NativeGAS("Stam", this); //"UA-XXXXXXXXX-X", this); //TrackingID first parameter
138 |
139 | //init Insights -- moved to MainActivity on Final tweak
140 | // if (bundle == null && !Insights.IsInitialized)
141 | /* if (!Insights.IsInitialized)
142 | {
143 | Xamarin.Insights.Initialize("AppID",
144 | ApplicationContext); //"b7015d6e120008cb54e81254b603f354855b059b", ApplicationContext);
145 | //Insights.Initialize("apikey", ApplicationContext);
146 | Insights.DisableCollection = false;
147 | Insights.DisableDataTransmission = false;
148 | Insights.DisableExceptionCatching = false;
149 | }
150 |
151 | */
152 | //Init Code for Ads of Admob , Facebook , Leadbolt etc.
153 | //init interstitial ad by leadbolt
154 | string LeadBoltInterStitial_API_KEY = "XXXXXXXXXXXXXXXXXXXXXXXXXX";
155 | // InterStitial_Android_LeadBolt.Get_ServiceInstance().Init_InterStitial(LeadBoltInterStitial_API_KEY, this);
156 |
157 |
158 | //init interstitial ad by AdMob
159 | string Admob_Interstit_Ad_UnitID =
160 | "ca-app-pub-XXXXXXXXXXXXXXXXXXXXXXXX";
161 | //InterStitial_Android_AdMob.Get_ServiceInstance().Init_InterStitial(Admob_Interstit_Ad_UnitID, this);
162 |
163 |
164 |
165 | //init interstitial ad by Facebook
166 | string Fb_PlacementID = "XXXXXXXXXXXXXXXXXXXXXXXXXX";
167 | //InterStitial_Android_Facebook.Get_ServiceInstance().Init_InterStitial(Fb_PlacementID, this);
168 |
169 |
170 | //init interstitial ad Mock
171 | // string Stam_PlacementID = "XXXXXXXXXXXXXXXXXXXXXXXXXXXX";
172 | // InterStitial_Android_Mock.Get_ServiceInstance().Init_InterStitial("Stam");
173 |
174 |
175 |
176 |
177 | System.Diagnostics.Debug.WriteLine(TAG, "Startup work is finished - starting MainActivity.");
178 | #if TRACE
179 | DualSplashApp.stopWatch.Stop();
180 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------SplashActivity SimulateStartup AFTER Slow Init Code : {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
181 | System.Diagnostics.Trace.WriteLine($"\n --------------------------- BEFORE StartActivity MainActivity : {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
182 | DualSplashApp.stopWatch.Start();
183 | #endif
184 |
185 |
186 | StartActivity(new Intent(Application.Context, typeof(MainActivity)));
187 | Finish();
188 | }
189 |
190 | protected override void OnPause()
191 | {
192 | base.OnPause();
193 | Acr.UserDialogs.UserDialogs.Instance.HideLoading();
194 | }
195 | }
196 | }
--------------------------------------------------------------------------------
/DualSplash.Android/Assets/AboutAssets.txt:
--------------------------------------------------------------------------------
1 | Any raw assets you want to be deployed with your application can be placed in
2 | this directory (and child directories) and given a Build Action of "AndroidAsset".
3 |
4 | These files will be deployed with you package and will be accessible using Android's
5 | AssetManager, like this:
6 |
7 | public class ReadAsset : Activity
8 | {
9 | protected override void OnCreate (Bundle bundle)
10 | {
11 | base.OnCreate (bundle);
12 |
13 | InputStream input = Assets.Open ("my_asset.txt");
14 | }
15 | }
16 |
17 | Additionally, some Android functions will automatically load asset files:
18 |
19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
--------------------------------------------------------------------------------
/DualSplash.Android/DualSplash.Android.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {33772F00-8EFD-48A3-A4CB-19A438A7680A}
9 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
10 | Library
11 | Properties
12 | DualSplash.Android
13 | ExDollar.Test.Vanilla.Android
14 | 512
15 | True
16 | Resources\Resource.Designer.cs
17 | Off
18 | false
19 | v7.1
20 | Properties\AndroidManifest.xml
21 | true
22 | PackageReference
23 |
24 |
25 | True
26 | Full
27 | False
28 | bin\Debug\
29 | DEBUG;TRACE
30 | prompt
31 | 4
32 | True
33 | SdkOnly
34 | False
35 |
36 | false
37 | false
38 |
39 |
40 | PdbOnly
41 | True
42 | True
43 | bin\Release\
44 | TRACE
45 | prompt
46 | 4
47 | False
48 | SdkOnly
49 | True
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | Designer
71 |
72 |
73 | Designer
74 |
75 |
76 |
77 |
78 | Designer
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 25.1.1
96 |
97 |
98 | 25.1.1
99 |
100 |
101 | 25.1.1
102 |
103 |
104 | 25.1.1
105 |
106 |
107 | 25.1.1
108 |
109 |
110 | 25.1.1
111 |
112 |
113 | 32.940.0-beta3
114 |
115 |
116 | 1.12.3
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 | {7fb7ac69-309f-4684-8d07-96d4aba0f1f2}
158 | DualSplash.Core
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
193 |
--------------------------------------------------------------------------------
/DualSplash.Android/DualSplash.Android.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | LGE Nexus 4
5 | ShowAllFiles
6 | AVD_GalaxyNexus_ToolsForApacheCordova
7 |
8 |
--------------------------------------------------------------------------------
/DualSplash.Android/Ioc/Locator/ViewModelLocator.cs:
--------------------------------------------------------------------------------
1 | using Acr.UserDialogs;
2 | using Android.App;
3 | using Autofac;
4 | using DualSplash.Core.ViewModels;
5 | using DualSplash.Core.Views;
6 | using XLabs.Platform.Device;
7 | using IContainer = Autofac.IContainer;
8 | using Thread = System.Threading.Thread;
9 |
10 |
11 | namespace DualSplash.Android.Ioc.Locator
12 | {
13 | public static class ViewModelLocator
14 | {
15 | private static IContainer _container;
16 |
17 |
18 | public static T Resolve()
19 | {
20 | return _container.Resolve();
21 | }
22 |
23 | public static IContainer RegisterDependencies(bool useMockServices,Application application=null)
24 | {
25 | var builder = new ContainerBuilder();
26 |
27 | //moq
28 | /* Mock moqDialogs = new Mock();
29 | Mock moqDevice =new Mock();
30 | Mock moqDisplay =new Mock();
31 | Mock moqFontManager =new Mock();*/
32 |
33 |
34 |
35 |
36 |
37 |
38 | // Register ViewModels
39 | builder.RegisterType().SingleInstance();
40 |
41 | // Register Views
42 | builder.RegisterType().SingleInstance();
43 | builder.RegisterType().SingleInstance();
44 |
45 |
46 |
47 | /*
48 | builder.RegisterType();
49 | builder.RegisterType();
50 | builder.RegisterType();
51 | builder.RegisterType();
52 | builder.RegisterType();
53 | builder.RegisterType();
54 | builder.RegisterType();
55 | builder.RegisterType();
56 | */
57 |
58 | //Register Services
59 | /* builder.RegisterType()
60 | .As()
61 | .SingleInstance();*/
62 |
63 | //await Task.Delay(500); // Slow init code
64 | Thread.Sleep(500); // 2
65 |
66 |
67 | // Services
68 | ////////////////////////////////////////////////////////////////////////////////////////////
69 | /*
70 | builder.RegisterType().As()
71 | .SingleInstance();
72 | */
73 |
74 | // Register Base Services
75 | //////----------------------------------Navigation--------------------------
76 |
77 | /*
78 | builder.RegisterType()
79 | .As()
80 | .SingleInstance();
81 | */
82 |
83 |
84 | ////////////////---------------------Ads -----------------------------------------
85 | /*
86 | builder.RegisterType()
87 | .As()
88 | .SingleInstance();
89 | */
90 |
91 | //////----------------------------------Aggregate Services--------------------------
92 | /*
93 | builder.RegisterAggregateService();
94 | */
95 |
96 |
97 |
98 |
99 |
100 | /////////////////////// android services
101 |
102 | builder.Register(t => AndroidDevice.CurrentDevice)
103 | .As()
104 | .SingleInstance();
105 |
106 | builder.Register(t => AndroidDevice.CurrentDevice.Display)
107 | .As()
108 | .SingleInstance();
109 |
110 | builder.RegisterType()
111 | .As()
112 | .SingleInstance();
113 |
114 |
115 | // UserDialogs.Init(application);
116 | builder.RegisterInstance(UserDialogs.Instance)
117 | .As()
118 | .SingleInstance();
119 |
120 |
121 |
122 | /*
123 | builder.RegisterType().As().SingleInstance();
124 | builder.RegisterType().As();
125 | builder.RegisterType().As();
126 | builder.RegisterType().As();
127 | builder.RegisterType().As();
128 | builder.RegisterType().As().SingleInstance();
129 |
130 | */
131 | if (useMockServices)
132 | {
133 | /* builder.RegisterInstance(new CatalogMockService()).As();
134 | builder.RegisterInstance(new BasketMockService()).As();
135 | builder.RegisterInstance(new OrderMockService()).As();
136 | builder.RegisterInstance(new UserMockService()).As();
137 | */
138 | //UseMockService = true;
139 | }
140 | else
141 | {
142 | /*
143 | builder.RegisterType().As().SingleInstance();
144 | builder.RegisterType().As().SingleInstance();
145 | builder.RegisterType().As().SingleInstance();
146 | builder.RegisterType().As().SingleInstance();
147 |
148 | UseMockService = false;
149 | */
150 | }
151 |
152 | if (_container != null)
153 | {
154 | _container.Dispose();
155 | }
156 | _container = builder.Build();
157 |
158 | return _container;
159 | }
160 | }
161 | }
--------------------------------------------------------------------------------
/DualSplash.Android/Properties/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/DualSplash.Android/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using Android.App;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("ExDollar.Test.Vanilla.Android")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("ExDollar.Test.Vanilla.Android")]
14 | [assembly: AssemblyCopyright("Copyright © 2017")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 | [assembly: ComVisible(false)]
18 |
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Build and Revision Numbers
27 | // by using the '*' as shown below:
28 | // [assembly: AssemblyVersion("1.0.*")]
29 | [assembly: AssemblyVersion("1.0.0.0")]
30 | [assembly: AssemblyFileVersion("1.0.0.0")]
31 |
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/AboutResources.txt:
--------------------------------------------------------------------------------
1 | Images, layout descriptions, binary blobs and string dictionaries can be included
2 | in your application as resource files. Various Android APIs are designed to
3 | operate on the resource IDs instead of dealing with images, strings or binary blobs
4 | directly.
5 |
6 | For example, a sample Android app that contains a user interface layout (main.axml),
7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
8 | would keep its resources in the "Resources" directory of the application:
9 |
10 | Resources/
11 | drawable/
12 | icon.png
13 |
14 | layout/
15 | main.axml
16 |
17 | values/
18 | strings.xml
19 |
20 | In order to get the build system to recognize Android resources, set the build action to
21 | "AndroidResource". The native Android APIs do not operate directly with filenames, but
22 | instead operate on resource IDs. When you compile an Android application that uses resources,
23 | the build system will package the resources for distribution and generate a class called "R"
24 | (this is an Android convention) that contains the tokens for each one of the resources
25 | included. For example, for the above Resources layout, this is what the R class would expose:
26 |
27 | public class R {
28 | public class drawable {
29 | public const int icon = 0x123;
30 | }
31 |
32 | public class layout {
33 | public const int main = 0x456;
34 | }
35 |
36 | public class strings {
37 | public const int first_string = 0xabc;
38 | public const int second_string = 0xbcd;
39 | }
40 | }
41 |
42 | You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
43 | to reference the layout/main.axml file, or R.strings.first_string to reference the first
44 | string in the dictionary file values/strings.xml.
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable-hdpi/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/DualSplash.Android/Resources/drawable-hdpi/Icon.png
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable-hdpi/first_screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/DualSplash.Android/Resources/drawable-hdpi/first_screen.png
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable-hdpi/splash_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/DualSplash.Android/Resources/drawable-hdpi/splash_logo.png
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable-mdpi/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/DualSplash.Android/Resources/drawable-mdpi/Icon.png
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable-mdpi/first_screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/DualSplash.Android/Resources/drawable-mdpi/first_screen.png
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable-mdpi/splash_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/DualSplash.Android/Resources/drawable-mdpi/splash_logo.png
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable-tvdpi/first_screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/DualSplash.Android/Resources/drawable-tvdpi/first_screen.png
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable-xhdpi/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/DualSplash.Android/Resources/drawable-xhdpi/Icon.png
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable-xhdpi/first_screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/DualSplash.Android/Resources/drawable-xhdpi/first_screen.png
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable-xhdpi/splash_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/DualSplash.Android/Resources/drawable-xhdpi/splash_logo.png
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable-xxhdpi/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/DualSplash.Android/Resources/drawable-xxhdpi/Icon.png
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable-xxhdpi/first_screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/DualSplash.Android/Resources/drawable-xxhdpi/first_screen.png
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable-xxhdpi/splash_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/DualSplash.Android/Resources/drawable-xxhdpi/splash_logo.png
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable-xxxhdpi/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/DualSplash.Android/Resources/drawable-xxxhdpi/Icon.png
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable-xxxhdpi/first_screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/DualSplash.Android/Resources/drawable-xxxhdpi/first_screen.png
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable-xxxhdpi/splash_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/DualSplash.Android/Resources/drawable-xxxhdpi/splash_logo.png
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/DualSplash.Android/Resources/drawable/Icon.png
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable/first_screen_xml.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | -
7 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/drawable/splash_screen_xml.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | -
7 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/layout/Main.axml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/layout/Tabbar.axml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/layout/Toolbar.axml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/values/Strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello World, Click Me!
4 | DualSplash.Android
5 |
6 |
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 | #FFFFFF
3 | #03A9F4
4 | #1976D2
5 | #FFC107
6 | #F5F5F5
7 | #FFFFFF
8 |
--------------------------------------------------------------------------------
/DualSplash.Android/Resources/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
29 |
30 |
35 |
36 |
42 |
43 |
46 |
50 |
51 |
52 |
55 |
56 |
--------------------------------------------------------------------------------
/DualSplash.Core/DualSplash.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard1.4
5 | $(PackageTargetFallback);portable45-net45+win8+wpa81;
6 | full
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | SlowPage.xaml
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/DualSplash.Core/DualSplashApp.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using Autofac;
3 | using DualSplash.Core.Ioc;
4 | using DualSplash.Core.ViewModels;
5 | using DualSplash.Core.Views;
6 | using Xamarin.Forms;
7 |
8 | namespace DualSplash.Core
9 | {
10 |
11 | [Xamarin.Forms.Internals.Preserve(AllMembers = true)]
12 | public class DualSplashApp : Application
13 | {
14 | public static NavigationPage RootNavigation;
15 | public static Stopwatch stopWatch;
16 |
17 | public DualSplashApp()
18 | {
19 |
20 |
21 |
22 |
23 |
24 |
25 | #if TRACE
26 |
27 | DualSplashApp.stopWatch.Stop();
28 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------DualSplashApp.cs - Start DualSplashApp Constructor before SlowPage created---------: {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
29 | DualSplashApp.stopWatch.Start();
30 |
31 | #endif
32 |
33 |
34 | //var container = AppContainer.Container;
35 | FastPage fastPage = null;
36 | if (AppContainer.Container != null)
37 | {
38 |
39 | using (var scope = AppContainer.Container.BeginLifetimeScope())
40 | {
41 | fastPage = scope.Resolve();
42 | }
43 | }
44 | //var dollarPage = container.Resolve();
45 | RootNavigation = new NavigationPage(fastPage);
46 | #if TRACE
47 | DualSplashApp.stopWatch.Stop();
48 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------DualSplashApp.cs - After SlowPage Created---------: {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
49 | DualSplashApp.stopWatch.Start();
50 | #endif
51 |
52 | MainPage = RootNavigation;
53 | #if TRACE
54 | DualSplashApp.stopWatch.Stop();
55 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------DualSplashApp.cs - After Set Navigation SlowPage---------: {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
56 | DualSplashApp.stopWatch.Start();
57 | #endif
58 |
59 | #if TRACE
60 | DualSplashApp.stopWatch.Stop();
61 |
62 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------Reach End DualSplashApp Constructor MainPage=mainNav...... {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
63 | DualSplashApp.stopWatch.Start();
64 | #endif
65 |
66 |
67 |
68 | }
69 |
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/DualSplash.Core/Ioc/AppContainer.cs:
--------------------------------------------------------------------------------
1 | using Autofac;
2 |
3 | namespace DualSplash.Core.Ioc
4 | {
5 | public static class AppContainer
6 | {
7 | public static IContainer Container { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/DualSplash.Core/SingleSplashApp.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using DualSplash.Core.Views;
3 | using Xamarin.Forms;
4 |
5 | namespace DualSplash.Core
6 | {
7 |
8 | [Xamarin.Forms.Internals.Preserve(AllMembers = true)]
9 | public class SingleSplashApp : Application
10 | {
11 | public static NavigationPage RootNavigation;
12 | public static Stopwatch stopWatch;
13 |
14 | public SingleSplashApp()
15 | {
16 |
17 |
18 |
19 |
20 |
21 |
22 | #if TRACE
23 |
24 | SingleSplashApp.stopWatch.Stop();
25 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------SingleSplashApp.cs - Start SingleSplashApp Constructor before SlowPage created---------: {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}");
26 | SingleSplashApp.stopWatch.Start();
27 |
28 | #endif
29 |
30 |
31 | //var container = AppContainer.Container;
32 | var slowPage = new SlowPage();
33 | //var dollarPage = container.Resolve();
34 | RootNavigation = new NavigationPage(slowPage);
35 | #if TRACE
36 | SingleSplashApp.stopWatch.Stop();
37 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------SingleSplashApp.cs - After SlowPage Created---------: {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}");
38 | SingleSplashApp.stopWatch.Start();
39 | #endif
40 |
41 | MainPage = RootNavigation;
42 | #if TRACE
43 | SingleSplashApp.stopWatch.Stop();
44 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------SingleSplashApp.cs - After Set Navigation SlowPage---------: {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}");
45 | SingleSplashApp.stopWatch.Start();
46 | #endif
47 |
48 | #if TRACE
49 | SingleSplashApp.stopWatch.Stop();
50 |
51 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------Reach End SingleSplashApp Constructor MainPage=mainNav...... {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}");
52 | SingleSplashApp.stopWatch.Start();
53 | #endif
54 |
55 |
56 |
57 | }
58 |
59 |
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/DualSplash.Core/Utils/Constants.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ExDollar.Mobile.Core.Services.Utils
8 | {
9 | public class Constants
10 | {
11 | public const string WindowBackgroundColorDefault = "#F5F5F5";
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/DualSplash.Core/ViewModels/SlowPageViewModel.cs:
--------------------------------------------------------------------------------
1 | using Acr.UserDialogs;
2 |
3 | namespace DualSplash.Core.ViewModels
4 | {
5 | public class SlowPageViewModel :MvvmHelpers.BaseViewModel
6 | {
7 | private bool _toggglePageLoadSwitch;
8 | public IUserDialogs _userDialogs;
9 | public SlowPageViewModel(IUserDialogs userDialogs)
10 | {
11 | _userDialogs = userDialogs;
12 | }
13 |
14 | public bool ToggglePageLoadSwitch
15 | {
16 | get { return _toggglePageLoadSwitch; }
17 | set => SetProperty(ref _toggglePageLoadSwitch, value);
18 | }
19 |
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/DualSplash.Core/Views/FastPage.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.Threading.Tasks;
3 | using ExDollar.Mobile.Core.Services.Utils;
4 | using Xamarin.Forms;
5 | using XLabs.Forms.Mvvm;
6 |
7 | namespace DualSplash.Core.Views
8 | {
9 | public class FastPage : SlowPage
10 | {
11 | public FastPage():base()
12 | {
13 |
14 | }
15 |
16 | protected override void OnAppearing()
17 | {
18 |
19 | #if TRACE
20 | if (DualSplashApp.stopWatch == null) DualSplashApp.stopWatch = new Stopwatch();
21 | DualSplashApp.stopWatch.Stop();
22 |
23 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------FastPage --Reach OnAppearing() !!! .... {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
24 | DualSplashApp.stopWatch.Start();
25 |
26 | #endif
27 | }
28 |
29 |
30 |
31 |
32 | public override async void Switch_OnToggled(object sender, ToggledEventArgs e)
33 | {
34 | #if TRACE
35 | DualSplashApp.stopWatch.Stop();
36 |
37 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------FastPage Reach After Page Load - Switch_OnToggled() !!! .... {DualSplashApp.stopWatch.Elapsed.TotalSeconds}");
38 | DualSplashApp.stopWatch.Start();
39 |
40 | #endif
41 |
42 | await Task.Yield();
43 |
44 | this.BackgroundColor = Color.FromHex(Constants.WindowBackgroundColorDefault);
45 | vm._userDialogs.HideLoading();
46 |
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/DualSplash.Core/Views/SlowPage.xaml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/DualSplash.Core/Views/SlowPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.Threading.Tasks;
3 | using Autofac;
4 | using DualSplash.Core.Ioc;
5 | using DualSplash.Core.ViewModels;
6 | using Xamarin.Forms;
7 | using Xamarin.Forms.Xaml;
8 |
9 | [assembly: XamlCompilation(XamlCompilationOptions.Compile)]
10 | namespace DualSplash.Core.Views
11 | {
12 |
13 |
14 | public partial class SlowPage : ContentPage
15 | {
16 | protected SlowPageViewModel vm;
17 | public SlowPage ()
18 | {
19 | InitializeComponent ();
20 | if (AppContainer.Container != null)
21 | {
22 |
23 | using (var scope=AppContainer.Container.BeginLifetimeScope())
24 | {
25 | vm = scope.Resolve();
26 | }
27 | BindingContext = vm;
28 | vm.ToggglePageLoadSwitch = true;
29 | }
30 | }
31 |
32 | protected override void OnAppearing()
33 | {
34 | base.OnAppearing();
35 |
36 | #if TRACE
37 | if(SingleSplashApp.stopWatch==null) SingleSplashApp.stopWatch=new Stopwatch();
38 | SingleSplashApp.stopWatch.Stop();
39 |
40 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------SlowPage --Reach OnAppearing() !!! .... {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}") ;
41 | SingleSplashApp.stopWatch.Start();
42 |
43 | #endif
44 |
45 | }
46 |
47 |
48 |
49 |
50 | public virtual async void Switch_OnToggled(object sender, ToggledEventArgs e)
51 | {
52 |
53 | #if TRACE
54 | SingleSplashApp.stopWatch.Stop();
55 |
56 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------SlowPage Reach After Page Load - Switch_OnToggled() !!! .... {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}");
57 | SingleSplashApp.stopWatch.Start();
58 |
59 | #endif
60 |
61 | await Task.Yield();
62 |
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/DualSplash.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26430.16
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "10. Core", "10. Core", "{A8FA68CB-0DBD-453D-B813-003BDB108DBE}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "20. Problem - SingleSplash", "20. Problem - SingleSplash", "{123E40F6-E8D6-47DF-946A-7353F73FAE0E}"
9 | EndProject
10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "30. Solution - DualSplash", "30. Solution - DualSplash", "{BC7CB8C6-77A8-4981-AEB3-BF1A9D976937}"
11 | EndProject
12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DualSplash.Core", "DualSplash.Core\DualSplash.Core.csproj", "{7FB7AC69-309F-4684-8D07-96D4ABA0F1F2}"
13 | EndProject
14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SingleSplash.Android", "SingleSplash.Android\SingleSplash.Android.csproj", "{87B9E286-0B35-46B5-86FA-A3720CBB75D0}"
15 | EndProject
16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DualSplash.Android", "DualSplash.Android\DualSplash.Android.csproj", "{33772F00-8EFD-48A3-A4CB-19A438A7680A}"
17 | EndProject
18 | Global
19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
20 | Debug|Any CPU = Debug|Any CPU
21 | Release|Any CPU = Release|Any CPU
22 | EndGlobalSection
23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
24 | {7FB7AC69-309F-4684-8D07-96D4ABA0F1F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25 | {7FB7AC69-309F-4684-8D07-96D4ABA0F1F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
26 | {7FB7AC69-309F-4684-8D07-96D4ABA0F1F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
27 | {7FB7AC69-309F-4684-8D07-96D4ABA0F1F2}.Release|Any CPU.Build.0 = Release|Any CPU
28 | {87B9E286-0B35-46B5-86FA-A3720CBB75D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29 | {87B9E286-0B35-46B5-86FA-A3720CBB75D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
30 | {87B9E286-0B35-46B5-86FA-A3720CBB75D0}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
31 | {87B9E286-0B35-46B5-86FA-A3720CBB75D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
32 | {87B9E286-0B35-46B5-86FA-A3720CBB75D0}.Release|Any CPU.Build.0 = Release|Any CPU
33 | {87B9E286-0B35-46B5-86FA-A3720CBB75D0}.Release|Any CPU.Deploy.0 = Release|Any CPU
34 | {33772F00-8EFD-48A3-A4CB-19A438A7680A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
35 | {33772F00-8EFD-48A3-A4CB-19A438A7680A}.Debug|Any CPU.Build.0 = Debug|Any CPU
36 | {33772F00-8EFD-48A3-A4CB-19A438A7680A}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
37 | {33772F00-8EFD-48A3-A4CB-19A438A7680A}.Release|Any CPU.ActiveCfg = Release|Any CPU
38 | {33772F00-8EFD-48A3-A4CB-19A438A7680A}.Release|Any CPU.Build.0 = Release|Any CPU
39 | {33772F00-8EFD-48A3-A4CB-19A438A7680A}.Release|Any CPU.Deploy.0 = Release|Any CPU
40 | EndGlobalSection
41 | GlobalSection(SolutionProperties) = preSolution
42 | HideSolutionNode = FALSE
43 | EndGlobalSection
44 | GlobalSection(NestedProjects) = preSolution
45 | {7FB7AC69-309F-4684-8D07-96D4ABA0F1F2} = {A8FA68CB-0DBD-453D-B813-003BDB108DBE}
46 | {87B9E286-0B35-46B5-86FA-A3720CBB75D0} = {123E40F6-E8D6-47DF-946A-7353F73FAE0E}
47 | {33772F00-8EFD-48A3-A4CB-19A438A7680A} = {BC7CB8C6-77A8-4981-AEB3-BF1A9D976937}
48 | EndGlobalSection
49 | EndGlobal
50 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Xamarin-forms-Android-Startup-Dual-Splash-Screen
2 | ================================================
3 |
4 | A Solution to the known problem of Xamarin Forms's Android startup time.
5 |
6 | My solution after 2 weeks of work, for StartUp time on Android **Without AOT** is
7 | [Dual
8 | SplashScreen](https://github.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen)*.*
9 |
10 | Actually, there is no magic here. The same init time is remains. This solution
11 | is based on UX "Perceived Performance". UX here will be *much better*.
12 | Instead of the user sees a long-time delay on one splash screen (or without
13 | splashscreen, which is worse),
14 | Now, the user sees 2 splash screens:
15 | 1. The normal splash screen, and…
16 | 2. Screenshot of the first interactive screen the user engaging when the app
17 | starts. I called it 'FirstScreen', which I implement it with MainActivity. The
18 | user sees what screen he going to get while progress bar is showing, and when
19 | the rendering is finished, the image (as a background) is switched with the real
20 | Page.
21 |
22 | If we analyze the delay at the start (cold start), there are 2 kinds of delay:
23 | 1. Init code of different components (Forms.init, DI init (e.g. autofac etc.))
24 | 2. Rendering of the page.
25 |
26 | So, by splitting the init code to the first activity (SplashActivity) and
27 | leaving only the Render delay to FirstScreen (or MainActivity) we can split the
28 | delay time by 2 pages, and that way the user sees **half** of the total delay,
29 | on each screen.
30 |
31 | Users starts to count the seconds on **static screen**. So, if you move fast to
32 | another screen, you good. The perception now is the app starts FASTER (even
33 | actually, as you'll see later the app starts even slower a little bit).
34 |
35 | I put on Github my solution
36 | [DualSplash](https://github.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen).
37 | Check it out.
38 |
39 |
40 | Credits to Ideas and components:
41 | 1. Acr.UserDialogs of Allan Ritchie
42 | [AllanRitchie](https://forums.xamarin.com/profile/AllanRitchie).
43 | 2. XF Page_Load event by Mohamed Yousuf
44 | [yousufctec](https://forums.xamarin.com/profile/yousufctec).
45 | 3. Splash screen in XF by Adam Pedley
46 | [AdamP](https://forums.xamarin.com/profile/AdamP).
47 |
48 | 4. Thank you All!
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | 
59 |
60 |
61 |
62 | - This Repo contains 1 XF Core project and 2 android projects.
63 |
64 | 1. SingleSplash – the problem – here you'll see normal splash screen with long
65 | delay (10sec on nexus4)
66 |
67 | 2. DualSplash – the solution – here you'll see the splash end in about 6sec (on
68 | nexus4) and moved to next page (which at start is a screenshot of the actual
69 | final interactive XF page) with progress bar Acr.UserDialogs of
70 | \@AllanRitchie(https://forums.xamarin.com/profile/AllanRitchie)
71 |
72 | If you start the 2 apps, you can think app 2 -DualSplash is faster, but in
73 | fact it is *slower* (on slow devices like nexus4) by 1sec (!) because the
74 | added activity, but the init methods are the same.
75 |
76 | Few Notes here:
77 |
78 | 1. In order to see the Progress bar when page is loading , OnCreate need to
79 | finish fast to put the native control (by Acr.UserDialogs or the normal
80 | Native one) and afterwards let XF Loadapplication(…) do the Xaml loading. To
81 | do so I used splash layer-list
82 | ( - better
83 | approach)
84 | and async code in OnCreate.
85 |
86 | 2. You need to screenshot the FirstScreen for different device sizes (and not
87 | like I did, take one image and resize it to all device sizes), because Xaml
88 | is rendered differently on different screen sizes.
89 | Another approach would be not to screenshot but to put an image of Template
90 | of empty page with the same design of your App and progress bar inside.
91 |
92 | 3. FirstScreen is shown with the screenshot as background at start until XF
93 | loads the Xaml Page. When finished rendering, there is the need to change
94 | the background back to normal, and it have to happened right after finished
95 | loading. For that I used the Trick of
96 | \@yousufctec(https://forums.xamarin.com/profile/yousufctec) , XF Page Load
97 | Event
98 |
99 | 4. I spread over all the code Stopwatch measurements to see the performance on
100 | every step of the app. You can see the output on logcat or debug output. You
101 | can see that DualSplash takes even longer actually, but the UX perception is
102 | that it's much Faster.
103 |
104 | 5. The code is flexible. You can move some init code from SplashActivity to
105 | MainActivity if you see the delay takes longer on the splash screen and move
106 | it to FirstScreen. It all depends on your App and device. Play with it!
107 |
108 | 6. I believe the Code can be tweaked further, you are welcome to improve it.
109 |
110 | Happy Coding.
111 |
112 | Issac kramer
113 |
114 | AtrizaSoft.com
115 |
--------------------------------------------------------------------------------
/SingleSplash.Android/Assets/AboutAssets.txt:
--------------------------------------------------------------------------------
1 | Any raw assets you want to be deployed with your application can be placed in
2 | this directory (and child directories) and given a Build Action of "AndroidAsset".
3 |
4 | These files will be deployed with you package and will be accessible using Android's
5 | AssetManager, like this:
6 |
7 | public class ReadAsset : Activity
8 | {
9 | protected override void OnCreate (Bundle bundle)
10 | {
11 | base.OnCreate (bundle);
12 |
13 | InputStream input = Assets.Open ("my_asset.txt");
14 | }
15 | }
16 |
17 | Additionally, some Android functions will automatically load asset files:
18 |
19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
--------------------------------------------------------------------------------
/SingleSplash.Android/FodyWeavers.xml.hide:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/SingleSplash.Android/Ioc/Locator/ViewModelLocator.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Acr.UserDialogs;
3 | using Android.App;
4 | using Autofac;
5 | using DualSplash.Core.ViewModels;
6 | using DualSplash.Core.Views;
7 | using Java.Lang;
8 | using XLabs.Platform.Device;
9 | using IContainer = Autofac.IContainer;
10 | using Thread = System.Threading.Thread;
11 |
12 |
13 | namespace SingleSplash.Android.Ioc.Locator
14 | {
15 | public static class ViewModelLocator
16 | {
17 | private static IContainer _container;
18 |
19 |
20 | public static T Resolve()
21 | {
22 | return _container.Resolve();
23 | }
24 |
25 | public static IContainer RegisterDependencies(bool useMockServices,Application application=null)
26 | {
27 | var builder = new ContainerBuilder();
28 |
29 | //moq
30 | /* Mock moqDialogs = new Mock();
31 | Mock moqDevice =new Mock();
32 | Mock moqDisplay =new Mock();
33 | Mock moqFontManager =new Mock();*/
34 |
35 |
36 |
37 |
38 |
39 |
40 | // Register ViewModels
41 | builder.RegisterType().SingleInstance();
42 |
43 | // Register Views
44 | builder.RegisterType().SingleInstance();
45 |
46 |
47 |
48 | /*
49 | builder.RegisterType();
50 | builder.RegisterType();
51 | builder.RegisterType();
52 | builder.RegisterType();
53 | builder.RegisterType();
54 | builder.RegisterType();
55 | builder.RegisterType();
56 | builder.RegisterType();
57 | */
58 |
59 | //Register Services
60 | /* builder.RegisterType()
61 | .As()
62 | .SingleInstance();*/
63 |
64 | //await Task.Delay(500); // Slow init code
65 | Thread.Sleep(500); // 2
66 |
67 |
68 | // Services
69 | ////////////////////////////////////////////////////////////////////////////////////////////
70 | /*
71 | builder.RegisterType().As()
72 | .SingleInstance();
73 | */
74 |
75 | // Register Base Services
76 | //////----------------------------------Navigation--------------------------
77 |
78 | /*
79 | builder.RegisterType()
80 | .As()
81 | .SingleInstance();
82 | */
83 |
84 |
85 | ////////////////---------------------Ads -----------------------------------------
86 | /*
87 | builder.RegisterType()
88 | .As()
89 | .SingleInstance();
90 | */
91 |
92 | //////----------------------------------Aggregate Services--------------------------
93 | /*
94 | builder.RegisterAggregateService();
95 | */
96 |
97 |
98 |
99 |
100 |
101 | /////////////////////// android services
102 |
103 | builder.Register(t => AndroidDevice.CurrentDevice)
104 | .As()
105 | .SingleInstance();
106 |
107 | builder.Register(t => AndroidDevice.CurrentDevice.Display)
108 | .As()
109 | .SingleInstance();
110 |
111 | builder.RegisterType()
112 | .As()
113 | .SingleInstance();
114 |
115 |
116 | // UserDialogs.Init(application);
117 | builder.RegisterInstance(UserDialogs.Instance)
118 | .As()
119 | .SingleInstance();
120 |
121 |
122 |
123 | /*
124 | builder.RegisterType().As().SingleInstance();
125 | builder.RegisterType().As();
126 | builder.RegisterType().As();
127 | builder.RegisterType().As();
128 | builder.RegisterType().As();
129 | builder.RegisterType().As().SingleInstance();
130 |
131 | */
132 | if (useMockServices)
133 | {
134 | /* builder.RegisterInstance(new CatalogMockService()).As();
135 | builder.RegisterInstance(new BasketMockService()).As();
136 | builder.RegisterInstance(new OrderMockService()).As();
137 | builder.RegisterInstance(new UserMockService()).As();
138 | */
139 | //UseMockService = true;
140 | }
141 | else
142 | {
143 | /*
144 | builder.RegisterType().As().SingleInstance();
145 | builder.RegisterType().As().SingleInstance();
146 | builder.RegisterType().As().SingleInstance();
147 | builder.RegisterType().As().SingleInstance();
148 |
149 | UseMockService = false;
150 | */
151 | }
152 |
153 | if (_container != null)
154 | {
155 | _container.Dispose();
156 | }
157 | _container = builder.Build();
158 |
159 | return _container;
160 | }
161 | }
162 | }
--------------------------------------------------------------------------------
/SingleSplash.Android/MainActivity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 | using Android.App;
6 | using Android.Content.PM;
7 | using Android.OS;
8 | using Android.Runtime;
9 | using Android.Views;
10 | using Autofac;
11 | using DualSplash.Core;
12 | using DualSplash.Core.Ioc;
13 | using SingleSplash.Android.Ioc.Locator;
14 | using Xamarin;
15 | using Xamarin.Forms;
16 | using XLabs.Ioc;
17 | using XLabs.Ioc.Autofac;
18 | using IContainer = System.ComponentModel.IContainer;
19 |
20 | namespace SingleSplash.Android
21 | {
22 |
23 | [Activity(Label = "@string/ApplicationTitle",
24 | Icon = "@drawable/icon",
25 | Theme = "@style/splashscreen",
26 | MainLauncher = true,
27 | ScreenOrientation = ScreenOrientation.SensorPortrait,
28 | LaunchMode = LaunchMode.SingleInstance,
29 | NoHistory = false,
30 |
31 | ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
32 | [Preserve(AllMembers = true)]
33 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
34 | {
35 | public MainActivity()
36 | {
37 | #if TRACE
38 |
39 | // AtrizA.Common.Utils.Utils.globalStopWatch = new Stopwatch();
40 | SingleSplashApp.stopWatch = new Stopwatch();
41 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------------------------------------------------------------" +
42 | $"\n ---------------------------------------------------------------------------------");
43 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------Starting MainActivity Constructor: {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}");
44 | SingleSplashApp.stopWatch.Start();
45 | //AtrizA.Common.Utils.Utils.globalStopWatch.Start();
46 |
47 | #endif
48 | }
49 |
50 | protected override void OnCreate(Bundle bundle)
51 | {
52 | TabLayoutResource = Resource.Layout.Tabbar;
53 | ToolbarResource = Resource.Layout.Toolbar;
54 |
55 |
56 |
57 | //set Splash screen and back normal Theme
58 | base.Window.RequestFeature(WindowFeatures.ActionBar);
59 | // Name of the MainActivity theme you had there before.
60 | // Or you can use global::Android.Resource.Style.ThemeHoloLight
61 | base.SetTheme(Resource.Style.MainTheme);
62 |
63 | try
64 | {
65 |
66 | #if TRACE
67 |
68 | // AtrizA.Common.Utils.Utils.globalStopWatch = new Stopwatch();
69 | SingleSplashApp.stopWatch.Stop();
70 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------MainActivity ----- OnCreate: {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}");
71 | SingleSplashApp.stopWatch.Start();
72 | // AtrizA.Common.Utils.Utils.globalStopWatch.Start();
73 |
74 | #endif
75 |
76 |
77 | base.OnCreate(bundle);
78 |
79 | #if TRACE
80 |
81 | SingleSplashApp.stopWatch.Stop();
82 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------MainActivity -OnCreate---------Before Forms.Init: {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}");
83 | SingleSplashApp.stopWatch.Start();
84 |
85 | #endif
86 |
87 | global::Xamarin.Forms.Forms.Init(this, bundle);
88 |
89 | #if TRACE
90 |
91 | SingleSplashApp.stopWatch.Stop();
92 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------MainActivity -OnCreate---------AFTER Forms.Init: {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}");
93 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------Reach BEFORE All packages Init (userdialog, insights ..etc....... ");
94 | SingleSplashApp.stopWatch.Start();
95 |
96 | #endif
97 |
98 |
99 | //init Google Analytics for mobile
100 | //GATracking_Android.GetGASInstance()
101 | // .Initialize_NativeGAS("Stam", this); //"UA-XXXXXXXXX-X", this); //TrackingID first parameter
102 | //await Task.Delay(500); // slow analytics init
103 | Thread.Sleep(500); // 1
104 |
105 |
106 |
107 | //init Insights
108 | if (bundle == null && !Insights.IsInitialized)
109 | {
110 | Xamarin.Insights.Initialize("AppID",
111 | ApplicationContext); //Insights.Initialize("apikey", ApplicationContext);
112 | Insights.DisableCollection = false;
113 | Insights.DisableDataTransmission = false;
114 | Insights.DisableExceptionCatching = false;
115 | }
116 |
117 | //Activating UserDialogs
118 | Acr.UserDialogs.UserDialogs.Init((Activity)Forms.Context);
119 |
120 |
121 |
122 | //Nav Service
123 | // INavigationService _navService;
124 |
125 |
126 | #if TRACE
127 |
128 | SingleSplashApp.stopWatch.Stop();
129 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------MainActivity -OnCreate---------BEFORE CONTAINER INIT: {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}");
130 |
131 | SingleSplashApp.stopWatch.Start();
132 |
133 | #endif
134 |
135 | //Ioc Container and Xlab Setup
136 |
137 | //ViewModelLocator Init instead of bootstrapper init
138 | AppContainer.Container= ViewModelLocator.RegisterDependencies(false);
139 |
140 | //var container = AppContainer.Container;
141 |
142 | #if TRACE
143 |
144 | SingleSplashApp.stopWatch.Stop();
145 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------MainActivity -OnCreate---------AFTER container INIT: {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}");
146 |
147 | SingleSplashApp.stopWatch.Start();
148 |
149 | #endif
150 |
151 |
152 | IResolver autofacResolver = new AutofacResolver(AppContainer.Container);
153 | Resolver.SetResolver(autofacResolver);
154 |
155 |
156 | //init interstitial ad by leadbolt
157 | string LeadBoltInterStitial_API_KEY = "XXXXXXXXXXXXXXXXXXXXXXXXXX";
158 | // InterStitial_Android_LeadBolt.Get_ServiceInstance().Init_InterStitial(LeadBoltInterStitial_API_KEY, this);
159 |
160 |
161 | //init interstitial ad by AdMob
162 | string Admob_Interstit_Ad_UnitID =
163 | "ca-app-pub-XXXXXXXXXXXXXXXXXXXXXXXX";
164 | //InterStitial_Android_AdMob.Get_ServiceInstance().Init_InterStitial(Admob_Interstit_Ad_UnitID, this);
165 |
166 |
167 |
168 | //init interstitial ad by Facebook
169 | string Fb_PlacementID = "XXXXXXXXXXXXXXXXXXXXXXXXXX";
170 | //InterStitial_Android_Facebook.Get_ServiceInstance().Init_InterStitial(Fb_PlacementID, this);
171 |
172 |
173 |
174 | //init interstitial ad Mock
175 | // string Stam_PlacementID = "XXXXXXXXXXXXXXXXXXXXXXXXXXXX";
176 | // InterStitial_Android_Mock.Get_ServiceInstance().Init_InterStitial("Stam");
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 | #if TRACE
185 |
186 | SingleSplashApp.stopWatch.Stop();
187 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------MainActivity -AFTER Packages init (userdialogs, Insights etc--------: {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}");
188 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------Reach BEFORE LoadApplication( SingleSplashApp....... ");
189 | SingleSplashApp.stopWatch.Start();
190 |
191 | #endif
192 |
193 |
194 |
195 |
196 | LoadApplication(new SingleSplashApp());
197 |
198 |
199 |
200 | #if TRACE
201 | SingleSplashApp.stopWatch.Stop();
202 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------Reach After LoadApplication( SingleSplashApp)...... {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}");
203 | SingleSplashApp.stopWatch.Start();
204 | #endif
205 |
206 |
207 | }
208 | catch (Exception ex)
209 | {
210 | Insights.Report(ex, Insights.Severity.Error);
211 | //TrackService.Track_App_Exception(String.Format("GA Exception Message: \n {0} \n GA Exception StackTrace: \n {1}", ex.Message, ex.StackTrace), false);
212 |
213 |
214 | }
215 | }
216 |
217 | protected override void OnResume()
218 | {
219 | base.OnResume();
220 |
221 | #if TRACE
222 | SingleSplashApp.stopWatch.Stop();
223 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------MainActivity - OnResume ...... {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}");
224 | SingleSplashApp.stopWatch.Start();
225 | #endif
226 |
227 |
228 | }
229 | }
230 | }
231 |
232 |
--------------------------------------------------------------------------------
/SingleSplash.Android/MainActivity.orig.cs:
--------------------------------------------------------------------------------
1 | using Android.App;
2 | using Android.Widget;
3 | using Android.OS;
4 | using System.Diagnostics;
5 | using DualSplash.Core;
6 |
7 | namespace SingleSplash.Android
8 | {
9 | [Activity(Label = "SingleSplash.Android", MainLauncher = false ,
10 | Icon = "@drawable/icon",
11 | Theme = "@style/MainTheme"
12 | )]
13 | [Xamarin.Forms.Internals.Preserve(AllMembers = true)]
14 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
15 | {
16 | public MainActivity()
17 | {
18 | #if TRACE
19 |
20 | // AtrizA.Common.Utils.Utils.globalStopWatch = new Stopwatch();
21 | SingleSplashApp.stopWatch = new Stopwatch();
22 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------------------------------------------------------------" +
23 | $"\n ---------------------------------------------------------------------------------");
24 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------Starting MainActivity Constructor: {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}");
25 |
26 | SingleSplashApp.stopWatch.Start();
27 | //AtrizA.Common.Utils.Utils.globalStopWatch.Start();
28 |
29 | #endif
30 |
31 | }
32 |
33 | protected override void OnCreate(Bundle bundle)
34 | {
35 | TabLayoutResource = Resource.Layout.Tabbar;
36 | ToolbarResource = Resource.Layout.Toolbar;
37 |
38 | try
39 | {
40 |
41 | #if TRACE
42 |
43 | // AtrizA.Common.Utils.Utils.globalStopWatch = new Stopwatch();
44 | SingleSplashApp.stopWatch.Stop();
45 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------MainActivity ----- OnCreate: {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}");
46 | SingleSplashApp.stopWatch.Start();
47 | // AtrizA.Common.Utils.Utils.globalStopWatch.Start();
48 |
49 | #endif
50 |
51 | base.OnCreate(bundle);
52 |
53 | #if TRACE
54 |
55 | SingleSplashApp.stopWatch.Stop();
56 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------MainActivity -OnCreate---------Before Forms.Init: {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}");
57 | SingleSplashApp.stopWatch.Start();
58 |
59 | #endif
60 |
61 |
62 | global::Xamarin.Forms.Forms.Init(this, bundle);
63 |
64 | #if TRACE
65 |
66 | SingleSplashApp.stopWatch.Stop();
67 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------MainActivity -OnCreate---------AFTER Forms.Init: {SingleSplashApp.stopWatch.Elapsed.TotalSeconds}");
68 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------Reach BEFORE LoadApplication( SingleSplashApp....... ");
69 | SingleSplashApp.stopWatch.Start();
70 |
71 | #endif
72 |
73 |
74 | LoadApplication(new SingleSplashApp());
75 |
76 |
77 | #if TRACE
78 | //SingleSplashApp.stopWatch.Stop();
79 | System.Diagnostics.Trace.WriteLine($"\n ---------------------------Reach After LoadApplication( SingleSplashApp....... {SingleSplashApp.stopWatch.Elapsed.TotalSeconds} ");
80 | #endif
81 |
82 |
83 |
84 | }
85 | catch (System.Exception ex)
86 | {
87 |
88 | throw;
89 | }
90 |
91 |
92 | // Set our view from the "main" layout resource
93 | // SetContentView (Resource.Layout.Main);
94 | }
95 | }
96 | }
97 |
98 |
--------------------------------------------------------------------------------
/SingleSplash.Android/Properties/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/SingleSplash.Android/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using Android.App;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("SingleSplash.Android")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("SingleSplash.Android")]
14 | [assembly: AssemblyCopyright("Copyright © 2017")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 | [assembly: ComVisible(false)]
18 |
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Build and Revision Numbers
27 | // by using the '*' as shown below:
28 | // [assembly: AssemblyVersion("1.0.*")]
29 | [assembly: AssemblyVersion("1.0.0.0")]
30 | [assembly: AssemblyFileVersion("1.0.0.0")]
31 |
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/AboutResources.txt:
--------------------------------------------------------------------------------
1 | Images, layout descriptions, binary blobs and string dictionaries can be included
2 | in your application as resource files. Various Android APIs are designed to
3 | operate on the resource IDs instead of dealing with images, strings or binary blobs
4 | directly.
5 |
6 | For example, a sample Android app that contains a user interface layout (main.axml),
7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
8 | would keep its resources in the "Resources" directory of the application:
9 |
10 | Resources/
11 | drawable/
12 | icon.png
13 |
14 | layout/
15 | main.axml
16 |
17 | values/
18 | strings.xml
19 |
20 | In order to get the build system to recognize Android resources, set the build action to
21 | "AndroidResource". The native Android APIs do not operate directly with filenames, but
22 | instead operate on resource IDs. When you compile an Android application that uses resources,
23 | the build system will package the resources for distribution and generate a class called "R"
24 | (this is an Android convention) that contains the tokens for each one of the resources
25 | included. For example, for the above Resources layout, this is what the R class would expose:
26 |
27 | public class R {
28 | public class drawable {
29 | public const int icon = 0x123;
30 | }
31 |
32 | public class layout {
33 | public const int main = 0x456;
34 | }
35 |
36 | public class strings {
37 | public const int first_string = 0xabc;
38 | public const int second_string = 0xbcd;
39 | }
40 | }
41 |
42 | You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
43 | to reference the layout/main.axml file, or R.strings.first_string to reference the first
44 | string in the dictionary file values/strings.xml.
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/SingleSplash.Android/Resources/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/drawable-hdpi/splash_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/SingleSplash.Android/Resources/drawable-hdpi/splash_logo.png
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/drawable-mdpi/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/SingleSplash.Android/Resources/drawable-mdpi/Icon.png
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/drawable-mdpi/splash_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/SingleSplash.Android/Resources/drawable-mdpi/splash_logo.png
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/drawable-xhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/SingleSplash.Android/Resources/drawable-xhdpi/icon.png
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/drawable-xhdpi/splash_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/SingleSplash.Android/Resources/drawable-xhdpi/splash_logo.png
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/drawable-xxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/SingleSplash.Android/Resources/drawable-xxhdpi/icon.png
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/drawable-xxhdpi/splash_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/SingleSplash.Android/Resources/drawable-xxhdpi/splash_logo.png
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/drawable-xxxhdpi/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/SingleSplash.Android/Resources/drawable-xxxhdpi/Icon.png
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/drawable-xxxhdpi/splash_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/SingleSplash.Android/Resources/drawable-xxxhdpi/splash_logo.png
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/drawable/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/SingleSplash.Android/Resources/drawable/Icon.png
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/drawable/splash_screen_xml.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | -
7 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/layout/Main.axml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/layout/Tabbar.axml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/layout/Toolbar.axml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/values/Strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello World, Click Me!
4 | SingleSplash.Android
5 |
6 |
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 | #FFFFFF
3 | #03A9F4
4 | #1976D2
5 | #FFC107
6 | #F5F5F5
7 | #FFFFFF
8 |
--------------------------------------------------------------------------------
/SingleSplash.Android/Resources/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
27 |
28 |
37 |
38 |
41 |
42 |
--------------------------------------------------------------------------------
/SingleSplash.Android/SingleSplash.Android.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {87B9E286-0B35-46B5-86FA-A3720CBB75D0}
9 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
10 | Library
11 | Properties
12 | SingleSplash.Android
13 | ExDollar.Test.Vanilla.Android
14 | 512
15 | True
16 | Resources\Resource.Designer.cs
17 | Off
18 | false
19 | v7.1
20 | Properties\AndroidManifest.xml
21 | true
22 | PackageReference
23 |
24 |
25 | True
26 | Full
27 | False
28 | bin\Debug\
29 | DEBUG;TRACE
30 | prompt
31 | 4
32 | True
33 | SdkOnly
34 | False
35 |
36 | false
37 | false
38 |
39 |
40 | PdbOnly
41 | True
42 | True
43 | bin\Release\
44 | TRACE
45 | prompt
46 | 4
47 | False
48 | SdkOnly
49 | True
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | Designer
70 |
71 |
72 | Designer
73 |
74 |
75 |
76 |
77 | Designer
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 | 25.1.1
95 |
96 |
97 | 25.1.1
98 |
99 |
100 | 25.1.1
101 |
102 |
103 | 25.1.1
104 |
105 |
106 | 25.1.1
107 |
108 |
109 | 25.1.1
110 |
111 |
112 | 32.940.0-beta3
113 |
114 |
115 | 1.12.3
116 |
117 |
118 |
119 |
120 | {7fb7ac69-309f-4684-8d07-96d4aba0f1f2}
121 | DualSplash.Core
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
174 |
--------------------------------------------------------------------------------
/SingleSplash.Android/SingleSplash.Android.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | LGE Nexus 4
5 | AVD_GalaxyNexus_ToolsForApacheCordova
6 | ShowAllFiles
7 | Nexus 4
8 |
9 |
--------------------------------------------------------------------------------
/WhichIsFaster.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IssacKramer/Xamarin-forms-Android-Startup-Dual-Splash-Screen/b2b005e8c1318bb4e6cd57d415a5d44e15f1ecea/WhichIsFaster.png
--------------------------------------------------------------------------------