protected override void SetupLayoutConstraints() { base.SetupLayoutConstraints(); this.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); this.AddConstraints( IconImageView.AtLeadingOf(this, 13), IconImageView.WithSameCenterY(this), IconImageView.Width().EqualTo(36), IconImageView.Height().EqualTo(36), RangeLabel.ToTrailingOf(IconImageView, 16), RangeLabel.AtTopOf(this, 16), TypeLabel.AtLeadingOf(RangeLabel), TypeLabel.Below(RangeLabel), ArrowImageView.WithSameCenterY(this), ArrowImageView.AtTrailingOf(this, 12), ArrowImageView.Width().EqualTo(8), ArrowImageView.Height().EqualTo(13), StateLabel.ToLeadingOf(ArrowImageView, 6), StateLabel.WithSameCenterY(this), MainDeviderView.Height().EqualTo(Theme.Dimensions.DeviderWidth), MainDeviderView.AtBottomOf(this), MainDeviderView.AtTrailingOf(this), MainDeviderView.WithSameLeading(RangeLabel), LastItemDeviderView.WithSameHeight(MainDeviderView), LastItemDeviderView.AtBottomOf(this), LastItemDeviderView.AtLeadingOf(this), LastItemDeviderView.ToLeadingOf(MainDeviderView)); }
void ReleaseDesignerOutlets() { if (ArrowImageView != null) { ArrowImageView.Dispose(); ArrowImageView = null; } if (ItemsLabel != null) { ItemsLabel.Dispose(); ItemsLabel = null; } if (ItemsView != null) { ItemsView.Dispose(); ItemsView = null; } if (NumberLabel != null) { NumberLabel.Dispose(); NumberLabel = null; } if (OrderImageView != null) { OrderImageView.Dispose(); OrderImageView = null; } if (OrderStatusLabel != null) { OrderStatusLabel.Dispose(); OrderStatusLabel = null; } if (PaymentStatusLabel != null) { PaymentStatusLabel.Dispose(); PaymentStatusLabel = null; } if (PaymentStatusView != null) { PaymentStatusView.Dispose(); PaymentStatusView = null; } if (PriceLabel != null) { PriceLabel.Dispose(); PriceLabel = null; } }
private void ApplyCustomProperty(IAttributeSet attrs) { Log.Debug(TAG, "Applying custom property"); var a = context.Theme.ObtainStyledAttributes(attrs, Resource.Styleable.CountryCodePicker, 0, 0); try { // set hide nameCode. If someone wants only phone code to avoid name collision for same country phone code. hideNameCode = a.GetBoolean(Resource.Styleable.CountryCodePicker_hideNameCode, false); // set autopop keyboard KeyboardAutoPopOnSearch = (a.GetBoolean(Resource.Styleable.CountryCodePicker_keyboardAutoPopOnSearch, true)); // set custom language is specified, then set it as custom int attrLanguage = LANGUAGE_ENGLISH; if (a.HasValue(Resource.Styleable.CountryCodePicker_ccpLanguage)) { attrLanguage = a.GetInt(Resource.Styleable.CountryCodePicker_ccpLanguage, 1); } CustomLanguage = GetLanguageEnum(attrLanguage); // set custom master list CustomMasterCountries = a.GetString(Resource.Styleable.CountryCodePicker_customMasterCountries); RefreshCustomMasterList(); // set preference countryPreference = a.GetString(Resource.Styleable.CountryCodePicker_countryPreference); RefreshPreferredCountries(); // set default country var lang = Locale.Default.DisplayLanguage; defaultCountryNameCode = a.GetString(Resource.Styleable.CountryCodePicker_defaultNameCode); bool usingNameCode = false; if (defaultCountryNameCode != null && defaultCountryNameCode.Length != 0) { if (Country.GetCountryForNameCodeFromLibraryMasterList(CustomLanguage, defaultCountryNameCode) != null) { usingNameCode = true; DefaultCountry = Country.GetCountryForNameCodeFromLibraryMasterList(CustomLanguage, defaultCountryNameCode); SetSelectedCountry(DefaultCountry); } } // set default country is not set using name code. if (!usingNameCode) { int defaultCountryCode = a.GetInteger(Resource.Styleable.CountryCodePicker_defaultCode, -1); // if invalid country is set using xml, it will be replaced with LIB_DEFAULT_COUNTRY_CODE if (Country.GetCountryForCode(CustomLanguage, PreferredCountries, defaultCountryCode) == null) { defaultCountryCode = LIB_DEFAULT_COUNTRY_CODE; } SetDefaultCountryUsingPhoneCode(defaultCountryCode); SetSelectedCountry(DefaultCountry); } // set color SelectedCountryTextView.SetTextColor(Color.ParseColor("#666666")); ArrowImageView.SetColorFilter(Color.ParseColor("#666666"), PorterDuff.Mode.SrcIn); // set text size SelectedCountryTextView.SetTextSize(ComplexUnitType.Dip, 18); // set arrow arrow size is explicitly defined int arrowSize = a.GetDimensionPixelSize(Resource.Styleable.CountryCodePicker_arrowSize, 0); if (arrowSize > 0) { SetArrowSize(arrowSize); } } catch (Exception e) { SelectedCountryTextView.Text = e.Message; } finally { a.Recycle(); } }