示例#1
0
        private void OnItemClick(object sender, int e)
        {
            IssueResponse.Issue issueClicked = Issues[e];
            var activity = new Intent(this, typeof(IssueDetailsActivity));

            activity.PutExtra("issue", JsonConvert.SerializeObject(issueClicked));
            StartActivity(activity);
        }
示例#2
0
        public async override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            IssueResponse.Issue issue = this.issues[position];
            ((IssueViewHolder)holder).Title.Text      = issue.Title;
            ((IssueViewHolder)holder).Attributes.Text = "#" + issue.Number.ToString() + " opened on " + issue.Created_at.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture) + " by " + issue.User.Login;

            ((IssueViewHolder)holder).LabelContainer.RemoveAllViews();
            for (int i = 0; i < issue.Labels.Count; i++)
            {
                TextView tv = new TextView(context);
                tv.Text = issue.Labels[i].Name;
                string col = "#" + issue.Labels[i].Color;
                tv.SetBackgroundColor(Color.ParseColor(col));
                LinearLayout.LayoutParams ll = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                ll.SetMargins(0, 0, 15, 10);
                tv.LayoutParameters = ll;
                tv.SetPadding(5, 5, 5, 5);
                tv.TextSize = 11;
                ((IssueViewHolder)holder).LabelContainer.AddView(tv);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.issue_details);

            IssueResponse.Issue issue = JsonConvert.DeserializeObject <IssueResponse.Issue>(Intent.GetStringExtra("issue"));



            issueTitle       = FindViewById <TextView>(Resource.Id.issueTitle);
            issueDescription = FindViewById <TextView>(Resource.Id.issueDescription);
            issueAttributes  = FindViewById <TextView>(Resource.Id.issueAttributes);
            labelContainer   = FindViewById <LinearLayout>(Resource.Id.labelContainer);
            authorImage      = FindViewById <ImageView>(Resource.Id.authorImage);
            authorName       = FindViewById <TextView>(Resource.Id.authorName);

            authorImage.SetImageBitmap(GetImageBitmapFromUrl(issue.User.Avatar_url));
            issueTitle.Text       = issue.Title;
            issueDescription.Text = issue.Body;
            authorName.Text       = issue.User.Login;
            issueAttributes.Text  = "#" + issue.Number.ToString() + " opened on " + issue.Created_at.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture);

            for (int i = 0; i < issue.Labels.Count; i++)
            {
                TextView tv = new TextView(this);
                tv.Text = issue.Labels[i].Name;
                string col = "#" + issue.Labels[i].Color;
                tv.SetBackgroundColor(Color.ParseColor(col));
                LinearLayout.LayoutParams ll = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                ll.SetMargins(0, 0, 15, 10);
                tv.LayoutParameters = ll;
                tv.SetPadding(5, 5, 5, 5);
                tv.TextSize = 11;
                labelContainer.AddView(tv);
            }
        }