public void OnItemClick(AdapterView <object> adapterView, View view, int i, long l) { TextView textView = (TextView)view; String momentType = (String)textView.GetText(); String targetUrl = MomentUtil.MOMENT_TYPES.Get(momentType); IItemScope target = new IItemScope_Builder() .SetUrl(targetUrl) .Build(); IMoment_Builder momentBuilder = new IMoment_Builder(); momentBuilder.SetType("http://schemas.google.com/" + momentType); momentBuilder.SetTarget(target); IItemScope result = MomentUtil.getResultFor(momentType); if (result != null) { momentBuilder.SetResult(result); } // Resolve the connection status, and write the moment once PlusClient is connected. mPendingMoments.Add(momentBuilder.Build()); mPlusClientFragment.SignIn(REQUEST_CODE_PLUS_CLIENT_FRAGMENT); }
// Generates the "result" JSON object for ReviewActivity moment. private static IItemScope getReviewActivityResult() { IItemScope rating = new IItemScope_Builder() .SetType("http://schema.org/Rating") .SetRatingValue("100") .SetBestRating("100") .SetWorstRating("0") .Build(); return(new IItemScope_Builder() .SetType("http://schema.org/Review") .SetName("A Humble Review of Widget") .SetUrl("https://developers.google.com/+/plugins/snippet/examples/review") .SetText("It is amazingly effective") .SetReviewRating(rating) .Build()); }
// Generates the "result" JSON object for ReviewActivity moment. private static IItemScope getReviewActivityResult() { IItemScope rating = new IItemScope_Builder() .SetType("http://schema.org/Rating") .SetRatingValue("100") .SetBestRating("100") .SetWorstRating("0") .Build(); return new IItemScope_Builder() .SetType("http://schema.org/Review") .SetName("A Humble Review of Widget") .SetUrl("https://developers.google.com/+/plugins/snippet/examples/review") .SetText("It is amazingly effective") .SetReviewRating(rating) .Build(); }