protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ConfigurationManager.Initialise(PCLAppConfig.FileSystemStream.PortableStream.Current); DependencyInjection.RegisterInterfaces(); cmdOpenCamera = ConfigurationManager.AppSettings["CmdOpenCamera"]; cmdTakePhoto = ConfigurationManager.AppSettings["CmdTakePhoto"]; cmdOpenCart = ConfigurationManager.AppSettings["CmdOpenCart"]; cmdOpenList = ConfigurationManager.AppSettings["CmdOpenList"]; cmdHelp = ConfigurationManager.AppSettings["CmdHelp"]; cmdRemind = ConfigurationManager.AppSettings["CmdRemind"]; cmdTutorialRequest = ConfigurationManager.AppSettings["CmdTutorialRequest"]; cmdTutorialLikeShopLens = ConfigurationManager.AppSettings["CmdTutorialLikeShopLens"]; userGuidPrefKey = ConfigurationManager.AppSettings["UserGuidPrefKey"]; shopLensDbContext = ConnectToDatabase(); prefs = PreferenceManager.GetDefaultSharedPreferences(this); talkBackEnabledIntentKey = ConfigurationManager.AppSettings["TalkBackKey"]; voicePrefs = new ActivityPreferences(this, ConfigurationManager.AppSettings["VoicePrefs"]); CheckVoicePrefs(); talkBackEnabled = IsTalkBackEnabled(); if (!talkBackEnabled) { InitiateNoTalkBackMode(); } // Set our view from the "main" layout resource. SetContentView(Resource.Layout.Main); camera2Frag = Camera2Fragment.NewInstance(this, this); if (savedInstanceState == null) { new Thread(() => { FragmentManager.BeginTransaction().Replace(Resource.Id.container, camera2Frag).Commit(); } ).Start(); } drawerLayout = FindViewById <DrawerLayout>(Resource.Id.DrawerLayout); toolbar = FindViewById <SupportToolbar>(Resource.Id.Toolbar); navView = FindViewById <NavigationView>(Resource.Id.NavView); rootView = FindViewById <CoordinatorLayout>(Resource.Id.root_view); drawerToggle = new Android.Support.V7.App.ActionBarDrawerToggle( this, drawerLayout, Resource.String.openDrawer, Resource.String.closeDrawer ); drawerLayout.AddDrawerListener(drawerToggle); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); drawerToggle.SyncState(); gestureListener = new GestureListener(); gestureListener.LeftEvent += GestureLeft; gestureDetector = new GestureDetector(this, gestureListener); navView.NavigationItemSelected += (sender, e) => { switch (e.MenuItem.ItemId) { case Resource.Id.NavItemShoppingCart: StartCartIntent(); break; case Resource.Id.NavItemShoppingList: StartListIntent(); break; } }; }
public void RecognizeImage(Bitmap bitmap, Activity activity, Camera2Fragment owner) { this.bitmap = bitmap; this.owner = owner; activity.RunOnUiThread(Recognise); }