-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNavigationGraph9Net9.cs
More file actions
107 lines (88 loc) · 4.17 KB
/
NavigationGraph9Net9.cs
File metadata and controls
107 lines (88 loc) · 4.17 KB
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
107
using Android.App;
using Android.OS;
using Android.Runtime;
using Android.Util;
using System;
namespace com.companyname.navigationgraph9net9
{
[Application]
public class NavigationGraph9ApplicationNet9 : Application, Application.IActivityLifecycleCallbacks
{
protected readonly string logTag = "Nav-ApplicationClass";
protected NavigationGraph9ApplicationNet9(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
{
}
public NavigationGraph9ApplicationNet9() { }
public override void OnCreate()
{
base.OnCreate();
// This screws up when using the SplashScreen Api - looks like an Android bug. So we use DynamicColors.ApplyToActivityIfAvailable in BaseActivity since we only have one activity. - note the singular, rather than the plural as is here
//DynamicColors.ApplyToActivitiesIfAvailable(this);
// Note that this is only called on a cold start.
//RegisterActivityLifecycleCallbacks(this);
//Log.Debug(logTag, logTag+" OnCreate - RegisterActivityLifecycleCallbacks");
}
public override void OnTerminate()
{
base.OnTerminate();
//UnregisterActivityLifecycleCallbacks(this);
//Log.Debug(logTag, logTag+ "OnTerminate");
}
// This fires before OnActivityDestroyed
//public override void OnTrimMemory([GeneratedEnum] TrimMemory level)
//{
// base.OnTrimMemory(level);
// if (level == TrimMemory.UiHidden)
// {
// // stop your service here
// //StopService(new Intent(this, typeof(MyService)));
// // ...
// }
//}
public void OnActivityCreated(Activity activity, Bundle? savedInstanceState)
{
Log.Debug(logTag, logTag+" OnActivityCreated");
}
public void OnActivityDestroyed(Activity activity)
{
// We require it because we have to implement it because of the Interface, however we don't require any code in the body because we are using OnActivitySaveInstanceState below
// Note: This worked fine when we had Developer Settings Apps Don’t keep activities in the ON position, but doesn't fire when Don’t keep activities is OFF
// Since our users aren't going to have that setting on, so we needed something else and that turned out to be OnActivitySaveInstanceState - see below
//if (!activity.IsChangingConfigurations)
//{
// activity.Finish();
// Log.Debug(logTag, logTag + " OnActivityDestroyed - only called because OnActivitySaveInstanceState called Finish() ");
//}
Log.Debug(logTag, logTag + " OnActivityDestroyed - only called because OnActivitySaveInstanceState called Finish() ");
}
public void OnActivityPaused(Activity activity)
{
Log.Debug(logTag, logTag+" OnActivityPaused");
}
public void OnActivityResumed(Activity activity)
{
Log.Debug(logTag, logTag+" OnActivityResumed");
}
//public void OnActivityRestoreInstanceState(Activity activity, Bundle? savedInstanceState)
//{
// //Log.Debug(logTag, logTag+" OnActivityRestoreInstanceState");
//}
public void OnActivitySaveInstanceState(Activity activity, Bundle outState)
{
// Replaces the functionality of OnActivityDestroyed above, which only works if in Developer Options - App - Don't keep activities is in the On position, which most likely wouldn't be ON for a non developer user.
if (!activity.IsChangingConfigurations)
{
activity.Finish();
Log.Debug(logTag, logTag + " OnActivitySaveInstanceState - Calling Activity.Finish()");
}
}
public void OnActivityStarted(Activity activity)
{
Log.Debug(logTag, logTag+" OnActivityStarted");
}
public void OnActivityStopped(Activity activity)
{
Log.Debug(logTag, logTag+" OnActivtyStopped");
}
}
}