protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); _persoon = Gegevens.GetPerson(); _groep = Gegevens.CurrentGroup(); SetContentView(Resource.Layout.Betaalscherm); _toolbar = FindViewById<Toolbar>(Resource.Id.toolbar); ImageView Avatar = _toolbar.FindViewById<ImageView>(Resource.Id.Avatar); TextView Title = _toolbar.FindViewById<TextView>(Resource.Id.Title); Title.Text = _groep.groepsnaam; foreach (var lid in _persoon.KrijgSchuldGroep(_groep)) { deelnemers.Add(new ListItem(lid.Key, Resource.Drawable.iconn, lid.Value, _groep)); } _adapter = new ListItemAdapter(ListItem.Session, deelnemers); _adapter.ItemClick += OnItemClick; _adapter.ItemLongClick += (sender, e) => {}; _recyclerView = FindViewById<RecyclerView>(Resource.Id.recyclerview); _recyclerView.SetMinimumHeight(ConvertDptoPx(listItemHeight*deelnemers.Count)); _recyclerView.SetLayoutManager(new LinearLayoutManager(this)); _recyclerView.SetScrollContainer(true); _recyclerView.NestedScrollingEnabled = false; _recyclerView.SetAdapter(_adapter); SetSupportActionBar(_toolbar); SupportActionBar.Title = ""; SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Login); EditText password = FindViewById<EditText>(Resource.Id.editPassword); EditText username = FindViewById<EditText>(Resource.Id.editUsername); Button login = FindViewById<Button>(Resource.Id.buttonLogin); login.Click += delegate { if (DatabaseInterface.Validate(username.Text, password.Text)) { try { p = Gegevens.GetServerData(username.Text, password.Text); var activity1 = new Intent(this, typeof(Hoofdscherm)); StartActivity(activity1); Finish(); } //Voor als er iets mis gaat bij het ophalen van de serverdata (connectie proplemen) catch (Exception e) { if (e.Source != null) { Alert("Exception source: " + e.Message); } } } else { Alert("Wrong password/username"); } }; Button create = FindViewById<Button>(Resource.Id.buttonCreate); create.Click += delegate { //Haalt Dialogvenster op Dialog_Create createdialog = new Dialog_Create(); createdialog.Show(FragmentManager.BeginTransaction(), "dialog fragment"); }; Button forgot = FindViewById<Button>(Resource.Id.buttonForgot); forgot.Click += delegate { //Haalt Dialogvenster op Dialog_Forgot forgotdialog = new Dialog_Forgot(); forgotdialog.Show(FragmentManager.BeginTransaction(), "dialog fragment"); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); _persoon = Gegevens.GetPerson(); _groep = Gegevens.CurrentGroup(); SetContentView(Resource.Layout.Historyscherm); Toolbar toolbar = FindViewById<Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); SupportActionBar.Title = "Debt History"; _recyclerView = FindViewById<RecyclerView>(Resource.Id.recyclerview); _recyclerView.SetLayoutManager(new LinearLayoutManager(this)); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView (inflater, container, savedInstanceState); var view = inflater.Inflate (Resource.Layout.dialog_create, container, false); Button button = view.FindViewById<Button>(Resource.Id.btnCreate); button.Click += delegate { EditText username = view.FindViewById<EditText>(Resource.Id.txtUsername); EditText password1 = view.FindViewById<EditText>(Resource.Id.txtPassword); EditText password2 = view.FindViewById<EditText>(Resource.Id.txtCPassword); if(password1.Text == password2.Text) { //account creëren bool isCreated = DatabaseInterface.AddUser(username.Text, password1.Text); if (isCreated) { Toast.MakeText(this.Activity, "Account had been created!", ToastLength.Short).Show(); //inloggen _persoon = Gegevens.GetServerData(username.Text, password1.Text); Intent myIntent = new Intent(this.Activity, typeof(Hoofdscherm)); StartActivity(myIntent); this.Activity.Finish(); } else { Toast.MakeText(this.Activity, "Username or password already exist(s)!", ToastLength.Long).Show(); } } else { Toast.MakeText(this.Activity, "Your passwords don't match!", ToastLength.Long).Show(); } }; return view; }
public static Persoon GetServerData(string persoonid, string password) { Dictionary<string, int> Groups = DatabaseInterface.GetGroupsByUsername (persoonid, password); List<Debt> RequestFrom = DatabaseInterface.GetRequestedDebtFromUsername (persoonid, password); List<Debt> RequestTo = DatabaseInterface.GetRequestedDebtToUsername (persoonid, password); List<Debt> From = DatabaseInterface.GetDebtFromUsername (persoonid, password); List<Debt> To = DatabaseInterface.GetDebtToUsername (persoonid, password); List<Payment> PayFrom = DatabaseInterface.GetPaymentFromUsername (persoonid, password); List<Payment> PayTo = DatabaseInterface.GetPaymentToUsername (persoonid, password); List<Groep> Groepen = new List<Groep> (); List<PaidDebt> HistoryTo = DatabaseInterface.GetHistoryToUsername (persoonid, password); List<PaidDebt> HistoryFrom = DatabaseInterface.GetHistoryFromUsername (persoonid, password); List<string> Contacts = DatabaseInterface.GetContacts(persoonid, password); foreach (var groep in Groups) { Groep groepje = new Groep (DatabaseInterface.GetMembersByGroup (groep.Key, persoonid, password), groep.Value , groep.Key); Groepen.Add (groepje); } Persoon pers = new Persoon (persoonid, password, To, From, Groepen, RequestTo, RequestFrom, HistoryTo, HistoryFrom, PayFrom, PayTo, Contacts); p = pers; return pers; }
public virtual void Refresh() { p = Gegevens.GetServerData(p.Id, p.Password); CreateEnvironment(); ((Hoofdscherm) this.Activity).TotalDebt = p.TotaalSchuld(); RefreshHandler.PostDelayed(CancelAnimation, 700); }
public void Refresh() { _persoon = Gegevens.GetServerData(_persoon.Id, _persoon.Password); _groep = Gegevens.CurrentGroup(); CreateParticipantsEnvironment(); RefreshHandler.PostDelayed(CancelAnimation, 700); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Groepscherm); _persoon = Gegevens.GetPerson(); _groep = Gegevens.CurrentGroup(); _toolbar = FindViewById<Toolbar>(Resource.Id.toolbar); TextView title = _toolbar.FindViewById<TextView>(Resource.Id.Title); title.Text = _groep.groepsnaam; SetSupportActionBar(_toolbar); SupportActionBar.Title = ""; SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); _participantsRecyclerView = FindViewById<RecyclerView>(Resource.Id.participantsrecyclerview); _participantsRecyclerView.SetLayoutManager(new LinearLayoutManager(this)); _participantsRecyclerView.SetScrollContainer(false); _participantsRecyclerView.NestedScrollingEnabled = false; _swipeRefreshLayout = FindViewById<SwipeRefreshLayout>(Resource.Id.swipe_refresh); _swipeRefreshLayout.SetColorSchemeResources(Resource.Color.mainColor); _swipeRefreshLayout.SetOnRefreshListener(this); CardView historyCardView = FindViewById<CardView>(Resource.Id.history_card_view); Button cameraButton = FindViewById<Button>(Resource.Id.buttonCamera); Button textButton = FindViewById<Button>(Resource.Id.buttonText); Button leaveButton = FindViewById<Button>(Resource.Id.buttonLeave); leaveButton.Click += (sender, e) => { DatabaseInterface.RemoveFromGroup(_persoon.Id, _groep.groepsnaam, _persoon.Id, _persoon.Password); Finish(); }; historyCardView.Click += (sender, e) => { var activity = new Intent(this, typeof(Historyscherm)); StartActivity(activity); }; cameraButton.Click += (sender, e) => { var activity = new Intent(this, typeof(CameraActivity)); StartActivityForResult(activity, 1); }; textButton.Click += (sender, e) => { var activity = new Intent(this, typeof(Nieuwschuld)); StartActivity(activity); }; CreateParticipantsEnvironment(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.AddGroupScherm); _persoon = Gegevens.GetPerson(); _groep = Gegevens.CurrentGroup (); Toolbar toolbar = FindViewById<Toolbar>(Resource.Id.toolbar); EditText titleEditText = FindViewById<EditText>(Resource.Id.grouptitle_edit_text); titleEditText.Hint = "Group title"; _scrollView = FindViewById<ScrollView> (Resource.Id.scrollview); _imageView = FindViewById<ImageView> (Resource.Id.groupavatar_image_view); _imageView.Click += (sender, e) => { var myIntent = new Intent(); myIntent.SetType("image/*"); myIntent.SetAction(Intent.ActionGetContent); StartActivityForResult(Intent.CreateChooser(myIntent, "Select Picture"), PickImageId); }; CardView addCardView = FindViewById<CardView>(Resource.Id.add_card_view); addCardView.Click += (sender, e) => { List<string> pStringList = new List<string>(); foreach(var item in _participantsAdapter.Items) { pStringList.Add(string.Join(",", item.Name, item.ImageId.ToString())); } var myIntent = new Intent(this, typeof(AddParticipantscherm)); string intentString = "New Group|" + string.Join("|", pStringList); myIntent.PutExtra("Current participants", intentString); StartActivityForResult(myIntent, PickContactsId); }; Button confimButton = FindViewById<Button> (Resource.Id.buttonConfirm); confimButton.Click += (sender, e) => { if (titleEditText.Text.Length != 0) { string groupName = titleEditText.Text.Replace(" ", "%20"); bool isCreated = DatabaseInterface.CreateGroup(_persoon.Id, groupName, _persoon.Id, _persoon.Password); foreach (var item in _participantsAdapter.Items) { bool isAdded = DatabaseInterface.AddToGroup(item.Name, groupName, _persoon.Id, _persoon.Password); } Finish(); } else { Toast.MakeText(this, "Make sure you give the group a title/name!", ToastLength.Short).Show(); } }; SetSupportActionBar(toolbar); SupportActionBar.Title = "Add Group"; SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); CreateParticipantsEnvironment(); }
public virtual void Refresh() { _persoon = Gegevens.GetServerData(_persoon.Id, _persoon.Password); _groep = Gegevens.CurrentGroup(); CreateEnvironments(); ((Payscherm) this.Activity).TotalDebt = _persoon.TotaalSchuldGroep(_groep); RefreshHandler.PostDelayed(CancelAnimation, 700); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); _persoon = Gegevens.GetPerson(); _groep = Gegevens.CurrentGroup(); SetContentView(Resource.Layout.Nieuwschuldscherm); _toolbar = FindViewById<Toolbar>(Resource.Id.toolbar); ImageView Avatar = _toolbar.FindViewById<ImageView>(Resource.Id.Avatar); TextView Title = _toolbar.FindViewById<TextView>(Resource.Id.Title); TextView item = FindViewById<TextView>(Resource.Id.pending_text); CardView Boodschap = FindViewById<CardView>(Resource.Id.pending_card_view); CardView Schuld = FindViewById<CardView>(Resource.Id.participants_card_view); LinearLayout layout = FindViewById<LinearLayout>(Resource.Id.layout1); ScrollView Scroll = FindViewById<ScrollView>(Resource.Id.scrollSchuld); layout.RemoveView (Boodschap); Title.Text = _groep.groepsnaam; MakeRecycleViewList (); Button confirm = FindViewById<Button>(Resource.Id.buttonConfirm); Button add = FindViewById<Button>(Resource.Id.buttonAdd); bool keer = false; confirm.Click += (sender, e) => { // check eerst of alle productprijzen ingevuld zijn foreach (var product in deelnemers) { if (product.Name == "" || product.StringValue == "") { Toast.MakeText(this, "Please fill in all fields", ToastLength.Long).Show(); return; } //sommige toestellen kunnen geen komma's invoeren product.StringValue = product.StringValue.Replace('.', ','); } //sluit als het nodig is het keyboard af InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService); imm.HideSoftInputFromWindow(add.WindowToken, 0); layout.RemoveViewsInLayout(0, layout.ChildCount); if(!keer) { //invullen van de reden van de debt ReasonAlert(); } for(int t = 0; t < deelnemers.Count; t++) //verwijder producten die uitgevinkt zijn if(!deelnemers[t].State || !IsNumber(deelnemers[t].StringValue)) {deelnemers.Remove(deelnemers[t]); t--;} else if (!keer) { lijst += deelnemers[t].Name + "-" + (Math.Round(System.Convert.ToDouble(deelnemers[t].StringValue)*100)).ToString() + "-"; } layout.AddView(Boodschap); layout.AddView(Schuld); //als alle boodschappen zijn langs gekomen if (deelnemers.Count == 1 && keer) { MaakNieuwSchuld(); confirm.Text = "Send"; deelnemers.Remove(deelnemers.First()); } //versuren v/d schuld else if (deelnemers.Count == 0) { VerstuurSchuld(); Finish();} else{ _adapter.NotifyDataSetChanged(); MaakNieuwSchuld(); groep.Clear(); if(keer) deelnemers.Remove(deelnemers.First()); item.Text = deelnemers.First().Name + " " + deelnemers.First().StringValue; confirm.Text = "Next"; keer = true; MakeRecycleViewPayers(); } }; add.Click += (sender, e) => { //haalt het toetsenbord weg InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService); imm.HideSoftInputFromWindow(add.WindowToken, 0); _adapter.NotifyDataSetChanged(); Scroll.PageScroll(FocusSearchDirection.Down); MakeRecycleViewList(); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.AddParticipantsScherm); _persoon = Gegevens.GetPerson(); List<string> tempList = DatabaseInterface.GetAllUsers(); List<ListItem> dataBaseList = tempList.Select (contactname => new ListItem (contactname, Resource.Drawable.iconn)).ToList(); CreateContactList(dataBaseList); Toolbar toolbar = FindViewById<Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = "Add contacts"; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.AddParticipantsScherm); _persoon = Gegevens.GetPerson(); _groep = Gegevens.CurrentGroup(); // haal contectenlijst uit database en stop ze in ListItem lijst List<ListItem> contactList = DatabaseInterface.GetContacts(_persoon.Id, _persoon.Password).Select(contact => new ListItem(contact, Resource.Drawable.iconn)).ToList(); contactList = contactList.OrderBy(x => x.Name).ToList(); _adapter = new ListItemAdapter(ListItem.CheckBoxContact, contactList); _adapter.ItemClick += (sender, args) => { Toast.MakeText(this, _adapter.Items[args.Position].Name, ToastLength.Short).Show(); }; _recyclerView = FindViewById<RecyclerView>(Resource.Id.recyclerview); _recyclerView.SetLayoutManager(new LinearLayoutManager(this)); _recyclerView.SetAdapter(_adapter); string intentString = Intent.GetStringExtra("Current participants"); if (intentString != string.Empty) { string[] contactStrings = intentString.Split('|'); if (contactStrings[0] == "New Group") { for (int i = 1; i < contactStrings.Length; i++) { string[] contactAttr = contactStrings[i].Split(','); foreach (var item in _adapter.Items) { if (contactAttr[0] == item.Name) { item.State = true; } } } } else if (contactStrings[0] == "Existing Group") { for (int i = 1; i < contactStrings.Length; i++) { string[] contactAttr = contactStrings[i].Split(','); for (int j = 0; j < _adapter.Items.Count; j++) { if (contactAttr[0] == _adapter.Items[j].Name) { _adapter.Items.RemoveAt(j); break; } } } } _adapter.NotifyDataSetChanged(); } Toolbar toolbar = FindViewById<Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); SupportActionBar.Title = "Add participants"; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); IsFirstInitialization = true; _persoon = Gegevens.GetPerson(); _groep = Gegevens.CurrentGroup(); SetContentView(Resource.Layout.Hoofdscherm); _toolbar = FindViewById<Toolbar>(Resource.Id.toolbar); _totalDebt = _toolbar.FindViewById<TextView>(Resource.Id.TotalDebt); _title = _toolbar.FindViewById<TextView>(Resource.Id.Title); _title.Text = _persoon.Id; TotalDebt = _persoon.TotaalSchuld(); SetSupportActionBar(_toolbar); SupportActionBar.Title = ""; _fragments = new HoofdschermFragment[] { new SessionFragment(), new PayFragment(), new ContactFragment() }; var titles = CharSequence.ArrayFromStringArray(new[] { "Sessions", "Payments", "Contacts" }); _viewPager = FindViewById<ViewPager>(Resource.Id.viewpager); _viewPager.Adapter = new TabsFragmentPagerAdapter(SupportFragmentManager, _fragments, titles); _viewPager.SetCurrentItem(1, true); _tabLayout = FindViewById<TabLayout>(Resource.Id.sliding_tabs); _tabLayout.SetupWithViewPager(_viewPager); _tabLayout.SetOnTabSelectedListener(this); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); _persoon = Gegevens.GetPerson(); _groep = Gegevens.CurrentGroup(); SetContentView(Resource.Layout.Payscherm); _toolbar = FindViewById<Toolbar>(Resource.Id.toolbar); _totalDebt = _toolbar.FindViewById<TextView>(Resource.Id.Title); TotalDebt = _persoon.TotaalSchuldGroep(_groep); SetSupportActionBar(_toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); SupportActionBar.Title = ""; _fragments = new PaySchermFragment[] { new InboxFragment(), new OutboxFragment(), }; var titles = CharSequence.ArrayFromStringArray(new[] { "Inbox", "Outbox" }); _viewPager = FindViewById<ViewPager>(Resource.Id.viewpager); _viewPager.Adapter = new TabsFragmentPagerAdapter(SupportFragmentManager, _fragments, titles); _viewPager.SetCurrentItem(0, true); _tabLayout = FindViewById<TabLayout>(Resource.Id.sliding_tabs); _tabLayout.SetupWithViewPager(_viewPager); _tabLayout.SetOnTabSelectedListener(this); Button newPaymentButton = FindViewById<Button>(Resource.Id.buttonNewPayment); newPaymentButton.Click += (sender, e) => { var activity = new Intent(this, typeof(Betaalscherm)); StartActivity(activity); }; }