Ejemplo n.º 1
0
        public override void OnAttach(global::Android.App.Activity activity)
        {
            base.OnAttach (activity);
            LeaderBoardSelfCard selfcard = new LeaderBoardSelfCard (nn_goalcard.eventinfo.seller_position,nn_goalcard.eventinfo.gross_sales);

            List<LeaderBoardCard> boardcardlist = new List<LeaderBoardCard> ();
                bool havesetboardboardheader=false;
                for (int i = 0; i < nn_goalcard.eventinfo.LeaderBoardList.Count; i++) {
                    if (!havesetboardboardheader) {
                        havesetboardboardheader = true;
                        boardcardlist.Add (new LeaderBoardCard(nn_goalcard.eventinfo.LeaderBoardList[i],1));
                    }  else {
                        boardcardlist.Add (new LeaderBoardCard(nn_goalcard.eventinfo.LeaderBoardList[i],2));
                    }
                }
            leaderboardadapter = new LeaderBoardAdapter (nn_activity,boardcardlist,selfcard);
        }
Ejemplo n.º 2
0
        //        //on switch
        public void OnShowGoals(int showgoal)
        {
            prizetextview.Text = "";
            personalprogresslabel.Text = "";

            circlecontainter.Click -= OnCircleContainerClick;
            prizeinfocontainer.Visibility = ViewStates.Invisible;
            clicktoseeprizetextview.Visibility = ViewStates.Invisible;

            prizeimage.SetImageBitmap (null);

            if (showgoal == 1) {

                avatarimagview.SetImageResource (Resource.Drawable.Goals_Avatar_Person);

                //if have seller position
                if (!string.IsNullOrEmpty (eventcard.eventinfo.seller_position) && !string.IsNullOrEmpty (eventcard.eventinfo.seller_position)) {
                    //if show personal
                    LeaderBoardSelfCard selfcard = new LeaderBoardSelfCard (eventcard.eventinfo.seller_position, eventcard.eventinfo.gross_sales);
                    List<LeaderBoardCard> boardcardlist = new List<LeaderBoardCard> ();
                    bool havesetboardboardheader = false;
                    for (int i = 0; i < eventcard.eventinfo.LeaderBoardList.Count; i++) {
                        if (!havesetboardboardheader) {
                            havesetboardboardheader = true;
                            boardcardlist.Add (new LeaderBoardCard (eventcard.eventinfo.LeaderBoardList [i], 1));
                        } else {
                            boardcardlist.Add (new LeaderBoardCard (eventcard.eventinfo.LeaderBoardList [i], 2));
                        }
                    }
                    leaderboardadapter = new LeaderBoardAdapter (nn_activity, boardcardlist, selfcard);
                } else {
                    leaderboardadapter = new LeaderBoardAdapter (nn_activity, new List<LeaderBoardCard> (), new LeaderBoardSelfCard("0","0"));
                }
                leaderboardlistview.Adapter = leaderboardadapter;
                setListViewHeightBasedOnItems (leaderboardlistview);
                leaderboardadapter.NotifyDataSetChanged ();
            } else {
                avatarimagview.SetImageResource (Resource.Drawable.Goals_Avatar_Team);

                if (!string.IsNullOrEmpty (eventcard.eventinfo.group_position) && !string.IsNullOrEmpty (eventcard.eventinfo.group_sales)) {
                    //if show team
                    LeaderBoardSelfCard selfcard = new LeaderBoardSelfCard (eventcard.eventinfo.group_position, eventcard.eventinfo.group_sales);
                    List<TeamLeaderBoardCard> boardcardlist = new List<TeamLeaderBoardCard> ();
                    bool havesetboardboardheader = false;
                    for (int i = 0; i < eventcard.eventinfo.groupLeaderBoardList.Count; i++) {
                        if (!havesetboardboardheader) {
                            havesetboardboardheader = true;
                            boardcardlist.Add (new TeamLeaderBoardCard (eventcard.eventinfo.groupLeaderBoardList[i], 1));
                        } else {
                            boardcardlist.Add (new TeamLeaderBoardCard (eventcard.eventinfo.groupLeaderBoardList[i], 2));
                        }
                    }
                    leaderboardadapter = new LeaderBoardAdapter (nn_activity, boardcardlist, selfcard, true);
                }else {
                    leaderboardadapter = new LeaderBoardAdapter (nn_activity, new List<TeamLeaderBoardCard> (), new LeaderBoardSelfCard("0","0"),true);
                }
                leaderboardlistview.Adapter = leaderboardadapter;
                setListViewHeightBasedOnItems (leaderboardlistview);
                leaderboardadapter.NotifyDataSetChanged ();
            }
            railedpricetextview.Text = "$"+0;
            goalsamounttextview.Text = "$"+0;

            //after reset
            if (showgoal == 1) {
                if (!eventcard.eventinfo.seller_prize_description.Equals ("")) {
                    prizetextview.Text = eventcard.eventinfo.seller_prize_description;
                }
                personalprogresslabel.Text = GoalScreenData.personalProgressLabelText;
            } else {
                if(!eventcard.eventinfo.seller_group_prize_description.Equals("")){
                    prizetextview.Text = eventcard.eventinfo.seller_group_prize_description;
                }
                personalprogresslabel.Text = GoalScreenData.teamProgressLabelText;
            }

            int peronalrise = 0;
            int goalamount = 0;
            if(showgoal == 1){
                if (!string.IsNullOrEmpty(eventcard.eventinfo.gross_sales) ) {
                    peronalrise = Int32.Parse(eventcard.eventinfo.gross_sales);
                }
                if(!string.IsNullOrEmpty(eventcard.eventinfo.seller_goal)){
                    goalamount = Int32.Parse(eventcard.eventinfo.seller_goal);
                }
            }else{
                if (!string.IsNullOrEmpty(eventcard.eventinfo.group_sales) ) {
                    peronalrise = Int32.Parse(eventcard.eventinfo.group_sales);
                }
                if(!string.IsNullOrEmpty(eventcard.eventinfo.group_goal)){
                    goalamount = Int32.Parse(eventcard.eventinfo.group_goal);
                }
            }

            railedpricetextview.Text = "$"+peronalrise;
            goalsamounttextview.Text = "$"+goalamount;

            decimal percent=(decimal)0;

            if (showgoal == 1) {
                if (!string.IsNullOrEmpty (eventcard.eventinfo.gross_sales) && !string.IsNullOrEmpty (eventcard.eventinfo.seller_goal)) {
                    peronalrise = Int32.Parse(eventcard.eventinfo.gross_sales);
                    goalamount = Int32.Parse(eventcard.eventinfo.seller_goal);
                    if (peronalrise < 0 | goalamount < 0) {
                        percent = 0;
                    } else if (peronalrise >= goalamount) {
                        percent = 1;
                    } else if (peronalrise < goalamount) {
                        percent = (decimal)peronalrise / goalamount;
                    }
                }
            } else {
                if (!string.IsNullOrEmpty (eventcard.eventinfo.group_sales) && !string.IsNullOrEmpty (eventcard.eventinfo.group_goal)) {
                        peronalrise = Int32.Parse(eventcard.eventinfo.group_sales);
                        goalamount = Int32.Parse(eventcard.eventinfo.group_goal);
                    if (peronalrise < 0 | goalamount < 0) {
                        percent = 0;
                    } else if (peronalrise >= goalamount) {
                        percent = 1;
                    } else if (peronalrise < goalamount) {
                        percent = (decimal)peronalrise / goalamount;
                    }
                }
            }
            textview.Text=Math.Round(percent*100)+"%";
            stokerelativelayout.progresssendangle=Convert.ToSingle(percent)*360;
            stokerelativelayout.Invalidate ();

            if (showgoal == 1) {
                prizetextview.Text = eventcard.eventinfo.seller_prize_description;
            } else {
                prizetextview.Text = eventcard.eventinfo.seller_group_prize_description;
            }

            if (showgoal == 1) {
                if (!string.IsNullOrEmpty (eventcard.eventinfo.seller_prize_image_id) && !eventcard.eventinfo.seller_prize_image_id.Equals ("0")) {
                    clicktoseeprizetextview.Visibility = ViewStates.Visible;
                    int defaultimageresourceid = TapUtil.getdefaultprizeresourceid (Int32.Parse (eventcard.eventinfo.seller_prize_image_id));
                    try {
                        Bitmap imageBitmap = BitmapFactory.DecodeResource (Resources, defaultimageresourceid);
                        Bitmap newbitmap = Bitmap.CreateScaledBitmap (imageBitmap, TapUtil.dptodx (200), TapUtil.dptodx (200), false);
                        if (newbitmap != null) {
                            prizebitmap = newbitmap;
                        }
                    } catch (Exception e1) {
                        Console.WriteLine (e1);
                    }

                    prizeimage.SetImageBitmap (prizebitmap);
                    prizeimage.SetScaleType (ImageView.ScaleType.CenterInside);

                    prizeinfocontainer.SetBackgroundColor (Color.White);
                    //prizeinfocontainer.LayoutParameters=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.MatchParent);
                    prizeinfocontainer.Visibility = ViewStates.Invisible;
                    circlecontainter.Click -= OnCircleContainerClick;
                    circlecontainter.Click += OnCircleContainerClick;
                    clicktoseeprizetextview.Visibility = ViewStates.Visible;
                }
            } else {
                if (!string.IsNullOrEmpty (eventcard.eventinfo.seller_group_prize_image_id) && !eventcard.eventinfo.seller_group_prize_image_id.Equals ("0")) {
                    clicktoseeprizetextview.Visibility = ViewStates.Visible;
                    int defaultimageresourceid = TapUtil.getdefaultprizeresourceid (Int32.Parse (eventcard.eventinfo.seller_group_prize_image_id));
                    try {
                        Bitmap imageBitmap = BitmapFactory.DecodeResource (Resources, defaultimageresourceid);
                        Bitmap newbitmap = Bitmap.CreateScaledBitmap (imageBitmap, TapUtil.dptodx (200), TapUtil.dptodx (200), false);
                        if (newbitmap != null) {
                            prizebitmap = newbitmap;
                        }
                    } catch (Exception e2) {
                        Console.WriteLine (e2);
                    }

                    prizeimage.SetImageBitmap (prizebitmap);
                    prizeimage.SetScaleType (ImageView.ScaleType.CenterInside);

                    prizeinfocontainer.SetBackgroundColor (Color.White);
                    //prizeinfocontainer.LayoutParameters=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.MatchParent);
                    prizeinfocontainer.Visibility = ViewStates.Invisible;
                    circlecontainter.Click -= OnCircleContainerClick;
                    circlecontainter.Click += OnCircleContainerClick;
                    clicktoseeprizetextview.Visibility = ViewStates.Visible;
                }
            }
        }
