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.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; } }); }