Esempio n. 1
0
            private void LoadPhoto(MediaModel mediaModel, CardView photoCard)
            {
                if (mediaModel != null)
                {
                    var photo = (ImageView)photoCard.GetChildAt(0);
                    var url   = mediaModel.Thumbnails.Mini;
                    Picasso.With(_context).Load(url).NoFade()
                    .Resize(_context.Resources.DisplayMetrics.WidthPixels, 0).Priority(Picasso.Priority.High)
                    .Into(photo, null, () =>
                    {
                        Picasso.With(_context).Load(url).NoFade().Priority(Picasso.Priority.High).Into(photo);
                    });

                    if (_type == PostPagerType.PostScreen)
                    {
                        photoCard.Radius = (int)BitmapUtils.DpToPixel(7, _context.Resources);
                    }

                    var size = new Size {
                        Height = mediaModel.Size.Height / Style.Density, Width = mediaModel.Size.Width / Style.Density
                    };
                    var height = (int)(OptimalPhotoSize.Get(size, Style.ScreenWidthInDp, 130, Style.MaxPostHeight) * Style.Density);
                    photoCard.LayoutParameters.Height = height;
                    ((View)photoCard.Parent).LayoutParameters.Height = height;
                    photo.LayoutParameters.Height = height;
                }
            }
Esempio n. 2
0
        internal CardInfoLojaModel GetItemLoja(CardView cardView)
        {
            var result   = new CardInfoLojaModel();
            var relativa = (RelativeLayout)cardView.GetChildAt(0);

            result.type        = ((TextView)relativa.GetChildAt(0)).Text;
            result.description = ((TextView)relativa.GetChildAt(1)).Text;
            return(result);
        }
Esempio n. 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Activity_Detail);

            SupportToolbar toolBar = FindViewById <SupportToolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolBar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            cl = FindViewById <CoordinatorLayout>(Resource.Id.main_content);
            LinearLayout l = (LinearLayout)((NestedScrollView)cl.GetChildAt(1)).GetChildAt(0);

            exercise = RestService.GetExercise(Intent.GetIntExtra("exercise_id", EXERCISE_ID));
            string exerciseName = exercise.Description;

            CardView cardView = (CardView)l.GetChildAt(0);
            TextView t        = (TextView)((LinearLayout)cardView.GetChildAt(0)).GetChildAt(1);

            t.Text = exercise.Steps[0].Text;

            for (int i = 1; i < exercise.Steps.Count; i++)
            {
                CardView c     = (CardView)LayoutInflater.Inflate(Resource.Menu.card_template, null);
                TextView title = (TextView)((LinearLayout)c.GetChildAt(0)).GetChildAt(0);
                TextView text  = (TextView)((LinearLayout)c.GetChildAt(0)).GetChildAt(1);
                title.Text         = "#" + exercise.Steps[i].StepNumber;
                text.Text          = exercise.Steps[i].Text;
                c.LayoutParameters = cardView.LayoutParameters;
                l.AddView(c);
            }

            CollapsingToolbarLayout collapsingToolBar = FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar);

            collapsingToolBar.Title = exerciseName;
        }
Esempio n. 4
0
        public override void UpdateView(View view, float position)
        {
            base.UpdateView(view, position);
            CardView card      = (CardView)view;
            View     alphaView = card.GetChildAt(1);
            View     imageView = card.GetChildAt(0);

            if (position < 0)
            {
                var alpha = view.Alpha;
                view.Alpha      = 1f;
                alphaView.Alpha = 0.9f - alpha;
                imageView.Alpha = 0.3f + alpha;
            }
            else
            {
                alphaView.Alpha = 0f;
                imageView.Alpha = 1f;
            }

            if (Build.VERSION.SdkInt < BuildVersionCodes.Lollipop)
            {
                var lm    = LayoutManager;
                var ratio = (float)lm.GetDecoratedLeft(view) / lm.ActiveCardLeft;

                var z = position switch
                {
                    _ when position < 0 => ZCenter1 *ratio,
                    _ when position < 0.5f => ZCenter1,
                    _ when position < 1f => ZCenter2,
                    _ => ZRight
                };

                card.CardElevation = Math.Max(0, z);
            }
        }
    }
Esempio n. 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Activity_Detail);

            SupportToolbar toolBar = FindViewById<SupportToolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolBar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            cl = FindViewById<CoordinatorLayout>(Resource.Id.main_content);
            LinearLayout l = (LinearLayout)((NestedScrollView)cl.GetChildAt(1)).GetChildAt(0);

            
            messages = RestService.GetMessages(Intent.GetIntExtra("chat_id", CHAT_ID), MainActivity.GetToken());

            CardView cardView = (CardView)l.GetChildAt(0);
            TextView tt = (TextView)((LinearLayout)cardView.GetChildAt(0)).GetChildAt(0);
            TextView t = (TextView)((LinearLayout)cardView.GetChildAt(0)).GetChildAt(1);
            t.Text = messages[0].Text;
            tt.Text = messages[0].UserName;

            for (int i = 1; i < messages.Count; i++)
            {
                CardView c = (CardView)LayoutInflater.Inflate(Resource.Menu.card_template, null);
                TextView title = (TextView)((LinearLayout)c.GetChildAt(0)).GetChildAt(0);
                TextView text = (TextView)((LinearLayout)c.GetChildAt(0)).GetChildAt(1);
                title.Text = messages[i].UserName;
                text.Text = messages[i].Text;
                c.LayoutParameters = cardView.LayoutParameters;
                l.AddView(c);
            }

            CollapsingToolbarLayout collapsingToolBar = FindViewById<CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar);
            collapsingToolBar.Title = "Chat";

        }
        internal CardMenuPDVsModel GetItemPDV(CardView cardView, List <CardMenuPDVsModel> listCard)
        {
            var result   = new CardMenuPDVsModel();
            var relativa = (RelativeLayout)cardView.GetChildAt(0);

            result.name     = ((TextView)relativa.GetChildAt(0)).Text;
            result.endereco = ((TextView)relativa.GetChildAt(1)).Text;
            foreach (CardMenuPDVsModel item in listCard)
            {
                if (item.name.Equals(result.name) && item.endereco.Equals(result.endereco))
                {
                    result.latitude  = item.latitude;
                    result.longitude = item.longitude;

                    result.listTypePdv = item.listTypePdv;
                    break;
                }
            }
            return(result);
        }