private void SetupRecyClerView() { playersListView = FindViewById <ListView>(Resource.Id.playersList); adapter = new PlayersAdapter(this, registeredPlayers); playersListView.Adapter = adapter; playersListView.ItemClick += PlayersListView_ItemClick; }
public void SetupRecyclerView() { playersRecyclerView.SetLayoutManager(new LinearLayoutManager(playersRecyclerView.Context)); playersAdapter = new PlayersAdapter(playersList); playersAdapter.ItemClick += PlayersAdapter_ItemClick; playersRecyclerView.SetAdapter(playersAdapter); }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your fragment here Players = UoW.PlayerRepo.GetAllPlayer().OrderBy(p => p.Name).ToList(); ActualPlayers = Players; adapter = new PlayersAdapter(ActualPlayers.ToList()); adapter.ClickedObject += Adapter_Clicked; }
private void SetupViews( ) { _playersAdapter = new PlayersAdapter(this); _playersAdapter.PlayerClicked += (sender, pos) => { PlayerListItemViewModel playerListItem = _playersAdapter.GetPlayer(pos); LoadPlayerDetailsScreen(playerListItem.Id); }; _recyclerView.SetLayoutManager(new LinearLayoutManager(this)); _recyclerView.SetAdapter(_playersAdapter); _recyclerView.AddItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.Vertical)); _swipeRefreshLayout.Refresh += async(sender, e) => { await Presenter.LoadPlayers(true); }; _fabAddPlayer.Click += FabAddPlayerOnClick; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.playersList); DataHelper.GetFirebase().Child($"Games/{GameInfo.roomCode}/Players").AsObservable <Player>().Subscribe(x => UpdatePlayers(x.Object)); Button startBtn = FindViewById <Button>(Resource.Id.letsTalk_btn); startBtn.Click += async(sender, e) => { if (registeredPlayers.Count < 2) { new ToastCreator(this, "There must be at least 2 players").Run(); return; } startBtn.Enabled = false; await SetGameStart(); StartActivity(typeof(LivePointsActivity)); ShowNotification(); Finish(); }; FindViewById <TextView>(Resource.Id.playerListTitle).Text = GameInfo.title; FindViewById <TextView>(Resource.Id.roomCode).Text = GameInfo.roomCode; var players = Task.Run(async() => await DataHelper.GetFirebase().Child($"Games/{GameInfo.roomCode}/Players").OnceAsync <Player>()).Result; foreach (var p in players) { if (registeredPlayers.Find(x => x.UserId == p.Object.UserId) == null) { registeredPlayers.Add(p.Object); } } playersListView = FindViewById <ListView>(Resource.Id.playersList); adapter = new PlayersAdapter(this, registeredPlayers); playersListView.Adapter = adapter; }