Example #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            _backButton    = FindViewById(Resource.Id.button_back);
            _confirmButton = toolbar.FindViewById(Resource.Id.button_confirm);
            _loader        = FindViewById(Resource.Id.loader);
            _location      = FindViewById <AppCompatAutoCompleteTextView>(Resource.Id.edit_search);

            GoogleMapOptions mapOptions = new GoogleMapOptions()
                                          .InvokeMapType(GoogleMap.MapTypeSatellite)
                                          .InvokeZoomControlsEnabled(false)
                                          .InvokeCompassEnabled(true);

            FragmentTransaction fragTx = FragmentManager.BeginTransaction();

            _mapFragment = MapFragment.NewInstance(mapOptions);
            fragTx.Add(Resource.Id.fragment_map, _mapFragment, "map");
            fragTx.Commit();
            _mapFragment.GetMapAsync(this);

            toolbar.FindViewById <TextView>(Resource.Id.title).Text = AppResources.Location;
            (_confirmButton as TextView).Text = AppResources.Ok;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            _sessionView   = FindViewById <SessionView>(Resource.Id.session);
            _backButton    = toolbar.FindViewById(Resource.Id.button_back);
            _confirmButton = toolbar.FindViewById(Resource.Id.button_confirm);

            (_confirmButton as TextView).Text = AppResources.Ok;
            toolbar.FindViewById <TextView>(Resource.Id.title).Text = AppResources.EditSession;
        }
Example #3
0
        private void SetupSearchView()
        {
            _searchView = _toolbar.FindViewById <SearchView>(Resource.Id.action_search);

            var searchIcon = (ImageView)_searchView.FindViewById(Resource.Id.search_button);

            searchIcon.SetImageResource(Resource.Mipmap.baseline_search_white_24);

            _searchView.QueryTextChange += (sender, args) => { SearchTextChanged?.Invoke(this, EventArgs.Empty); };
        }
Example #4
0
        private async void OnRecord(object sender, PropertyEventArgs <bool> args)
        {
            // Deteniendo grabación (Grabación terminada).
            if (args.Property)
            {
                // Actualizando UI.
                BottomToolbar.FindViewById(Resource.Id.menuRecord).Visibility = ViewStates.Visible;
                BottomToolbar.FindViewById(Resource.Id.menuStop).Visibility   = ViewStates.Gone;

                // Preparando Reproductor
                DibbiAudio.PreparePlay();

                // Preparando y mostrando dialogo de reproducción.
                DibbiPlayer.State = PlayerState.Preview;
                DibbiPlayer.Show(FragmentManager, "player_dialog");

                // Ocultado detalles de la ultima grabación.
                NotesList.Visibility = ViewStates.Visible;
                FindViewById <LinearLayout>(Resource.Id.RecordDescription).Visibility = ViewStates.Gone;
                FindViewById <TextView>(Resource.Id.RecordDuration).Text = "0:00";

                NotesList.Alpha = 1.0f;
            }
            // Iniciando grabación.
            else
            {
                // Actualizando UI.
                BottomToolbar.FindViewById(Resource.Id.menuRecord).Visibility = ViewStates.Gone;
                BottomToolbar.FindViewById(Resource.Id.menuStop).Visibility   = ViewStates.Visible;

                NotesList.Animate().Alpha(0.0f).SetDuration(400);
                await Task.Delay(400);

                // Mostrar detalles de la grabación.
                NotesList.Visibility = ViewStates.Gone;
                FindViewById <LinearLayout>(Resource.Id.RecordDescription).Visibility = ViewStates.Visible;
            }
        }
