/
Issue10182Activity.cs
106 lines (95 loc) · 2.68 KB
/
Issue10182Activity.cs
1
2
3
4
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.OS;
using Android.Renderscripts;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Xamarin.Forms.Controls.Issues;
namespace Xamarin.Forms.ControlGallery.Android
{
[Activity(Label = "Issue10182Activity", Icon = "@drawable/icon", Theme = "@style/MyTheme",
MainLauncher = false, HardwareAccelerated = true,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.UiMode)]
public class Issue10182Activity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
Activity1 _activity1;
protected override void OnCreate(Bundle savedInstanceState)
{
var currentApplication = Xamarin.Forms.Application.Current;
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new Issue10182Application());
_activity1 = (Activity1)DependencyService.Resolve<Context>();
Device.BeginInvokeOnMainThread(async () =>
{
try
{
await Task.Delay(1000);
{
Intent intent = new Intent(_activity1, typeof(Activity1));
intent.AddFlags(ActivityFlags.ReorderToFront);
_activity1.StartActivity(intent);
}
await Task.Delay(1000);
{
Intent intent = new Intent(this, typeof(Issue10182Activity));
intent.AddFlags(ActivityFlags.ReorderToFront);
StartActivity(intent);
}
await Task.Delay(1000);
{
Intent intent = new Intent(_activity1, typeof(Activity1));
intent.AddFlags(ActivityFlags.ReorderToFront);
_activity1.StartActivity(intent);
}
}
finally
{
this.Finish();
_activity1.ReloadApplication();
currentApplication.MainPage = new Issue10182.Issue10182SuccessPage();
}
});
}
public class Issue10182Test : ContentPage
{
public Issue10182Test()
{
Content = new StackLayout()
{
Children =
{
new Label()
{
Text = "Hold Please. Activity should vanish soon and you'll see a success label",
AutomationId = "Loaded"
}
}
};
}
}
public class Issue10182Application : Application
{
protected override void OnStart()
{
var contentPage = new Issue10182Test();
base.OnStart();
MainPage = contentPage;
}
protected override void OnSleep()
{
base.OnSleep();
MainPage = new NavigationPage(new ContentPage());
}
}
}
}