Ejemplo n.º 1
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			SetContentView (Resource.Layout.Category);

			var toolbar = FindViewById<Toolbar> (Resource.Id.toolbar_cat);

			SetSupportActionBar (toolbar);
			SupportActionBar.SetDisplayHomeAsUpEnabled (true);
			SupportActionBar.SetHomeButtonEnabled (true);
			var CatName = Intent.GetStringExtra ("CatName");

			App.Instance.tracker.SetScreenName ("Category Drilldown Screen - Category: " + CatName);
			App.Instance.tracker.Send (new HitBuilders.ScreenViewBuilder().Build());

			var dashboardInfo = App.Instance.GetCacheItem<DashboardInfo> (DataCacheEnum.DASHBOARD);

			SupportActionBar.Title = CatName;


			chartView = FindViewById<ChartView> (Resource.Id.cat_chart);
			chartTable = FindViewById<ListView> (Resource.Id.lst_chart_table);
			totalText = FindViewById<TextView> (Resource.Id.txt_cat_balance_amount);
			changeViewBtn = FindViewById<Button> (Resource.Id.switch_chart);
			chartTableView = FindViewById<View> (Resource.Id.cat_list_layout);

			changeViewBtn.Click += (object sender, EventArgs e) => {
				if (!isListDisplay) {
					chartView.Visibility = ViewStates.Gone;
					chartTableView.Visibility = ViewStates.Visible;
					changeViewBtn.Text = "View Chart";
				} else {
					chartTableView.Visibility = ViewStates.Gone;
					chartView.Visibility = ViewStates.Visible;
					changeViewBtn.Text = "View List";
				}

				isListDisplay = !isListDisplay;
			};


			//adjust the size of changeViewButton here according to the screen width
			changeViewBtn.LayoutParameters.Width = Resources.DisplayMetrics.WidthPixels * 2 / 7;

			var CatTotal = dashboardInfo.fundsInfo.funds.Where (x => x.assetCategoryDescripton == CatName).Sum (x =>x.fundBalance);

			totalText.Text = String.Format ("{0:C}", CatTotal);

			var result = dashboardInfo.fundsInfo.funds.Where (x => x.assetCategoryDescripton == CatName).Select (fc => new GenericChartInput () {
				Name = fc.fundName,
				Amount = fc.fundBalance
			}).ToList();

			var catChartData = new List<IChartInput> ();

			foreach (var gi in result.OrderByDescending(x => x.Amount).ToList()) {
				catChartData.Add (gi);
			}

			chartData = ChartBuilder.ChartSourceBuilder (catChartData, RSColors.chartColorArray, false);

			chartView.updateData (chartData);
			chartView.NavType = ChartView.ChartNavType.Fund;

			adapter = new ChartListAdapter (this, chartData);

			chartTable.Adapter = adapter;
			chartTable.ItemClick += OnListItemClick;
		}
Ejemplo n.º 2
0
		private void loadLayout (View view)
		{
			try
			{
				loading = view.FindViewById<ProgressBar> (Resource.Id.progress_loading_dash);
				loading.Visibility = ViewStates.Visible;


				totalHeaderText = view.FindViewById<TextView> (Resource.Id.txt_total_balance_hdr);

				var totalBalanceTxt = view.FindViewById<TextView> (Resource.Id.txt_total_balance_amount);
				totalBalanceTxt.TextSize = Math.Min(Resources.DisplayMetrics.HeightPixels / 20, 48);


				chartView = view.FindViewById<ChartView> (Resource.Id.pie_chart);
				table = view.FindViewById<ListView> (Resource.Id.list);
				totalText = view.FindViewById<TextView> (Resource.Id.txt_total_balance_amount);
				changeViewBtn = view.FindViewById<Button> (Resource.Id.switch_chart);
				list_data = view.FindViewById<View> (Resource.Id.list_view);
				lastContribution = view.FindViewById<TextView> (Resource.Id.last_contribution);
				lastContributionAmount = view.FindViewById<TextView> (Resource.Id.txt_last_contrib_amt);
				lastContributionAmountMore = view.FindViewById<TextView> (Resource.Id.txt_last_contrib_amt_more);

				rateOfReturnPeriod = view.FindViewById<TextView> (Resource.Id.txt_ror_lbl);
				rateOfReturnAmount = view.FindViewById<TextView> (Resource.Id.txt_ror_amt);
				rateOfReturnAmountMore = view.FindViewById<TextView> (Resource.Id.txt_ror_amt_more);

				rateOfReturnAmount.Click += ShowDisclaimer; 
				rateOfReturnAmountMore.Click += ShowDisclaimer;
				rateOfReturnAmountMore.SetTextColor(Color.ParseColor(RSColors.MM_BLUE));
				lastContributionAmountMore.SetTextColor(Color.ParseColor(RSColors.MM_BLUE));

				changeViewBtn.Enabled = true;
				//adjust the size of changeViewButton here according to the screen width
				changeViewBtn.LayoutParameters.Width = Resources.DisplayMetrics.WidthPixels * 2 / 7;

				changeViewBtn.Click += (object sender, EventArgs e) => {
					if (!isListDisplay) {
						chartView.Visibility = ViewStates.Gone;
						list_data.Visibility = ViewStates.Visible;
						changeViewBtn.Text = "View Chart";
					} else {
						list_data.Visibility = ViewStates.Gone;
						chartView.Visibility = ViewStates.Visible;
						changeViewBtn.Text = "View List";
					}

					isListDisplay = !isListDisplay;
				};

				table.ItemClick += OnListItemClick;
			}
			catch(Exception e) {
				Insights.Report (e, new Dictionary <string, string> { 
					{"Source", "Dashboard Load Layout"}
				}, ReportSeverity.Error);
			}

		}