From a3eff32cc39529e6ed5eeb04b09d45ba1574abf5 Mon Sep 17 00:00:00 2001
From: Per Eric Trapnes
Date: Mon, 18 May 2026 22:53:44 +0200
Subject: [PATCH] checkstyle hustlersapp
---
.../DesktopViewController.java | 2 +-
.../gruppe42/view/apps/HustlersApp.java | 85 +++++--------------
.../gruppe42/view/views/DesktopView.java | 16 ++--
3 files changed, 31 insertions(+), 72 deletions(-)
diff --git a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/controller/viewcontrollers/DesktopViewController.java b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/controller/viewcontrollers/DesktopViewController.java
index 256169a..1de0926 100644
--- a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/controller/viewcontrollers/DesktopViewController.java
+++ b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/controller/viewcontrollers/DesktopViewController.java
@@ -107,9 +107,9 @@ public DesktopViewController(
setupPopupOverlay();
setupDesktopUi();
-
setupListeners();
+
int startDay = timeAndWeatherController.dayIndexProperty().get();
stockAppController.setWeekend(startDay == SATURDAY_INDEX || startDay == SUNDAY_INDEX);
diff --git a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/view/apps/HustlersApp.java b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/view/apps/HustlersApp.java
index a436384..b29031c 100644
--- a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/view/apps/HustlersApp.java
+++ b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/view/apps/HustlersApp.java
@@ -46,9 +46,10 @@ public class HustlersApp extends Popup {
* including sidebar navigation and content rendering system.
*/
public HustlersApp() {
- super(720, 480, 80, 60, App.HUSTLERS);
+ super(720, 480, 400, 400, App.HUSTLERS);
buildChapters();
buildUi();
+ show();
}
/**
@@ -85,86 +86,40 @@ private void buildChapters() {
+ "that money is gone. Never invest money you need for rent.\n\n"
+ "PRO TIPS\n"
+ "Watch the trend for at least two days before buying.\n"
- + "Diversify — don't put everything in one stock.\n"
+ + "Diversify - don't put everything in one stock.\n"
+ "Always keep enough cash to cover your weekly rent."
});
chapters.put("Bank", new String[]{
"HOW THE BANK WORKS",
- "The Bank app is your financial safety net — and leverage tool.\n\n"
+ "The Bank app is your financial safety net - and leverage tool.\n\n"
+ "SAVINGS ACCOUNT\n"
+ "Your account displays your total balance, cash available, "
- + "cash invested and total return. "
+ + "cash invested and total return.\n"
+ "Remember, green numbers mean you're flying, red means you gotta lock in chief.\n\n"
+ "PORTFOLIO\n"
- + "If you like to brag about your investments, this is where it's at. "
- + "If it's empty, what are you even doing reading this?! Get to investing! "
- + "On the other hand, if it's full, I'm one proud G. \n\n"
+ + "If you like to brag about your investments, this is where it's at.\n"
+ + "If it's empty, what are you even doing reading this?! Get to investing!\n"
+ + "On the other hand, if it's full, I'm one proud G.\n\n"
+ "PRO TIPS\n"
+ "Clicking on a share in your portfolio will open its page in the Market app.\n"
+ "Bank app + Market app = holy dual wield.\n"
+ "Check your current cash balance before rent day."
});
- chapters.put("App Store", new String[]{
- "HOW THE APP STORE WORKS",
- "The App Store lets you purchase new apps that unlock extra features.\n\n"
- + "BROWSING APPS\n"
- + "Open the App Store and scroll through the available apps. "
- + "Each listing shows the app name, what it does, and its one-time price.\n\n"
- + "BUYING AN APP\n"
- + "Tap an app, read the description, and tap PURCHASE. "
- + "The price is taken from your wallet and the app appears on your home screen.\n\n"
- + "INSTALLED APPS\n"
- + "Purchased apps stay with you permanently — you never pay again. "
- + "Apps can include trading tools, extra income streams, "
- + "and communication upgrades.\n\n"
- + "FREE vs. PAID\n"
- + "Some apps are free by default (like this one). "
- + "Premium apps cost money but often pay for themselves quickly.\n\n"
- + "PRO TIPS\n"
- + "Buy income-boosting apps early — they compound over time.\n"
- + "Don't blow your rent fund on apps. Timing is everything."
- });
-
chapters.put("Email", new String[]{
"HOW EMAIL WORKS",
"Email is how the game world communicates with you.\n\n"
+ "RECEIVING EMAILS\n"
- + "Emails arrive automatically — from employers, contacts, and the system. "
+ + "Emails arrive automatically - from employers, contacts, and the system. "
+ "A badge on the Email app icon shows unread messages.\n\n"
- + "IMPORTANT EMAILS\n"
- + "Some emails contain offers, jobs, or warnings that expire. "
- + "Check your inbox regularly so you don't miss time-sensitive opportunities.\n\n"
- + "JOB OFFERS\n"
- + "Employers send job offers via email. Accept them through the email itself. "
- + "Ignoring an offer causes it to expire after a set number of days.\n\n"
- + "RENT REMINDERS\n"
- + "You will receive a rent reminder email before the end of each week. "
- + "This is your cue to make sure your wallet has enough to cover the payment.\n\n"
- + "PRO TIPS\n"
- + "Read every email when it arrives — some are one-time chances.\n"
- + "Rent reminders are not optional reading."
- });
-
- chapters.put("Messenger", new String[]{
- "HOW MESSENGER WORKS",
- "Messenger is your direct line to contacts, NPCs, and deal-makers.\n\n"
- + "CONVERSATIONS\n"
- + "Each contact has their own chat thread. Tap a conversation to open it.\n\n"
- + "STORY INTERACTIONS\n"
- + "Some story events and side quests are triggered through Messenger. "
- + "Replying (or not replying) to certain contacts affects your relationships "
- + "and can unlock or close off opportunities.\n\n"
- + "DEALS AND TIPS\n"
- + "Certain contacts send you hot tips on the market or exclusive deals. "
- + "These appear as messages — act quickly because they are time-limited.\n\n"
- + "NOTIFICATIONS\n"
- + "New messages show a badge on the Messenger icon. "
- + "Don't let important messages pile up unread.\n\n"
+ + "BREAKING NEWS\n"
+ + "These are like the news, but for emails. "
+ + "Check your inbox regularly so you don't miss "
+ + "time-sensitive opportunities and events.\n\n"
+ "PRO TIPS\n"
- + "Maintain good relationships — ignoring contacts costs you opportunities.\n"
- + "Market tips from contacts can be more reliable than raw price trends."
+ + "Read every email when it arrives - some are one-time chances.\n"
+ + "Read the entire newsletter carefully - they might fool you.\n"
});
chapters.put("Rent", new String[]{
@@ -174,7 +129,7 @@ private void buildChapters() {
+ "Rent is charged on Saturday 00:00, right before the new week begins, "
+ "so you have until Friday to make sure you're set.\n\n"
+ "HOW IT'S PAID\n"
- + "The rent amount is deducted directly from your wallet — automatically, "
+ + "The rent amount is deducted directly from your wallet - automatically, "
+ "no action needed on your part. Make sure the money is in your wallet, "
+ "NOT locked in savings/investments.\n\n"
+ "WHAT IF YOU CAN'T PAY?\n"
@@ -184,14 +139,14 @@ private void buildChapters() {
+ "HOW MUCH IS RENT?\n"
+ "Your rent amount is shown on the Rent Day popup at Saturday 00:00. "
+ "You can count on it being $50 the first couple weeks.\n"
- + "It may increase as you progress — so keep earning.\n\n"
+ + "It may increase as you progress - so keep earning.\n\n"
+ "PRO TIPS\n"
+ "Check your wallet balance on Friday.\n"
+ "Sell shares if you are short."
});
chapters.put("Hearts", new String[]{
- "YOUR LIVES — HEARTS",
+ "YOUR LIVES - HEARTS",
"Hearts represent how many chances you have left before it's game over.\n\n"
+ "STARTING HEARTS\n"
+ "You begin the game with a set number of hearts shown in the footer.\n\n"
@@ -201,10 +156,10 @@ private void buildChapters() {
+ "When you run out of hearts, the game ends. "
+ "There is no revive. Manage your money or start over.\n\n"
+ "CAN YOU GAIN HEARTS BACK?\n"
- + "Nah bro, work with the cards you've been dealt — protect the ones you have.\n\n"
+ + "Nah bro, work with the cards you've been dealt - protect the ones you have.\n\n"
+ "PRO TIPS\n"
+ "Treat every heart like real money. One bad week can cascade.\n"
- + "If you're at one heart, play conservative — protect your wallet above all."
+ + "If you're at one heart, play conservative - protect your wallet above all."
});
}
diff --git a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/view/views/DesktopView.java b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/view/views/DesktopView.java
index a72d501..b731713 100644
--- a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/view/views/DesktopView.java
+++ b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/view/views/DesktopView.java
@@ -4,6 +4,7 @@
import edu.ntnu.idi.idatt2003.gruppe42.model.App;
import edu.ntnu.idi.idatt2003.gruppe42.view.views.components.DesktopBottomBar;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
import java.util.Objects;
@@ -82,8 +83,6 @@ public DesktopView(final DesktopViewController controller) {
gridArea = createGrid();
bottomBar = new DesktopBottomBar(controller.getPlayer());
- // Ensure the popup overlay is in a pane that allows x,y positioning,
- // and then place that pane in the center of the BorderPane.
Pane centerArea = new Pane(gridArea, popupOverlay);
Region region = (Region) gridArea;
region.prefWidthProperty().bind(centerArea.widthProperty());
@@ -296,13 +295,16 @@ private GridPane createGrid() {
grid.getRowConstraints().add(rc);
}
- App[] apps = App.values();
+ List desktopApps = Arrays.stream(App.values())
+ .filter(DesktopView::isDesktopApp)
+ .toList();
+
for (int row = 0; row < ROWS; row++) {
for (int col = 0; col < COLS; col++) {
StackPane cell = new StackPane();
controller.configureCellAsDropTarget(cell);
- if (row == 0 && col < apps.length && isDesktopApp(apps[col])) {
- cell.getChildren().add(controller.createAppButton(apps[col]));
+ if (row == 0 && col < desktopApps.size()) {
+ cell.getChildren().add(controller.createAppButton(desktopApps.get(col)));
}
grid.add(cell, col, row);
}
@@ -315,7 +317,9 @@ private static boolean isDesktopApp(final App app) {
&& app != App.WARNING
&& app != App.GAMEOVER
&& app != App.SETTINGS
- && app != App.FILEPICKER;
+ && app != App.FILEPICKER
+ && app != App.APPSTORE // is a desktop app but is not developed yet
+ && app != App.NEWS; // is a desktop app but is not developed yet
}
private String resource(final String path) {