Exemplo n.º 1
0
        public void LoadData(Context context)
        {
            _context = context;

            ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(context);

            var categoriesAsCollection = prefs.GetStringSet("Categories", GetDefaultCategories());

            Categories.Clear();
            foreach (var i in categoriesAsCollection)
            {
                Categories.Add(Enum.Parse <PoiCategory>(i));
            }

            IsViewAngleCorrection = prefs.GetBoolean("IsViewAngleCorrection", false);

            CorrectionViewAngleHorizontal = prefs.GetFloat("CorrectionViewAngleHorizontal", 0);
            CorrectionViewAngleVertical   = prefs.GetFloat("CorrectionViewAngleVertical", 0);

            AltitudeFromElevationMap = prefs.GetBoolean("AltitudeFromElevationMap", true);
            AutoElevationProfile     = prefs.GetBoolean("AutoElevationProfile", true);

            PrivacyPolicyApprovementLevel = prefs.GetInt("PrivacyPolicyApprovementLevel", 0);

            {
                var isTutorialNeeded = prefs.GetBoolean("ShowTutorialMainActivity", true);
                SetTutorialNeeded(TutorialPart.MainActivity, isTutorialNeeded);
            }
            {
                var isTutorialNeeded = prefs.GetBoolean("ShowTutorialPhotoEditActivity", true);
                SetTutorialNeeded(TutorialPart.PhotoEditActivity, isTutorialNeeded);
            }
            {
                var isTutorialNeeded = prefs.GetBoolean("ShowTutorialPhotoShowActivity", true);
                SetTutorialNeeded(TutorialPart.PhotoShowActivity, isTutorialNeeded);
            }

            CameraResolutionSelected = new Android.Util.Size(prefs.GetInt("CameraResolutionWidth", 0), prefs.GetInt("CameraResolutionHeight", 0));
            CameraId = prefs.GetString("CameraId", null);

            string lan = prefs.GetString("Language", "");

            if (!Enum.TryParse <Language>(lan, out Language))
            {
                Language = PoiCountryHelper.GetDefaultLanguage();
            }

            _applicationRatingCompleted = prefs.GetBoolean("ApplicationRatingCompleted", false);
            string applicationRatingQuestionDateAsString = prefs.GetString("ApplicationRatingQuestionDate", null);

            if (DateTime.TryParse(applicationRatingQuestionDateAsString, out var applicationRatingQuestionDateAsDate))
            {
                _applicationRatingQuestionDate = applicationRatingQuestionDateAsDate;
            }


            ShowElevationProfile = AutoElevationProfile;
        }
Exemplo n.º 2
0
        public CountryAdapter(Activity _context, bool includeAll = false)
            : base()
        {
            this.context = _context;
            list         = PoiCountryHelper.GetAllCountries().Select(x => (PoiCountry?)x)
                           .OrderBy(x => PoiCountryHelper.GetCountryName(x)).ToList();

            if (includeAll)
            {
                list.Insert(0, null);
            }
        }
Exemplo n.º 3
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View view = convertView;

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

            view.Tag = position;
            view.SetOnClickListener(this);

            PoiViewItem item = this[position];

            view.FindViewById <ImageView>(Resource.Id.InfoAvailable).Visibility =
                item.IsImportant() ? ViewStates.Visible : ViewStates.Invisible;

            view.FindViewById <TextView>(Resource.Id.Title).Text = item.Poi.Name;

            view.FindViewById <TextView>(Resource.Id.Country).Text = item.Poi.Country != null?
                                                                     PoiCountryHelper.GetCountryName(item.Poi.Country.Value) : "Unknown";

            view.FindViewById <TextView>(Resource.Id.Description).Text =
                $"{item.Poi.Altitude:F0} m | {item.GpsLocation.Distance.Value/1000f:F2} km | {item.GpsLocation.Bearing.Value:F2}°";

            _thumbnail = view.FindViewById <ImageView>(Resource.Id.Thumbnail);
            //_thumbnail.SetColorFilter(ColorFilterPoiItem.GetColorFilter(item));
            _thumbnail.SetImageResource(PoiCategoryHelper.GetImage(item.Poi.Category));

            var deleteButton = view.FindViewById <ImageButton>(Resource.Id.PoiDeleteButton);
            var likeButton   = view.FindViewById <ImageButton>(Resource.Id.PoiLikeButton);

            if (_showOptions)
            {
                deleteButton.SetOnClickListener(this);
                deleteButton.Tag = position;

                likeButton.SetOnClickListener(this);
                likeButton.Tag = position;

                likeButton.SetImageResource(item.Poi.Favorite ? Android.Resource.Drawable.ButtonStarBigOn : Android.Resource.Drawable.ButtonStarBigOff);
            }
            else
            {
                deleteButton.Visibility = ViewStates.Gone;
                likeButton.Visibility   = ViewStates.Gone;
            }

            view.SetBackgroundResource(Resource.Drawable.bg_activity);
            view.Background.Alpha = item.Selected ? 100 : 0;
            return(view);
        }
Exemplo n.º 4
0
        public static async Task <PoiCountry?> GetDefaultCountryByPhoneLocation()
        {
            PoiCountry?defaultCountry = null;
            var        location       = await GpsLocationProvider.GetLastKnownLocationAsync();

            if (location != null)
            {
                var placeInfo = await PlaceNameProvider.AsyncGetPlaceName(location);

                defaultCountry = placeInfo?.Country;
            }

            if (!defaultCountry.HasValue)
            {
                defaultCountry = PoiCountryHelper.GetDefaultCountryByPhoneSettings();
            }

            return(defaultCountry);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
        }