Exemplo n.º 1
0
        /// <summary>
        /// Called when [create].
        /// </summary>
        /// <param name="bundle">The bundle.</param>
        protected override void OnCreate(Bundle bundle)
        {
            // Check if _handler has Categories and Businesses initialized
            ErrorCheckActivity.checkXMLHandlerInitialization(this.ApplicationContext, _handler.isInitialized);

            base.OnCreate(bundle);
            SetContentView(Resource.Layout.ListBusiness);

            // Set the toolbar
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = this.ApplicationContext.GetString(Resource.String.RecyclingInfoActivityLabel);

            // Getting Views
            _ListView = FindViewById <ListView>(Resource.Id.lvListArea);


            // Get unique List of all possible Businesses
            GetBusinessList();

            // Set the custom adapter
            BusinessListAdapter adapter = new BusinessListAdapter(this, _businessList);

            _ListView.Adapter = adapter;

            // Set the ListView on-click function
            _ListView.ItemClick += _ListView_ItemClick;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Called on creation of Business Details Activity.
        /// </summary>
        /// <param name="bundle">The bundle, used for passing data between Activities. This should include the extra "businessName"</param>
        protected override void OnCreate(Bundle bundle)
        {
            // Check if _handler has Categories and Businesses initialized
            ErrorCheckActivity.checkXMLHandlerInitialization(this.ApplicationContext, _handler.isInitialized);

            base.OnCreate(bundle);
            SetContentView(Resource.Layout.BusinessDetails);

            // Get the passed properties
            _categoryName    = Intent.GetStringExtra("categoryName") ?? "No Data Found";
            _subcategoryName = Intent.GetStringExtra("subcategoryName") ?? "No Data Found";
            _businessName    = Intent.GetStringExtra("businessName") ?? "No Data Found";
            _businessObj     = _handler.GetBusinessByName(_businessName);

            // Set the toolbar
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = _businessName ?? this.ApplicationContext.GetString(Resource.String.BusinessDetailsActivityLabel);

            // Get layout objects
            _txtBusName            = FindViewById <TextView>(Resource.Id.txtBusinessName);
            _txtBusAddress         = FindViewById <TextView>(Resource.Id.txtBusinessAddress);
            _txtBusPhone           = FindViewById <TextView>(Resource.Id.txtBusinessPhone);
            _txtBusWebsite         = FindViewById <TextView>(Resource.Id.txtBusinessWebsite);
            _txtBusAccepts         = FindViewById <TextView>(Resource.Id.txtBusinessAccepts);
            _txtBusAcceptsLabel    = FindViewById <TextView>(Resource.Id.txtBusinessAcceptsLabel);
            _layoutBusAddress      = FindViewById <LinearLayout>(Resource.Id.layoutBusinessAddress);
            _layoutBusPhone        = FindViewById <LinearLayout>(Resource.Id.layoutBusinessPhone);
            _layoutBusWebsite      = FindViewById <LinearLayout>(Resource.Id.layoutBusinessWebsite);
            _layoutBusAccepts      = FindViewById <LinearLayout>(Resource.Id.layoutBusinessAccepts);
            _layoutBusAcceptsLabel = FindViewById <LinearLayout>(Resource.Id.layoutBusinessAcceptsLabel);
            _layoutBusLinks        = FindViewById <LinearLayout>(Resource.Id.layoutBusinessLinks);

            // Set the layout objects
            _txtBusName.Text         = _businessObj.Name;
            _txtBusAddress.Text      = GetFormattedAddress();
            _txtBusPhone.Text        = GetFormattedPhoneNumber();
            _txtBusWebsite.Text      = _businessObj.Website;
            _txtBusAccepts.Text      = GetSubcategoriesAccepted();
            _txtBusAcceptsLabel.Text = GetSubcategoriesAcceptedLabel();

            // Remove layouts if content is not available
            RemoveOnEmptyTextView(_txtBusAddress, _layoutBusAddress);
            RemoveOnEmptyTextView(_txtBusPhone, _layoutBusPhone);
            RemoveOnEmptyTextView(_txtBusWebsite, _layoutBusWebsite);
            RemoveOnEmptyTextView(_txtBusAccepts, _layoutBusAccepts);
            RemoveOnEmptyTextView(_txtBusAccepts, _layoutBusAcceptsLabel);

            // Event Listeners
            _layoutBusPhone.Clickable   = true;
            _layoutBusPhone.Click      += _txtBusPhone_Click;
            _layoutBusWebsite.Clickable = true;
            _layoutBusWebsite.Click    += _txtBusWebsite_Click;
            _layoutBusAddress.Clickable = true;
            _layoutBusAddress.Click    += _busAddress_Click;

            // Add Links and Link Listeners
            addBusLinks();
        }
        /// <summary>
        /// Called when [create].
        /// </summary>
        /// <param name="bundle">The bundle.</param>
        protected override void OnCreate(Bundle bundle)
        {
            // Check if _handler has Categories and Businesses initialized
            ErrorCheckActivity.checkXMLHandlerInitialization(this.ApplicationContext, _handler.isInitialized);

            base.OnCreate(bundle);
            SetContentView(Resource.Layout.ListBusiness);

            // Set the toolbar
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = Intent.GetStringExtra("subcategoryName") ?? this.ApplicationContext.GetString(Resource.String.ApplicationName);

            // Get Views
            _ListView = FindViewById <ListView>(Resource.Id.lvListArea);

            // Get the passed categoryName
            _categoryName    = Intent.GetStringExtra("categoryName") ?? "No Data Found";
            _subcategoryName = Intent.GetStringExtra("subcategoryName") ?? "No Data Found";

            // Get unique List of all possible Businesses for the given categoryName & subcategoryName
            GetBusinessList(_categoryName, _subcategoryName);

            // Set the custom adapter
            BusinessListAdapter adapter = new BusinessListAdapter(this, _businessList);

            _ListView.Adapter = adapter;

            // Events ...
            _ListView.ItemClick += _ListView_ItemClick;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Called when [create].
        /// </summary>
        /// <param name="bundle">The bundle.</param>
        protected override void OnCreate(Bundle bundle)
        {
            // Check if _handler has Categories and Businesses initialized
            ErrorCheckActivity.checkXMLHandlerInitialization(this.ApplicationContext, _handler.isInitialized);

            base.OnCreate(bundle);

            // Set our view from the layout resource
            SetContentView(Resource.Layout.ListCategory);

            // Set the toolbar
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = this.ApplicationContext.GetString(Resource.String.CategoryListActivityLabel);

            _ListView = FindViewById <ListView>(Resource.Id.lvListArea);

            // Get a sorted Unique List<sring> of Categories
            _categoryListStrings = new List <string>();

            foreach (var c in _handler.CategoryList)
            {
                _categoryListStrings.Add(c.Name);
            }

            _categoryListStrings = _categoryListStrings.Distinct().ToList();
            _categoryListStrings.Sort();

            // Remove the Repair subcategory from _categoryListStrings
            _categoryListStrings.Remove(this.ApplicationContext.GetString(Resource.String.RepairCategoryName));

            // Set the custom adapter
            CategoryListAdapter adapter = new CategoryListAdapter(this, _categoryListStrings);

            _ListView.Adapter = adapter;

            // Set the ListView on-click function
            _ListView.ItemClick += _ListView_ItemClick;
        }