public TableSource(List <JobCMS> jobList1, List <RecentSearch> aRecentSearchList, Boolean latestJobSelected, IntroController aIntroVC) { //TableItems = items; jobList = jobList1; _recentSearchs = aRecentSearchList; isRecentSearch = latestJobSelected; _introViewCtrl = aIntroVC; }
void FavoriteButtonWithCount(UINavigationItem navItem) { List <JobCMS> favJobList = DbHelper.GetFavoriteJobs(); int favCount = 0; if (favJobList != null) { favCount = favJobList.Count; } UIButton btn = new UIButton(UIButtonType.Custom); btn.Frame = new RectangleF(0, 0, 40, 40); btn.TouchUpInside += FavoriteButtonPressed; UILabel lbl = new UILabel(); lbl.Frame = new RectangleF(19, 0, 20, 20); lbl.Text = favCount.ToString(); lbl.TextAlignment = UITextAlignment.Center; lbl.TextColor = UIColor.Red; //lbl.Font = UIFont.SystemFontOfSize(14); if (favCount < 10) { lbl.Font = UIFont.BoldSystemFontOfSize(14); } else { lbl.Font = UIFont.BoldSystemFontOfSize(12); } if (favCount == 0) { btn.SetImage(UIImage.FromBundle("favicon-unselected"), UIControlState.Normal); } else { btn.SetImage(UIImage.FromBundle("Badge"), UIControlState.Normal); btn.AddSubview(lbl); } btn.ShowsTouchWhenHighlighted = true; UIBarButtonItem barButton2 = new UIBarButtonItem(btn); navItem.RightBarButtonItem = barButton2; IntroController.favAnimation(this, lbl, true, 0.3f, null); }
static void favAnimation(IntroController instance, UIView view, bool isIn, double duration = 0.3, Action onFinished = null) { var minAlpha = (nfloat)0.0f; var maxAlpha = (nfloat)1.0f; var minTransform = CGAffineTransform.MakeScale((nfloat)0.1, (nfloat)0.1); var maxTransform = CGAffineTransform.MakeScale((nfloat)1, (nfloat)1); view.Alpha = isIn ? minAlpha : maxAlpha; view.Transform = isIn ? minTransform : maxTransform; UIView.Animate(duration, 0, UIViewAnimationOptions.CurveEaseInOut, () => { view.Alpha = isIn ? maxAlpha : minAlpha; view.Transform = isIn ? maxTransform : minTransform; }, onFinished ); }