-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNotificationReceiver.cs
42 lines (36 loc) · 1.3 KB
/
NotificationReceiver.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
using Android.Content;
using Android.Util;
using SoftWing.SwSystem;
using System;
namespace SoftWing
{
[BroadcastReceiver(Enabled = true, Exported = true)]
class NotificationReceiver : BroadcastReceiver
{
private const String TAG = "NotificationReceiver";
public const String ACTION_SHOW = "com.jodonlucas.softwing.SHOW";
private SwSystem.MessageDispatcher dispatcher;
private string profile;
public NotificationReceiver()
{
dispatcher = SwSystem.MessageDispatcher.GetInstance();
profile = SwSettings.Default_Keymap_Filename;
}
public NotificationReceiver(string profile_in)
{
dispatcher = SwSystem.MessageDispatcher.GetInstance();
profile = profile_in;
}
public string ProfileActionString {get { return ACTION_SHOW + "." + profile; } }
public override void OnReceive(Context context, Intent intent)
{
String action = intent.Action;
Log.Info(TAG, "NotificationReceiver.onReceive called, profile=" + profile);
if (action.Equals(ProfileActionString))
{
SwSettings.SetSelectedKeymap(profile);
dispatcher.Post(new SwSystem.Messages.ShowImeMessage());
}
}
}
}