Exemple #1
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View view = convertView;

            if (view == null)
            {
                view = context.LayoutInflater.Inflate(Resource.Layout.DownloadCountryListLayout, parent, false);
            }

            PoiCountry item = this[position];

            view.FindViewById <TextView>(Resource.Id.PoiItemCountryAsText).Text = PoiCountryHelper.GetCountryName(item);
            view.FindViewById <ImageView>(Resource.Id.PoiItemCountryAsIcon).SetImageResource(PoiCountryHelper.GetCountryIcon(item));

            if (_highlightSelection)
            {
                view.SetBackgroundColor(item == Selection ? highlightedColor : normalColor);
            }

            return(view);
        }
Exemple #2
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View view = convertView;

            if (view == null)
            {
                view = context.LayoutInflater.Inflate(Resource.Layout.CountryItem, parent, false);
            }

            PoiCountry?item = this[position];

            if (item.HasValue)
            {
                view.FindViewById <TextView>(Resource.Id.PoiItemCountryAsText).Text = PoiCountryHelper.GetCountryName(item);
                view.FindViewById <ImageView>(Resource.Id.PoiItemCountryAsIcon).SetImageResource(PoiCountryHelper.GetCountryIcon(item.Value));
            }
            else
            {
                view.FindViewById <TextView>(Resource.Id.PoiItemCountryAsText).Text = context.Resources.GetText(Resource.String.Common_AllCountries);
                view.FindViewById <ImageView>(Resource.Id.PoiItemCountryAsIcon).SetImageResource(Resource.Drawable.flag_of_Unknown);
            }

            return(view);
        }