Add retina version for all img

This commit is contained in:
Manfred Karrer 2014-09-16 03:53:43 +02:00
parent 97facb6bbf
commit 1ca97369aa
68 changed files with 103 additions and 56 deletions

View File

@ -49,7 +49,11 @@ public class AWTSystemTray {
Platform.setImplicitExit(false);
SystemTray systemTray = SystemTray.getSystemTray();
trayIcon = new TrayIcon(getImage(ImageUtil.SYS_TRAY));
if (ImageUtil.isRetina())
trayIcon = new TrayIcon(getImage(ImageUtil.SYS_TRAY_HI_RES));
else
trayIcon = new TrayIcon(getImage(ImageUtil.SYS_TRAY));
trayIcon.setToolTip("BitSquare P2P Fiat-Bitcoin exchange");
PopupMenu popupMenu = new PopupMenu();
@ -93,12 +97,18 @@ public class AWTSystemTray {
}
}
public static void setAlert() {
trayIcon.setImage(getImage(ImageUtil.SYS_TRAY_ALERT));
public static void setAlertIcon() {
if (ImageUtil.isRetina())
trayIcon.setImage(getImage(ImageUtil.SYS_TRAY_ALERT_HI_RES));
else
trayIcon.setImage(getImage(ImageUtil.SYS_TRAY_ALERT));
}
public static void unSetAlert() {
trayIcon.setImage(getImage(ImageUtil.SYS_TRAY));
public static void setIcon() {
if (ImageUtil.isRetina())
trayIcon.setImage(getImage(ImageUtil.SYS_TRAY_HI_RES));
else
trayIcon.setImage(getImage(ImageUtil.SYS_TRAY));
}
public static void setStageHidden() {

View File

@ -9,6 +9,38 @@
-fx-image: url("../../../images/info.png");
}
#image-alert-round {
-fx-image: url("../../../images/alert_round.png");
}
#image-remove {
-fx-image: url("../../../images/remove.png");
}
#image-buy {
-fx-image: url("../../../images/buy.png");
}
#image-sell {
-fx-image: url("../../../images/sell.png");
}
#image-expand {
-fx-image: url("../../../images/expand.png");
}
#image-collapse {
-fx-image: url("../../../images/collapse.png");
}
#image-buy-large {
-fx-image: url("../../../images/buy_large.png");
}
#image-sell-large {
-fx-image: url("../../../images/sell_large.png");
}
/* naviagtion buttons */
#image-nav-home {

View File

