Ejemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            this.SetContentView(Resource.Layout.Main);
            if (!canAccessLocation() || !canAccessCamera() || !canWriteExternalStorage() || !canReadExternalStorage())
            {
                RequestPermissions(new string[] { Manifest.Permission.AccessFineLocation, Manifest.Permission.Camera, Manifest.Permission.WriteExternalStorage, Manifest.Permission.ReadExternalStorage }, 1);
            }


            //if (!canAccessLocation() || !canAccessCamera())
            //{
            //	RequestPermissions(new string[] { Manifest.Permission.AccessFineLocation, Manifest.Permission.Camera }, 1);
            //}

            ImageButton FillAudit        = FindViewById <ImageButton>(Resource.Id.FillAudit);
            ListView    auditListingView = FindViewById <ListView>(Resource.Id.AuditListingView);
            ImageButton btnMap           = FindViewById <ImageButton>(Resource.Id.btnMap);

            FillAudit.Click += FillAudit_Click;
            btnMap.Click    += BtnMap_Click;

            manageTemplate.SetContext(this);
            List <AuditDetails> auditTest = manageTemplate.GetAllAudit();

            var auditDetailsAdapter = new AuditDetailsAdapter(this);
            var textview            = new TextView(auditListingView.Context);
            var emptyView           = FindViewById <TextView>(Resource.Id.emptyView);

            emptyView.Text             = "There are no saved audits.";
            auditListingView.EmptyView = emptyView;
            auditListingView.Adapter   = auditDetailsAdapter;


            SearchView _searchview = FindViewById <SearchView>(Resource.Id.txtSearch);

            _searchview.QueryTextChange += (object sender, SearchView.QueryTextChangeEventArgs e) =>
            {
                auditDetailsAdapter.filter(e.NewText);
            };

            auditListingView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
            {
                long id        = auditDetailsAdapter.GetItemId(e.Position);
                var  activity2 = new Intent(this, typeof(AuditQuesAnswersActivity));
                activity2.PutExtra("auditId", id.ToString());
                activity2.PutExtra("isNewAudit", false.ToString());
                this.StartActivity(activity2);
            };
        }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            this.SetContentView(Resource.Layout.Main);


            ImageButton FillAudit        = FindViewById <ImageButton>(Resource.Id.FillAudit);
            ListView    auditListingView = FindViewById <ListView>(Resource.Id.AuditListingView);
            Button      btnMap           = FindViewById <Button>(Resource.Id.btnMap);

            FillAudit.Click += FillAudit_Click;
            btnMap.Click    += BtnMap_Click;

            manageTemplate.SetContext(this);
            List <AuditDetails> auditTest = manageTemplate.GetAllAudit();

            var auditDetailsAdapter = new AuditDetailsAdapter(this);

            auditListingView.Adapter = auditDetailsAdapter;
        }