private void InitActionBar() { actionBar = (RetailMobile.Fragments.ItemActionBar) this.FragmentManager.FindFragmentById(Resource.Id.ActionBar1); actionBar.ClearButtons(); actionBar.AddButtonLeft(1, "", Resource.Drawable.settings_48); actionBar.ActionButtonClicked += new RetailMobile.Fragments.ItemActionBar.ActionButtonCLickedDelegate(ActionBarButtonClicked); }
private void InitActionBar() { bool showMenuButton = false; actionBar = (RetailMobile.Fragments.ItemActionBar) this.FragmentManager.FindFragmentById(Resource.Id.ActionBar3); if (actionBar == null) { actionBar = (RetailMobile.Fragments.ItemActionBar) this.FragmentManager.FindFragmentById(Resource.Id.ActionBar1); showMenuButton = true; } actionBar.ClearButtons(); actionBar.AddButtonRight(ControlIds.SETTINGS_SAVE_BUTTON, "", Resource.Drawable.save_48); if (showMenuButton) { actionBar.AddButtonLeft(ControlIds.INVOICE_MAINMENU_BUTTON, "", Resource.Drawable.menu_32); } else { actionBar.AddButtonLeft(ControlIds.SETTINGS_BACK_BUTTON, "", Resource.Drawable.back_48); } actionBar.ActionButtonClicked += new RetailMobile.Fragments.ItemActionBar.ActionButtonCLickedDelegate(ActionBarButtonClicked); string title = this.Activity.GetString(Resource.String.Settings); actionBar.SetTitle(title); }
public CustomerSelectDialog(Activity context, int theme) : base(context, theme) { activity = context; //dialogCustomers.Window.SetLayout(Android.Widget.RelativeLayout.LayoutParams.FillParent, Android.Widget.RelativeLayout.LayoutParams.FillParent); // SetTitle(context.GetString(Resource.String.miCustomers)); SetContentView(Resource.Layout.dialog_customer_search); actionBar = (RetailMobile.Fragments.ItemActionBar)((Android.Support.V4.App.FragmentActivity)activity).SupportFragmentManager.FindFragmentById(Resource.Id.ActionBarDialogCust); actionBar.ActionButtonClicked += new RetailMobile.Fragments.ItemActionBar.ActionButtonCLickedDelegate(ActionBarButtonClicked); actionBar.ClearButtons(); actionBar.AddButtonRight(OK_BUTTON, activity.GetString(Resource.String.btnOK), Resource.Drawable.tick_16); actionBar.AddButtonLeft(CANCEL_BUTTON, activity.GetString(Resource.String.btnClose), Resource.Drawable.close_icon64); actionBar.SetTitle(activity.GetString(Resource.String.miCustomers)); lvCustomers = FindViewById <ListView>(Resource.Id.lvCustomers); tbCustCode = FindViewById <EditText>(Resource.Id.tbCustCode); tbCustName = FindViewById <EditText>(Resource.Id.tbCustName); tbCustCode.AfterTextChanged += new EventHandler <Android.Text.AfterTextChangedEventArgs>(tbSearch_AfterTextChanged); tbCustName.AfterTextChanged += new EventHandler <Android.Text.AfterTextChangedEventArgs>(tbSearch_AfterTextChanged); lvCustomers.ChoiceMode = ChoiceMode.Single; lvCustomers.ItemClick += new EventHandler <AdapterView.ItemClickEventArgs>(lvCustomers_ItemClick); Library.CustomerInfoList custInfoList = Library.CustomerInfoList.GetCustomerInfoList(activity, new Library.CustomerInfoList.Criteria() { CustCode = tbCustCode.Text, CustName = tbCustName.Text }); lvCustomers.Adapter = new CustomersAdapter(activity, custInfoList); GC.Collect(); }
private void InitActionBar() { actionBar = (RetailMobile.Fragments.ItemActionBar) this.FragmentManager.FindFragmentById(Resource.Id.ActionBar3); if (actionBar == null) { actionBar = (RetailMobile.Fragments.ItemActionBar) this.FragmentManager.FindFragmentById(Resource.Id.ActionBar1); } actionBar.ClearButtons(); actionBar.SetTitle(this.Activity.GetString(Resource.String.miItems)); }
private void InitActionBar() { actionBar = (RetailMobile.Fragments.ItemActionBar) this.FragmentManager.FindFragmentById(Resource.Id.ActionBar3); if (actionBar == null) { actionBar = (RetailMobile.Fragments.ItemActionBar) this.FragmentManager.FindFragmentById(Resource.Id.ActionBar1); } actionBar.ClearButtons(); actionBar.AddButtonRight(SAVE_BUTTON, this.Activity.GetString(Resource.String.btnSave), Resource.Drawable.save_48); actionBar.ActionButtonClicked += new RetailMobile.Fragments.ItemActionBar.ActionButtonCLickedDelegate(ActionBarButtonClicked); actionBar.SetTitle(this.Activity.GetString(Resource.String.miCustomers)); }
//IScrollLoadble LoadableAdapter; private void InitActionBar() { bool showMenuButton = false; actionBar = (RetailMobile.Fragments.ItemActionBar) this.FragmentManager.FindFragmentById(Resource.Id.ActionBar2); if (actionBar == null) { actionBar = (RetailMobile.Fragments.ItemActionBar) this.FragmentManager.FindFragmentById(Resource.Id.ActionBar1); showMenuButton = true; } actionBar.ClearButtons(); //actionBar.AddButtonLeft(65, "", Resource.Drawable.menu_32); actionBar.AddButtonRight(ControlIds.INVOICE_ADD_BUTTON, "", Resource.Drawable.add_48); if (showMenuButton) { actionBar.AddButtonLeft(ControlIds.INVOICE_MAINMENU_BUTTON, "", Resource.Drawable.menu_32); } actionBar.ActionButtonClicked += new RetailMobile.Fragments.ItemActionBar.ActionButtonCLickedDelegate(ActionBarButtonClicked); }
public ItemsSelectDialog(Activity context, int theme, TransHed header) : base(context, theme) { currentContext = context; transHed = header; activity = context; //SetTitle(context.GetString (Resource.String.miItems)); SetContentView(Resource.Layout.dialog_item_search); actionBar = (RetailMobile.Fragments.ItemActionBar)((Android.Support.V4.App.FragmentActivity)activity).SupportFragmentManager.FindFragmentById(Resource.Id.ActionBarDialog1); actionBar.ActionButtonClicked += new RetailMobile.Fragments.ItemActionBar.ActionButtonCLickedDelegate(ActionBarButtonClicked); actionBar.ClearButtons(); actionBar.AddButtonRight(OK_BUTTON, currentContext.GetString(Resource.String.btnOK), Resource.Drawable.tick_16); actionBar.AddButtonLeft(CANCEL_BUTTON, currentContext.GetString(Resource.String.btnClose), Resource.Drawable.close_icon64); actionBar.SetTitle(currentContext.GetString(Resource.String.miItems)); lvItems = FindViewById <ListView>(Resource.Id.lvItems); tbSearch = FindViewById <EditText>(Resource.Id.tbSearch); tbRetVal = FindViewById <EditText>(Resource.Id.tbRetVal); cbCateg1 = FindViewById <Spinner>(Resource.Id.cbCateg1); cbCateg2 = FindViewById <Spinner>(Resource.Id.cbCateg2); imgItemSelected = FindViewById <ImageView>(Resource.Id.imgItemSelected); btnShowImage = FindViewById <Button>(Resource.Id.btnShowImage); btnShowImage.Click += new EventHandler(btnShowImage_Click); tbSearch.AfterTextChanged += new EventHandler <Android.Text.AfterTextChangedEventArgs>(tbSearch_AfterTextChanged); tbRetVal.AfterTextChanged += new EventHandler <Android.Text.AfterTextChangedEventArgs>(tbSearch_AfterTextChanged); List <KeyValuePair <int, string> > categ1List = AddCategoryList(1); List <KeyValuePair <int, string> > categ2List = AddCategoryList(2); categ1List.Insert(0, new KeyValuePair <int, string>(0, activity.GetString(Resource.String.SpinnerAll))); categ2List.Insert(0, new KeyValuePair <int, string>(0, activity.GetString(Resource.String.SpinnerAll))); SpinnerAdapter <int, string> categ1Adapter = new SpinnerAdapter <int, string>(activity, categ1List); SpinnerAdapter <int, string> categ2Adapter = new SpinnerAdapter <int, string>(activity, categ2List); cbCateg1.Adapter = categ1Adapter; cbCateg2.Adapter = categ2Adapter; cbCateg1.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(cbCateg1_ItemSelected); cbCateg2.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(cbCateg1_ItemSelected); lvItems.FocusChange += new EventHandler <View.FocusChangeEventArgs>(lvItems_FocusChange); lvItems.AddHeaderView(context.LayoutInflater.Inflate(Resource.Layout.item_row_checkable_header, null)); adapterItems = new CheckableItemsAdapter(activity, new ItemInfoList()); adapterItems.ItemImageSelected += new CheckableItemsAdapter.ItemImageSelectedDelegate(ItemImageSelected); lvItems.Adapter = adapterItems; adapterItems.SingleItemSelectedEvent += () => { _checkedItems = adapterItems.CheckedItemIds; Dismiss(); }; adapterItems.SingleItemFocusedEvent += (item) => { TextView lblItemSelectedInfo = FindViewById <TextView>(Resource.Id.lblItemSelectedInfo); //ImageView imgItemSelected = FindViewById<ImageView>(Resource.Id.imgItemSelected); lblItemSelectedInfo.Text = item.ItemDesc; imgItemSelected.SetImageResource(Resource.Drawable.night);//todo }; lvItems.Scroll += new EventHandler <AbsListView.ScrollEventArgs>((o, e) => { if (scrollLoading && e.TotalItemCount > previousTotal) { scrollLoading = false; previousTotal = e.TotalItemCount; currentPage++; } if (!scrollLoading && (e.FirstVisibleItem + e.VisibleItemCount) + 10 >= e.TotalItemCount && e.TotalItemCount >= 10) { // ((IScrollLoadble)lvItems.Adapter).LoadData(currentPage); HeaderViewListAdapter adapter = (HeaderViewListAdapter)lvItems.Adapter; IScrollLoadble origAdapter = (IScrollLoadble)adapter.WrappedAdapter; origAdapter.LoadData(currentPage); scrollLoading = true; } }); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); AndroidEnvironment.UnhandledExceptionRaiser += (sender, e) => { RetailMobile.Error.LogError(this, e.Exception.Message, e.Exception.StackTrace); }; PreferencesUtil.LoadSettings(this); Sync.GenerateDatabase(this); SetContentView(Resource.Layout.main); pbLoadingLayout = FindViewById <RelativeLayout>(Resource.Id.pbLoadingLayout); RelativeLayout layoutFragment1 = FindViewById <RelativeLayout>(Resource.Id.fragment1); RelativeLayout layoutFragment2 = FindViewById <RelativeLayout>(Resource.Id.fragment2); RelativeLayout layoutFragment3 = FindViewById <RelativeLayout>(Resource.Id.fragment3); LinearLayout layout2 = FindViewById <LinearLayout>(Resource.Id.layout2); mainActionBar = (RetailMobile.Fragments.ItemActionBar)SupportFragmentManager.FindFragmentById(Resource.Id.ActionBar1); bool isLoggedIn = false; if (layoutFragment1 != null) { if (!string.IsNullOrEmpty(PreferencesUtil.Username) && !string.IsNullOrEmpty(PreferencesUtil.Password) && LoginFragment.Login(this, PreferencesUtil.Username, PreferencesUtil.Password)) { isLoggedIn = true; if (layoutFragment2 == null && layoutFragment3 == null) { fragmentInvoice = new InvoiceInfoFragment(); var ft = SupportFragmentManager.BeginTransaction(); ft.Replace(Resource.Id.fragment1, fragmentInvoice); ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade); ft.AddToBackStack("Invoice"); ft.Commit(); } else { fragmentMainMenu = new MainMenuFragment(); var ft = SupportFragmentManager.BeginTransaction(); ft.Replace(Resource.Id.fragment1, fragmentMainMenu); ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade); ft.AddToBackStack("MainMenu"); ft.Commit(); } } else { isLoggedIn = false; LoginFragment fragmentLogin = new LoginFragment(); var ft = SupportFragmentManager.BeginTransaction(); ft.Replace(Resource.Id.fragment1, fragmentLogin); ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade); ft.AddToBackStack("Login"); ft.Commit(); } } if (layoutFragment2 != null && layoutFragment3 != null) { if (isLoggedIn) { layout2.Visibility = ViewStates.Visible; fragmentDetails = DetailsFragment.NewInstance((int)MainMenu.MenuItems.Invoices); var ft = SupportFragmentManager.BeginTransaction(); ft.Replace(Resource.Id.fragment2, fragmentDetails); ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade); ft.Commit(); fragmentInvoice = InvoiceInfoFragment.NewInstance(0); ft = SupportFragmentManager.BeginTransaction(); ft.Replace(Resource.Id.fragment3, fragmentInvoice); ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade); ft.Commit(); } else { layoutFragment3.Visibility = ViewStates.Gone; layoutFragment2.Visibility = ViewStates.Gone; } } if (layoutFragment2 == null && layoutFragment3 == null) { menu = new Com.Jeremyfeinstein.Slidingmenu.Lib.SlidingMenu(this); menu.Mode = 0; menu.TouchModeAbove = SlidingMenu.TouchmodeNone; menu.SetShadowWidthRes(Resource.Dimension.shadow_width); menu.SetShadowDrawable(Resource.Drawable.shadow); menu.SetBehindOffsetRes(Resource.Dimension.slidingmenu_offset); menu.SetFadeDegree(0.35f); menu.AttachToActivity(this, Com.Jeremyfeinstein.Slidingmenu.Lib.SlidingMenu.SlidingContent); menu.SetMenu(Resource.Layout.FragmentMainMenu); } SupportFragmentManager.ExecutePendingTransactions(); System.Threading.Tasks.Task.Factory.StartNew(() => Sync.SyncUsers(this)).ContinueWith(task => this.RunOnUiThread(() => HideProgressBar())); }