public static void GetDiary() { var resDiary = DiaryDao.GetDiary(Singleton.Instance.IDMonth, Singleton.Instance.IDDay); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); TextView tvMonthDayTitle = new TextView(Singleton.Instance.DiaryActivity); tvMonthDayTitle.LayoutParameters = lp; var resMonth = MonthDao.GetMonth(Singleton.Instance.IDMonth); if (resMonth != null) { tvMonthDayTitle.Text = "Month: " + resMonth.Name + " Day: " + Singleton.Instance.IDDay; } tvMonthDayTitle.TextSize = 20; tvMonthDayTitle.SetTypeface(Android.Graphics.Typeface.Default, Android.Graphics.TypefaceStyle.Bold); Singleton.Instance.DLinearLayout.AddView(tvMonthDayTitle); TextView tvDiary = new TextView(Singleton.Instance.DiaryActivity); tvDiary.LayoutParameters = lp; if (resDiary != null) { tvDiary.Text = resDiary.Content; } tvMonthDayTitle.TextSize = 17; tvMonthDayTitle.SetTypeface(Android.Graphics.Typeface.Default, Android.Graphics.TypefaceStyle.Normal); Singleton.Instance.DLinearLayout.AddView(tvDiary); }
public static void GetEmotion() { var resEmotions = EmotionDao.GetEmotions(Singleton.Instance.IDMonth); LinearLayout linearLayout = null; LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); int idMonth = -1; StringBuilder sb = new StringBuilder(); for (int i = 0; i < resEmotions.Count; i++) { if (idMonth != resEmotions[i].IDMonth) { if (idMonth != -1) { TextView tvDayExpenditure = new TextView(Singleton.Instance.EmotionActivity); tvDayExpenditure.LayoutParameters = lp; tvDayExpenditure.Text = sb.ToString(); tvDayExpenditure.TextSize = 17; tvDayExpenditure.SetTypeface(Android.Graphics.Typeface.Default, Android.Graphics.TypefaceStyle.Bold); linearLayout.AddView(tvDayExpenditure); sb = new StringBuilder(); } idMonth = resEmotions[i].IDMonth; linearLayout = new LinearLayout(Singleton.Instance.EmotionActivity); linearLayout.LayoutParameters = lp; linearLayout.Orientation = Orientation.Vertical; Singleton.Instance.EmLinearLayout.AddView(linearLayout); TextView tvMonthTitle = new TextView(Singleton.Instance.EmotionActivity); tvMonthTitle.LayoutParameters = lp; var resMonth = MonthDao.GetMonth(idMonth); if (resMonth != null) { tvMonthTitle.Text = "Month: " + resMonth.Name; } tvMonthTitle.TextSize = 20; tvMonthTitle.SetTypeface(Android.Graphics.Typeface.Default, Android.Graphics.TypefaceStyle.Bold); linearLayout.AddView(tvMonthTitle); } sb.Append(resEmotions[i].Ranking + " "); if (i == resEmotions.Count - 1) { TextView tvDayExpenditure = new TextView(Singleton.Instance.EmotionActivity); tvDayExpenditure.LayoutParameters = lp; tvDayExpenditure.Text = sb.ToString(); tvDayExpenditure.TextSize = 17; tvDayExpenditure.SetTypeface(Android.Graphics.Typeface.Default, Android.Graphics.TypefaceStyle.Bold); linearLayout.AddView(tvDayExpenditure); } } }
public void OnPageSelected(int position) { switch (GoalTimeDao.GetGoalTime().Name) { case "Year": Singleton.Instance.tvGoalTitle.Text = "2018"; break; case "Month": Singleton.Instance.tvGoalTitle.Text = MonthDao.GetMonth(position + 1).Title; break; case "Day": Singleton.Instance.tvGoalTitle.Text = (position + 1).ToString(); break; } }
public static void GetHabbit() { var resHabbits = HabbitDao.GetHabbits(Singleton.Instance.IDMonth); var resHabbitTypes = SelfJournalDbContext.Instance.HabbitTypes; LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); TextView tvMonthTitle = new TextView(Singleton.Instance.HabbitActivity); tvMonthTitle.LayoutParameters = lp; var resMonth = MonthDao.GetMonth(Singleton.Instance.IDMonth); if (resMonth != null) { tvMonthTitle.Text = "Month: " + resMonth.Name; } tvMonthTitle.TextSize = 20; tvMonthTitle.SetTypeface(Android.Graphics.Typeface.Default, Android.Graphics.TypefaceStyle.Bold); Singleton.Instance.HLinearLayout.AddView(tvMonthTitle); TextView tvHabbit = new TextView(Singleton.Instance.HabbitActivity); tvHabbit.LayoutParameters = lp; tvHabbit.TextSize = 17; tvHabbit.SetTypeface(Android.Graphics.Typeface.Default, Android.Graphics.TypefaceStyle.Bold); for (int j = 0; j < resHabbitTypes.Count; j++) { if (j != 0) { tvHabbit.Text += "\n"; } StringBuilder sb = new StringBuilder(resHabbitTypes[j].Name + ": "); for (int i = 0; i < resHabbits.Count; i++) { if (resHabbits[i].IDHabbitType == resHabbitTypes[j].ID) { sb.Append(resHabbits[i].IDDay + " "); } } tvHabbit.Text += sb.ToString(); } Singleton.Instance.HLinearLayout.AddView(tvHabbit); }
public static void GetExpenditure() { var resExpenditures = ExpenditureDao.GetExpenditures(Singleton.Instance.IDMonth); LinearLayout linearLayout = null; LinearLayout bLinearLayout = null; LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); int idMonth = -1, idDay = -1; StringBuilder sbThu = new StringBuilder("Thu: "); StringBuilder sbChi = new StringBuilder("Chi: "); StringBuilder sbSum = new StringBuilder("Sum: "); double sum = 0; bool isChangedMonth = false; for (int i = 0; i < resExpenditures.Count; i++) { if (idMonth != resExpenditures[i].IDMonth) { isChangedMonth = true; idMonth = resExpenditures[i].IDMonth; bLinearLayout = linearLayout; linearLayout = new LinearLayout(Singleton.Instance.ExpenditureActivity); linearLayout.LayoutParameters = lp; linearLayout.Orientation = Orientation.Vertical; if (i == 0) { bLinearLayout = linearLayout; } Singleton.Instance.ELinearLayout.AddView(linearLayout); TextView tvMonthTitle = new TextView(Singleton.Instance.ExpenditureActivity); tvMonthTitle.LayoutParameters = lp; var resMonth = MonthDao.GetMonth(idMonth); if (resMonth != null) { tvMonthTitle.Text = "Month: " + resMonth.Name; } tvMonthTitle.TextSize = 20; tvMonthTitle.SetTypeface(Android.Graphics.Typeface.Default, Android.Graphics.TypefaceStyle.Bold); linearLayout.AddView(tvMonthTitle); } if (idDay != resExpenditures[i].IDDay) { if (idDay != -1) { TextView tvDayExpenditure = new TextView(Singleton.Instance.ExpenditureActivity); tvDayExpenditure.LayoutParameters = lp; tvDayExpenditure.Text = sbThu + "\n" + sbChi + "\n" + sbSum.Append(sum); tvDayExpenditure.TextSize = 15; tvDayExpenditure.SetTypeface(Android.Graphics.Typeface.Default, Android.Graphics.TypefaceStyle.Normal); if (isChangedMonth) { bLinearLayout.AddView(tvDayExpenditure); isChangedMonth = false; } else { linearLayout.AddView(tvDayExpenditure); } sbThu = new StringBuilder("Thu: "); sbChi = new StringBuilder("Chi: "); sbSum = new StringBuilder("Sum: "); sum = 0; } idDay = resExpenditures[i].IDDay; TextView tvDayTitle = new TextView(Singleton.Instance.ExpenditureActivity); tvDayTitle.LayoutParameters = lp; tvDayTitle.Text = "Day: " + idDay; tvDayTitle.TextSize = 17; tvDayTitle.SetTypeface(Android.Graphics.Typeface.Default, Android.Graphics.TypefaceStyle.Bold); linearLayout.AddView(tvDayTitle); } var resExpenditureType = ExpenditureTypeDao.GetExpenditureType(resExpenditures[i].IDExpenditure); if (resExpenditureType != null) { switch (resExpenditureType.Positive) { case true: sbThu.Append(" +" + resExpenditures[i].Amount); sum += resExpenditures[i].Amount; break; case false: sbChi.Append(" -" + resExpenditures[i].Amount); sum += -resExpenditures[i].Amount; break; } } if (i == resExpenditures.Count - 1) { TextView tvDayExpenditure = new TextView(Singleton.Instance.ExpenditureActivity); tvDayExpenditure.LayoutParameters = lp; tvDayExpenditure.Text = sbThu + "\n" + sbChi + "\n" + sbSum.Append(sum); tvDayExpenditure.TextSize = 15; tvDayExpenditure.SetTypeface(Android.Graphics.Typeface.Default, Android.Graphics.TypefaceStyle.Normal); linearLayout.AddView(tvDayExpenditure); } } }