Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix style issues #3876

Merged
merged 6 commits into from
Jan 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions core/src/main/java/bisq/core/locale/GlobalSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

public class GlobalSettings {
private static boolean useAnimations = true;
private static boolean useDarkMode = false;
private static Locale locale;
private static final ObjectProperty<Locale> localeProperty = new SimpleObjectProperty<>(locale);
private static TradeCurrency defaultTradeCurrency;
Expand All @@ -48,10 +47,6 @@ public static void setUseAnimations(boolean useAnimations) {
GlobalSettings.useAnimations = useAnimations;
}

public static void setUseDarkMode(boolean useDarkMode) {
GlobalSettings.useDarkMode = useDarkMode;
}

public static void setDefaultTradeCurrency(TradeCurrency fiatCurrency) {
GlobalSettings.defaultTradeCurrency = fiatCurrency;
}
Expand Down
8 changes: 4 additions & 4 deletions desktop/src/main/java/bisq/desktop/bisq.css
Original file line number Diff line number Diff line change
Expand Up @@ -1645,12 +1645,12 @@ textfield */
#buy-button-big {
-fx-font-size: 1em;
-fx-background-color: -bs-buy;
-fx-text-fill: white;
-fx-text-fill: -bs-white;
}

#buy-button {
-fx-background-color: -bs-buy;
-fx-text-fill: white;
-fx-text-fill: -bs-white;
}

#buy-button-big:hover, #buy-button:hover,
Expand All @@ -1660,13 +1660,13 @@ textfield */

#sell-button-big {
-fx-background-color: -bs-sell;
-fx-text-fill: white;
-fx-text-fill: -bs-white;
-fx-font-size: 1em;
}

#sell-button {
-fx-background-color: -bs-sell;
-fx-text-fill: white;
-fx-text-fill: -bs-white;
}

#sell-button-big:hover, #sell-button:hover,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
priceAsPercentageValueCurrencyBox, volumeValueCurrencyBox, priceValueCurrencyBox,
minAmountValueCurrencyBox, advancedOptionsBox, paymentGroupBox;

private Subscription isWaitingForFundsSubscription, balanceSubscription, cancelButton2StyleSubscription;
private Subscription isWaitingForFundsSubscription, balanceSubscription;
private ChangeListener<Boolean> amountFocusedListener, minAmountFocusedListener, volumeFocusedListener,
buyerSecurityDepositFocusedListener, priceFocusedListener, placeOfferCompletedListener,
priceAsPercentageFocusedListener, getShowWalletFundedNotificationListener,
Expand Down Expand Up @@ -662,15 +662,11 @@ private void addSubscriptions() {
waitingForFundsLabel.setManaged(isWaitingForFunds);
});

cancelButton2StyleSubscription = EasyBind.subscribe(placeOfferButton.visibleProperty(),
isVisible -> cancelButton2.setId(isVisible ? "cancel-button" : null));

balanceSubscription = EasyBind.subscribe(model.getDataModel().getBalance(), balanceTextField::setBalance);
}

private void removeSubscriptions() {
isWaitingForFundsSubscription.unsubscribe();
cancelButton2StyleSubscription.unsubscribe();
balanceSubscription.unsubscribe();
}

Expand Down Expand Up @@ -1294,7 +1290,7 @@ private void addAmountPriceFields() {
Res.get("shared.distanceInPercent"));
percentagePriceDescription = priceAsPercentageInputBoxTuple.first;

getSmallIconForLabel(MaterialDesignIcon.CHART_LINE, percentagePriceDescription);
getSmallIconForLabel(MaterialDesignIcon.CHART_LINE, percentagePriceDescription, "small-icon-label");

percentagePriceBox = priceAsPercentageInputBoxTuple.second;

