Class LeaderboardController
- java.lang.Object
-
- com.cmput301w23t09.qrhunter.leaderboard.LeaderboardController
-
public class LeaderboardController extends java.lang.ObjectController that handles retrieving and updating leaderboards.
-
-
Constructor Summary
Constructors Constructor Description LeaderboardController(LeaderboardFragment fragment, GameController gameController)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LeaderboardFragmentgetFragment()Retrieve the leaderboard fragmentGameControllergetGameController()Retrieve the game controllervoidgetTopQRCodesByRegionLeaderboard(java.util.function.BiConsumer<java.lang.Exception,java.util.List<Leaderboard<QRCodeLeaderboardEntry>>> callback)Retrieve the top QRCode points value leaderboard by region in descending order.voidgetTopQRCodesLeaderboard(java.util.function.BiConsumer<java.lang.Exception,Leaderboard<QRCodeLeaderboardEntry>> callback)Retrieve the top QRCodes points value leaderboard in descending order.voidgetTopScansLeaderboard(java.util.function.BiConsumer<java.lang.Exception,Leaderboard<PlayerLeaderboardEntry>> callback)Retrieve the top scans leaderboard in descending order.voidgetTotalPointsLeaderboard(java.util.function.BiConsumer<java.lang.Exception,Leaderboard<PlayerLeaderboardEntry>> callback)Retrieve the total points leaderboard in descending order.voidhandleEntryClick(PlayerLeaderboardEntry entry)Called when a player leaderboard entry is clickedvoidhandleEntryClick(QRCodeLeaderboardEntry entry)Called when a qr leaderboard entry is clickedbooleanisFilteredByFollowedPlayers()Check if the leaderboard is currently filtering to followed playersvoidonFilterButtonClick()Called when the filter button is clickedvoidsetIsFilteredByFollowedPlayers(boolean filteredByFollowedPlayers)Modify whether or not the leaderboards requested should only filter to followed players
-
-
-
Constructor Detail
-
LeaderboardController
public LeaderboardController(LeaderboardFragment fragment, GameController gameController)
-
-
Method Detail
-
getTotalPointsLeaderboard
public void getTotalPointsLeaderboard(java.util.function.BiConsumer<java.lang.Exception,Leaderboard<PlayerLeaderboardEntry>> callback)
Retrieve the total points leaderboard in descending order.- Parameters:
callback- callback to call with leaderboard
-
getTopScansLeaderboard
public void getTopScansLeaderboard(java.util.function.BiConsumer<java.lang.Exception,Leaderboard<PlayerLeaderboardEntry>> callback)
Retrieve the top scans leaderboard in descending order.- Parameters:
callback- callback to call with leaderboard
-
getTopQRCodesLeaderboard
public void getTopQRCodesLeaderboard(java.util.function.BiConsumer<java.lang.Exception,Leaderboard<QRCodeLeaderboardEntry>> callback)
Retrieve the top QRCodes points value leaderboard in descending order.- Parameters:
callback- callback to call with leaderboard
-
getTopQRCodesByRegionLeaderboard
public void getTopQRCodesByRegionLeaderboard(java.util.function.BiConsumer<java.lang.Exception,java.util.List<Leaderboard<QRCodeLeaderboardEntry>>> callback)
Retrieve the top QRCode points value leaderboard by region in descending order.- Parameters:
callback- callback to call with the leaderboards mapped by their city.
-
handleEntryClick
public void handleEntryClick(PlayerLeaderboardEntry entry)
Called when a player leaderboard entry is clicked- Parameters:
entry- player entry
-
handleEntryClick
public void handleEntryClick(QRCodeLeaderboardEntry entry)
Called when a qr leaderboard entry is clicked- Parameters:
entry- qr entry
-
onFilterButtonClick
public void onFilterButtonClick()
Called when the filter button is clicked
-
setIsFilteredByFollowedPlayers
public void setIsFilteredByFollowedPlayers(boolean filteredByFollowedPlayers)
Modify whether or not the leaderboards requested should only filter to followed players- Parameters:
filteredByFollowedPlayers- whether or not to apply the filter
-
isFilteredByFollowedPlayers
public boolean isFilteredByFollowedPlayers()
Check if the leaderboard is currently filtering to followed players- Returns:
- if the filter is active
-
getGameController
public GameController getGameController()
Retrieve the game controller- Returns:
- game controller
-
getFragment
public LeaderboardFragment getFragment()
Retrieve the leaderboard fragment- Returns:
- fragment
-
-