Ejemplo n.º 3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            view = (RelativeLayout)inflater.Inflate (Resource.Layout.raffledetail, container, false);
            bodypanel=(RelativeLayout)view.FindViewById (Resource.Id.raffledetail_bodypanel_relativelayout);
            invitecard=(RelativeLayout)view.FindViewById (Resource.Id.raffledetail_invitationpanel_relativelayout);
            scrollcontainer=(ScrollView)view.FindViewById (Resource.Id.raffledetail_scrollcontainer_scrollview);

            LinearLayout sociallayout = (LinearLayout)invitecard.FindViewById (Resource.Id.raffledetail_socialbar_linearlayout);
            sociallayout.SetGravity (GravityFlags.Center);
            LinearLayout itemscontainer = new LinearLayout (nn_activity);
            LinearLayout.LayoutParams param = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent,LinearLayout.LayoutParams.WrapContent);
            param.Gravity = GravityFlags.CenterHorizontal;
            itemscontainer.LayoutParameters = param;
            itemscontainer.Orientation = Orientation.Horizontal;

            toobaritemfacebook = new ToolBarButton (nn_activity,itemscontainer,Resource.Drawable.ic_facebook_70X70);
            toobaritemfacebook.Click+= (object sender, EventArgs e) => {
                ShowPostToFacebook();
            };

            toobaritemtwitter = new ToolBarButton (nn_activity,itemscontainer,Resource.Drawable.ic_twitter_70X70);

            toobaritemtwitter.Click+= (object sender, EventArgs e) => {
                if(this.eventcard.eventinfo.representative_needed.Equals("N")){
                    socialshareandroid.Twitter (RaffleDetailDate.c_twitterAPIKey, RaffleDetailDate.c_twitterSecret, String.Format(RaffleDetailDate.c_twitterMessageTemplate_WithLink,eventcard.eventinfo.organization), eventcard.eventinfo.sell_ticket_url);
                }
                else{
                    socialshareandroid.Twitter (RaffleDetailDate.c_twitterAPIKey, RaffleDetailDate.c_twitterSecret,String.Format(RaffleDetailDate.c_twitterMessageTemplate_NoLink,eventcard.eventinfo.organization),RaffleDetailDate.Tap5050WebPageLink);
                }
            };

            toobaritemsms = new ToolBarButton (nn_activity,itemscontainer,Resource.Drawable.ic_sms_70X70);
            toobaritemsms.Click+= (object sender, EventArgs e) => {
                (nn_activity as HomeScreen).ShowContactListPicker(eventcard,eventcard.eventinfo.organization,eventcard.eventinfo.buy_ticket_url,eventcard.eventinfo.location_name);
            };

            toobaritememail = new ToolBarButton (nn_activity,itemscontainer,Resource.Drawable.ic_email_70X70);
            toobaritememail.Click+= (object sender, EventArgs e) => {
                (nn_activity as HomeScreen).ShowEmailListPicker(eventcard,eventcard.eventinfo.organization,eventcard.eventinfo.buy_ticket_url,eventcard.eventinfo.location_name);
            };

            itemscontainer.AddView (toobaritemfacebook);
            itemscontainer.AddView (toobaritemtwitter);
            itemscontainer.AddView (toobaritemsms);
            itemscontainer.AddView (toobaritememail);
            sociallayout.AddView (itemscontainer);

            TextView sendinvitationhint = (TextView)invitecard.FindViewById (Resource.Id.raffledetail_sendinvitationhint_textview);
            sendinvitationhint.Text = RaffleDetailDate.contactDescriptionText;

            invitationedittext = (EditText)invitecard.FindViewById (Resource.Id.raffledetail_sendinvitation_edittext);
            invitationedittext.Hint = RaffleDetailDate.ContactTextFieldPlaceholder;
            invitationedittext.SetSingleLine ();

            sendinvitationbutton=(Button)invitecard.FindViewById (Resource.Id.raffledetail_sendinvitation_button);
            sendinvitationbutton.Click+= (object sender, EventArgs e) =>{
                string destination=invitationedittext.Text;

                //check if it is a canada phone
                if(FormatManager.chechinput(destination,FormatManager.FormatOption.Phone)){
                    string contactsstring="To:\n"+"<"+destination+">";

                    List<string> destinationlist=new List<string>();
                    destinationlist.Add(destination);

                    string sendmessagestring="";
                    if (String.IsNullOrEmpty(eventcard.eventinfo.share_sms_body))
                    {
                        if (eventcard.eventinfo.representative_needed.Equals("N"))
                        {
                            sendmessagestring = String.Format(RaffleDetailDate.c_smsMessageTemplate_WithLink, eventcard.eventinfo.organization, eventcard.eventinfo.buy_ticket_url, eventcard.eventinfo.location_name);
                        }
                        else
                        {
                            sendmessagestring = String.Format(RaffleDetailDate.c_smsMessageTemplate_NoLink, eventcard.eventinfo.organization, RaffleDetailDate.Tap5050WebPageLink);
                        }
                    }
                    else {
                        sendmessagestring = SharingString.Format(eventcard.eventinfo.share_sms_body, eventcard.eventinfo);
                    }

                    //for API>4.4 call system default app to send message
                    if (global::Android.OS.Build.VERSION.SdkInt >= global::Android.OS.BuildVersionCodes.Kitkat)
                    {
                        SocialShareAndroid.Sms(sendmessagestring,destinationlist.ToArray());
                    }
                    else
                    {
                        (nn_activity as HomeScreen).ShowSMSFragment(eventcard,sendmessagestring, contactsstring,destinationlist);
                    }

                }
                else if(FormatManager.chechinput(destination,FormatManager.FormatOption.Email)){
                    List<string> destinationlist=new List<string>();
                    destinationlist.Add(destination);

                    if (String.IsNullOrEmpty(eventcard.eventinfo.share_email_body) && String.IsNullOrEmpty(eventcard.eventinfo.share_email_subject))
                    {
                        if (eventcard.eventinfo.representative_needed.Equals("N"))
                        {
                            SocialShareAndroid.Email(String.Format(RaffleDetailDate.c_emailMessageTemplate_WithLink, eventcard.eventinfo.organization, eventcard.eventinfo.buy_ticket_url, eventcard.eventinfo.location_name),
                                String.Format(RaffleDetailDate.c_emailSubjectTemplate_WithLink, eventcard.eventinfo.organization),
                                destinationlist.ToArray());
                        }
                        else
                        {
                            SocialShareAndroid.Email(String.Format(RaffleDetailDate.c_emailMessageTemplate_NoLink, eventcard.eventinfo.organization, eventcard.eventinfo.location_name, RaffleDetailDate.Tap5050WebPageLink), string.Format(RaffleDetailDate.c_emailSubjectTemplate_NoLink, eventcard.eventinfo.organization), destinationlist.ToArray());
                        }
                    }
                    else {
                        SocialShareAndroid.Email(SharingString.Format(eventcard.eventinfo.share_email_body, eventcard.eventinfo), SharingString.Format(eventcard.eventinfo.share_email_subject, eventcard.eventinfo), destinationlist.ToArray());
                    }
                }
                else{
                    nn_activity.ShowCustomAlterDialogFragment(RaffleDetailDate.AlertScreenFormatErrorTitle,RaffleDetailDate.AlertScreenFormatErrorMessage,GlobalScreenData.DefaultPositive,null,"exceptiondialog.raffledetail.invitationformat");
                }
            };

            leftindicator = (RelativeLayout)view.FindViewById (Resource.Id.raffledetail_toptableftindicator_relativelayout);
            middleindicator= (RelativeLayout)view.FindViewById (Resource.Id.raffledetail_toptabmiddleindicator_relativelayout);
            rightindicator= (RelativeLayout)view.FindViewById (Resource.Id.raffledetail_toptabrightindicator_relativelayout);

            leftbutton=(Button)view.FindViewById (Resource.Id.raffledetail_toptableft_button);
            leftbutton.Tag = 0;
            middlebutton=(Button)view.FindViewById (Resource.Id.raffledetail_toptabmiddle_button);
            middlebutton.Tag = 1;
            rightbutton=(Button)view.FindViewById (Resource.Id.raffledetail_toptabright_button);
            rightbutton.Tag = 2;

            leftbutton.Click-= onToptabClick;
            leftbutton.Click+= onToptabClick;
            middlebutton.Click-= onToptabClick;
            middlebutton.Click+= onToptabClick;
            rightbutton.Click-= onToptabClick;
            rightbutton.Click+= onToptabClick;

            //set indicator color of switches
            setIndicator(0);

            if (eventcard.eventinfo.has_jackpot.Equals ("Y") && eventcard.eventinfo.jackpot_description != null && eventcard.eventinfo.jackpot_total != null) {
                jackpotdescriptiontext = (TextView)view.FindViewById (Resource.Id.raffledetail_jackpotdescription_textview);
                jackpotdescriptiontext.Text = eventcard.eventinfo.jackpot_description;

                jackpottotaltext = (TextView)view.FindViewById (Resource.Id.raffledetail_jackpottotal_textview);
                jackpottotaltext.Text = "$"+eventcard.eventinfo.jackpot_total;

            }
            else {
                jackpotlinearlayout = (LinearLayout)view.FindViewById (Resource.Id.raffledetail_jackpot_linearlayout);
                jackpotlinearlayout.Visibility = ViewStates.Gone;
            }

            //set image

            if(eventcard.originalmap!=null){
                rafflelogoimagview=(ImageView)view.FindViewById (Resource.Id.raffledetail_pic_imgview);
                rafflelogoimagview.SetImageBitmap(eventcard.originalmap);
            }
            //set licence
            licencetext=(TextView)view.FindViewById(Resource.Id.raffledetail_licence_textview);
            licencetext.Text = RaffleDetailDate.LicenseNumberLabelText +"\n"+ eventcard.eventinfo.licence_number;

            //setname and org
            nametext = (TextView)view.FindViewById (Resource.Id.raffledetail_name_textview);
            nametext.Text=eventcard.eventinfo.event_name;

            organizationtext = (TextView)view.FindViewById (Resource.Id.raffledetail_organization_textview);
            organizationtext.Text=eventcard.eventinfo.organization;

            //set description
            descriptiontext=(TextView)view.FindViewById(Resource.Id.raffledetail_description_textview);
            descriptiontext.Text = eventcard.eventinfo.description;

            seeprizebutton = (Button)view.FindViewById (Resource.Id.raffledetail_seeprize_button);
            seeprizebutton.Click+= (object sender, EventArgs e) => {
                if(!String.IsNullOrEmpty(eventcard.eventinfo.prize_url)){
                    (nn_activity as HomeScreen).ShowSeePrize(eventcard.eventinfo.prize_url);
                }
            };
            seeprizebutton.Text = RaffleDetailDate.SeePrizeBtnTitle;

            if(string.IsNullOrEmpty(eventcard.eventinfo.prize_url)){
                seeprizebutton.Visibility = ViewStates.Invisible;
            }

            sellticketbutton = (Button)view.FindViewById (Resource.Id.raffledetail_buyticket_button);

            if(eventcard.eventinfo.have_contract.Equals("N")){
                sellticketbutton.Text=RaffleDetailDate.ApplyContractBtnTitle;
                sellticketbutton.Click += OnApplyContractButtonClick;
            }
            if (eventcard.eventinfo.have_contract.Equals ("Y")) {
                sellticketbutton.Text=RaffleDetailDate.SellTicketBtnTitle;
                sellticketbutton.Click += OnSellTicketButtonClick;
            }

            //			//create menu
            //			Tap5050MenuBuilder menubuilder=new Tap5050MenuBuilder(nn_activity,Resource.Drawable.bg_relativelayout_grayround);
            //			menubuilder.SetCell ();
            //			menubuilder.AddItem (Resource.Drawable.ic_invitation_75X75,"Quick Invitation",()=>{
            //				menucontainer.Visibility=ViewStates.Invisible;
            //				if(invitecard.Visibility==ViewStates.Gone){
            //					invitecard.Visibility=ViewStates.Visible;
            //				}
            //				if(showgoal==0){
            //					var headerLayoutParams = (global::Android.Views.ViewGroup.MarginLayoutParams) invitecard.LayoutParameters;
            //					headerLayoutParams.TopMargin = 0;
            //					invitecard.LayoutParameters = headerLayoutParams;
            //				}
            //			});
            //			menubuilder.AddItem (Resource.Drawable.ic_facebook_70X70,"FaceBook Share",()=>{
            //				menucontainer.Visibility=ViewStates.Invisible;
            //				ShowPostToFacebook();
            //			});
            //			menubuilder.AddItem (Resource.Drawable.ic_twitter_70X70,"Twiter Share",()=>{
            //				menucontainer.Visibility=ViewStates.Invisible;
            //				if(this.eventcard.eventinfo.representative_needed.Equals("N")){
            //					socialshareandroid.Twitter (RaffleDetailDate.c_twitterAPIKey, RaffleDetailDate.c_twitterSecret, String.Format(RaffleDetailDate.c_twitterMessageTemplate_WithLink,eventcard.eventinfo.organization), eventcard.eventinfo.sell_ticket_url);
            //				}
            //				else{
            //					socialshareandroid.Twitter (RaffleDetailDate.c_twitterAPIKey, RaffleDetailDate.c_twitterSecret,String.Format(RaffleDetailDate.c_twitterMessageTemplate_NoLink,eventcard.eventinfo.organization),RaffleDetailDate.Tap5050WebPageLink);
            //				}
            //
            //			});
            //			menubuilder.AddItem (Resource.Drawable.ic_sms_70X70,"SMS Share",()=>{
            //				menucontainer.Visibility=ViewStates.Invisible;
            //				(nn_activity as HomeScreen).ShowContactListPicker(eventcard,eventcard.eventinfo.organization,eventcard.eventinfo.buy_ticket_url,eventcard.eventinfo.location_name);
            //
            //			});
            //			menubuilder.AddItem (Resource.Drawable.ic_email_70X70,"Email Share",()=>{
            //				menucontainer.Visibility=ViewStates.Invisible;
            //				(nn_activity as HomeScreen).ShowEmailListPicker(eventcard,eventcard.eventinfo.organization,eventcard.eventinfo.buy_ticket_url,eventcard.eventinfo.location_name);
            //
            //			});
            //
            //			//get container add to view
            //			menucontainer=menubuilder.Build ();
            //			RelativeLayout.LayoutParams menucontainerparam = new RelativeLayout.LayoutParams (TapUtil.dptodx(menubuilder.totalwidth),TapUtil.dptodx(menubuilder.totalheight));
            //			menucontainerparam.RightMargin=TapUtil.dptodx (60+35);
            //			menucontainerparam.TopMargin=TapUtil.dptodx (5);
            //			menucontainerparam.AddRule (LayoutRules.AlignParentRight);
            //			menucontainer.LayoutParameters = menucontainerparam;
            //			view.AddView (menucontainer);
            //			menucontainer.Visibility = ViewStates.Invisible;

                //if have seller position
                if (!string.IsNullOrEmpty (eventcard.eventinfo.seller_position) && !string.IsNullOrEmpty (eventcard.eventinfo.seller_position)) {
                    //if show personal
                    LeaderBoardSelfCard selfcard = new LeaderBoardSelfCard (eventcard.eventinfo.seller_position, eventcard.eventinfo.gross_sales);
                    List<LeaderBoardCard> boardcardlist = new List<LeaderBoardCard> ();
                    bool havesetboardboardheader = false;
                    for (int i = 0; i < eventcard.eventinfo.LeaderBoardList.Count; i++) {
                        if (!havesetboardboardheader) {
                            havesetboardboardheader = true;
                            boardcardlist.Add (new LeaderBoardCard (eventcard.eventinfo.LeaderBoardList [i], 1));
                        } else {
                            boardcardlist.Add (new LeaderBoardCard (eventcard.eventinfo.LeaderBoardList [i], 2));
                        }
                    }
                    leaderboardadapter = new LeaderBoardAdapter (nn_activity, boardcardlist, selfcard);
                } else {
                    leaderboardadapter = new LeaderBoardAdapter (nn_activity, new List<LeaderBoardCard> (), new LeaderBoardSelfCard("0","0"));
                }

                if (!string.IsNullOrEmpty (eventcard.eventinfo.group_position) && !string.IsNullOrEmpty (eventcard.eventinfo.group_sales)) {
                    //if show team
                    LeaderBoardSelfCard selfcard = new LeaderBoardSelfCard (eventcard.eventinfo.group_position, eventcard.eventinfo.group_sales);
                    List<TeamLeaderBoardCard> boardcardlist = new List<TeamLeaderBoardCard> ();
                    bool havesetboardboardheader = false;
                for (int i = 0; i < eventcard.eventinfo.groupLeaderBoardList.Count; i++) {
                        if (!havesetboardboardheader) {
                            havesetboardboardheader = true;
                            boardcardlist.Add (new TeamLeaderBoardCard (eventcard.eventinfo.groupLeaderBoardList[i], 1));
                        } else {
                            boardcardlist.Add (new TeamLeaderBoardCard (eventcard.eventinfo.groupLeaderBoardList[i], 2));
                        }
                    }
                    leaderboardadapter = new LeaderBoardAdapter (nn_activity, boardcardlist, selfcard, true);
                }else {
                    leaderboardadapter = new LeaderBoardAdapter (nn_activity, new List<TeamLeaderBoardCard> (), new LeaderBoardSelfCard("0","0"),true);
                }

            //GET CONTAINER
            goalscontainer=(RelativeLayout)view.FindViewById (Resource.Id.raffledetail_goalsbodycontainer_relativelayout);
            goalscontainer.Visibility = ViewStates.Invisible;
            //goalscontainer.SetBackgroundResource(Resource.Drawable.bg_relativelayout_grayround);

            RelativeLayout slideritemcontainer = new RelativeLayout (nn_activity);
            slideritemcontainer.LayoutParameters=new RelativeLayout.LayoutParams ( RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            //slideritemcontainer.SetPadding (TapUtil.dptodx(30),TapUtil.dptodx(10),TapUtil.dptodx(30),TapUtil.dptodx(10));

            try{
                DateTime eventEndTime=DateTime.ParseExact (eventcard.eventinfo.event_end_time.Substring (0, 19),
                    "yyyy-MM-ddTHH:mm:ss", null);
                hours=(eventEndTime-DateTime.Now).TotalHours;
            }
            catch{
                hours = 0;
            }

            daybartextview = new TextView (nn_activity);
            int leftday = (int)hours / 24;
            int lefthours = (int)hours % 24;
            daybartextview.Text = string.Format (" "+leftday+" Days,"+" "+lefthours+" Hours");
            daybartextview.Gravity = GravityFlags.Center;
            daybartextview.Typeface = Typeface.DefaultBold;
            daybartextview.SetBackgroundResource(Resource.Color.iosblue);
            daybartextview.TextSize = TapUtil.dptodx (8);
            daybartextview.SetTextColor (Color.White);
            daybartextview.Id = TapUtil.generateViewId ();
            RelativeLayout.LayoutParams daybartextviewparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            daybartextviewparam.TopMargin=TapUtil.dptodx (10);
            daybartextviewparam.LeftMargin=TapUtil.dptodx (5);
            daybartextviewparam.RightMargin=TapUtil.dptodx (5);
            daybartextview.LayoutParameters = daybartextviewparam;
            slideritemcontainer.AddView (daybartextview);

            circlepanelrealtivelayout = new RelativeLayout (nn_activity);
            //circlepanelrealtivelayout.SetBackgroundResource (Resource.Drawable.bg_relativelayout_grayround);
            circlepanelrealtivelayout.Id = TapUtil.generateViewId ();
            RelativeLayout.LayoutParams circlepanelparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            //circlepanelparam.TopMargin=TapUtil.dptodx(20);
            circlepanelparam.AddRule (LayoutRules.Below, daybartextview.Id);
            circlepanelrealtivelayout.LayoutParameters= circlepanelparam;
            circlepanelrealtivelayout.SetPadding (TapUtil.dptodx (5), TapUtil.dptodx (5), TapUtil.dptodx (5), TapUtil.dptodx (5));

            personalprogresslabel = new TextView (nn_activity);
            personalprogresslabel.Text=GoalScreenData.personalProgressLabelText;

            RelativeLayout.LayoutParams personalprogresslabelparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            personalprogresslabel.LayoutParameters = personalprogresslabelparam;
            personalprogresslabel.Gravity = GravityFlags.Center;
            personalprogresslabel.Typeface = Typeface.DefaultBold;
            personalprogresslabel.Id = TapUtil.generateViewId ();

            goalslinearlayout = new LinearLayout (nn_activity);
            RelativeLayout.LayoutParams goalslayoutparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            goalslayoutparam.AddRule (LayoutRules.Below, personalprogresslabel.Id);
            goalslayoutparam.TopMargin = TapUtil.dptodx (10);
            goalslinearlayout.LayoutParameters = goalslayoutparam;
            goalslinearlayout.Orientation = Orientation.Horizontal;
            goalslinearlayout.Id = TapUtil.generateViewId ();

            int peronalrise = 0;
            int goalamount = 0;
                if (!string.IsNullOrEmpty(eventcard.eventinfo.gross_sales) ) {
                    peronalrise = Int32.Parse(eventcard.eventinfo.gross_sales);
                }
                if(!string.IsNullOrEmpty(eventcard.eventinfo.seller_goal)){
                    goalamount = Int32.Parse(eventcard.eventinfo.seller_goal);
                }

            LinearLayout raisedlinearlayout = new LinearLayout (nn_activity);
            raisedlinearlayout.Orientation = Orientation.Vertical;
            LinearLayout.LayoutParams raisedlayoutparam = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent,TapUtil.dptodx(40));
            raisedlayoutparam.Weight = 1;
            raisedlinearlayout.LayoutParameters = raisedlayoutparam;

            railedpricetextview = new TextView (nn_activity);
            railedpricetextview.Text = "$"+peronalrise;
            railedpricetextview.LayoutParameters =new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,TapUtil.dptodx(20));
            railedpricetextview.Gravity = GravityFlags.Center;

            TextView railedpricelabel = new TextView (nn_activity);
            railedpricelabel.Text = GoalScreenData.raiseToDateText;
            railedpricelabel.LayoutParameters=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,TapUtil.dptodx(20));
            railedpricelabel.Gravity = GravityFlags.Center;

            raisedlinearlayout.AddView (railedpricetextview);
            raisedlinearlayout.AddView (railedpricelabel);

            //goals text section
            LinearLayout goalslinearlayoutseprater = new LinearLayout (nn_activity);
            goalslinearlayoutseprater.LayoutParameters=new LinearLayout.LayoutParams (TapUtil.dptodx(1),TapUtil.dptodx(40));
            goalslinearlayoutseprater.SetBackgroundColor (Color.LightGray);

            LinearLayout goalamoutlinearlayout = new LinearLayout (nn_activity);
            goalamoutlinearlayout.Orientation = Orientation.Vertical;
            LinearLayout.LayoutParams goalnumlayoutparam = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent,TapUtil.dptodx(40));
            goalnumlayoutparam.Weight = 1;
            goalamoutlinearlayout.LayoutParameters = goalnumlayoutparam;

            goalsamounttextview = new TextView (nn_activity);
            goalsamounttextview.Text = "$"+goalamount;
            goalsamounttextview.LayoutParameters=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,TapUtil.dptodx(20));
            goalsamounttextview.Gravity = GravityFlags.Center;

            TextView  goalsamountlabel = new TextView (nn_activity);
            goalsamountlabel.Text = GoalScreenData.goalAmountText;
            goalsamountlabel.LayoutParameters=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,TapUtil.dptodx(20));
            goalsamountlabel.Gravity = GravityFlags.Center;

            goalamoutlinearlayout.AddView (goalsamounttextview);
            goalamoutlinearlayout.AddView (goalsamountlabel);

            goalslinearlayout.AddView (raisedlinearlayout);
            goalslinearlayout.AddView (goalslinearlayoutseprater);
            goalslinearlayout.AddView (goalamoutlinearlayout);

            //circle
            int circlewidthdp = 200;
            int progresswidthdp = 20;
            int stokewidth = 2;
            decimal percent=(decimal)0;

                if (!string.IsNullOrEmpty (eventcard.eventinfo.gross_sales) && !string.IsNullOrEmpty (eventcard.eventinfo.seller_goal)) {

                    if (peronalrise < 0 | goalamount < 0) {
                        percent = 0;
                    } else if (peronalrise >= goalamount) {
                        percent = 1;
                    } else if (peronalrise < goalamount) {
                        percent = (decimal)peronalrise / goalamount;
                    }
                }

            //rounded layout
            circlecontainter = new RelativeLayout (nn_activity);
            RelativeLayout.LayoutParams circlecontainterlayoutparam=new RelativeLayout.LayoutParams (TapUtil.dptodx(circlewidthdp),TapUtil.dptodx(circlewidthdp));
            circlecontainterlayoutparam.AddRule (LayoutRules.Below, goalslinearlayout.Id);
            circlecontainterlayoutparam.AddRule (LayoutRules.CenterHorizontal);
            circlecontainterlayoutparam.TopMargin = TapUtil.dptodx (20);
            circlecontainter.LayoutParameters = circlecontainterlayoutparam;

            stokerelativelayout = new AvatarProgressRelativeLayout (nn_activity,circlewidthdp,progresswidthdp,stokewidth,Convert.ToSingle(percent));
            stokerelativelayout.Invalidate ();

            //content inside innercircle
            RelativeLayout imgtextcontainter = new RelativeLayout (nn_activity);
            RelativeLayout.LayoutParams imgtextcontainterlayoutparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.MatchParent);
            imgtextcontainterlayoutparam.AddRule(LayoutRules.CenterHorizontal);
            imgtextcontainter.LayoutParameters = imgtextcontainterlayoutparam;
            imgtextcontainter.SetPadding (TapUtil.dptodx (stokerelativelayout.progresswidthdp*2), TapUtil.dptodx (stokerelativelayout.progresswidthdp*2), TapUtil.dptodx (stokerelativelayout.progresswidthdp*2), TapUtil.dptodx (stokerelativelayout.progresswidthdp*2));

            avatarimagview= new ImageView (nn_activity);
            avatarimagview.SetImageResource (Resource.Drawable.Goals_Avatar_Person);
            avatarimagview.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,TapUtil.dptodx(Convert.ToSingle(circlewidthdp*0.4)));
            avatarimagview.Id = TapUtil.generateViewId ();

            textview = new TextView (nn_activity);
            RelativeLayout.LayoutParams textlayoutparam = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, TapUtil.dptodx (Convert.ToSingle(circlewidthdp * 0.1)));
            textlayoutparam.AddRule (LayoutRules.Below, avatarimagview.Id);
            textview.Gravity = GravityFlags.Center;
            textview.LayoutParameters = textlayoutparam;
            textview.Id = TapUtil.generateViewId ();
            textview.Text=Math.Round(percent*100)+"%";
            textview.Typeface=Typeface.DefaultBold;

            clicktoseeprizetextview = new TextView (nn_activity);
            RelativeLayout.LayoutParams clicktoseeprizetextviewlayoutparam = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, TapUtil.dptodx (Convert.ToSingle(circlewidthdp * 0.1)));
            clicktoseeprizetextviewlayoutparam.AddRule (LayoutRules.Below, textview.Id);
            clicktoseeprizetextview.Gravity = GravityFlags.Center;
            clicktoseeprizetextview.LayoutParameters = clicktoseeprizetextviewlayoutparam;
            clicktoseeprizetextview.Id = TapUtil.generateViewId ();
            clicktoseeprizetextview.Text=GoalScreenData.clickToSeeGoalPrizeLabel;
            clicktoseeprizetextview.Typeface=Typeface.DefaultBold;
            clicktoseeprizetextview.TextSize = TapUtil.dptodx (3);
            clicktoseeprizetextview.SetTextColor (Resources.GetColor(Resource.Color.iosblue));
            clicktoseeprizetextview.Visibility = ViewStates.Gone;

            imgtextcontainter.AddView (avatarimagview);
            imgtextcontainter.AddView (textview);
            imgtextcontainter.AddView (clicktoseeprizetextview);

            circlecontainter.AddView (stokerelativelayout);
            circlecontainter.AddView (imgtextcontainter);

            circlepanelrealtivelayout.AddView (personalprogresslabel);
            circlepanelrealtivelayout.AddView (goalslinearlayout);
            circlepanelrealtivelayout.AddView (circlecontainter);

            prizeinfocontainer = new RelativeLayout (nn_activity);
            prizeinfocontainer.LayoutParameters=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.MatchParent);
            prizeinfocontainer.Visibility=ViewStates.Invisible;
            prizeinfocontainer.Tag=0;

            prizetextview = new TextView (nn_activity);
            RelativeLayout.LayoutParams prizelayoutparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            prizelayoutparam.AddRule (LayoutRules.CenterHorizontal);
            prizelayoutparam.TopMargin = TapUtil.dptodx (10);
            prizetextview.Gravity = GravityFlags.Center;
            prizetextview.LayoutParameters = prizelayoutparam;

             			prizetextview.Text = eventcard.eventinfo.seller_prize_description;

            prizetextview.Id = TapUtil.generateViewId ();

            prizeimage=new ImageView(nn_activity);
            RelativeLayout.LayoutParams prizeimageparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            prizeimageparam.AddRule (LayoutRules.Below, prizetextview.Id);
            prizeimageparam.TopMargin = TapUtil.dptodx (5);
            prizeimage.LayoutParameters = prizeimageparam;
            prizelayoutparam.AddRule (LayoutRules.CenterHorizontal);

            prizeinfocontainer.AddView (prizetextview);
            prizeinfocontainer.AddView (prizeimage);

            circlepanelrealtivelayout.AddView (prizeinfocontainer);

            slideritemcontainer.AddView (circlepanelrealtivelayout);

            ViewTreeObserver observer = circlepanelrealtivelayout.ViewTreeObserver;
            observer.AddOnGlobalLayoutListener (this);

            //add leaderboard
            RelativeLayout leaderboardrelativelayout = new RelativeLayout (nn_activity);
            leaderboardrelativelayout.SetBackgroundResource (Resource.Drawable.bg_relativelayout_grayround);
            leaderboardrelativelayout.Id = TapUtil.generateViewId ();
            RelativeLayout.LayoutParams leaderboardparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            leaderboardparam.TopMargin=TapUtil.dptodx(20);
            leaderboardparam.AddRule (LayoutRules.Below, circlepanelrealtivelayout.Id);
            leaderboardrelativelayout.LayoutParameters= leaderboardparam;
            leaderboardrelativelayout.SetPadding (TapUtil.dptodx (5), TapUtil.dptodx (5), TapUtil.dptodx (5), TapUtil.dptodx (5));

            leaderboardlistview = new ListView (nn_activity);
            leaderboardlistview.LayoutParameters=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,0);
            leaderboardlistview.Adapter = leaderboardadapter;
            leaderboardrelativelayout.AddView (leaderboardlistview);
            setListViewHeightBasedOnItems (leaderboardlistview);

            slideritemcontainer.AddView (leaderboardrelativelayout);
            goalscontainer.AddView (slideritemcontainer);

            // if have prize tos show
                if (!string.IsNullOrEmpty (eventcard.eventinfo.seller_prize_image_id) && !eventcard.eventinfo.seller_prize_image_id.Equals ("0")) {
                    clicktoseeprizetextview.Visibility = ViewStates.Visible;
                    int defaultimageresourceid = TapUtil.getdefaultprizeresourceid (Int32.Parse (eventcard.eventinfo.seller_prize_image_id));
                    try {
                        Bitmap imageBitmap = BitmapFactory.DecodeResource (Resources, defaultimageresourceid);
                        Bitmap newbitmap = Bitmap.CreateScaledBitmap (imageBitmap, TapUtil.dptodx (200), TapUtil.dptodx (200), false);
                        if (newbitmap != null) {
                            prizebitmap = newbitmap;
                        }
                    } catch (Exception e) {
                        Console.WriteLine (e);
                    }

                    prizeimage.SetImageBitmap (prizebitmap);
                    prizeimage.SetScaleType (ImageView.ScaleType.CenterInside);

                    prizeinfocontainer.SetBackgroundColor (Color.White);
                    //prizeinfocontainer.LayoutParameters=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.MatchParent);
                    prizeinfocontainer.Visibility = ViewStates.Invisible;
                    circlecontainter.Click -= OnCircleContainerClick;
                    circlecontainter.Click += OnCircleContainerClick;
                }

            return view;
        }