/** * {@inheritDoc} */ public void OnQueryComplete(int token, Java.Lang.Object cookie, ICursor cursor) { if (Activity == null) { return; } try { if (!cursor.MoveToFirst()) { return; } mNameString = cursor.GetString(VendorsQuery.NAME); mName.Text = mNameString; // Unregister around setting checked state to avoid triggering // listener since change isn't user generated. mStarred.CheckedChange += null; mStarred.Checked = cursor.GetInt(VendorsQuery.STARRED) != 0; mStarred.CheckedChange += HandleCheckedChange; // Start background fetch to load vendor logo String logoUrl = cursor.GetString(VendorsQuery.LOGO_URL); if (!TextUtils.IsEmpty(logoUrl)) { BitmapUtils.FetchImage(Activity, new Java.Lang.String(logoUrl), null, null, (result) => { Activity.RunOnUiThread(() => { if (result == null) { mLogo.Visibility = ViewStates.Gone; } else { mLogo.Visibility = ViewStates.Visible; mLogo.SetImageBitmap(result); } }); }); } mUrl.Text = cursor.GetString(VendorsQuery.URL); mDesc.Text = cursor.GetString(VendorsQuery.DESC); mProductDesc.Text = cursor.GetString(VendorsQuery.PRODUCT_DESC); mTrackId = cursor.GetString(VendorsQuery.TRACK_ID); // Assign track details when found // TODO: handle vendors not attached to track ActivityHelper activityHelper = ((BaseActivity)Activity).ActivityHelper; activityHelper.SetActionBarTitle(new Java.Lang.String(cursor.GetString(VendorsQuery.TRACK_NAME))); activityHelper.SetActionBarColor(new Color(cursor.GetInt(VendorsQuery.TRACK_COLOR))); //AnalyticsUtils.getInstance(getActivity()).trackPageView("/Sandbox/Vendors/" + mNameString); } finally { cursor.Close(); } }
private void OnSpeakersQueryComplete(ICursor cursor) { try { mSpeakersCursor = true; // TODO: remove any existing speakers from layout, since this cursor // might be from a data change notification. ViewGroup speakersGroup = mRootView.FindViewById <ViewGroup> (Resource.Id.session_speakers_block); LayoutInflater inflater = Activity.LayoutInflater; bool hasSpeakers = false; while (cursor.MoveToNext()) { String speakerName = cursor.GetString(SpeakersQuery.SPEAKER_NAME); if (TextUtils.IsEmpty(speakerName)) { continue; } String speakerImageUrl = cursor.GetString(SpeakersQuery.SPEAKER_IMAGE_URL); String speakerCompany = cursor.GetString(SpeakersQuery.SPEAKER_COMPANY); String speakerUrl = cursor.GetString(SpeakersQuery.SPEAKER_URL); String speakerAbstract = cursor.GetString(SpeakersQuery.SPEAKER_ABSTRACT); String speakerHeader = speakerName; if (!TextUtils.IsEmpty(speakerCompany)) { speakerHeader += ", " + speakerCompany; } var speakerView = inflater.Inflate(Resource.Layout.speaker_detail, speakersGroup, false); var speakerHeaderView = speakerView.FindViewById <TextView> (Resource.Id.speaker_header); var speakerImgView = speakerView.FindViewById <ImageView> (Resource.Id.speaker_image); var speakerUrlView = speakerView.FindViewById <TextView> (Resource.Id.speaker_url); var speakerAbstractView = speakerView.FindViewById <TextView> (Resource.Id.speaker_abstract); if (!TextUtils.IsEmpty(speakerImageUrl)) { BitmapUtils.FetchImage(Activity, new Java.Lang.String(speakerImageUrl), null, null, (result) => { Activity.RunOnUiThread(() => { speakerImgView.SetImageBitmap(result); }); }); } speakerHeaderView.Text = speakerHeader; UIUtils.SetTextMaybeHtml(speakerAbstractView, speakerAbstract); if (!TextUtils.IsEmpty(speakerUrl)) { UIUtils.SetTextMaybeHtml(speakerUrlView, speakerUrl); speakerUrlView.Visibility = ViewStates.Visible; } else { speakerUrlView.Visibility = ViewStates.Gone; } speakersGroup.AddView(speakerView); hasSpeakers = true; mHasSummaryContent = true; } speakersGroup.Visibility = (hasSpeakers ? ViewStates.Visible : ViewStates.Gone); // Show empty message when all data is loaded, and nothing to show if (mSessionCursor && !mHasSummaryContent) { mRootView.FindViewById(Android.Resource.Id.Empty).Visibility = ViewStates.Visible; } } finally { if (null != cursor) { cursor.Close(); } } }