Example #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Main);

            // Preparando UI.
            NotesList = FindViewById <ListView>(Resource.Id.ListNotes);

            BottomToolbar = FindViewById <Toolbar>(Resource.Id.MainBottomToolbar);
            BottomToolbar.InflateMenu(Resource.Menu.main_bottom_menu);
            BottomToolbar.MenuItemClick += BottomToolbarItemClick;
            BottomToolbar.FindViewById(Resource.Id.menuStop).Visibility = ViewStates.Gone;

            SetActionBar(FindViewById <Toolbar>(Resource.Id.MainTopToolbar));
            RegisterForContextMenu(NotesList);

            // Inicializando componentes.
            DibbiAudio                     = new DibbiAudio();
            DibbiAudio.FileName            = CacheDir.AbsolutePath + "/cacheaudiorecord.3gp";
            DibbiAudio.OnPlaying          += OnPlay;
            DibbiAudio.OnStopPlaying      += OnPlay;
            DibbiAudio.OnRecording        += OnRecord;
            DibbiAudio.OnStopRecording    += OnRecord;
            DibbiAudio.OnProgressPlaying  += OnProgress;
            DibbiAudio.OnUpdateRecordTime += OnRecordTime;

            DibbiPlayer = PlayerDialog.NewInstance();
            DibbiPlayer.PlayerStarting        += OnPlayerStarting;
            DibbiPlayer.PlayerStoping         += OnPlayerStoping;
            DibbiPlayer.PlayerProgressChanged += OnPlayerProgressChanged;
            DibbiPlayer.DialogConfirm         += OnDialogConfirm;
            DibbiPlayer.DialogDismiss         += OnDialogDismiss;
            DibbiPlayer.BaseDialogDismiss     += OnBaseDialogDismiss;
            DibbiPlayer.DialogShow            += OnPlayerShow;

            DibbiData = new DibbiData(FilesDir.AbsolutePath + "/dibbi.db");
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            user = Serializador.LoadFromXMLString <Usuario>(PreferenceManager.GetDefaultSharedPreferences(this).GetString("user", ""));
            shop = Serializador.LoadFromXMLString <Loja>(PreferenceManager.GetDefaultSharedPreferences(this).GetString("shop", ""));

            MobileBarcodeScanner.Initialize(Application);
            SetContentView(Resource.Layout.ProductSearch);

            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            toolbar.InflateMenu(Resource.Menu.product_search_options_menu);
            toolbar.FindViewById <TextView>(Resource.Id.scan).SetTextColor(Android.Graphics.Color.White);

            toolbar.MenuItemClick += (sender, e) =>
            {
                switch (e.Item.ItemId)
                {
                case Resource.Id.scan:
                    Scan();
                    break;
                }
            };

            listView            = FindViewById <ListView>(Resource.Id.listaProdutos);
            listView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
            {
                var produto = arrayProdutos[e.Position];

                if (produto.Ativo != 'Y')
                {
                    AlertDialog.Builder alert = new AlertDialog.Builder(this);
                    alert.SetTitle("Aviso");
                    alert.SetMessage("Este produto encontra-se inativo!");
                    alert.SetPositiveButton("Fechar", (s, v) => { });
                    alert.Show();
                    return;
                }

                var intent = new Intent(this, typeof(ItemActivity));
                intent.PutExtra("productCode", produto.CdProduto);
                intent.PutExtra("shopCode", shop.ERP.Codigo);
                intent.PutExtra("action", "new");
                StartActivity(intent);
            };

            searchView = FindViewById <SearchView>(Resource.Id.searchView);
            searchView.SetIconifiedByDefault(false);

            searchView.QueryTextSubmit += (object sender, SearchView.QueryTextSubmitEventArgs e) =>
            {
                string query = e.Query;

                if (string.IsNullOrEmpty(query))
                {
                    return;
                }

                Search(query);
            };
        }
