コード例 #1
0
 private void ToggleCheckedBackground(TextViewHolder holder, int position)
 {
     try
     {
         if (SelectedItems.Get(position, false))
         {
             holder.MainView.SetBackgroundColor(Color.LightBlue);
             if (CurrentSelectedIdx == position)
             {
                 ResetCurrentItems();
             }
         }
         else
         {
             holder.MainView.SetBackgroundColor(Color.Transparent);
             if (CurrentSelectedIdx == position)
             {
                 ResetCurrentItems();
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
コード例 #2
0
 public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
 {
     try
     {
         //Setup your layout here >>
         var itemView = MessageList[viewType];
         if (itemView != null)
         {
             if (itemView.Position == "Right" || itemView.Position == "right")
             {
                 View           row            = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Right_MS_view, parent, false);
                 TextViewHolder textViewHolder = new TextViewHolder(row, OnClick, OnLongClick, ActivityContext);
                 return(textViewHolder);
             }
             else
             {
                 View           row            = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Left_MS_view, parent, false);
                 TextViewHolder textViewHolder = new TextViewHolder(row, OnClick, OnLongClick, ActivityContext);
                 return(textViewHolder);
             }
         }
         else
         {
             return(null);
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
         return(null);
     }
 }
コード例 #3
0
        public void Initialize(TextViewHolder holder, GetUserMessagesObject.Message item)
        {
            try
            {
                var time = Methods.Time.UnixTimeStampToDateTime(Convert.ToInt32(item.Time));
                if (holder.Time.Text != time.ToShortTimeString())
                {
                    holder.Time.Text = time.ToShortTimeString();

                    string text = Methods.FunString.DecodeString(item.Text);
                    holder.TextSanitizerAutoLink.Load(text, item.Position);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }