Esempio n. 1
0
        protected override void OnResume()
        {
            isToRunning = true;
            base.OnResume();
            if (modelActivity != null)
            {
                model.myToolbar         = modelActivity.myToolbar;
                model.gps               = modelActivity.gps;
                model.dialog            = modelActivity.dialog;
                model.dbGenericActivity = modelActivity.dbGenericActivity;
            }
            modelActivity.gps.UpdateLocation();

            if (controller.HasVisitaAntigaAtiva())
            {
                controller.CheckOutTarefa();
                model      = null;
                controller = null;
                var i       = new Intent(this, typeof(MenuPdvs));
                var options = ActivityOptions.MakeSceneTransitionAnimation(this,
                                                                           Pair.Create(FindViewById(Resource.Id.profile_image_tarefa), "profileImage"),
                                                                           Pair.Create(FindViewById(Resource.Id.profileLayout), "profileBar"),
                                                                           Pair.Create(FindViewById(Resource.Id.toolbar), "toolbar"));
                StartActivity(i, options.ToBundle());
            }
            else
            {
                RunOnUiThread(() =>
                {
                    PopulateProgressBar();
                    PopulateTarefas();
                    CheckOutTarefas();
                });
            }
        }
Esempio n. 2
0
 void CheckOutTarefas()
 {
     if (model.list_produtos.Count < 1 && model.list_loja.Count < 1)
     {
         controller.CheckOutTarefaLista();
         AlertDialog.Builder dialogBuilder;
         dialogBuilder = new AlertDialog.Builder(this, Resource.Style.DialogTheme);
         dialogBuilder.SetTitle(Resources.GetString(Resource.String.tarefas));
         dialogBuilder.SetMessage(Resources.GetString(Resource.String.dialog_confirm_sem_tarefas_no_pdv));
         dialogBuilder.SetPositiveButton(Resources.GetString(Resource.String.ok),
                                         delegate
         {
             model       = null;
             controller  = null;
             var i       = new Intent(this, typeof(MenuPdvs));
             var options = ActivityOptions.MakeSceneTransitionAnimation(this,
                                                                        Pair.Create(FindViewById(Resource.Id.profile_image_tarefa), "profileImage"),
                                                                        Pair.Create(FindViewById(Resource.Id.profileLayout), "profileBar"),
                                                                        Pair.Create(FindViewById(Resource.Id.toolbar), "toolbar"));
             StartActivity(i, options.ToBundle());
         }
                                         );
         dialogBuilder.SetCancelable(false);
         model.dialog = dialogBuilder.Create();
         RunOnUiThread(() => model.dialog.Show());
     }
 }
Esempio n. 3
0
 void ConcluirTarefas()
 {
     MetricsManager.TrackEvent("ForceCheckOut");
     AlertDialog.Builder dialogBuilder;
     dialogBuilder = new AlertDialog.Builder(this, Resource.Style.DialogTheme);
     dialogBuilder.SetTitle(Resources.GetString(Resource.String.tarefas));
     dialogBuilder.SetMessage(Resources.GetString(Resource.String.confirm_tarefas));
     dialogBuilder.SetPositiveButton(Resources.GetString(Resource.String.sim),
                                     delegate
     {
         controller.CheckOutTarefa();
         model       = null;
         controller  = null;
         var i       = new Intent(this, typeof(MenuPdvs));
         var options = ActivityOptions.MakeSceneTransitionAnimation(this,
                                                                    Pair.Create(FindViewById(Resource.Id.profile_image_tarefa), "profileImage"),
                                                                    Pair.Create(FindViewById(Resource.Id.profileLayout), "profileBar"),
                                                                    Pair.Create(FindViewById(Resource.Id.toolbar), "toolbar"));
         StartActivity(i, options.ToBundle());
     }
                                     );
     dialogBuilder.SetNegativeButton(Resources.GetString(Resource.String.nao), delegate
     {
         MetricsManager.TrackEvent("CancelForceCheckOut");
     });
     model.dialog = dialogBuilder.Create();
     RunOnUiThread(() => model.dialog.Show());
 }
Esempio n. 4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            model = new MenuTarefasModel();
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.menu_tarefas);
            model.camera            = new Camera(ApplicationContext);
            model.myToolbar         = modelActivity.myToolbar;
            model.gps               = modelActivity.gps;
            model.dialog            = modelActivity.dialog;
            model.dbGenericActivity = modelActivity.dbGenericActivity;
            Window.EnterTransition  = null;
            Window.SharedElementReenterTransition = null;
            Window.ReenterTransition = null;
            model.txtMetaDiaria      = FindViewById <TextView>(Resource.Id.txtMetaDiariaTarefa);
            model.barMetaDiaria      = FindViewById <ProgressBar>(Resource.Id.pBarMetaTarefa);

            model.modelPCL = new SPromoterMobile.MenuTarefasModel
            {
                idVisitas          = new ListTypePDV().FromIntentVar(Intent.GetStringExtra("visitas")),
                idsUsuariosLogados = new List <string>(),
                db = new MenuTarefasDA(SQLite_Android.DB.dataBase)
            };
            foreach (var itemIds in Intent.GetStringArrayListExtra("idUser"))
            {
                model.modelPCL.idsUsuariosLogados.Add(itemIds);
            }

            model.profileAvatar = FindViewById <CircleImageView>(Resource.Id.profile_image_tarefa);
            var users   = model.dbGenericActivity.GetUsersIDsLogged();
            var profile = users.Find((obj) => !string.IsNullOrEmpty(obj.AVATAR));

            if (profile != null && profile.AVATAR != null)
            {
                model.profileAvatar.SetImageBitmap(model.camera.GetBitMap(profile.AVATAR));
            }

            model.modelPCL.db     = new MenuTarefasDA(SQLite_Android.DB.dataBase);
            model.adapterProdutos = new CardInfoProdutosAdapter()
            {
                HasStableIds = true
            };
            model.adapterLoja = new CardInfoLojaAdapter()
            {
                HasStableIds = true
            };
            var modelFormDinamico = new FormDinamicoModel
            {
                Db = new FormDinamicoDA(SQLite_Android.DB.dataBase)
            };

            model.modelPCL.formDinamico = new FormDinamicoCon(modelFormDinamico);
            controller = new MenuTarefasCon(model.modelPCL);
            var layoutManagerProduto = new GridLayoutManager(this, 1, LinearLayoutManager.Vertical, false);

            mRecyclerViewProdutos = FindViewById <RecyclerView>(Resource.Id.card_list_produtos);
            mRecyclerViewProdutos.SetLayoutManager(layoutManagerProduto);
            mRecyclerViewProdutos.HasFixedSize = true;
            mRecyclerViewProdutos.SetItemViewCacheSize(20);
            mRecyclerViewProdutos.DrawingCacheEnabled = true;
            mRecyclerViewProdutos.DrawingCacheQuality = DrawingCacheQuality.High;

            var layoutManagerLoja = new GridLayoutManager(this, 1, LinearLayoutManager.Vertical, false);

            mRecyclerViewLoja = FindViewById <RecyclerView>(Resource.Id.card_list_loja);
            mRecyclerViewLoja.SetLayoutManager(layoutManagerLoja);
            mRecyclerViewLoja.HasFixedSize = true;
            mRecyclerViewLoja.SetItemViewCacheSize(20);
            mRecyclerViewLoja.DrawingCacheEnabled = true;
            mRecyclerViewLoja.DrawingCacheQuality = DrawingCacheQuality.High;
        }