Example #7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.Item);

            user = Serializador.LoadFromXMLString <Usuario>(PreferenceManager.GetDefaultSharedPreferences(this).GetString("user", ""));

            action      = this.Intent.GetStringExtra("action");
            maxDiscount = (decimal)user.MaxDiscount;

            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            toolbar.InflateMenu(Resource.Menu.item_options_menu);

            var addItem = toolbar.FindViewById <TextView>(Resource.Id.adicionar_produto);

            addItem.SetTextColor(Android.Graphics.Color.White);
            addItem.Text = action.Equals("new") ? "Adicionar" : "Editar";

            var removeItem = toolbar.FindViewById <TextView>(Resource.Id.remover_produto);

            removeItem.SetTextColor(Android.Graphics.Color.White);
            removeItem.Visibility = action.Equals("update") ? Android.Views.ViewStates.Visible : Android.Views.ViewStates.Gone;

            toolbar.MenuItemClick += (sender, e) =>
            {
                switch (e.Item.ItemId)
                {
                case Resource.Id.adicionar_produto:
                    Confirm();
                    return;

                case Resource.Id.remover_produto:
                    AlertDialog.Builder alert = new AlertDialog.Builder(this);
                    alert.SetTitle("Aviso!");
                    alert.SetMessage("Deseja remover o item do orçamento?");
                    alert.SetPositiveButton("Sim", (s, v) =>
                    {
                        action = "remove";
                        Confirm();
                    });
                    alert.SetNegativeButton("Não", (s, v) => { });
                    alert.Show();
                    return;

                default:
                    return;
                }
            };

            item = new ItemPedido();
            Load();

            var qtd   = FindViewById <EditText>(Resource.Id.txtQuantidade);
            var total = FindViewById <TextView>(Resource.Id.lblValorTotal);

            qtd.ClearFocus();
            qtd.Text         = item.Quantidade.ToString("0.00");
            qtd.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) =>
            {
                item.Quantidade = Conversor.StringToDecimal(e.Text.ToString(), 1);
                total.Text      = string.Format(CultureInfo.GetCultureInfo("pt-BR"), "{0:C}", item.ValorTotal);
                UpdateScreen();
            };

            FindViewById <Button>(Resource.Id.btnDecrement).Click += (object sender, System.EventArgs e) =>
            {
                item.Quantidade -= 1;
                item.Quantidade  = item.Quantidade < 0 ? 0 : item.Quantidade;
                qtd.Text         = item.Quantidade.ToString();
                qtd.ClearFocus();
                UpdateScreen();
            };

            FindViewById <Button>(Resource.Id.btnIncrement).Click += (object sender, System.EventArgs e) =>
            {
                item.Quantidade += 1;
                qtd.Text         = item.Quantidade.ToString();
                qtd.ClearFocus();
                UpdateScreen();
            };

            FindViewById <Button>(Resource.Id.btnPrices).Click += (s, e) =>
            {
                changePrice();
            };

            var txtAl = FindViewById <Input>(Resource.Id.txtAliquota);
            var txtVl = FindViewById <Input>(Resource.Id.txtVlDesc);

            txtAl.EditorAction += (sender, e) =>
            {
                e.Handled = false;
                if (e.ActionId == Android.Views.InputMethods.ImeAction.Done)
                {
                    decimal desconto = Conversor.StringToDecimal(txtAl.Text, 0);

                    if (desconto > maxDiscount)
                    {
                        Toast.MakeText(this, string.Format("Desconto máximo permitido: {0:#.##}%", maxDiscount), ToastLength.Short).Show();
                    }
                    else
                    {
                        txtAl.ClearFocus();
                        item.SetDescontoPercent(desconto);
                        UpdateScreen();
                    }

                    e.Handled = true;
                }
            };

            txtAl.FocusChange += (sender, e) =>
            {
                if (!e.HasFocus)
                {
                    txtAl.Text = item.DescontoPercent.ToString("F");
                }
            };

            txtVl.EditorAction += (sender, e) =>
            {
                e.Handled = false;
                if (e.ActionId == Android.Views.InputMethods.ImeAction.Done)
                {
                    var     maxValue = item.ValorTotal * (maxDiscount / 100);
                    decimal desconto = Conversor.StringToDecimal(txtVl.Text, 0);

                    if (desconto > maxValue)
                    {
                        var msg = string.Format(CultureInfo.GetCultureInfo("pt-BR"), "Desconto máximo para este item: {0:C}", maxValue);
                        Toast.MakeText(this, msg, ToastLength.Short).Show();
                    }
                    else
                    {
                        txtVl.ClearFocus();
                        item.SetDescontoDinheiro(desconto);
                        UpdateScreen();
                    }

                    e.Handled = true;
                }
            };



            txtVl.FocusChange += (sender, e) =>
            {
                if (!e.HasFocus)
                {
                    txtVl.Text = item.DescontoDinheiro.ToString("F");
                }
            };

            var btnAdd = FindViewById <Button>(Resource.Id.btnAddItem);

            btnAdd.Click += (sender, e) => { Confirm(); };
            btnAdd.Text   = action.Equals("new") ? "Adicionar" : "Editar";
        }