@ -24,7 +24,6 @@ import io.bitsquare.gui.OverlayManager;
import io.bitsquare.gui.ViewCB;
import io.bitsquare.gui.components.NetworkSyncPane;
import io.bitsquare.gui.components.Popups;
import io.bitsquare.gui.util.ImageUtil;
import io.bitsquare.gui.util.Profiler;
import io.bitsquare.gui.util.Transitions;
import io.bitsquare.util.ViewLoader;
@ -184,7 +183,9 @@ public class MainViewCB extends ViewCB<MainPM> {
Profiler.printMsgWithTime("MainController.ondMainNavigationAdded");
presentationModel.takeOfferRequested.addListener((ov, olaValue, newValue) -> {
final Button alertButton = new Button("", ImageUtil.getImageView(ImageUtil.MSG_ALERT));
ImageView icon = new ImageView();
icon.setId("image-alert-round");
final Button alertButton = new Button("", icon);
alertButton.setId("nav-alert-button");
alertButton.relocate(36, 19);
alertButton.setOnAction((e) ->
@ -194,7 +195,7 @@ public class MainViewCB extends ViewCB<MainPM> {
Tooltip.install(alertButton, new Tooltip("Your offer has been accepted"));
ordersButtonButtonPane.getChildren().add(alertButton);
AWTSystemTray.setAlert();
AWTSystemTray.setAlertIcon();
});
navigation.navigateToLastStoredItem();

View File

@ -236,7 +236,7 @@ public class RestrictionsViewCB extends CachedViewCB<RestrictionsPM> implements
public ListCell<Locale> call(ListView<Locale> list) {
return new ListCell<Locale>() {
final Label label = new Label();
final ImageView icon = ImageUtil.getImageView(ImageUtil.REMOVE_ICON);
final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);
final Button removeButton = new Button("", icon);
final AnchorPane pane = new AnchorPane(label, removeButton);
@ -294,7 +294,7 @@ public class RestrictionsViewCB extends CachedViewCB<RestrictionsPM> implements
public ListCell<Country> call(ListView<Country> list) {
return new ListCell<Country>() {
final Label label = new Label();
final ImageView icon = ImageUtil.getImageView(ImageUtil.REMOVE_ICON);
final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);
final Button removeButton = new Button("", icon);
final AnchorPane pane = new AnchorPane(label, removeButton);
@ -338,7 +338,7 @@ public class RestrictionsViewCB extends CachedViewCB<RestrictionsPM> implements
public ListCell<Arbitrator> call(ListView<Arbitrator> list) {
return new ListCell<Arbitrator>() {
final Label label = new Label();
final ImageView icon = ImageUtil.getImageView(ImageUtil.REMOVE_ICON);
final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);
final Button removeButton = new Button("", icon);
final AnchorPane pane = new AnchorPane(label, removeButton);

View File

@ -155,7 +155,7 @@ public class OfferController extends CachedViewController {
@Override
public TableCell<String, OfferListItem> call(TableColumn<String, OfferListItem> directionColumn) {
return new TableCell<String, OfferListItem>() {
final ImageView iconView = ImageUtil.getImageView(ImageUtil.REMOVE_ICON);
final ImageView iconView = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);
final Button button = new Button();
{

View File

@ -78,8 +78,6 @@ public class PendingTradeController extends CachedViewController {
private Trade currentTrade;
private final Image buyIcon = ImageUtil.getImage(ImageUtil.BUY_ICON);
private final Image sellIcon = ImageUtil.getImage(ImageUtil.SELL_ICON);
private ConfidenceDisplay confidenceDisplay;
@FXML private TableView openTradesTable;
@ -290,7 +288,7 @@ public class PendingTradeController extends CachedViewController {
bankTransferInitedButton.setVisible(false);
AWTSystemTray.unSetAlert();
AWTSystemTray.setIcon();
}
}
@ -364,15 +362,7 @@ public class PendingTradeController extends CachedViewController {
hBox.getChildren().clear();
if (tradesTableItem != null) {
Country country = tradesTableItem.getTrade().getOffer().getBankAccountCountry();
try {
hBox.getChildren().add(ImageUtil.getImageView(
"/images/countries/" + country.getCode().toLowerCase() + ".png"));
} catch (Exception e) {
log.warn("Country icon not found: /images/countries/" +
country.getCode().toLowerCase() + ".png country name: " +
country.getName());
}
hBox.getChildren().add(ImageUtil.getCountryIconImageView(country));
Tooltip.install(this, new Tooltip(country.getName()));
}
}
@ -429,19 +419,17 @@ public class PendingTradeController extends CachedViewController {
if (tradesTableItem != null) {
String title;
Image icon;
Offer offer = tradesTableItem.getTrade().getOffer();
if (offer.getDirection() == Direction.SELL) {
icon = buyIcon;
iconView.setId("image-buy");
title = BSFormatter.formatDirection(Direction.BUY, true);
}
else {
icon = sellIcon;
iconView.setId("image-sell");
title = BSFormatter.formatDirection(Direction.SELL, true);
}
button.setDisable(true);
iconView.setImage(icon);
button.setText(title);
setGraphic(button);
}

View File

@ -51,9 +51,7 @@
<GridPane.margin>
<Insets bottom="10.0" left="10.0" right="10.0" top="20.0"/>
</GridPane.margin>
<ImageView pickOnBounds="true" preserveRatio="true">
<Image url="@/images/buy_large.png"/>
</ImageView>
<ImageView fx:id="imageView" pickOnBounds="true"/>
<Label fx:id="buyLabel" id="direction-icon-label" text="%createOffer.amountPriceBox.subTitle"
alignment="CENTER">
<padding>

View File

@ -32,6 +32,7 @@ import io.bitsquare.gui.main.help.HelpId;
import io.bitsquare.gui.main.trade.OrderBookInfo;
import io.bitsquare.gui.util.ImageUtil;
import io.bitsquare.locale.BSResources;
import io.bitsquare.trade.Direction;
import java.net.URL;
@ -73,6 +74,7 @@ import static javafx.beans.binding.Bindings.createStringBinding;
public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
private static final Logger log = LoggerFactory.getLogger(CreateOfferViewCB.class);
private Navigation navigation;
private OverlayManager overlayManager;
private CloseListener closeListener;
@ -86,6 +88,7 @@ public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
@FXML InfoDisplay advancedInfoDisplay, fundsBoxInfoDisplay;
@FXML ScrollPane scrollPane;
@FXML ImageView imageView;
@FXML TitledGroupBg priceAmountPane, payFundsPane, showDetailsPane;
@FXML Label buyLabel, addressLabel,
balanceLabel, totalToPayLabel, totalToPayInfoIconLabel,
@ -157,6 +160,11 @@ public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
public void initWithOrderBookInfo(OrderBookInfo orderBookInfo) {
presentationModel.setOrderBookFilter(orderBookInfo);
if (orderBookInfo.getDirection() == Direction.BUY)
imageView.setId("image-buy-large");
else
imageView.setId("image-sell-large");
}
public void setCloseListener(CloseListener closeListener) {
@ -190,8 +198,8 @@ public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
showAdvancedSettingsButton.setVisible(true);
if (expand == null) {
expand = ImageUtil.getImageView(ImageUtil.EXPAND);
collapse = ImageUtil.getImageView(ImageUtil.COLLAPSE);
expand = ImageUtil.getImageViewById(ImageUtil.EXPAND);
collapse = ImageUtil.getImageViewById(ImageUtil.COLLAPSE);
}
showAdvancedSettingsButton.setGraphic(expand);

View File

@ -25,6 +25,7 @@ import io.bitsquare.gui.util.validation.OptionalBtcValidator;
import io.bitsquare.gui.util.validation.OptionalFiatValidator;
import io.bitsquare.locale.BSResources;
import io.bitsquare.locale.Country;
import io.bitsquare.trade.Direction;
import io.bitsquare.trade.Offer;
import com.google.inject.Inject;
@ -200,7 +201,9 @@ public class OrderBookPM extends PresentationModel<OrderBookModel> {
}
String getDirectionLabel(Offer offer) {
return BSFormatter.formatDirection(offer.getDirection(), true);
// mirror direction
Direction direction = offer.getDirection() == Direction.BUY ? Direction.SELL : Direction.BUY;
return BSFormatter.formatDirection(direction, true);
}
OrderBookInfo getOrderBookInfo() {

View File

@ -70,9 +70,6 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
private boolean detailsVisible;
private boolean advancedScreenInited;
private final Image buyIcon = ImageUtil.getImage(ImageUtil.BUY_ICON);
private final Image sellIcon = ImageUtil.getImage(ImageUtil.SELL_ICON);
private ImageView expand;
private ImageView collapse;
@ -125,8 +122,8 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
setupValidators();
setupComparators();
expand = ImageUtil.getImageView(ImageUtil.EXPAND);
collapse = ImageUtil.getImageView(ImageUtil.COLLAPSE);
expand = ImageUtil.getImageViewById(ImageUtil.EXPAND);
collapse = ImageUtil.getImageViewById(ImageUtil.COLLAPSE);
showAdvancedSettingsButton.setGraphic(expand);
super.initialize(url, rb);
@ -452,17 +449,19 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
if (item != null) {
String title;
Image icon;
Offer offer = item.getOffer();
if (presentationModel.isMyOffer(offer)) {
icon = ImageUtil.getImage(ImageUtil.REMOVE_ICON);
iconView.setId("image-remove");
title = "Remove";
button.setOnAction(event -> presentationModel.removeOffer(item
.getOffer()));
}
else {
icon = offer.getDirection() == Direction.SELL ? buyIcon : sellIcon;
if (offer.getDirection() == Direction.SELL)
iconView.setId("image-buy");
else
iconView.setId("image-sell");
title = presentationModel.getDirectionLabel(offer);
button.setOnAction(event -> takeOffer(item.getOffer()));
}
@ -471,7 +470,6 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
verifyIfTradable(item));
verifyIfTradable(item);
iconView.setImage(icon);
button.setText(title);
setGraphic(button);
}

View File

@ -21,6 +21,8 @@ import io.bitsquare.locale.Country;
import javafx.scene.image.*;
import com.sun.javafx.tk.quantum.QuantumToolkit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -28,30 +30,34 @@ import org.slf4j.LoggerFactory;
public class ImageUtil {
private static final Logger log = LoggerFactory.getLogger(ImageUtil.class);
public static final String SYS_TRAY = "/images/system_tray_icon_44_32.png";
public static final String SYS_TRAY_ALERT = "/images/system_tray_notify_icon_44_32.png";
// System tray use AWT and there is no CSS support for loading retina supported images
public static final String SYS_TRAY = "/images/system_tray_icon.png";
public static final String SYS_TRAY_HI_RES = "/images/system_tray_icon@2x.png";
public static final String SYS_TRAY_ALERT = "/images/system_tray_icon_alert.png";
public static final String SYS_TRAY_ALERT_HI_RES = "/images/system_tray_icon_alert@2x.png";
public static final String MSG_ALERT = "/images/nav/alertRound.png";
public static final String BUY_ICON = "/images/buy.png";
public static final String SELL_ICON = "/images/sell.png";
public static final String REMOVE_ICON = "/images/removeOffer.png";
public static final String REMOVE_ICON = "image-remove";
public static final String EXPAND = "image-expand";
public static final String COLLAPSE = "image-collapse";
public static final String EXPAND = "/images/expand.png";
public static final String COLLAPSE = "/images/collapse.png";
public static ImageView getImageViewById(String id) {
ImageView imageView = new ImageView();
imageView.setId(id);
return imageView;
}
public static Image getImage(String url) {
private static Image getImageByUrl(String url) {
return new Image(ImageUtil.class.getResourceAsStream(url));
}
public static ImageView getImageView(String url) {
return new ImageView(getImage(url));
public static ImageView getImageViewByUrl(String url) {
return new ImageView(getImageByUrl(url));
}
public static ImageView getCountryIconImageView(Country country) {
try {
return ImageUtil.getImageView("/images/countries/" + country.getCode().toLowerCase() + ".png");
return ImageUtil.getImageViewByUrl("/images/countries/" + country.getCode().toLowerCase() + ".png");
} catch (Exception e) {
log.error("Country icon not found URL = /images/countries/" + country.getCode().toLowerCase() +
".png / country name = " + country.getName());
@ -59,5 +65,8 @@ public class ImageUtil {
}
}
public static boolean isRetina() {
return ((QuantumToolkit) QuantumToolkit.getToolkit()).getMaxPixelScale() > 1.9f;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 B

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 901 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 837 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 425 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 286 B