Expand Down Expand Up @@ -1367,7 +1363,7 @@ private void addSecondRow() {
Tuple2<Label, VBox> priceInputBoxTuple = getTradeInputBox(priceValueCurrencyBox, "");
priceDescriptionLabel = priceInputBoxTuple.first;

getSmallIconForLabel(MaterialDesignIcon.LOCK, priceDescriptionLabel);
getSmallIconForLabel(MaterialDesignIcon.LOCK, priceDescriptionLabel, "small-icon-label");

editOfferElements.add(priceDescriptionLabel);
fixedPriceBox = priceInputBoxTuple.second;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import bisq.desktop.main.offer.OfferView;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.main.overlays.windows.OfferDetailsWindow;
import bisq.desktop.util.CssTheme;
import bisq.desktop.util.DisplayUtils;
import bisq.desktop.util.FormBuilder;
import bisq.desktop.util.GUIUtil;
Expand Down Expand Up @@ -1001,12 +1002,14 @@ public void updateItem(final OfferBookListItem newItem, boolean empty) {
if (myOffer) {
iconView.setId("image-remove");
title = Res.get("shared.remove");
button.setId("cancel-button");
button.setId(null);
button.setStyle(CssTheme.isDarkTheme() ? "-fx-text-fill: white" : "-fx-text-fill: #444444");
button.setOnAction(e -> onRemoveOpenOffer(offer));
} else {
boolean isSellOffer = offer.getDirection() == OfferPayload.Direction.SELL;
iconView.setId(isSellOffer ? "image-buy-white" : "image-sell-white");
button.setId(isSellOffer ? "buy-button" : "sell-button");
button.setStyle("-fx-text-fill: white");
if (isSellOffer) {
title = CurrencyUtil.isFiatCurrency(offer.getCurrencyCode()) ?
Res.get("offerbook.takeOfferToBuy", offer.getOfferPayload().getBaseCurrencyCode()) :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
private BusyAnimation waitingForFundsBusyAnimation, offerAvailabilityBusyAnimation;
private Notification walletFundedNotification;
private OfferView.CloseHandler closeHandler;
private Subscription cancelButton2StyleSubscription, balanceSubscription,
private Subscription balanceSubscription,
showTransactionPublishedScreenSubscription, showWarningInvalidBtcDecimalPlacesSubscription,
isWaitingForFundsSubscription, offerWarningSubscription, errorMessageSubscription,
isOfferAvailableSubscription;
Expand Down Expand Up @@ -760,8 +760,6 @@ private void addSubscriptions() {
});*/

balanceSubscription = EasyBind.subscribe(model.dataModel.getBalance(), balanceTextField::setBalance);
cancelButton2StyleSubscription = EasyBind.subscribe(takeOfferButton.visibleProperty(),
isVisible -> cancelButton2.setId(isVisible ? "cancel-button" : null));
}

private void removeSubscriptions() {
Expand All @@ -773,7 +771,6 @@ private void removeSubscriptions() {
showTransactionPublishedScreenSubscription.unsubscribe();
// noSufficientFeeSubscription.unsubscribe();
balanceSubscription.unsubscribe();
cancelButton2StyleSubscription.unsubscribe();
}

private void addListeners() {
Expand Down Expand Up @@ -1106,7 +1103,7 @@ private void addAmountPriceFields() {
Res.get("takeOffer.amountPriceBox.priceDescription"));
priceDescriptionLabel = priceInputBoxTuple.first;

getSmallIconForLabel(MaterialDesignIcon.LOCK, priceDescriptionLabel);
getSmallIconForLabel(MaterialDesignIcon.LOCK, priceDescriptionLabel, "small-icon-label");

VBox priceBox = priceInputBoxTuple.second;

Expand Down Expand Up @@ -1145,7 +1142,7 @@ private void addSecondRow() {
Res.get("shared.distanceInPercent"));
priceAsPercentageDescription = priceAsPercentageInputBoxTuple.first;

getSmallIconForLabel(MaterialDesignIcon.CHART_LINE, priceAsPercentageDescription);
getSmallIconForLabel(MaterialDesignIcon.CHART_LINE, priceAsPercentageDescription, "small-icon-label");

priceAsPercentageInputBox = priceAsPercentageInputBoxTuple.second;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ private void addConfirmAndCancelButtons(boolean isPlaceOffer) {

Button cancelButton = new AutoTooltipButton(Res.get("shared.cancel"));
cancelButton.setDefaultButton(false);
cancelButton.setId("cancel-button");
cancelButton.setOnAction(e -> {
closeHandlerOptional.ifPresent(Runnable::run);
hide();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ private void addConfirmEditGroup() {

cancelButton = new AutoTooltipButton(Res.get("shared.cancel"));
cancelButton.setDefaultButton(false);
cancelButton.setId("cancel-button");
cancelButton.setOnAction(event -> close());
editOfferConfirmationBox.getChildren().add(cancelButton);

Expand Down
24 changes: 13 additions & 11 deletions desktop/src/main/java/bisq/desktop/theme-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@

-bs-toggle-selected: #25b135;
-bs-warning: #db6300;
-bs-buy: #2ea33c;
-bs-buy: #006600;
-bs-buy-focus: black;
-bs-buy-hover: #237b2d;
-bs-buy-transparent: rgba(46, 163, 60, 0.3);
-bs-sell: #ee6563;
-bs-sell: #660000;
-bs-sell-focus: #090202;
-bs-sell-hover: #b42522;
-bs-sell-transparent: rgba(216, 52, 49, 0.3);
Expand All @@ -125,6 +125,9 @@
-bs-green-soft: derive(-bs-rd-green, 60%);
-bs-red-soft: derive(-bs-rd-error-red, 60%);
-bs-progress-bar-track: #272728;
-bs-chart-tick: rgba(255, 255, 255, 0.7);
-bs-chart-lines: rgba(0, 0, 0, 0.3);
-bs-white: white;
}

/* list view */
Expand Down Expand Up @@ -209,13 +212,6 @@
-fx-border-color: -bs-color-gray-2;
}

#sell-button, #sell-button-big {
-fx-background-color: #660000 !important;
}
#buy-button, #buy-button-big {
-fx-background-color: #006600 !important;
}

.wallet-seed-words {
-fx-text-fill: -bs-color-gray-6;
}
Expand All @@ -234,12 +230,12 @@
-fx-border-color: transparent transparent transparent transparent;
}
#charts .axis, #price-chart .axis, #volume-chart .axis, #charts-dao .axis {
-fx-tick-label-fill: rgba(255,255,255,0.7);
-fx-tick-label-fill: -bs-chart-tick;
}
.chart-horizontal-grid-lines,
.chart-horizontal-zero-line, .chart-vertical-zero-line,
.axis-tick-mark, .axis-minor-tick-mark {
-fx-stroke: rgba(0,0,0,0.3);
-fx-stroke: -bs-chart-lines;
}

/* scrollbars */
Expand All @@ -253,11 +249,17 @@
.scroll-bar:vertical .thumb:hover {
-fx-background-color: -bs-color-gray-5;
}

.scroll-bar:horizontal .thumb:pressed,
.scroll-bar:vertical .thumb:pressed {
-fx-background-color: -bs-color-gray-4;
}

.scroll-bar:vertical:focused,
.scroll-bar:horizontal:focused {
-fx-background-color: transparent, -bs-color-gray-4, -bs-color-gray-4;
}

.small-icon-label {
-fx-fill: -bs-text-color;
}
1 change: 1 addition & 0 deletions desktop/src/main/java/bisq/desktop/theme-light.css
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,5 @@
-fx-selection-bar-non-focused: -fx-selection-bar;
-fx-default-button: derive(-fx-accent, 95%);
-bs-progress-bar-track: #e0e0e0;
-bs-white: white;
}
21 changes: 15 additions & 6 deletions desktop/src/main/java/bisq/desktop/util/CssTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ public class CssTheme {
public static final int CSS_THEME_LIGHT = 0;
public static final int CSS_THEME_DARK = 1;

private static int currentCSSTheme;

public static void loadSceneStyles(Scene scene, int cssTheme) {
String cssThemeFolder = "/bisq/desktop/";
String cssThemeFile = "";

currentCSSTheme = cssTheme;

switch (cssTheme) {

case CSS_THEME_DARK:
Expand All @@ -40,13 +44,18 @@ public static void loadSceneStyles(Scene scene, int cssTheme) {
}

scene.getStylesheets().setAll(
// load base styles first
cssThemeFolder + "bisq.css",
cssThemeFolder + "images.css",
cssThemeFolder + "CandleStickChart.css",
// load base styles first

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was badly indented before, should be 8 for arguments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry this was one of my early contributions and I had my text editor set to hard tabs or something

cssThemeFolder + "bisq.css",
cssThemeFolder + "images.css",
cssThemeFolder + "CandleStickChart.css",

// load theme last to allow override
cssThemeFolder + cssThemeFile
// load theme last to allow override
cssThemeFolder + cssThemeFile
);
}

public static boolean isDarkTheme() {
return currentCSSTheme == CSS_THEME_DARK;
}

}
13 changes: 12 additions & 1 deletion desktop/src/main/java/bisq/desktop/util/FormBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -2045,10 +2045,13 @@ public static void removeRowsFromGridPane(GridPane gridPane, int fromGridRow, in
// Icons
///////////////////////////////////////////////////////////////////////////////////////////

public static Text getIconForLabel(GlyphIcons icon, String iconSize, Label label) {
public static Text getIconForLabel(GlyphIcons icon, String iconSize, Label label, String style) {
if (icon.fontFamily().equals(MATERIAL_DESIGN_ICONS)) {
final Text textIcon = MaterialDesignIconFactory.get().createIcon(icon, iconSize);
textIcon.setOpacity(0.7);
if (style != null) {
textIcon.getStyleClass().add(style);
}
label.setContentDisplay(ContentDisplay.LEFT);
label.setGraphic(textIcon);
return textIcon;
Expand All @@ -2057,6 +2060,14 @@ public static Text getIconForLabel(GlyphIcons icon, String iconSize, Label label
}
}

public static Text getIconForLabel(GlyphIcons icon, String iconSize, Label label) {
return getIconForLabel(icon, iconSize, label, null);
}

public static Text getSmallIconForLabel(GlyphIcons icon, Label label, String style) {
return getIconForLabel(icon, "0.769em", label, style);
}

public static Text getSmallIconForLabel(GlyphIcons icon, Label label) {
return getIconForLabel(icon, "0.769em", label);
}
Expand Down