Class LeaderboardController
- java.lang.Object
-
- com.cmput301w23t09.qrhunter.leaderboard.LeaderboardController
-
public class LeaderboardController extends java.lang.Object
Controller 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 LeaderboardFragment
getFragment()
Retrieve the leaderboard fragmentGameController
getGameController()
Retrieve the game controllervoid
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.void
getTopQRCodesLeaderboard(java.util.function.BiConsumer<java.lang.Exception,Leaderboard<QRCodeLeaderboardEntry>> callback)
Retrieve the top QRCodes points value leaderboard in descending order.void
getTopScansLeaderboard(java.util.function.BiConsumer<java.lang.Exception,Leaderboard<PlayerLeaderboardEntry>> callback)
Retrieve the top scans leaderboard in descending order.void
getTotalPointsLeaderboard(java.util.function.BiConsumer<java.lang.Exception,Leaderboard<PlayerLeaderboardEntry>> callback)
Retrieve the total points leaderboard in descending order.void
handleEntryClick(PlayerLeaderboardEntry entry)
Called when a player leaderboard entry is clickedvoid
handleEntryClick(QRCodeLeaderboardEntry entry)
Called when a qr leaderboard entry is clickedboolean
isFilteredByFollowedPlayers()
Check if the leaderboard is currently filtering to followed playersvoid
onFilterButtonClick()
Called when the filter button is clickedvoid
setIsFilteredByFollowedPlayers(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
-
-