// force renderer to show up always in portrait orientation
        protected override void OnWindowVisibilityChanged([GeneratedEnum] ViewStates visibility)
        {
            base.OnWindowVisibilityChanged(visibility);

            var activity = (Activity)Context;

            if (visibility.Equals(ViewStates.Gone))
            {
                // go back to previous orientation
                activity.RequestedOrientation = _previousOrientation;
            }
            else if (visibility.Equals(ViewStates.Visible))
            {
                if (_previousOrientation.Equals(ScreenOrientation.Sensor))
                {
                    _previousOrientation = activity.RequestedOrientation;
                }

                activity.RequestedOrientation = ScreenOrientation.Portrait;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets if the edit ccontent of the card is visible or not.
        /// </summary>
        /// <param name="state">The ViewState that specifies if things are shown or not.</param>
        private void SetContentVisible(ViewStates state)
        {
            foreach (var item in new List<View>() { cardFood, cardInterest, cardLanguage })
            {
                // When hidded, these are set to gone, otherwise there will be a lot of empty space at the buttom of the card.
                item.FindViewById<ImageView>(Resource.Id.confirm_input).Visibility = state.Equals(ViewStates.Visible) ? ViewStates.Visible : ViewStates.Gone;
                item.FindViewById<TextInputLayout>(Resource.Id.info_input_container).Visibility = state.Equals(ViewStates.Visible) ? ViewStates.Visible : ViewStates.Gone;

                // Get each entry in the card, and toggle the remove button.
                var content = item.FindViewById<LinearLayout>(Resource.Id.profile_card_entry);
                var childCount = content.ChildCount;

                for (int i = 0; i < childCount; i++)
                {
                    var entry = content.GetChildAt(i);
                    var icon = entry.FindViewById<ImageView>(Resource.Id.profile_card_entry_remove);
                    icon.Visibility = state;
                }
            }
        }