├── .gitignore
├── Docs
├── Images
│ ├── CognitiveServices_Keys.png
│ ├── CognitiveServices_Signup.png
│ ├── TranslatorService_Creation.png
│ └── TranslatorService_Keys.png
└── Register.md
├── LICENSE.md
├── README.md
├── Screenshots
├── Windows
│ ├── DescribeImage01.png
│ └── DescribeImage02.png
└── iOS
│ └── DescribeImage01.png
├── See4Me.sln
└── Src
├── See4Me.Android
├── Activities
│ ├── MainActivity.cs
│ └── SplashActivity.cs
├── Application.cs
├── Assets
│ └── AboutAssets.txt
├── Common
│ └── ActivityBase.cs
├── Extensions
│ └── ContextExtensions.cs
├── Properties
│ ├── AndroidManifest.xml
│ └── AssemblyInfo.cs
├── Resources
│ ├── AboutResources.txt
│ ├── Resource.Designer.cs
│ ├── Values-it
│ │ └── AppResources.xml
│ ├── drawable
│ │ ├── Icon.png
│ │ ├── camera.png
│ │ ├── roundedbutton.xml
│ │ └── splash_screen.xml
│ ├── layout
│ │ └── Main.axml
│ └── values
│ │ ├── AppResources.xml
│ │ ├── Strings.xml
│ │ └── Styles.xml
├── See4Me.Android.csproj
├── Services
│ ├── AppService.cs
│ ├── LauncherService.cs
│ ├── MediaPicker.cs
│ ├── NavigationService.cs
│ └── StreamingService.cs
├── ViewModels
│ ├── SplashViewModel.cs
│ └── ViewModelLocator.cs
├── app.config
└── packages.config
├── See4Me.Engine
├── CognitiveClient.cs
├── CognitiveException.cs
├── CognitiveResult.cs
├── CognitiveSettings.cs
├── Enums
│ ├── Emotion.cs
│ ├── Gender.cs
│ ├── RecognitionPhase.cs
│ └── RecognitionType.cs
├── Extensions
│ ├── FaceExtensions.cs
│ ├── OcrResultExtensions.cs
│ ├── StreamExtensions.cs
│ ├── StringExtensions.cs
│ └── VisionExtensions.cs
├── Properties
│ └── AssemblyInfo.cs
├── See4Me.Engine.csproj
├── Services
│ ├── ServiceSettings
│ │ ├── IVisionSettingsProvider.cs
│ │ ├── SimpleVisionSettingsProvider.cs
│ │ └── VisionSettings.cs
│ └── TranslatorService
│ │ ├── AzureAuthToken.cs
│ │ ├── ErrorResponse.cs
│ │ ├── ITranslatorServiceClient.cs
│ │ ├── TranslatorServiceClient.cs
│ │ └── TranslatorServiceException.cs
├── app.config
└── packages.config
├── See4Me.Localization
├── HowToUse.it.txt
├── HowToUse.txt
├── Properties
│ └── AssemblyInfo.cs
├── Resources
│ ├── AppResources.Designer.cs
│ ├── AppResources.it.resx
│ ├── AppResources.resx
│ ├── Resx2Others.tt
│ ├── Resx2OthersTemplate.cs
│ ├── Resx2OthersTemplate.tt
│ └── Strings.cs
├── See4Me.Localization.csproj
└── project.json
├── See4Me.Shared
├── Common
│ ├── AutoRelayCommand.cs
│ └── VisionSettings.json
├── Constants.cs
├── Extensions
│ ├── ExceptionExtensions.cs
│ └── StreamExtensions.cs
├── See4Me.Shared.projitems
├── See4Me.Shared.shproj
├── ServiceKeys.cs
├── Services
│ ├── DialogService.cs
│ ├── IAppService.cs
│ ├── IDialogService.cs
│ ├── ILauncherService.cs
│ ├── IMediaPicker.cs
│ ├── INavigationService.cs
│ ├── INetworkService.cs
│ ├── ISettingsService.cs
│ ├── ISpeechService.cs
│ ├── IStreamingService.cs
│ ├── NetworkService.cs
│ ├── SettingsService.cs
│ ├── SpeechHelper.cs
│ └── SpeechService.cs
└── ViewModels
│ ├── AboutViewModel.cs
│ ├── MainViewModel.cs
│ ├── PrivacyViewModel.cs
│ ├── RecognizeTextViewModel.cs
│ ├── SettingsViewModel.cs
│ ├── ViewModelBase.cs
│ └── ViewModelLocator.cs
├── See4Me.Windows
├── App.xaml
├── App.xaml.cs
├── Assets
│ ├── LockScreenLogo.scale-200.png
│ ├── Original
│ │ ├── SplashScreen.scale-100.png
│ │ ├── SplashScreen.scale-125.png
│ │ ├── SplashScreen.scale-150.png
│ │ ├── SplashScreen.scale-200.png
│ │ └── SplashScreen.scale-400.png
│ ├── Sounds
│ │ └── Shutter.mp3
│ ├── SplashScreen.scale-100.png
│ ├── SplashScreen.scale-125.png
│ ├── SplashScreen.scale-150.png
│ ├── SplashScreen.scale-200.png
│ ├── SplashScreen.scale-400.png
│ ├── Square150x150Logo.scale-100.png
│ ├── Square150x150Logo.scale-125.png
│ ├── Square150x150Logo.scale-150.png
│ ├── Square150x150Logo.scale-200.png
│ ├── Square150x150Logo.scale-400.png
│ ├── Square310x310Logo.scale-100.png
│ ├── Square310x310Logo.scale-125.png
│ ├── Square310x310Logo.scale-150.png
│ ├── Square310x310Logo.scale-200.png
│ ├── Square310x310Logo.scale-400.png
│ ├── Square44x44Logo.scale-100.png
│ ├── Square44x44Logo.scale-125.png
│ ├── Square44x44Logo.scale-150.png
│ ├── Square44x44Logo.scale-200.png
│ ├── Square44x44Logo.scale-400.png
│ ├── Square44x44Logo.targetsize-16.png
│ ├── Square44x44Logo.targetsize-24.png
│ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ ├── Square44x44Logo.targetsize-256.png
│ ├── Square44x44Logo.targetsize-48.png
│ ├── Square71x71Logo.scale-100.png
│ ├── Square71x71Logo.scale-125.png
│ ├── Square71x71Logo.scale-150.png
│ ├── Square71x71Logo.scale-200.png
│ ├── Square71x71Logo.scale-400.png
│ ├── StoreLogo.scale-100.png
│ ├── StoreLogo.scale-125.png
│ ├── StoreLogo.scale-150.png
│ ├── StoreLogo.scale-200.png
│ ├── StoreLogo.scale-400.png
│ ├── Wide310x150Logo.scale-100.png
│ ├── Wide310x150Logo.scale-125.png
│ ├── Wide310x150Logo.scale-150.png
│ ├── Wide310x150Logo.scale-200.png
│ └── Wide310x150Logo.scale-400.png
├── Behaviors
│ ├── CameraPressedBehavior.cs
│ ├── PushButton.cs
│ ├── PushButtonBehavior.cs
│ └── SwipeTriggerBehavior.cs
├── Constants.cs
├── Extensions
│ └── ImageExtensions.cs
├── LocalizedStrings.cs
├── Package.appxmanifest
├── Properties
│ ├── AssemblyInfo.cs
│ └── Default.rd.xml
├── See4Me.Windows.csproj
├── Services
│ ├── AppService.cs
│ ├── LauncherService.cs
│ ├── MediaPicker.cs
│ ├── NavigationService.cs
│ ├── StreamResolution.cs
│ └── StreamingService.cs
├── Strings
│ ├── en
│ │ └── Resources.resw
│ └── it
│ │ └── Resources.resw
├── Styles
│ └── Styles.xaml
├── ViewModels
│ ├── MainViewModel.cs
│ ├── RecognizeTextViewModel.cs
│ ├── SettingsViewModel.cs
│ ├── ViewModelBase.cs
│ └── ViewModelLocator.cs
├── Views
│ ├── AboutPage.xaml
│ ├── AboutPage.xaml.cs
│ ├── MainPage.xaml
│ ├── MainPage.xaml.cs
│ ├── PrivacyPolicyPage.xaml
│ ├── PrivacyPolicyPage.xaml.cs
│ ├── RecognizeTextPage.xaml
│ ├── RecognizeTextPage.xaml.cs
│ ├── SettingsPage.xaml
│ └── SettingsPage.xaml.cs
└── project.json
└── See4Me.iOS
├── AppDelegate.cs
├── Common
└── ViewControllerBase.cs
├── Entitlements.plist
├── Extensions
├── AVCaptureExtensions.cs
├── ContextExtensions.cs
└── LocalizationExtensions.cs
├── Info.plist
├── LinkerWorkarounds.cs
├── Main.cs
├── Main.storyboard
├── Properties
└── AssemblyInfo.cs
├── Resources
├── Icon-60.png
├── Icon-60@2x.png
├── Icon-60@3x.png
├── Icon-72.png
├── Icon-72@2x.png
├── Icon-76.png
├── Icon-76@2x.png
├── Icon-83.5@2x.png
├── Icon-Small-40.png
├── Icon-Small-40@2x.png
├── Icon-Small-40@3x.png
├── Icon-Small-50.png
├── Icon-Small-50@2x.png
├── Icon-Small.png
├── Icon-Small@2x.png
├── Icon-Small@3x.png
├── Icon.png
├── Icon@2x.png
├── Images
│ ├── Camera.png
│ ├── Camera@2x.png
│ ├── Eye.png
│ ├── Eye@2x.png
│ ├── Settings.png
│ ├── Settings@2x.png
│ ├── SwitchCamera.png
│ └── SwitchCamera@2x.png
├── LaunchScreen.xib
├── iTunesArtwork.png
└── iTunesArtwork@2x.png
├── See4Me.iOS.csproj
├── Services
├── AppService.cs
├── ImageTools.cs
├── LauncherService.cs
├── MediaPicker.cs
├── NavigationService.cs
├── OutputRecorder.cs
├── SoundTools.cs
└── StreamingService.cs
├── ViewControllers
├── AboutViewController.cs
├── AboutViewController.designer.cs
├── MainViewController.cs
├── MainViewController.designer.cs
├── PrivacyPolicyViewController.cs
├── PrivacyPolicyViewController.designer.cs
├── SettingsViewController.cs
└── SettingsViewController.designer.cs
├── app.config
├── en.lproj
└── Localizable.strings
├── it.lproj
└── Localizable.strings
└── packages.config
/Docs/Images/CognitiveServices_Keys.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DotNetToscana/See4Me/8e467eed8966a62701738e907db4439861fb73f2/Docs/Images/CognitiveServices_Keys.png
--------------------------------------------------------------------------------
/Docs/Images/CognitiveServices_Signup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DotNetToscana/See4Me/8e467eed8966a62701738e907db4439861fb73f2/Docs/Images/CognitiveServices_Signup.png
--------------------------------------------------------------------------------
/Docs/Images/TranslatorService_Creation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DotNetToscana/See4Me/8e467eed8966a62701738e907db4439861fb73f2/Docs/Images/TranslatorService_Creation.png
--------------------------------------------------------------------------------
/Docs/Images/TranslatorService_Keys.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DotNetToscana/See4Me/8e467eed8966a62701738e907db4439861fb73f2/Docs/Images/TranslatorService_Keys.png
--------------------------------------------------------------------------------
/Docs/Register.md:
--------------------------------------------------------------------------------
1 | # How to Register Cognitive Services
2 |
3 | In order to use Microsoft Cognitive Services, you need to get the corresponding service keys by following the instructions available in the **Microsoft Cognitive Services subscription** page:
4 |
5 | 1. Go to https://www.microsoft.com/cognitive-services/en-us/sign-up and login with your Microsoft, GitHub or LinkedIn account:
6 |
7 |
8 |
9 | 2. After logging in, click the **Request new trials** button and select the products you want to subscribe. For our purposes, we need the following ones:
10 | 1. Computer Vision
11 | 2. Face
12 |
13 | In the description column you can see the free quota limit for each service. Check the option *I agree to the Microsoft Cognitive Services Terms and Microsoft Privacy Statement* and click **Subscribe**.
14 |
15 | 3. You'll be redirect to the **My free subscription** pages, that contains all the products for which you have a subscription. For each one there is a couple of Keys, for example:
16 |
17 |
18 |
19 | By clicking on **Show**, you'll see the keys you'll need to enter in the app setting page to use Cognitive Services features.
20 |
21 |
22 | Then, if you want to use translation feature, you also need an Azure subscription to activate **Microsoft Translator Service**. Go to https://portal.azure.com/#create/Microsoft.CognitiveServices/apitype/TextTranslation to start the service creation wizard:
23 |
24 |
25 |
26 | Enter an account name and be sure that, under API type, the value *Translator Text API* is selected. Then insert all the other information. In particular, in the *Pricing tier* box you can select how to pay the service: as all the resources available on Azure, you pay what you use. There is a free tier that allows to translate up to 2M characters a month. When you have set all the properties, confirm by clicking on **Create**. After the service deployment is completed, go to its **Keys** section:
27 |
28 |
29 |
30 | You need to enter either Key 1 or Key 2 in the app setting page to activate translator feature. Note that it may take up to 10 minutes for the newly (re)generated keys to take effect.
31 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Introducing See4Me
2 |
3 | *See4Me* is a cross-platform app to 'see' the world using [Microsoft Cognitive Services](https://www.microsoft.com/cognitive-services). Simply point the smartphone and tap: in a few moments the app will describe and speak what it sees -- from scenes to objects to people with age and emotion. The app is also able to automatically translate descriptions using [Microsoft Translator](https://www.microsoft.com/en-us/translator/products.aspx).
4 |
5 | **Getting started**
6 |
7 | To use See4Me, you must obtain Cognitive API and Microsoft Translator subscription keys by following the instructions available in [How to register Cognitive Services](Docs/Register.md).
8 |
9 | Then, you need to enter these service keys (Subscription Key for Vision, Face, Emotion and Translator Services) in the *Src/See4Me.Shared/ServiceKeys.cs* file.
10 |
11 | **Screenshots**
12 |
13 | *Windows 10 version*
14 |
15 |
16 |
17 |
18 | *iOS version*
19 |
20 |
21 |
22 | **Contribute**
23 |
24 | The project is continuously evolving. We welcome contributions. Feel free to file issues and pull requests on the repo and we'll address them as we can.
25 |
26 | **Developer Code of Conduct**
27 |
28 | The image, voice, video or text understanding capabilities of See4Me use Microsoft Cognitive Services. Microsoft will receive the images, audio, video, and other data that you upload (via this app) for service improvement purposes. To report abuse of the Microsoft Cognitive Services to Microsoft, please visit the Microsoft Cognitive Services website at https://www.microsoft.com/cognitive-services, and use the "Report Abuse" link at the bottom of the page to contact Microsoft. For more information about Microsoft privacy policies please see their privacy statement here: https://go.microsoft.com/fwlink/?LinkId=521839.
29 |
30 | See4Me uses the Microsoft Cognitive Services, see https://www.microsoft.com/cognitive-services/. Developers using this project are expected to follow the “Developer Code of Conduct for Microsoft Cognitive Services” at http://go.microsoft.com/fwlink/?LinkId=698895.
31 |
--------------------------------------------------------------------------------
/Screenshots/Windows/DescribeImage01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DotNetToscana/See4Me/8e467eed8966a62701738e907db4439861fb73f2/Screenshots/Windows/DescribeImage01.png
--------------------------------------------------------------------------------
/Screenshots/Windows/DescribeImage02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DotNetToscana/See4Me/8e467eed8966a62701738e907db4439861fb73f2/Screenshots/Windows/DescribeImage02.png
--------------------------------------------------------------------------------
/Screenshots/iOS/DescribeImage01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DotNetToscana/See4Me/8e467eed8966a62701738e907db4439861fb73f2/Screenshots/iOS/DescribeImage01.png
--------------------------------------------------------------------------------
/Src/See4Me.Android/Activities/MainActivity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using Android.App;
4 | using Android.Content;
5 | using Android.Runtime;
6 | using Android.Views;
7 | using Android.Widget;
8 | using See4Me.ViewModels;
9 | using See4Me.Android.Common;
10 | using GalaSoft.MvvmLight.Messaging;
11 | using Android.Media;
12 | using Android.OS;
13 | using Android.Hardware;
14 | using GalaSoft.MvvmLight.Helpers;
15 | using Java.Security;
16 | using Messaging = GalaSoft.MvvmLight.Messaging;
17 | using Microsoft.Practices.ServiceLocation;
18 | using See4Me.Android.Extensions;
19 | using See4Me.Services;
20 | using Android.Content.Res;
21 | using Android.Content.PM;
22 | using System.Collections.Generic;
23 |
24 | namespace See4Me.Android
25 | {
26 | [Activity(Label = "@string/ApplicationName", Icon = "@drawable/icon", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize,
27 | ScreenOrientation = ScreenOrientation.Landscape, Theme = "@style/See4Me")]
28 | public class MainActivity : ActivityBase
29 | {
30 | private List bindings;
31 |
32 | private TextureView textureView;
33 | private TextView statusMessage;
34 | private ImageButton takePhotoButton;
35 |
36 | public TextView StatusMessage => statusMessage ?? (statusMessage = FindViewById(Resource.Id.textViewMessage));
37 |
38 | public ImageButton TakePhotoButton => takePhotoButton ?? (takePhotoButton = FindViewById(Resource.Id.takePhotoButton));
39 |
40 | public TextureView TextureView => textureView ?? (textureView = FindViewById(Resource.Id.textureViewMain));
41 |
42 | protected override int? LayoutResourseID => Resource.Layout.Main;
43 |
44 | protected override void OnInitialize(Bundle bundle)
45 | {
46 | this.RegisterMessages();
47 | this.bindings = new List()
48 | {
49 | this.SetBinding(() => ViewModel.StatusMessage, () => StatusMessage.Text, BindingMode.OneWay).RegisterHandler(StatusMessage),
50 | };
51 |
52 | this.TakePhotoButton.SetCommand(this.ViewModel.DescribeImageCommand);
53 |
54 | // Initializes camera streaming.
55 | var streamingService = ServiceLocator.Current.GetInstance() as TextureView.ISurfaceTextureListener;
56 | TextureView.SurfaceTextureListener = streamingService;
57 |
58 | base.OnInitialize(bundle);
59 | }
60 |
61 | private void RegisterMessages()
62 | {
63 | Messaging.Messenger.Default.Register>(this, (message) =>
64 | {
65 | switch (message.Notification)
66 | {
67 | case Constants.InitializeStreaming:
68 | message.Execute(TextureView);
69 | break;
70 | }
71 | });
72 | }
73 |
74 | protected override async void OnResume()
75 | {
76 | base.OnResume();
77 |
78 | await ViewModel.InitializeStreamingAsync();
79 | await ViewModel.CheckShowConsentAsync();
80 | }
81 |
82 | protected override async void OnPause()
83 | {
84 | base.OnPause();
85 |
86 | await ViewModel.CleanupAsync();
87 | }
88 |
89 | public override bool OnKeyDown([GeneratedEnum] Keycode keyCode, KeyEvent e)
90 | {
91 | if (keyCode == Keycode.VolumeDown || keyCode == Keycode.VolumeUp)
92 | {
93 | ViewModel.DescribeImageCommand.Execute(null);
94 | return true;
95 | }
96 |
97 | return base.OnKeyDown(keyCode, e);
98 | }
99 | }
100 | }
101 |
102 |
--------------------------------------------------------------------------------
/Src/See4Me.Android/Activities/SplashActivity.cs:
--------------------------------------------------------------------------------
1 | using Android.App;
2 | using Android.Content;
3 | using Android.OS;
4 | using Android.Content.PM;
5 | using GalaSoft.MvvmLight.Views;
6 | using See4Me.Android;
7 | using System.Threading.Tasks;
8 | using See4Me.ViewModels;
9 | using See4Me.Android.Common;
10 |
11 | namespace SpeedOrder.Droid.Activities
12 | {
13 | [Activity(MainLauncher = true, Label = "@string/ApplicationName", Theme = "@style/See4Me.Splash", Icon = "@drawable/icon",
14 | ScreenOrientation = ScreenOrientation.Landscape, NoHistory = true)]
15 | public class SplashActivity : ActivityBase
16 | {
17 | protected override async void OnResume()
18 | {
19 | base.OnResume();
20 |
21 | // Uses a delay to force the splash screen to appear.
22 | await Task.Delay(100);
23 |
24 | // Navigates to the actual Main Page.
25 | ViewModel.NavigateToMainPage();
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/Src/See4Me.Android/Application.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using Android.App;
4 | using Android.Runtime;
5 | using See4Me.ViewModels;
6 | using GalaSoft.MvvmLight.Threading;
7 | using GalaSoft.MvvmLight.Views;
8 | using See4Me.Services;
9 |
10 | namespace See4Me.Android
11 | {
12 | [Application(Label = "See4Me", Icon = "@drawable/Icon")]
13 | public class Application : global::Android.App.Application
14 | {
15 | ///
16 | /// Must implement this constructor for subclassing the application class.
17 | /// Will act as a global application class throughout the app.
18 | ///
19 | /// pointer to java
20 | /// transfer enumeration
21 | public Application(IntPtr javaReference, JniHandleOwnership transfer)
22 | : base(javaReference, transfer)
23 | { }
24 |
25 | ///
26 | /// Override on create to instantiate the service container to be persistant.
27 | ///
28 | public override void OnCreate()
29 | {
30 | base.OnCreate();
31 |
32 | // Registers services for core library
33 | this.Initialize();
34 | }
35 |
36 | private void Initialize()
37 | {
38 | // Page navigation
39 | var navigationService = new Services.NavigationService();
40 | navigationService.Configure(Pages.MainPage.ToString(), typeof(MainActivity));
41 |
42 | this.Locator = new ViewModelLocator();
43 | Locator.Initialize(navigationService);
44 |
45 | // MVVM Light's DispatcherHelper for cross-thread handling.
46 | DispatcherHelper.Initialize();
47 | }
48 |
49 | public ViewModelLocator Locator { get; private set; }
50 | }
51 | }
--------------------------------------------------------------------------------
/Src/See4Me.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");
--------------------------------------------------------------------------------
/Src/See4Me.Android/Common/ActivityBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using Android.App;
6 | using Android.Content;
7 | using Android.Runtime;
8 | using Android.Views;
9 | using Android.Widget;
10 | using See4Me.ViewModels;
11 | using Microsoft.Practices.ServiceLocation;
12 | using GalaSoft.MvvmLight.Messaging;
13 | using Android.OS;
14 | using GalaSoft.MvvmLight.Views;
15 |
16 | namespace See4Me.Android.Common
17 | {
18 | public abstract class ActivityBase : GalaSoft.MvvmLight.Views.ActivityBase where T : ViewModelBase
19 | {
20 | protected T ViewModel => ServiceLocator.Current.GetInstance();
21 |
22 | protected virtual int? LayoutResourseID { get; }
23 |
24 | protected override void OnCreate(Bundle savedInstanceState)
25 | {
26 | base.OnCreate(savedInstanceState);
27 |
28 | if (LayoutResourseID.HasValue)
29 | {
30 | SetContentView(LayoutResourseID.Value);
31 | }
32 | else
33 | {
34 | var view = OnSetContentView(savedInstanceState);
35 | if (view != null)
36 | SetContentView(view);
37 | }
38 |
39 | OnInitialize(savedInstanceState);
40 | }
41 |
42 | protected virtual View OnSetContentView(Bundle savedInstanceState) => null;
43 |
44 | protected override void OnDestroy()
45 | {
46 | GalaSoft.MvvmLight.Messaging.Messenger.Default.Unregister(this);
47 | base.OnDestroy();
48 | }
49 |
50 | protected virtual void OnInitialize(Bundle bundle) { }
51 | }
52 | }
--------------------------------------------------------------------------------
/Src/See4Me.Android/Extensions/ContextExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using Android.App;
6 | using Android.Content;
7 | using Android.Views;
8 | using Android.Widget;
9 | using GalaSoft.MvvmLight.Helpers;
10 | using GalaSoft.MvvmLight.Command;
11 |
12 | namespace See4Me.Android.Extensions
13 | {
14 | public static class ContextExtensions
15 | {
16 | public static Binding RegisterHandler(this Binding binding, View view)
17 | {
18 | if (view is TextView)
19 | {
20 | var textView = (view as TextView);
21 | textView.Text = null;
22 | textView.TextChanged += (s, e) => { };
23 | }
24 | else if (view is CheckBox)
25 | {
26 | (view as CheckBox).CheckedChange += (s, e) => { };
27 | }
28 |
29 | return binding;
30 | }
31 |
32 | public static View SetCommand(this View view, RelayCommand command)
33 | {
34 | view.Click += (s, e) => { };
35 | view.SetCommand(Events.Click, command);
36 |
37 | //view.Enabled = command.CanExecute(null);
38 | //command.CanExecuteChanged += (s, args) => view.Enabled = command.CanExecute(null);
39 |
40 | return view;
41 | }
42 | }
43 |
44 | public static class Events
45 | {
46 | public const string TextChanged = "TextChanged";
47 | public const string CheckedChanged = "CheckedChanged";
48 | public const string Click = "Click";
49 | }
50 | }
--------------------------------------------------------------------------------
/Src/See4Me.Android/Properties/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Src/See4Me.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("See4Me.Android")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("See4Me.Android")]
14 | [assembly: AssemblyCopyright("Copyright © 2016")]
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 |
--------------------------------------------------------------------------------
/Src/See4Me.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.
--------------------------------------------------------------------------------
/Src/See4Me.Android/Resources/drawable/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DotNetToscana/See4Me/8e467eed8966a62701738e907db4439861fb73f2/Src/See4Me.Android/Resources/drawable/Icon.png
--------------------------------------------------------------------------------
/Src/See4Me.Android/Resources/drawable/camera.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DotNetToscana/See4Me/8e467eed8966a62701738e907db4439861fb73f2/Src/See4Me.Android/Resources/drawable/camera.png
--------------------------------------------------------------------------------
/Src/See4Me.Android/Resources/drawable/roundedbutton.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
--------------------------------------------------------------------------------
/Src/See4Me.Android/Resources/drawable/splash_screen.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 | -
7 |
10 |
11 |
--------------------------------------------------------------------------------
/Src/See4Me.Android/Resources/layout/Main.axml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
14 |
23 |
37 |
38 |
--------------------------------------------------------------------------------
/Src/See4Me.Android/Resources/values/Strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | See4Me
4 |
5 |
--------------------------------------------------------------------------------
/Src/See4Me.Android/Resources/values/Styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
14 |
--------------------------------------------------------------------------------
/Src/See4Me.Android/Services/AppService.cs:
--------------------------------------------------------------------------------
1 | using See4Me.Android;
2 | using See4Me.Localization.Resources;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace See4Me.Services
10 | {
11 | public class AppService : IAppService
12 | {
13 | private const string BLOG_URL = "https://marcominerva.wordpress.com";
14 | private const string TWITTER_URL = "https://twitter.com/marcominerva";
15 | private const string LINKEDIN_URL = "https://www.linkedin.com/in/marcominerva";
16 |
17 | public string Version
18 | {
19 | get
20 | {
21 | var context = Application.Context;
22 | var versionName = context.PackageManager.GetPackageInfo(context.PackageName, global::Android.Content.PM.PackageInfoFlags.MetaData).VersionName;
23 | return versionName;
24 | }
25 | }
26 |
27 | public string Author => AppResources.AndroidProjectAuthor;
28 |
29 | public string BlogUrl => BLOG_URL;
30 |
31 | public string TwitterUrl => TWITTER_URL;
32 |
33 | public string LinkedInUrl => LINKEDIN_URL;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Src/See4Me.Android/Services/LauncherService.cs:
--------------------------------------------------------------------------------
1 | using Android.Content;
2 | using See4Me.Android;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace See4Me.Services
10 | {
11 | public class LauncherService : ILauncherService
12 | {
13 | public Task LaunchUriAsync(string uri)
14 | {
15 | var intent = new Intent(Intent.ActionView);
16 | intent.SetData(global::Android.Net.Uri.Parse(uri));
17 | MainActivity.CurrentActivity.StartActivity(intent);
18 |
19 | return Task.FromResult