protected override void OnCreate(Bundle bundle) { StartSetup(); base.OnCreate(bundle); SetContentView(Resource.Layout.BarcodeEntry); prefs = PreferenceManager.GetDefaultSharedPreferences(this); locationname = prefs.GetString("LocationName", ""); EditInventoryID = prefs.GetString("EditFromItemListForBarcode", ""); AccessBarCodeScan = prefs.GetString("AccessBarCodeScan", ""); AccessFindITExport = prefs.GetString("AccessFindITExport", ""); AccessExport = prefs.GetString("AccessExport", ""); editor = prefs.Edit(); _fab = FindViewById <Fab>(Resource.Id.btnSaveBarCode); _fab.FabColor = Color.Blue; _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.icon_save2x); _fab.Show(); _fabbacktolist = FindViewById <ImageView>(Resource.Id.btnBarBacktolist); empid = prefs.GetLong("EmpID", 0); projectid = prefs.GetLong("ProjectID", 0); projectname = prefs.GetString("ProjectName", ""); clientname = prefs.GetString("ClientName", ""); AlertVibrate = prefs.GetInt("AlertVibrate", 0); AlertTone = prefs.GetInt("AlertTone", 0); editor = prefs.Edit(); SetTypeFace(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); this.RequestWindowFeature(WindowFeatures.NoTitle); SetContentView(Resource.Layout.ManualEntry); // ========================= Get Global Shared Data prefs = PreferenceManager.GetDefaultSharedPreferences(this); empid = prefs.GetLong("EmpID", 0); projectid = prefs.GetLong("ProjectID", 0); if (projectid == 0) { projectid = IMApplication.projectid; } projectname = prefs.GetString("ProjectName", ""); if (projectname == "") { projectname = IMApplication.projectname; } clientname = prefs.GetString("ClientName", ""); if (clientname == "") { clientname = IMApplication.clientname; } ISharedPreferencesEditor editor = prefs.Edit(); editor.PutLong("ProjectID", projectid); editor.PutString("ProjectName", projectname); editor.PutString("ClientName", clientname); editor.Commit(); // applies changes synchronously on older APIs editor.Apply(); locationname = prefs.GetString("LocationName", ""); EditInventoryID = prefs.GetString("EditFromItemList", ""); if (IMApplication.player != null) { IMApplication.player.Stop(); IMApplication.player = null; } // ========================= Get Global Shared Data // ========================= Rounded Button _fab = FindViewById <Fab>(Resource.Id.btnSave); _fab.FabColor = Color.Blue; _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.icon_save2x); _fab.Show(); _fab.Click += delegate { SaveDataToLocalDataBase(); }; // ========================= Rounded Button // ========================= Button Event ImageView _backtolist = FindViewById <ImageView>(Resource.Id.btnManualBacktolist); _backtolist.Click += delegate { ClearAll(); try { StartActivity(typeof(LocationList)); } catch { Toast.MakeText(this, "Oops…something happened, Please try again", ToastLength.Short).Show(); } }; // ========================= Button Event // ========================= Set Font Typeface tf = Typeface.CreateFromAsset(Assets, "Fonts/ROBOTO-LIGHT.TTF"); EditText txtprojectname = FindViewById <EditText>(Resource.Id.txtProjectName); txtprojectname.Typeface = tf; txtprojectname.Invalidate(); EditText txtclientname = FindViewById <EditText>(Resource.Id.txtClientName); txtclientname.Typeface = tf; txtclientname.Invalidate(); EditText txtlocation = FindViewById <EditText>(Resource.Id.txtLocation); txtlocation.Typeface = tf; txtlocation.Invalidate(); EditText txtItemDescription = FindViewById <EditText>(Resource.Id.txtItemDescription); txtItemDescription.Typeface = tf; txtItemDescription.Invalidate(); EditText txtbrand = FindViewById <EditText>(Resource.Id.txtBrand); txtbrand.Typeface = tf; txtbrand.Invalidate(); EditText txtquantity = FindViewById <EditText>(Resource.Id.txtQuantity); txtquantity.Typeface = tf; txtquantity.Invalidate(); EditText txtModelNumber = FindViewById <EditText>(Resource.Id.txtModelNumber); txtModelNumber.Typeface = tf; txtModelNumber.Invalidate(); EditText txtUnitCost = FindViewById <EditText>(Resource.Id.txtUnitCost); txtUnitCost.Typeface = tf; txtUnitCost.Invalidate(); EditText txtNotes = FindViewById <EditText>(Resource.Id.txtNotes); txtNotes.Typeface = tf; txtNotes.Invalidate(); // ========================= Set Font txtlocation.SetText(locationname, TextView.BufferType.Editable); editor = prefs.Edit(); txtlocation.TextChanged += delegate { editor.PutString("LocationName", txtlocation.Text); editor.Commit(); }; txtprojectname.SetText(projectname, TextView.BufferType.Editable); txtclientname.SetText(clientname, TextView.BufferType.Editable); Cam1 = FindViewById <ImageView>(Resource.Id.cam1); TextView Cam1Path = FindViewById <TextView>(Resource.Id.cam1path); Cam1.Click += delegate { if (IMApplication.camera != null) { IMApplication.camera.Release(); IMApplication.camera = null; } if (Cam1Path.Text.Trim() == "") { rnd = new Random(); number = rnd.Next(10000, 99999); Intent intent = new Intent(Android.Provider.MediaStore.ActionImageCapture); string path = CreateDirectoryForPictures(); string picname = String.Format("img_{0}.jpg", number); Java.IO.File objFile = new Java.IO.File(path, picname); intent.PutExtra(Android.Provider.MediaStore.ExtraOutput, Android.Net.Uri.FromFile(objFile)); intent.PutExtra("height", 100); capturedimagename = picname; StartActivityForResult(intent, 1); } else { string picname = CreateDirectoryForPictures() + "/" + Cam1Path.Text.Trim(); OnPreviewImage(picname); currentPreviewcount = 1; } }; Cam2 = FindViewById <ImageView>(Resource.Id.cam2); TextView Cam2path = FindViewById <TextView>(Resource.Id.cam2path); Cam2.Click += delegate { if (IMApplication.camera != null) { IMApplication.camera.Release(); IMApplication.camera = null; } if (Cam2path.Text.Trim() == "") { rnd = new Random(); number = rnd.Next(10000, 99999); Intent intent = new Intent(Android.Provider.MediaStore.ActionImageCapture); string path = CreateDirectoryForPictures(); string picname = String.Format("img_{0}.jpg", number); Java.IO.File objFile = new Java.IO.File(path, picname); intent.PutExtra(Android.Provider.MediaStore.ExtraOutput, Android.Net.Uri.FromFile(objFile)); capturedimagename = picname; StartActivityForResult(intent, 2); } else { string picname = CreateDirectoryForPictures() + "/" + Cam2path.Text.Trim(); OnPreviewImage(picname); currentPreviewcount = 2; } }; Cam3 = FindViewById <ImageView>(Resource.Id.cam3); TextView Cam3path = FindViewById <TextView>(Resource.Id.cam3path); Cam3.Click += delegate { if (IMApplication.camera != null) { IMApplication.camera.Release(); IMApplication.camera = null; } if (Cam3path.Text.Trim() == "") { rnd = new Random(); number = rnd.Next(10000, 99999); Intent intent = new Intent(Android.Provider.MediaStore.ActionImageCapture); string path = CreateDirectoryForPictures(); string picname = String.Format("img_{0}.jpg", number); Java.IO.File objFile = new Java.IO.File(path, picname); intent.PutExtra(Android.Provider.MediaStore.ExtraOutput, Android.Net.Uri.FromFile(objFile)); intent.PutExtra(Android.Provider.MediaStore.ExtraSizeLimit, 300); capturedimagename = picname; StartActivityForResult(intent, 3); } else { string picname = CreateDirectoryForPictures() + "/" + Cam3path.Text.Trim(); OnPreviewImage(picname); currentPreviewcount = 3; } }; Cam4 = FindViewById <ImageView>(Resource.Id.cam4); TextView Cam4path = FindViewById <TextView>(Resource.Id.cam4path); Cam4.Click += delegate { if (IMApplication.camera != null) { IMApplication.camera.Release(); IMApplication.camera = null; } if (Cam4path.Text.Trim() == "") { rnd = new Random(); number = rnd.Next(10000, 99999); Intent intent = new Intent(Android.Provider.MediaStore.ActionImageCapture); string path = CreateDirectoryForPictures(); string picname = String.Format("img_{0}.jpg", number); Java.IO.File objFile = new Java.IO.File(path, picname); intent.PutExtra(Android.Provider.MediaStore.ExtraOutput, Android.Net.Uri.FromFile(objFile)); capturedimagename = picname; StartActivityForResult(intent, 4); } else { string picname = CreateDirectoryForPictures() + "/" + Cam4path.Text.Trim(); OnPreviewImage(picname); currentPreviewcount = 4; } }; Button btnSavePreview = FindViewById <Button>(Resource.Id.btnSavePreview); btnSavePreview.Click += delegate { LinearLayout LayoutManualEntry = FindViewById <LinearLayout>(Resource.Id.LayoutManualEntry); LinearLayout LayoutManualPreview = FindViewById <LinearLayout>(Resource.Id.LayoutManualPreview); LayoutManualEntry.Visibility = ViewStates.Visible; LayoutManualPreview.Visibility = ViewStates.Gone; }; Button btnDiscardPreview = FindViewById <Button>(Resource.Id.btnDiscardPreview); btnDiscardPreview.Click += delegate { if (currentPreviewcount != 0) { rnd = new Random(); number = rnd.Next(10000, 99999); Intent intent = new Intent(Android.Provider.MediaStore.ActionImageCapture); string path = CreateDirectoryForPictures(); string picname = String.Format("img_{0}.jpg", number); Java.IO.File objFile = new Java.IO.File(path, picname); intent.PutExtra(Android.Provider.MediaStore.ExtraOutput, Android.Net.Uri.FromFile(objFile)); capturedimagename = picname; StartActivityForResult(intent, currentPreviewcount); currentPreviewcount = 0; } }; if (EditInventoryID.Trim() != "") { PopulateDataFromDatabase(EditInventoryID); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Title = Resources.GetString(Resource.String.title_home); MyDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); Search = FindViewById <SearchView>(Resource.Id.search); SwipeRefresh = FindViewById <SwipeRefreshLayout>(Resource.Id.refresh); SwipeRefreshEmpty = FindViewById <SwipeRefreshLayout>(Resource.Id.refreshEmpty); Fab = FindViewById <FloatingActionButton>(Resource.Id.fab); ListViewRepositories = FindViewById <MvxListView>(Resource.Id.listRep); MyToggle = new ActionBarDrawerToggle(this, MyDrawerLayout, Resource.String.open_drawer, Resource.String.close_drawer); MyDrawerLayout.AddDrawerListener(MyToggle); MyToggle.SyncState(); ListViewRepositories.ViewTreeObserver.ScrollChanged += (sender, e) => { if (ViewModel.Repositories != null && ViewModel.Repositories.Count > 0 && ListViewRepositories.LastVisiblePosition >= ViewModel.Repositories.Count() - 10) { ViewModel.LoadMore(null); } }; SwipeRefresh.Refresh += Refresh; SwipeRefreshEmpty.Refresh += Refresh; Fab.Click += (sender, e) => { if (ViewModel.SearchVisible) { DoSearch(); } else { ViewModel.SearchVisible = true; ShowKeyboard(Search); } }; ListViewRepositories.ScrollStateChanged += (sender, e) => { if (e.ScrollState == Android.Widget.ScrollState.Idle) { Fab.Show(); } else { Fab.Hide(); ViewModel.SearchVisible = false; } }; Search.SetIconifiedByDefault(false); Search.QueryTextChange += (object sender, SearchView.QueryTextChangeEventArgs e) => { if (string.IsNullOrEmpty(Search.Query)) { DoSearch(false); } }; Search.QueryTextSubmit += (object sender, SearchView.QueryTextSubmitEventArgs e) => { DoSearch(); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Typeface tf = Typeface.CreateFromAsset(Assets, "Fonts/ROBOTO-LIGHT.TTF"); this.RequestWindowFeature(WindowFeatures.NoTitle); SetContentView(Resource.Layout.Main_Search_A); StartSetup(); _fab = FindViewById <Fab> (Resource.Id.btnOpenCreateProjectPopUp); _fab.FabColor = Color.ParseColor("#3597d4"); _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.CreateProject); _fab.Show(); prefs = PreferenceManager.GetDefaultSharedPreferences(this); editor = prefs.Edit(); projectid = prefs.GetLong("ProjectID", 0); long empid = prefs.GetLong("EmpID", 5); EmpID = prefs.GetLong("EmpID", 0); UserType = prefs.GetLong("UserType", 1); UserPlan = prefs.GetString("UserPlan", ""); IsInternal = prefs.GetLong("IsInternal", 0); if (IsInternal == 1) { _fab.Visibility = ViewStates.Gone; } else { _fab.Visibility = ViewStates.Visible; } _fab.Click += delegate { if (UserType == 1) { OpenInAppPurchasePopUp(); } else { showcreateprojectdialog(); } }; WebService objime = new WebService(); projectloadingdialog = ProgressDialog.Show(this, "Loading", "Please wait....."); objime.ProjectListAsync("", empid.ToString()); objime.ProjectListCompleted += getempxml; // listView=listView = FindViewById<ListView>(Resource.Id.List); if (IMApplication.player != null) { IMApplication.player.Stop(); IMApplication.player = null; } ImageView Cam1 = FindViewById <ImageView> (Resource.Id.imgSearchBack); ImageView imgDeleteVoiceSearch = FindViewById <ImageView> (Resource.Id.imgDeleteVoiceSearch); ImageView imgVoiceSearch = FindViewById <ImageView> (Resource.Id.imgVoiceSearch); EditText txtsearchproject = FindViewById <EditText> (Resource.Id.txtsearchproject); listView = FindViewById <ListView> (Resource.Id.List); listView.ItemClick += OnListItemClick; listView.ItemLongClick += DeleteProject; db = this.OpenOrCreateDatabase("ImInventory", FileCreationMode.Private, null); txtsearchproject.TextChanged += delegate { int projectidcolumn; int ProjectID; string text = txtsearchproject.Text; ICursor c1 = db.RawQuery("SELECT * FROM " + "tbl_Inventory WHERE EmpID = " + empid + " AND (ItemDescription like '%" + text + "%' OR BarCodeNumber like '%" + text + "%') GROUP BY ProjectName ORDER BY ID ", null); var projectitemsitems = filterdtableItems; List <TableItem> serceitemsbyprojectidlist = new List <TableItem>(); if (c1.Count > 0) { projectidcolumn = c1.GetColumnIndex("ProjectID"); c1.MoveToFirst(); if (c1 != null) { // Loop through all Results do { ProjectID = c1.GetInt(projectidcolumn); List <TableItem> serceitemsbyprojectid = projectitemsitems.Where(x => x.ProjectID == Convert.ToString(ProjectID)).ToList(); serceitemsbyprojectidlist = serceitemsbyprojectidlist.Concat(serceitemsbyprojectid).ToList(); }while (c1.MoveToNext()); } } if (text.Trim() != "") { imgVoiceSearch.Visibility = ViewStates.Gone; imgDeleteVoiceSearch.Visibility = ViewStates.Visible; List <TableItem> serceitemsbyprojectname = projectitemsitems.Where(x => x.Projectname.ToLower().Contains(text.Trim().ToLower())).ToList(); List <TableItem> serceitemsbyclientname = projectitemsitems.Where(x => x.ClientName.ToLower().Contains(text.Trim().ToLower())).ToList(); projectitemsitems = serceitemsbyprojectname.Concat(serceitemsbyclientname).ToList(); projectitemsitems = projectitemsitems.Concat(serceitemsbyprojectidlist).ToList(); projectitemsitems = projectitemsitems.OrderBy(x => x.ProjectID).ToList(); var projectitemsitem = projectitemsitems.GroupBy(x => new { x.ProjectID }).OrderBy(g => g.Key.ProjectID).ThenBy(g => g.Key.ProjectID).ToList(); projectitemsitems = new List <TableItem>(); foreach (var group in projectitemsitem) { List <TableItem> cps = group.ToList(); projectitemsitems = projectitemsitems.Concat(group).ToList(); } tableItems = projectitemsitems; } else { imgVoiceSearch.Visibility = ViewStates.Visible; imgDeleteVoiceSearch.Visibility = ViewStates.Gone; projectitemsitems = filterdtableItems; } listView.Adapter = new ProjectScreenAdapter(this, projectitemsitems); }; imgDeleteVoiceSearch.Click += delegate { listView = FindViewById <ListView> (Resource.Id.List); imgVoiceSearch.Visibility = ViewStates.Visible; imgDeleteVoiceSearch.Visibility = ViewStates.Gone; txtsearchproject.SetText("", TextView.BufferType.Editable); //listView = FindViewById<ListView>(Resource.Id.List); listView.Adapter = new ProjectScreenAdapter(this, filterdtableItems); tableItems = filterdtableItems; //listView.ItemClick += OnListItemClick; }; Cam1.Click += delegate { this.Finish(); //StartActivity (typeof(Main)); }; }