Example #8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            user = Serializador.LoadFromXMLString <Usuario>(PreferenceManager.GetDefaultSharedPreferences(this).GetString("user", ""));
            shop = Serializador.LoadFromXMLString <Loja>(PreferenceManager.GetDefaultSharedPreferences(this).GetString("shop", ""));

            pedido = new Pedido(user.Id, user.Vendedor.Id, shop.ERP.Codigo);

            // Create your application here
            SetContentView(Resource.Layout.Order);

            lblItens = FindViewById <TextView>(Resource.Id.lblItens);
            lblTotal = FindViewById <TextView>(Resource.Id.lblTotal);
            UpdateScreen();

            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            toolbar.InflateMenu(Resource.Menu.order_options_menu);
            toolbar.FindViewById <TextView>(Resource.Id.home).SetTextColor(Android.Graphics.Color.White);
            toolbar.FindViewById <TextView>(Resource.Id.novo_pedido).SetTextColor(Android.Graphics.Color.White);

            toolbar.MenuItemClick += (sender, e) =>
            {
                switch (e.Item.ItemId)
                {
                case Resource.Id.home:
                    AlertDialog.Builder alert = new AlertDialog.Builder(this);
                    alert.SetTitle("Início");
                    alert.SetMessage("Todas as alterações serão perdidas. Deseja continuar?");
                    alert.SetPositiveButton("Sim", (s, v) =>
                    {
                        var i = new Intent(this, typeof(HomeActivity));
                        i.AddFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask);
                        StartActivity(i);
                    });
                    alert.SetNegativeButton("Não", (s, v) => { });
                    alert.Create().Show();
                    return;

                case Resource.Id.novo_pedido:
                    New();
                    return;

                case Resource.Id.salvar_pedido:
                    Export();
                    return;

                case Resource.Id.add_produto:
                    SearchProduct();
                    return;

                case Resource.Id.logout:
                    StartActivity(new Intent(this, typeof(LogoutActivity)));
                    return;

                default:
                    return;
                }
            };

            FindViewById <TextView>(Resource.Id.lblVendedor).Text = user.Vendedor.Nome;
            FindViewById <TextView>(Resource.Id.lblLoja).Text     = string.Format("{0} - {1}", shop.ERP.Codigo, shop.ERP.Nome);

            FindViewById <Button>(Resource.Id.btnVerItens).Click += (sender, e) =>
            {
                ViewItems();
            };

            FindViewById <Button>(Resource.Id.btnAddItem).Click += (sender, e) => { SearchProduct(); };

            SetAddCustomerBtn();

            FindViewById <EditText>(Resource.Id.txtObs).TextChanged += (sender, e) =>
            {
                pedido.Observacoes = e.Text.ToString();
            };

            FindViewById <Button>(Resource.Id.btnFinalizar).Click += (sender, e) =>
            {
                Export();
            };
        }