示例#1
0
        public void UpdateLetters(List <Letter> letters)
        {
            _letters = letters;
            NotifyDataSetChanged();

            _fragment.ShowToast(AndroidHelper.GetString(Resource.String.updatedDraftLetters), ToastLength.Short);
        }
        private void OnActionButtonClick(int position, int buttonResourceId)
        {
            var legislator = GetLegislatorAtPosition(position);

            if (legislator == null)
            {
                Logger.Error($"Unable to process legislator's action button click. Unable to find legislator at position {position}");
                _fragment.ShowToast(AndroidHelper.GetString(Resource.String.unableToProcessAction));
                return;
            }

            ContactMethod contactMethod = null;

            switch (buttonResourceId)
            {
            case Resource.Id.legislatorCtrl_email:
                contactMethod = legislator.Email;
                break;

            case Resource.Id.legislatorCtrl_phone:
                contactMethod = legislator.OfficeNumber;
                break;

            case Resource.Id.legislatorCtrl_address:
                contactMethod = legislator.OfficeAddress;
                break;

            case Resource.Id.legislatorCtrl_facebook:
                contactMethod = legislator.FacebookId;
                break;

            case Resource.Id.legislatorCtrl_twitter:
                contactMethod = legislator.TwitterId;
                break;

            case Resource.Id.legislatorCtrl_youtube:
                contactMethod = legislator.YouTubeId;
                break;

            case Resource.Id.legislatorCtrl_webpage:
                contactMethod = legislator.Website;
                break;
            }

            if (contactMethod != null)
            {
                AppHelper.PerformContactMethodIntent(_fragment, contactMethod, false);
            }
        }