public override void convert(EasyLVHolder holder, int position, BookMixAToc.MixToc.Chapters chapters)
        {
            TextView tvTocItem = holder.getView <TextView>(Resource.Id.tvTocItem);

            tvTocItem.Text = (chapters.title);
            Drawable drawable;

            if (currentChapter == position + 1)
            {
                tvTocItem.SetTextColor(new Color(ContextCompat.GetColor(mContext, Resource.Color.light_red)));
                drawable = ContextCompat.GetDrawable(mContext, Resource.Drawable.ic_toc_item_activated);
            }
            else if (isEpub || FileUtils.getChapterFile(bookId, position + 1).Length() > 10)
            {
                tvTocItem.SetTextColor(new Color(ContextCompat.GetColor(mContext, Resource.Color.light_black)));
                drawable = ContextCompat.GetDrawable(mContext, Resource.Drawable.ic_toc_item_download);
            }
            else
            {
                tvTocItem.SetTextColor(new Color(ContextCompat.GetColor(mContext, Resource.Color.light_black)));
                drawable = ContextCompat.GetDrawable(mContext, Resource.Drawable.ic_toc_item_normal);
            }
            drawable.SetBounds(0, 0, drawable.MinimumWidth, drawable.MinimumHeight);
            tvTocItem.SetCompoundDrawables(drawable, null, null, null);
        }
Esempio n. 2
0
 public override void convert(EasyLVHolder holder, int position, ReadTheme readTheme)
 {
     if (readTheme != null)
     {
         ThemeManager.setReaderTheme(readTheme.theme, holder.getView <View>(Resource.Id.ivThemeBg));
         if (selected == position)
         {
             holder.setVisible(Resource.Id.ivSelected, true);
         }
         else
         {
             holder.setVisible(Resource.Id.ivSelected, false);
         }
     }
 }
        public override void convert(EasyLVHolder holder, int position, BookMark item)
        {
            TextView tv = holder.getView <TextView>(Resource.Id.tvMarkItem);

            SpannableString spanText = new SpannableString((position + 1) + ". " + item.title + ": ");

            spanText.SetSpan(new ForegroundColorSpan(new Color(ContextCompat.GetColor(mContext, Resource.Color.light_coffee))),
                             0, spanText.Length(), SpanTypes.InclusiveExclusive);

            tv.Text = spanText.ToString();

            if (item.desc != null)
            {
                tv.Append(item.desc
                          .Replace(" ", "")
                          .Replace(" ", "")
                          .Replace("\n", ""));
            }
        }
Esempio n. 4
0
        public override void convert(EasyLVHolder holder, int position, string s)
        {
            holder.setText(Resource.Id.tvMinorItem, s);

            if (current == position)
            {
                holder.setVisible(Resource.Id.ivMinorChecked, true);
            }
            else
            {
                holder.setVisible(Resource.Id.ivMinorChecked, false);
            }

            if (position != 0)
            { // 子项右移
                TextView textView = holder.getView <TextView>(Resource.Id.tvMinorItem);
                RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams)textView.LayoutParameters;
                layoutParams.LeftMargin   = ScreenUtils.dpToPxInt(25);
                textView.LayoutParameters = layoutParams;
            }
        }