diff --git a/forge-gui-mobile/src/forge/deck/FDeckEditor.java b/forge-gui-mobile/src/forge/deck/FDeckEditor.java index c66bae364d9..904b441b822 100644 --- a/forge-gui-mobile/src/forge/deck/FDeckEditor.java +++ b/forge-gui-mobile/src/forge/deck/FDeckEditor.java @@ -524,7 +524,7 @@ public class FDeckEditor extends TabPageScreen { protected static class OptionsPage extends DeckEditorPage { private static final float PADDING = Utils.scaleMin(5); - private final FLabel lblName = add(new FLabel.Builder().text("Name:").build()); + private final FLabel lblName = add(new FLabel.Builder().text("Name:").textColor(FLabel.INLINE_LABEL_COLOR).build()); private final FTextField txtName = add(new FTextField()); private final FLabel btnSave = add(new FLabel.ButtonBuilder().text("Save Deck").icon(FSkinImage.SAVE).build()); private final FLabel btnAddLands = add(new FLabel.ButtonBuilder().text("Add Lands").icon(FSkinImage.LAND).build()); @@ -541,7 +541,7 @@ public class FDeckEditor extends TabPageScreen { protected void initialize() { txtName.setGhostText("[New Deck]"); txtName.setText(parentScreen.getDeck().getName()); - txtName.setEnabled(false); //TODO: Allow editing for non-limited decks + txtName.setReadOnly(true); //TODO: Allow editing for non-limited decks btnSave.setCommand(new FEventHandler() { @Override diff --git a/forge-gui-mobile/src/forge/itemmanager/views/ImageView.java b/forge-gui-mobile/src/forge/itemmanager/views/ImageView.java index 00bbad31e4a..7ce39703c33 100644 --- a/forge-gui-mobile/src/forge/itemmanager/views/ImageView.java +++ b/forge-gui-mobile/src/forge/itemmanager/views/ImageView.java @@ -44,7 +44,6 @@ public class ImageView extends ItemView { private static final float PILE_SPACING_Y = 0.1f; private static final FSkinFont LABEL_FONT = FSkinFont.get(12); private static final FSkinColor GROUP_HEADER_FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); - private static final FSkinColor OPTION_LABEL_COLOR = GROUP_HEADER_FORE_COLOR.alphaColor(0.7f); private static final FSkinColor GROUP_HEADER_LINE_COLOR = GROUP_HEADER_FORE_COLOR.alphaColor(0.5f); private static final FSkinFont GROUP_HEADER_FONT = LABEL_FONT; private static final float GROUP_HEADER_HEIGHT = Utils.scaleY(19); @@ -137,9 +136,9 @@ public class ImageView extends ItemView { } } private final ExpandCollapseButton btnExpandCollapseAll = new ExpandCollapseButton(); - private final FLabel lblGroupBy = new FLabel.Builder().text("Groups:").font(LABEL_FONT).textColor(OPTION_LABEL_COLOR).build(); + private final FLabel lblGroupBy = new FLabel.Builder().text("Groups:").font(LABEL_FONT).textColor(FLabel.INLINE_LABEL_COLOR).build(); private final FComboBox cbGroupByOptions = new FComboBox(); - private final FLabel lblPileBy = new FLabel.Builder().text("Piles:").font(LABEL_FONT).textColor(OPTION_LABEL_COLOR).build(); + private final FLabel lblPileBy = new FLabel.Builder().text("Piles:").font(LABEL_FONT).textColor(FLabel.INLINE_LABEL_COLOR).build(); private final FComboBox cbPileByOptions = new FComboBox(); public ImageView(ItemManager itemManager0, ItemManagerModel model0) { diff --git a/forge-gui-mobile/src/forge/toolbox/FLabel.java b/forge-gui-mobile/src/forge/toolbox/FLabel.java index 7e5188a5241..efdce3d9faa 100644 --- a/forge-gui-mobile/src/forge/toolbox/FLabel.java +++ b/forge-gui-mobile/src/forge/toolbox/FLabel.java @@ -70,7 +70,8 @@ public class FLabel extends FDisplayObject implements IButton { } } - private static final FSkinColor DEFAULT_TEXT_COLOR = FSkinColor.get(Colors.CLR_TEXT); + public static final FSkinColor DEFAULT_TEXT_COLOR = FSkinColor.get(Colors.CLR_TEXT); + public static final FSkinColor INLINE_LABEL_COLOR = DEFAULT_TEXT_COLOR.alphaColor(0.7f); private static final FSkinColor clrMain = FSkinColor.get(Colors.CLR_INACTIVE); private static final FSkinColor d50 = clrMain.stepColor(-50); private static final FSkinColor d30 = clrMain.stepColor(-30); diff --git a/forge-gui-mobile/src/forge/toolbox/FTextField.java b/forge-gui-mobile/src/forge/toolbox/FTextField.java index ebc1e6ff53f..be51c4a09be 100644 --- a/forge-gui-mobile/src/forge/toolbox/FTextField.java +++ b/forge-gui-mobile/src/forge/toolbox/FTextField.java @@ -36,7 +36,7 @@ public class FTextField extends FDisplayObject implements ITextField { protected FSkinFont font, renderedFont; private HAlignment alignment; private int selStart, selLength; - private boolean isEditing; + private boolean isEditing, readOnly; public FTextField() { this(""); @@ -111,6 +111,13 @@ public class FTextField extends FDisplayObject implements ITextField { setHeight(getDefaultHeight(font)); } + public boolean isReadOnly() { + return readOnly; + } + public void setReadOnly(boolean readOnly0) { + readOnly = readOnly0; + } + public FEventHandler getChangedHandler() { return changedHandler; } @@ -163,6 +170,7 @@ public class FTextField extends FDisplayObject implements ITextField { } public boolean startEdit() { + if (readOnly) { return false; } if (isEditing) { return true; } //do nothing if already editing selStart = 0; //select all before starting input @@ -290,7 +298,11 @@ public class FTextField extends FDisplayObject implements ITextField { public void draw(Graphics g) { float w = getWidth(); float h = getHeight(); - g.fillRect(BACK_COLOR, 0, 0, w, h); + boolean drawBackground = !readOnly; //don't draw background or border if read-only + + if (drawBackground) { + g.fillRect(BACK_COLOR, 0, 0, w, h); + } //determine actual rendered font so selection logic is accurate renderedFont = font; @@ -328,7 +340,9 @@ public class FTextField extends FDisplayObject implements ITextField { drawText(g, w, h); } - g.drawRect(BORDER_THICKNESS, FORE_COLOR, BORDER_THICKNESS, BORDER_THICKNESS, w - 2 * BORDER_THICKNESS, h - 2 * BORDER_THICKNESS); //allow smooth border to fully display within bounds + if (drawBackground) { + g.drawRect(BORDER_THICKNESS, FORE_COLOR, BORDER_THICKNESS, BORDER_THICKNESS, w - 2 * BORDER_THICKNESS, h - 2 * BORDER_THICKNESS); //allow smooth border to fully display within bounds + } } private void drawText(Graphics g, float w, float h) {