Example #1
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            if (convertView == null)
            {
                viewHolder  = new NoticeViewHolder();
                convertView = LayoutInflater.FromContext(context).Inflate(Resource.Layout.NoticeList, null);

                viewHolder.Title       = convertView.FindViewById <TextView>(Resource.Id.lstTxtTitle);
                viewHolder.Description = convertView.FindViewById <TextView>(Resource.Id.lstTxtDescription);
                viewHolder.Icon        = convertView.FindViewById <TextView>(Resource.Id.lstTxtExt);
                viewHolder.BaseCover   = convertView.FindViewById <LinearLayout>(Resource.Id.listCover);
                viewHolder.BaseIcon    = convertView.FindViewById <LinearLayout>(Resource.Id.lstIcon);

                Functions.SetElevation(6f, 12f, viewHolder.BaseIcon, viewHolder.BaseCover);

                viewHolder.Title.Typeface       = Typeface.CreateFromAsset(context.Assets, "Fonts/OpenSans/OpenSans-Semibold.ttf");
                viewHolder.Description.Typeface = Typeface.CreateFromAsset(context.Assets, "Fonts/OpenSans/OpenSans-Regular.ttf");
                viewHolder.Icon.Typeface        = Typeface.CreateFromAsset(context.Assets, "Fonts/OpenSans/OpenSans-Semibold.ttf");

                Functions.ResizeText(viewHolder.Title, context);
                Functions.ResizeText(viewHolder.Description, context);
                Functions.ResizeText(viewHolder.Icon, context);

                if (offlineFiles[position].FileExtension.ToUpper().Contains("PDF"))
                {
                    viewHolder.BaseIcon.BackgroundTintList = ColorStateList.ValueOf(Color.ParseColor("#FF4040"));
                }
                else
                {
                    viewHolder.BaseIcon.BackgroundTintList = ColorStateList.ValueOf(Color.ParseColor("#FF840E"));
                }

                convertView.Tag = viewHolder;
            }
            else
            {
                viewHolder = (NoticeViewHolder)convertView.Tag;
            }

            viewHolder.Title.Text       = " " + System.IO.Path.GetFileNameWithoutExtension(offlineFiles[position].FilePath);
            viewHolder.Description.Text = "Category : " + category;
            viewHolder.Icon.Text        = offlineFiles[position].FileExtension.Replace(".", "").ToUpper();

            Animation iconAnimation = AnimationUtils.LoadAnimation(context, Resource.Animation.SlideInRight);

            iconAnimation.Duration     = 500;
            iconAnimation.Interpolator = new DecelerateInterpolator(1.2f);

            Animation contentAnimation = AnimationUtils.LoadAnimation(context, Resource.Animation.SlideInLeft);

            contentAnimation.Duration     = 500;
            contentAnimation.Interpolator = new DecelerateInterpolator(1.2f);

            AnimationSet set = new AnimationSet(false);

            set.AddAnimation(iconAnimation);
            set.AddAnimation(contentAnimation);

            convertView.FindViewById <LinearLayout>(Resource.Id.lstIcon).Animation   = iconAnimation;
            convertView.FindViewById <LinearLayout>(Resource.Id.listCover).Animation = contentAnimation;

            convertView.StartAnimation(set);

            return(convertView);
        }