-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
696 additions
and
326 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -352,3 +352,4 @@ MigrationBackup/ | |
# Secrets | ||
Secrets.cs | ||
/Res/key/* | ||
*.blend1 |
56 changes: 56 additions & 0 deletions
56
Earphone/EarphoneLeftAndRight/EarphoneLeftAndRight.Android/AppWidget.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using Android.App; | ||
using Android.Appwidget; | ||
using Android.Content; | ||
using Android.OS; | ||
using Android.Runtime; | ||
using Android.Views; | ||
using Android.Widget; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace EarphoneLeftAndRight.Droid | ||
{ | ||
[BroadcastReceiver(Label = "Stereo Test Widget")] | ||
[IntentFilter(new string[] { "android.appwidget.action.APPWIDGET_UPDATE" })] | ||
[MetaData("android.appwidget.provider", Resource = "@xml/appwidget_provider")] | ||
public class AppWidget : AppWidgetProvider | ||
{ | ||
public const string ACTION_SELECTED = "com.github.kurema.earphoneleftandright.widget.ACTION_SELECTED"; | ||
|
||
public override void OnUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) | ||
{ | ||
var me = new ComponentName(context, Java.Lang.Class.FromType(typeof(AppWidget)).Name); | ||
|
||
appWidgetManager.UpdateAppWidget(me, BuildRemoteViews(context, appWidgetIds)); | ||
|
||
//base.OnUpdate(context, appWidgetManager, appWidgetIds); | ||
} | ||
|
||
RemoteViews BuildRemoteViews(Context context, int[] appWidgetIds) | ||
{ | ||
var widgetView = new RemoteViews(context.PackageName, Resource.Layout.app_widget); | ||
var intent = new Intent(context, typeof(AppWidget)); | ||
intent.SetAction(ACTION_SELECTED); | ||
var pi = PendingIntent.GetBroadcast(context, 0, intent, PendingIntentFlags.UpdateCurrent); | ||
widgetView.SetOnClickPendingIntent(Resource.Id.imageView1, pi); | ||
return widgetView; | ||
} | ||
|
||
public override async void OnReceive(Context context, Intent intent) | ||
{ | ||
base.OnReceive(context, intent); | ||
|
||
switch (intent.Action) | ||
{ | ||
case ACTION_SELECTED: | ||
Manager.Tts.StopIfSpeaking(); | ||
|
||
await Manager.Tts.SpeakLeft(); | ||
await Manager.Tts.SpeakRight(); | ||
break; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Earphone/EarphoneLeftAndRight/EarphoneLeftAndRight.Android/Properties/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.