v0.8.2: Interface improvements to TitleScene, WndSettings, and WndGame
This commit is contained in:
parent
192ecce74b
commit
43fb81fc36
|
@ -134,9 +134,7 @@ windows.wndsadghost.weapon=Ghost's weapon
|
||||||
windows.wndsadghost.armor=Ghost's armor
|
windows.wndsadghost.armor=Ghost's armor
|
||||||
windows.wndsadghost.farewell=Farewell, adventurer!
|
windows.wndsadghost.farewell=Farewell, adventurer!
|
||||||
|
|
||||||
windows.wndsettings.display=Display
|
windows.wndsettings$displaytab.title=Display Settings
|
||||||
windows.wndsettings.ui=UI
|
|
||||||
windows.wndsettings.audio=Audio
|
|
||||||
windows.wndsettings$displaytab.scale=Display Scale
|
windows.wndsettings$displaytab.scale=Display Scale
|
||||||
windows.wndsettings$displaytab.saver=Power Saver
|
windows.wndsettings$displaytab.saver=Power Saver
|
||||||
windows.wndsettings$displaytab.saver_desc=Power Saver mode draws the game at a reduced size and scales it up to fit your screen.\n\nThis will make graphics less crisp and enlarge the UI slightly, but will also improve performance and battery life.\n\nYou may need to restart the game for changes to take effect.
|
windows.wndsettings$displaytab.saver_desc=Power Saver mode draws the game at a reduced size and scales it up to fit your screen.\n\nThis will make graphics less crisp and enlarge the UI slightly, but will also improve performance and battery life.\n\nYou may need to restart the game for changes to take effect.
|
||||||
|
@ -150,6 +148,7 @@ windows.wndsettings$displaytab.bright=Bright
|
||||||
windows.wndsettings$displaytab.visual_grid=Visual Grid
|
windows.wndsettings$displaytab.visual_grid=Visual Grid
|
||||||
windows.wndsettings$displaytab.off=Off
|
windows.wndsettings$displaytab.off=Off
|
||||||
windows.wndsettings$displaytab.high=High
|
windows.wndsettings$displaytab.high=High
|
||||||
|
windows.wndsettings$uitab.title=Interface Settings
|
||||||
windows.wndsettings$uitab.mode=Toolbar Mode:
|
windows.wndsettings$uitab.mode=Toolbar Mode:
|
||||||
windows.wndsettings$uitab.split=Split
|
windows.wndsettings$uitab.split=Split
|
||||||
windows.wndsettings$uitab.group=Group
|
windows.wndsettings$uitab.group=Group
|
||||||
|
@ -160,10 +159,16 @@ windows.wndsettings$uitab.quickslots=Quickslots
|
||||||
windows.wndsettings$uitab.fullscreen=Fullscreen
|
windows.wndsettings$uitab.fullscreen=Fullscreen
|
||||||
windows.wndsettings$uitab.system_font=System Font
|
windows.wndsettings$uitab.system_font=System Font
|
||||||
windows.wndsettings$uitab.key_bindings=Key Bindings
|
windows.wndsettings$uitab.key_bindings=Key Bindings
|
||||||
|
windows.wndsettings$datatab.title=Connectivity Settings
|
||||||
|
windows.wndsettings$datatab.news=Check for news
|
||||||
|
windows.wndsettings$datatab.updates=Check for updates
|
||||||
|
windows.wndsettings$datatab.wifi=Only check on WiFi
|
||||||
|
windows.wndsettings$audiotab.title=Audio Settings
|
||||||
windows.wndsettings$audiotab.music_vol=Music Volume
|
windows.wndsettings$audiotab.music_vol=Music Volume
|
||||||
windows.wndsettings$audiotab.music_mute=Mute Music
|
windows.wndsettings$audiotab.music_mute=Mute Music
|
||||||
windows.wndsettings$audiotab.sfx_vol=SFX Volume
|
windows.wndsettings$audiotab.sfx_vol=SFX Volume
|
||||||
windows.wndsettings$audiotab.sfx_mute=Mute SFX
|
windows.wndsettings$audiotab.sfx_mute=Mute SFX
|
||||||
|
windows.wndsettings$langstab.title=Language Settings
|
||||||
windows.wndsettings$langstab.completed=This language has been fully translated and reviewed.
|
windows.wndsettings$langstab.completed=This language has been fully translated and reviewed.
|
||||||
windows.wndsettings$langstab.unreviewed=_This language has not yet been reviewed._ It may contain errors, but all text has been translated.
|
windows.wndsettings$langstab.unreviewed=_This language has not yet been reviewed._ It may contain errors, but all text has been translated.
|
||||||
windows.wndsettings$langstab.unfinished=_This language has not been fully translated._ Large amounts of text may still be in English.
|
windows.wndsettings$langstab.unfinished=_This language has not been fully translated._ Large amounts of text may still be in English.
|
||||||
|
@ -171,9 +176,6 @@ windows.wndsettings$langstab.transifex=All translation provided by volunteers th
|
||||||
windows.wndsettings$langstab.credits=credits
|
windows.wndsettings$langstab.credits=credits
|
||||||
windows.wndsettings$langstab.reviewers=reviewers
|
windows.wndsettings$langstab.reviewers=reviewers
|
||||||
windows.wndsettings$langstab.translators=translators
|
windows.wndsettings$langstab.translators=translators
|
||||||
windows.wndsettings$datatab.news=Check for news
|
|
||||||
windows.wndsettings$datatab.updates=Check for updates
|
|
||||||
windows.wndsettings$datatab.wifi=Only check on WiFi
|
|
||||||
|
|
||||||
windows.wndstartgame.title=Choose Your Hero
|
windows.wndstartgame.title=Choose Your Hero
|
||||||
windows.wndstartgame.huntress_unlock=Defeat the boss on floor 15 to unlock this character
|
windows.wndstartgame.huntress_unlock=Defeat the boss on floor 15 to unlock this character
|
||||||
|
|
|
@ -224,10 +224,6 @@ public class TitleScene extends PixelScene {
|
||||||
|
|
||||||
int pos = 2;
|
int pos = 2;
|
||||||
|
|
||||||
ExitButton btnExit = new ExitButton();
|
|
||||||
btnExit.setPos( w - btnExit.width(), 0 );
|
|
||||||
add( btnExit );
|
|
||||||
|
|
||||||
fadeIn();
|
fadeIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +313,7 @@ public class TitleScene extends PixelScene {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
if (blinking){
|
if (blinking){
|
||||||
WndSettings.last_index = 3;
|
WndSettings.last_index = 4;
|
||||||
}
|
}
|
||||||
ShatteredPixelDungeon.scene().add(new WndSettings());
|
ShatteredPixelDungeon.scene().add(new WndSettings());
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,14 +67,10 @@ public class WelcomeScene extends PixelScene {
|
||||||
title.brightness(0.6f);
|
title.brightness(0.6f);
|
||||||
add( title );
|
add( title );
|
||||||
|
|
||||||
float topRegion = Math.max(title.height, h*0.45f);
|
float topRegion = Math.max(title.height - 6, h*0.45f);
|
||||||
|
|
||||||
title.x = (w - title.width()) / 2f;
|
title.x = (w - title.width()) / 2f;
|
||||||
if (landscape()) {
|
title.y = 2 + (topRegion - title.height()) / 2f;
|
||||||
title.y = (topRegion - title.height()) / 2f;
|
|
||||||
} else {
|
|
||||||
title.y = 20 + (topRegion - title.height() - 20) / 2f;
|
|
||||||
}
|
|
||||||
|
|
||||||
align(title);
|
align(title);
|
||||||
|
|
||||||
|
@ -113,7 +109,8 @@ public class WelcomeScene extends PixelScene {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//FIXME these buttons are very low on 18:9 devices
|
float buttonY = Math.min(topRegion + (PixelScene.landscape() ? 60 : 120), h - 24);
|
||||||
|
|
||||||
if (previousVersion != 0){
|
if (previousVersion != 0){
|
||||||
StyledButton changes = new StyledButton(Chrome.Type.GREY_BUTTON_TR, Messages.get(TitleScene.class, "changes")){
|
StyledButton changes = new StyledButton(Chrome.Type.GREY_BUTTON_TR, Messages.get(TitleScene.class, "changes")){
|
||||||
@Override
|
@Override
|
||||||
|
@ -123,15 +120,15 @@ public class WelcomeScene extends PixelScene {
|
||||||
ShatteredPixelDungeon.switchScene(ChangesScene.class);
|
ShatteredPixelDungeon.switchScene(ChangesScene.class);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
okay.setRect(title.x, h-25, (title.width()/2)-2, 21);
|
okay.setRect(title.x, buttonY, (title.width()/2)-2, 20);
|
||||||
add(okay);
|
add(okay);
|
||||||
|
|
||||||
changes.setRect(okay.right()+2, h-25, (title.width()/2)-2, 21);
|
changes.setRect(okay.right()+2, buttonY, (title.width()/2)-2, 20);
|
||||||
changes.icon(Icons.get(Icons.CHANGES));
|
changes.icon(Icons.get(Icons.CHANGES));
|
||||||
add(changes);
|
add(changes);
|
||||||
} else {
|
} else {
|
||||||
okay.text(Messages.get(TitleScene.class, "enter"));
|
okay.text(Messages.get(TitleScene.class, "enter"));
|
||||||
okay.setRect(title.x, h-25, title.width(), 21);
|
okay.setRect(title.x, buttonY, title.width(), 20);
|
||||||
okay.icon(Icons.get(Icons.ENTER));
|
okay.icon(Icons.get(Icons.ENTER));
|
||||||
add(okay);
|
add(okay);
|
||||||
}
|
}
|
||||||
|
@ -157,8 +154,8 @@ public class WelcomeScene extends PixelScene {
|
||||||
message = Messages.get(this, "what_msg");
|
message = Messages.get(this, "what_msg");
|
||||||
}
|
}
|
||||||
text.text(message, w-20);
|
text.text(message, w-20);
|
||||||
float textSpace = h - title.y - (title.height() - 10) - okay.height() - 2;
|
float textSpace = okay.top() - topRegion - 4;
|
||||||
text.setPos((w - text.width()) / 2f, title.y+(title.height() - 10) + ((textSpace - text.height()) / 2));
|
text.setPos((w - text.width()) / 2f, (topRegion + 2) + (textSpace - text.height())/2);
|
||||||
add(text);
|
add(text);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -209,10 +206,4 @@ public class WelcomeScene extends PixelScene {
|
||||||
SPDSettings.version(ShatteredPixelDungeon.versionCode);
|
SPDSettings.version(ShatteredPixelDungeon.versionCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void placeTorch( float x, float y ) {
|
|
||||||
Fireball fb = new Fireball();
|
|
||||||
fb.setPos( x, y );
|
|
||||||
add( fb );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.HeroSelectScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.RankingsScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.RankingsScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.TitleScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.TitleScene;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||||
import com.watabou.noosa.Game;
|
import com.watabou.noosa.Game;
|
||||||
|
@ -48,30 +49,32 @@ public class WndGame extends Window {
|
||||||
|
|
||||||
super();
|
super();
|
||||||
|
|
||||||
addButton( new RedButton( Messages.get(this, "settings") ) {
|
RedButton curBtn;
|
||||||
|
addButton( curBtn = new RedButton( Messages.get(this, "settings") ) {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
hide();
|
hide();
|
||||||
GameScene.show(new WndSettings());
|
GameScene.show(new WndSettings());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
curBtn.icon(Icons.get(Icons.PREFS));
|
||||||
|
|
||||||
// Challenges window
|
// Challenges window
|
||||||
if (Dungeon.challenges > 0) {
|
if (Dungeon.challenges > 0) {
|
||||||
addButton( new RedButton( Messages.get(this, "challenges") ) {
|
addButton( curBtn = new RedButton( Messages.get(this, "challenges") ) {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
hide();
|
hide();
|
||||||
GameScene.show( new WndChallenges( Dungeon.challenges, false ) );
|
GameScene.show( new WndChallenges( Dungeon.challenges, false ) );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
curBtn.icon(Icons.get(Icons.CHALLENGE_ON));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restart
|
// Restart
|
||||||
if (Dungeon.hero == null || !Dungeon.hero.isAlive()) {
|
if (Dungeon.hero == null || !Dungeon.hero.isAlive()) {
|
||||||
|
|
||||||
RedButton btnStart;
|
addButton( curBtn = new RedButton( Messages.get(this, "start") ) {
|
||||||
addButton( btnStart = new RedButton( Messages.get(this, "start") ) {
|
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
InterlevelScene.noStory = true;
|
InterlevelScene.noStory = true;
|
||||||
|
@ -80,15 +83,17 @@ public class WndGame extends Window {
|
||||||
ShatteredPixelDungeon.switchScene(HeroSelectScene.class);
|
ShatteredPixelDungeon.switchScene(HeroSelectScene.class);
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
btnStart.textColor(Window.TITLE_COLOR);
|
curBtn.icon(Icons.get(Icons.ENTER));
|
||||||
|
curBtn.textColor(Window.TITLE_COLOR);
|
||||||
|
|
||||||
addButton( new RedButton( Messages.get(this, "rankings") ) {
|
addButton( curBtn = new RedButton( Messages.get(this, "rankings") ) {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
|
InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
|
||||||
Game.switchScene( RankingsScene.class );
|
Game.switchScene( RankingsScene.class );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
curBtn.icon(Icons.get(Icons.RANKINGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
addButtons(
|
addButtons(
|
||||||
|
|
|
@ -58,19 +58,16 @@ public class WndSettings extends WndTabbed {
|
||||||
|
|
||||||
private static final int SLIDER_HEIGHT = 24;
|
private static final int SLIDER_HEIGHT = 24;
|
||||||
private static final int BTN_HEIGHT = 18;
|
private static final int BTN_HEIGHT = 18;
|
||||||
private static final int GAP_TINY = 2;
|
private static final float GAP = 2;
|
||||||
private static final int GAP_SML = 6;
|
|
||||||
private static final int GAP_LRG = 18;
|
|
||||||
|
|
||||||
private DisplayTab display;
|
private DisplayTab display;
|
||||||
private UITab ui;
|
private UITab ui;
|
||||||
|
private DataTab data;
|
||||||
private AudioTab audio;
|
private AudioTab audio;
|
||||||
private LangsTab langs;
|
private LangsTab langs;
|
||||||
private DataTab data;
|
|
||||||
|
|
||||||
public static int last_index = 0;
|
public static int last_index = 0;
|
||||||
|
|
||||||
//FIXME now that this is totally refactored I should look into making this look neater. It's almost there
|
|
||||||
public WndSettings() {
|
public WndSettings() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
@ -106,6 +103,20 @@ public class WndSettings extends WndTabbed {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
data = new DataTab();
|
||||||
|
data.setSize(width, 0);
|
||||||
|
height = Math.max(height, data.height());
|
||||||
|
add( data );
|
||||||
|
|
||||||
|
add( new IconTab(Icons.get(Icons.DATA)){
|
||||||
|
@Override
|
||||||
|
protected void select(boolean value) {
|
||||||
|
super.select(value);
|
||||||
|
data.visible = data.active = value;
|
||||||
|
if (value) last_index = 2;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
audio = new AudioTab();
|
audio = new AudioTab();
|
||||||
audio.setSize(width, 0);
|
audio.setSize(width, 0);
|
||||||
height = Math.max(height, audio.height());
|
height = Math.max(height, audio.height());
|
||||||
|
@ -116,7 +127,7 @@ public class WndSettings extends WndTabbed {
|
||||||
protected void select(boolean value) {
|
protected void select(boolean value) {
|
||||||
super.select(value);
|
super.select(value);
|
||||||
audio.visible = audio.active = value;
|
audio.visible = audio.active = value;
|
||||||
if (value) last_index = 2;
|
if (value) last_index = 3;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -130,7 +141,7 @@ public class WndSettings extends WndTabbed {
|
||||||
protected void select(boolean value) {
|
protected void select(boolean value) {
|
||||||
super.select(value);
|
super.select(value);
|
||||||
langs.visible = langs.active = value;
|
langs.visible = langs.active = value;
|
||||||
if (value) last_index = 3;
|
if (value) last_index = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -148,20 +159,6 @@ public class WndSettings extends WndTabbed {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
data = new DataTab();
|
|
||||||
data.setSize(width, 0);
|
|
||||||
height = Math.max(height, data.height());
|
|
||||||
add( data );
|
|
||||||
|
|
||||||
add( new IconTab(Icons.get(Icons.DATA)){
|
|
||||||
@Override
|
|
||||||
protected void select(boolean value) {
|
|
||||||
super.select(value);
|
|
||||||
data.visible = data.active = value;
|
|
||||||
if (value) last_index = 4;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
resize(width, (int)Math.ceil(height));
|
resize(width, (int)Math.ceil(height));
|
||||||
|
|
||||||
layoutTabs();
|
layoutTabs();
|
||||||
|
@ -188,15 +185,24 @@ public class WndSettings extends WndTabbed {
|
||||||
|
|
||||||
private static class DisplayTab extends Component {
|
private static class DisplayTab extends Component {
|
||||||
|
|
||||||
|
RenderedTextBlock title;
|
||||||
|
ColorBlock sep1;
|
||||||
OptionSlider optScale;
|
OptionSlider optScale;
|
||||||
CheckBox chkSaver;
|
CheckBox chkSaver;
|
||||||
RedButton btnOrientation;
|
RedButton btnOrientation;
|
||||||
|
ColorBlock sep2;
|
||||||
OptionSlider optBrightness;
|
OptionSlider optBrightness;
|
||||||
OptionSlider optVisGrid;
|
OptionSlider optVisGrid;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createChildren() {
|
protected void createChildren() {
|
||||||
|
title = PixelScene.renderTextBlock(Messages.get(this, "title"), 9);
|
||||||
|
title.hardlight(TITLE_COLOR);
|
||||||
|
add(title);
|
||||||
|
|
||||||
|
sep1 = new ColorBlock(1, 1, 0xFF000000);
|
||||||
|
add(sep1);
|
||||||
|
|
||||||
if ((int)Math.ceil(2* Game.density) < PixelScene.maxDefaultZoom) {
|
if ((int)Math.ceil(2* Game.density) < PixelScene.maxDefaultZoom) {
|
||||||
optScale = new OptionSlider(Messages.get(this, "scale"),
|
optScale = new OptionSlider(Messages.get(this, "scale"),
|
||||||
(int)Math.ceil(2* Game.density)+ "X",
|
(int)Math.ceil(2* Game.density)+ "X",
|
||||||
|
@ -256,6 +262,9 @@ public class WndSettings extends WndTabbed {
|
||||||
add(btnOrientation);
|
add(btnOrientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sep2 = new ColorBlock(1, 1, 0xFF000000);
|
||||||
|
add(sep2);
|
||||||
|
|
||||||
optBrightness = new OptionSlider(Messages.get(this, "brightness"),
|
optBrightness = new OptionSlider(Messages.get(this, "brightness"),
|
||||||
Messages.get(this, "dark"), Messages.get(this, "bright"), -1, 1) {
|
Messages.get(this, "dark"), Messages.get(this, "bright"), -1, 1) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -281,35 +290,45 @@ public class WndSettings extends WndTabbed {
|
||||||
@Override
|
@Override
|
||||||
protected void layout() {
|
protected void layout() {
|
||||||
|
|
||||||
float bottom = 0;
|
float bottom = y;
|
||||||
|
|
||||||
|
title.setPos((width - title.width())/2, bottom + GAP);
|
||||||
|
sep1.size(width, 1);
|
||||||
|
sep1.y = title.bottom() + 2*GAP;
|
||||||
|
|
||||||
|
bottom = sep1.y + 1;
|
||||||
|
|
||||||
if (optScale != null){
|
if (optScale != null){
|
||||||
optScale.setRect(0, 0, width, SLIDER_HEIGHT);
|
optScale.setRect(0, bottom + GAP, width, SLIDER_HEIGHT);
|
||||||
bottom = optScale.bottom();
|
bottom = optScale.bottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (width > 200 && chkSaver != null && btnOrientation != null) {
|
if (width > 200 && chkSaver != null && btnOrientation != null) {
|
||||||
chkSaver.setRect(0, bottom + GAP_TINY, width/2-1, BTN_HEIGHT);
|
chkSaver.setRect(0, bottom + GAP, width/2-1, BTN_HEIGHT);
|
||||||
btnOrientation.setRect(chkSaver.right()+GAP_TINY, bottom + GAP_TINY, width/2-1, BTN_HEIGHT);
|
btnOrientation.setRect(chkSaver.right()+ GAP, bottom + GAP, width/2-1, BTN_HEIGHT);
|
||||||
bottom = btnOrientation.bottom();
|
bottom = btnOrientation.bottom();
|
||||||
} else {
|
} else {
|
||||||
if (chkSaver != null) {
|
if (chkSaver != null) {
|
||||||
chkSaver.setRect(0, bottom + GAP_TINY, width, BTN_HEIGHT);
|
chkSaver.setRect(0, bottom + GAP, width, BTN_HEIGHT);
|
||||||
bottom = chkSaver.bottom();
|
bottom = chkSaver.bottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (btnOrientation != null) {
|
if (btnOrientation != null) {
|
||||||
btnOrientation.setRect(0, bottom + GAP_TINY, width, BTN_HEIGHT);
|
btnOrientation.setRect(0, bottom + GAP, width, BTN_HEIGHT);
|
||||||
bottom = btnOrientation.bottom();
|
bottom = btnOrientation.bottom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sep2.size(width, 1);
|
||||||
|
sep2.y = bottom + GAP;
|
||||||
|
bottom = sep2.y + 1;
|
||||||
|
|
||||||
if (width > 200){
|
if (width > 200){
|
||||||
optBrightness.setRect(0, bottom + GAP_LRG, width/2-1, SLIDER_HEIGHT);
|
optBrightness.setRect(0, bottom + GAP, width/2-GAP/2, SLIDER_HEIGHT);
|
||||||
optVisGrid.setRect(optBrightness.right() + GAP_TINY, optBrightness.top(), width/2-1, SLIDER_HEIGHT);
|
optVisGrid.setRect(optBrightness.right() + GAP, optBrightness.top(), width/2-GAP/2, SLIDER_HEIGHT);
|
||||||
} else {
|
} else {
|
||||||
optBrightness.setRect(0, bottom + GAP_LRG, width, SLIDER_HEIGHT);
|
optBrightness.setRect(0, bottom + GAP, width, SLIDER_HEIGHT);
|
||||||
optVisGrid.setRect(0, optBrightness.bottom() + GAP_TINY, width, SLIDER_HEIGHT);
|
optVisGrid.setRect(0, optBrightness.bottom() + GAP, width, SLIDER_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
height = optVisGrid.bottom();
|
height = optVisGrid.bottom();
|
||||||
|
@ -319,18 +338,27 @@ public class WndSettings extends WndTabbed {
|
||||||
|
|
||||||
private static class UITab extends Component {
|
private static class UITab extends Component {
|
||||||
|
|
||||||
|
RenderedTextBlock title;
|
||||||
|
ColorBlock sep1;
|
||||||
RenderedTextBlock barDesc;
|
RenderedTextBlock barDesc;
|
||||||
RedButton btnSplit; RedButton btnGrouped; RedButton btnCentered;
|
RedButton btnSplit; RedButton btnGrouped; RedButton btnCentered;
|
||||||
CheckBox chkFlipToolbar;
|
CheckBox chkFlipToolbar;
|
||||||
CheckBox chkFlipTags;
|
CheckBox chkFlipTags;
|
||||||
|
ColorBlock sep2;
|
||||||
CheckBox chkFullscreen;
|
CheckBox chkFullscreen;
|
||||||
CheckBox chkFont;
|
CheckBox chkFont;
|
||||||
|
ColorBlock sep3;
|
||||||
RedButton btnKeyBindings;
|
RedButton btnKeyBindings;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createChildren() {
|
protected void createChildren() {
|
||||||
|
title = PixelScene.renderTextBlock(Messages.get(this, "title"), 9);
|
||||||
|
title.hardlight(TITLE_COLOR);
|
||||||
|
add(title);
|
||||||
|
|
||||||
|
sep1 = new ColorBlock(1, 1, 0xFF000000);
|
||||||
|
add(sep1);
|
||||||
|
|
||||||
barDesc = PixelScene.renderTextBlock(Messages.get(this, "mode"), 9);
|
barDesc = PixelScene.renderTextBlock(Messages.get(this, "mode"), 9);
|
||||||
add(barDesc);
|
add(barDesc);
|
||||||
|
|
||||||
|
@ -395,6 +423,9 @@ public class WndSettings extends WndTabbed {
|
||||||
chkFlipTags.checked(SPDSettings.flipTags());
|
chkFlipTags.checked(SPDSettings.flipTags());
|
||||||
add(chkFlipTags);
|
add(chkFlipTags);
|
||||||
|
|
||||||
|
sep2 = new ColorBlock(1, 1, 0xFF000000);
|
||||||
|
add(sep2);
|
||||||
|
|
||||||
chkFullscreen = new CheckBox( Messages.get(this, "fullscreen") ) {
|
chkFullscreen = new CheckBox( Messages.get(this, "fullscreen") ) {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
|
@ -423,11 +454,14 @@ public class WndSettings extends WndTabbed {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
chkFont.checked(SPDSettings.systemFont());
|
chkFont.checked(SPDSettings.systemFont());
|
||||||
add(chkFont);
|
add(chkFont);
|
||||||
|
|
||||||
if (DeviceCompat.hasHardKeyboard()){
|
if (DeviceCompat.hasHardKeyboard()){
|
||||||
|
|
||||||
|
sep3 = new ColorBlock(1, 1, 0xFF000000);
|
||||||
|
add(sep3);
|
||||||
|
|
||||||
btnKeyBindings = new RedButton(Messages.get(this, "key_bindings")){
|
btnKeyBindings = new RedButton(Messages.get(this, "key_bindings")){
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
|
@ -442,30 +476,38 @@ public class WndSettings extends WndTabbed {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void layout() {
|
protected void layout() {
|
||||||
barDesc.setPos((width-barDesc.width())/2f, GAP_TINY);
|
title.setPos((width - title.width())/2, y + GAP);
|
||||||
|
sep1.size(width, 1);
|
||||||
|
sep1.y = title.bottom() + 2*GAP;
|
||||||
|
|
||||||
|
barDesc.setPos((width-barDesc.width())/2f, sep1.y + 1 + GAP);
|
||||||
PixelScene.align(barDesc);
|
PixelScene.align(barDesc);
|
||||||
|
|
||||||
int btnWidth = (int)(width - 2*GAP_TINY)/3;
|
int btnWidth = (int)(width - 2* GAP)/3;
|
||||||
btnSplit.setRect(0, barDesc.bottom() + GAP_TINY, btnWidth, 16);
|
btnSplit.setRect(0, barDesc.bottom() + GAP, btnWidth, 16);
|
||||||
btnGrouped.setRect(btnSplit.right()+GAP_TINY, btnSplit.top(), btnWidth, 16);
|
btnGrouped.setRect(btnSplit.right()+ GAP, btnSplit.top(), btnWidth, 16);
|
||||||
btnCentered.setRect(btnGrouped.right()+GAP_TINY, btnSplit.top(), btnWidth, 16);
|
btnCentered.setRect(btnGrouped.right()+ GAP, btnSplit.top(), btnWidth, 16);
|
||||||
|
|
||||||
if (width > 200) {
|
if (width > 200) {
|
||||||
chkFlipToolbar.setRect(0, btnGrouped.bottom() + GAP_TINY, width/2 - 1, BTN_HEIGHT);
|
chkFlipToolbar.setRect(0, btnGrouped.bottom() + GAP, width/2 - 1, BTN_HEIGHT);
|
||||||
chkFlipTags.setRect(chkFlipToolbar.right() + GAP_TINY, chkFlipToolbar.top(), width/2 -1, BTN_HEIGHT);
|
chkFlipTags.setRect(chkFlipToolbar.right() + GAP, chkFlipToolbar.top(), width/2 -1, BTN_HEIGHT);
|
||||||
|
sep2.size(width, 1);
|
||||||
chkFullscreen.setRect(0, chkFlipTags.bottom() + GAP_SML, width/2 - 1, BTN_HEIGHT);
|
sep2.y = chkFlipTags.bottom() + 2;
|
||||||
chkFont.setRect(chkFullscreen.right() + GAP_TINY, chkFullscreen.top(), width/2 - 1, BTN_HEIGHT);
|
chkFullscreen.setRect(0, sep2.y + 1 + GAP, width/2 - 1, BTN_HEIGHT);
|
||||||
|
chkFont.setRect(chkFullscreen.right() + GAP, chkFullscreen.top(), width/2 - 1, BTN_HEIGHT);
|
||||||
} else {
|
} else {
|
||||||
chkFlipToolbar.setRect(0, btnGrouped.bottom() + GAP_TINY, width, BTN_HEIGHT);
|
chkFlipToolbar.setRect(0, btnGrouped.bottom() + GAP, width, BTN_HEIGHT);
|
||||||
chkFlipTags.setRect(0, chkFlipToolbar.bottom() + GAP_TINY, width, BTN_HEIGHT);
|
chkFlipTags.setRect(0, chkFlipToolbar.bottom() + GAP, width, BTN_HEIGHT);
|
||||||
|
sep2.size(width, 1);
|
||||||
chkFullscreen.setRect(0, chkFlipTags.bottom() + GAP_SML, width, BTN_HEIGHT);
|
sep2.y = chkFlipTags.bottom() + 2;
|
||||||
chkFont.setRect(0, chkFullscreen.bottom() + GAP_TINY, width, BTN_HEIGHT);
|
chkFullscreen.setRect(0, sep2.y + 1 + GAP, width, BTN_HEIGHT);
|
||||||
|
chkFont.setRect(0, chkFullscreen.bottom() + GAP, width, BTN_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (btnKeyBindings != null){
|
if (btnKeyBindings != null){
|
||||||
btnKeyBindings.setRect(0, chkFont.bottom() + GAP_SML, width, BTN_HEIGHT);
|
sep3.size(width, 1);
|
||||||
|
sep3.y = chkFont.bottom() + 2;
|
||||||
|
btnKeyBindings.setRect(0, sep3.y + 1 + GAP, width, BTN_HEIGHT);
|
||||||
height = btnKeyBindings.bottom();
|
height = btnKeyBindings.bottom();
|
||||||
} else {
|
} else {
|
||||||
height = chkFont.bottom();
|
height = chkFont.bottom();
|
||||||
|
@ -474,16 +516,102 @@ public class WndSettings extends WndTabbed {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class DataTab extends Component{
|
||||||
|
|
||||||
|
RenderedTextBlock title;
|
||||||
|
ColorBlock sep1;
|
||||||
|
CheckBox chkNews;
|
||||||
|
CheckBox chkUpdates;
|
||||||
|
CheckBox chkWifi;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void createChildren() {
|
||||||
|
title = PixelScene.renderTextBlock(Messages.get(this, "title"), 9);
|
||||||
|
title.hardlight(TITLE_COLOR);
|
||||||
|
add(title);
|
||||||
|
|
||||||
|
sep1 = new ColorBlock(1, 1, 0xFF000000);
|
||||||
|
add(sep1);
|
||||||
|
|
||||||
|
chkNews = new CheckBox(Messages.get(this, "news")){
|
||||||
|
@Override
|
||||||
|
protected void onClick() {
|
||||||
|
super.onClick();
|
||||||
|
SPDSettings.news(checked());
|
||||||
|
News.clearArticles();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
chkNews.checked(SPDSettings.news());
|
||||||
|
add(chkNews);
|
||||||
|
|
||||||
|
chkUpdates = new CheckBox(Messages.get(this, "updates")){
|
||||||
|
@Override
|
||||||
|
protected void onClick() {
|
||||||
|
super.onClick();
|
||||||
|
SPDSettings.updates(checked());
|
||||||
|
Updates.clearUpdate();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
chkUpdates.checked(SPDSettings.updates());
|
||||||
|
add(chkUpdates);
|
||||||
|
|
||||||
|
if (!DeviceCompat.isDesktop()){
|
||||||
|
chkWifi = new CheckBox(Messages.get(this, "wifi")){
|
||||||
|
@Override
|
||||||
|
protected void onClick() {
|
||||||
|
super.onClick();
|
||||||
|
SPDSettings.WiFi(checked());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
chkWifi.checked(SPDSettings.WiFi());
|
||||||
|
add(chkWifi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void layout() {
|
||||||
|
title.setPos((width - title.width())/2, y + GAP);
|
||||||
|
sep1.size(width, 1);
|
||||||
|
sep1.y = title.bottom() + 2*GAP;
|
||||||
|
|
||||||
|
if (width > 200){
|
||||||
|
chkNews.setRect(0, sep1.y + 1 + GAP, width/2-1, BTN_HEIGHT);
|
||||||
|
chkUpdates.setRect(chkNews.right() + GAP, chkNews.top(), width/2-1, BTN_HEIGHT);
|
||||||
|
} else {
|
||||||
|
chkNews.setRect(0, sep1.y + 1 + GAP, width, BTN_HEIGHT);
|
||||||
|
chkUpdates.setRect(0, chkNews.bottom()+ GAP, width, BTN_HEIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
float pos = chkUpdates.bottom();
|
||||||
|
if (chkWifi != null){
|
||||||
|
chkWifi.setRect(0, pos + GAP, width, BTN_HEIGHT);
|
||||||
|
pos = chkWifi.bottom();
|
||||||
|
}
|
||||||
|
|
||||||
|
height = pos;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static class AudioTab extends Component {
|
private static class AudioTab extends Component {
|
||||||
|
|
||||||
|
RenderedTextBlock title;
|
||||||
|
ColorBlock sep1;
|
||||||
OptionSlider optMusic;
|
OptionSlider optMusic;
|
||||||
CheckBox chkMusicMute;
|
CheckBox chkMusicMute;
|
||||||
|
ColorBlock sep2;
|
||||||
OptionSlider optSFX;
|
OptionSlider optSFX;
|
||||||
CheckBox chkMuteSFX;
|
CheckBox chkMuteSFX;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createChildren() {
|
protected void createChildren() {
|
||||||
|
title = PixelScene.renderTextBlock(Messages.get(this, "title"), 9);
|
||||||
|
title.hardlight(TITLE_COLOR);
|
||||||
|
add(title);
|
||||||
|
|
||||||
|
sep1 = new ColorBlock(1, 1, 0xFF000000);
|
||||||
|
add(sep1);
|
||||||
|
|
||||||
optMusic = new OptionSlider(Messages.get(this, "music_vol"), "0", "10", 0, 10) {
|
optMusic = new OptionSlider(Messages.get(this, "music_vol"), "0", "10", 0, 10) {
|
||||||
@Override
|
@Override
|
||||||
protected void onChange() {
|
protected void onChange() {
|
||||||
|
@ -503,6 +631,9 @@ public class WndSettings extends WndTabbed {
|
||||||
chkMusicMute.checked(!SPDSettings.music());
|
chkMusicMute.checked(!SPDSettings.music());
|
||||||
add(chkMusicMute);
|
add(chkMusicMute);
|
||||||
|
|
||||||
|
sep2 = new ColorBlock(1, 1, 0xFF000000);
|
||||||
|
add(sep2);
|
||||||
|
|
||||||
optSFX = new OptionSlider(Messages.get(this, "sfx_vol"), "0", "10", 0, 10) {
|
optSFX = new OptionSlider(Messages.get(this, "sfx_vol"), "0", "10", 0, 10) {
|
||||||
@Override
|
@Override
|
||||||
protected void onChange() {
|
protected void onChange() {
|
||||||
|
@ -536,11 +667,18 @@ public class WndSettings extends WndTabbed {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void layout() {
|
protected void layout() {
|
||||||
optMusic.setRect(0, 0, width, SLIDER_HEIGHT);
|
title.setPos((width - title.width())/2, y + GAP);
|
||||||
chkMusicMute.setRect(0, optMusic.bottom() + GAP_TINY, width, BTN_HEIGHT);
|
sep1.size(width, 1);
|
||||||
|
sep1.y = title.bottom() + 2*GAP;
|
||||||
|
|
||||||
optSFX.setRect(0, chkMusicMute.bottom() + GAP_LRG, width, SLIDER_HEIGHT);
|
optMusic.setRect(0, sep1.y + 1 + GAP, width, SLIDER_HEIGHT);
|
||||||
chkMuteSFX.setRect(0, optSFX.bottom() + GAP_TINY, width, BTN_HEIGHT);
|
chkMusicMute.setRect(0, optMusic.bottom() + GAP, width, BTN_HEIGHT);
|
||||||
|
|
||||||
|
sep2.size(width, 1);
|
||||||
|
sep2.y = chkMusicMute.bottom() + GAP;
|
||||||
|
|
||||||
|
optSFX.setRect(0, sep2.y + 1 + GAP, width, SLIDER_HEIGHT);
|
||||||
|
chkMuteSFX.setRect(0, optSFX.bottom() + GAP, width, BTN_HEIGHT);
|
||||||
|
|
||||||
height = chkMuteSFX.bottom();
|
height = chkMuteSFX.bottom();
|
||||||
}
|
}
|
||||||
|
@ -552,22 +690,27 @@ public class WndSettings extends WndTabbed {
|
||||||
final static int COLS_P = 3;
|
final static int COLS_P = 3;
|
||||||
final static int COLS_L = 4;
|
final static int COLS_L = 4;
|
||||||
|
|
||||||
final static int BTN_HEIGHT = 12;
|
final static int BTN_HEIGHT = 11;
|
||||||
|
|
||||||
|
RenderedTextBlock title;
|
||||||
|
ColorBlock sep1;
|
||||||
RenderedTextBlock txtLangName;
|
RenderedTextBlock txtLangName;
|
||||||
RenderedTextBlock txtLangInfo;
|
RenderedTextBlock txtLangInfo;
|
||||||
|
|
||||||
ColorBlock sep1;
|
|
||||||
|
|
||||||
RedButton[] lanBtns;
|
|
||||||
|
|
||||||
ColorBlock sep2;
|
ColorBlock sep2;
|
||||||
|
RedButton[] lanBtns;
|
||||||
|
ColorBlock sep3;
|
||||||
RenderedTextBlock txtTranifex;
|
RenderedTextBlock txtTranifex;
|
||||||
RedButton btnCredits;
|
RedButton btnCredits;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createChildren() {
|
protected void createChildren() {
|
||||||
|
title = PixelScene.renderTextBlock(Messages.get(this, "title"), 9);
|
||||||
|
title.hardlight(TITLE_COLOR);
|
||||||
|
add(title);
|
||||||
|
|
||||||
|
sep1 = new ColorBlock(1, 1, 0xFF000000);
|
||||||
|
add(sep1);
|
||||||
|
|
||||||
final ArrayList<Languages> langs = new ArrayList<>(Arrays.asList(Languages.values()));
|
final ArrayList<Languages> langs = new ArrayList<>(Arrays.asList(Languages.values()));
|
||||||
|
|
||||||
Languages nativeLang = Languages.matchLocale(Locale.getDefault());
|
Languages nativeLang = Languages.matchLocale(Locale.getDefault());
|
||||||
|
@ -578,7 +721,9 @@ public class WndSettings extends WndTabbed {
|
||||||
final Languages currLang = Messages.lang();
|
final Languages currLang = Messages.lang();
|
||||||
|
|
||||||
txtLangName = PixelScene.renderTextBlock( Messages.titleCase(currLang.nativeName()) , 9 );
|
txtLangName = PixelScene.renderTextBlock( Messages.titleCase(currLang.nativeName()) , 9 );
|
||||||
txtLangName.hardlight(TITLE_COLOR);
|
if (currLang.status() == Languages.Status.REVIEWED) txtLangName.hardlight(TITLE_COLOR);
|
||||||
|
else if (currLang.status() == Languages.Status.UNREVIEWED) txtLangName.hardlight(CharSprite.WARNING);
|
||||||
|
else if (currLang.status() == Languages.Status.INCOMPLETE) txtLangName.hardlight(CharSprite.NEGATIVE);
|
||||||
add(txtLangName);
|
add(txtLangName);
|
||||||
|
|
||||||
txtLangInfo = PixelScene.renderTextBlock(6);
|
txtLangInfo = PixelScene.renderTextBlock(6);
|
||||||
|
@ -590,8 +735,8 @@ public class WndSettings extends WndTabbed {
|
||||||
else if (currLang.status() == Languages.Status.INCOMPLETE) txtLangInfo.setHightlighting(true, CharSprite.NEGATIVE);
|
else if (currLang.status() == Languages.Status.INCOMPLETE) txtLangInfo.setHightlighting(true, CharSprite.NEGATIVE);
|
||||||
add(txtLangInfo);
|
add(txtLangInfo);
|
||||||
|
|
||||||
sep1 = new ColorBlock(1, 1, 0xFF000000);
|
sep2 = new ColorBlock(1, 1, 0xFF000000);
|
||||||
add(sep1);
|
add(sep2);
|
||||||
|
|
||||||
lanBtns = new RedButton[langs.size()];
|
lanBtns = new RedButton[langs.size()];
|
||||||
for (int i = 0; i < langs.size(); i++){
|
for (int i = 0; i < langs.size(); i++){
|
||||||
|
@ -631,8 +776,8 @@ public class WndSettings extends WndTabbed {
|
||||||
add(btn);
|
add(btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
sep2 = new ColorBlock(1, 1, 0xFF000000);
|
sep3 = new ColorBlock(1, 1, 0xFF000000);
|
||||||
add(sep2);
|
add(sep3);
|
||||||
|
|
||||||
txtTranifex = PixelScene.renderTextBlock(6);
|
txtTranifex = PixelScene.renderTextBlock(6);
|
||||||
txtTranifex.text(Messages.get(this, "transifex"));
|
txtTranifex.text(Messages.get(this, "transifex"));
|
||||||
|
@ -714,18 +859,21 @@ public class WndSettings extends WndTabbed {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void layout() {
|
protected void layout() {
|
||||||
txtLangName.setPos( (width - txtLangName.width())/2f, 2 );
|
title.setPos((width - title.width())/2, y + GAP);
|
||||||
|
sep1.size(width, 1);
|
||||||
|
sep1.y = title.bottom() + 2*GAP;
|
||||||
|
|
||||||
|
txtLangName.setPos( (width - txtLangName.width())/2f, sep1.y + 1 + GAP );
|
||||||
PixelScene.align(txtLangName);
|
PixelScene.align(txtLangName);
|
||||||
|
|
||||||
txtLangInfo.setPos(0, txtLangName.bottom() + 4);
|
txtLangInfo.setPos(0, txtLangName.bottom() + 2*GAP);
|
||||||
txtLangInfo.maxWidth((int)width);
|
txtLangInfo.maxWidth((int)width);
|
||||||
|
|
||||||
int y = PixelScene.landscape() ? 26 : 32;
|
y = txtLangInfo.bottom() + GAP;
|
||||||
y = Math.max(y, (int)Math.ceil(txtLangInfo.bottom()+1));
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
|
|
||||||
sep1.size(width, 1);
|
sep2.size(width, 1);
|
||||||
sep1.y = y;
|
sep2.y = y;
|
||||||
y += 2;
|
y += 2;
|
||||||
|
|
||||||
int cols = PixelScene.landscape() ? COLS_L : COLS_P;
|
int cols = PixelScene.landscape() ? COLS_L : COLS_P;
|
||||||
|
@ -743,8 +891,8 @@ public class WndSettings extends WndTabbed {
|
||||||
y += BTN_HEIGHT+1;
|
y += BTN_HEIGHT+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sep2.size(width, 1);
|
sep3.size(width, 1);
|
||||||
sep2.y = y;
|
sep3.y = y;
|
||||||
y += 2;
|
y += 2;
|
||||||
|
|
||||||
if (btnCredits != null){
|
if (btnCredits != null){
|
||||||
|
@ -764,68 +912,4 @@ public class WndSettings extends WndTabbed {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class DataTab extends Component{
|
|
||||||
|
|
||||||
CheckBox chkNews;
|
|
||||||
CheckBox chkUpdates;
|
|
||||||
CheckBox chkWifi;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void createChildren() {
|
|
||||||
chkNews = new CheckBox(Messages.get(this, "news")){
|
|
||||||
@Override
|
|
||||||
protected void onClick() {
|
|
||||||
super.onClick();
|
|
||||||
SPDSettings.news(checked());
|
|
||||||
News.clearArticles();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
chkNews.checked(SPDSettings.news());
|
|
||||||
add(chkNews);
|
|
||||||
|
|
||||||
chkUpdates = new CheckBox(Messages.get(this, "updates")){
|
|
||||||
@Override
|
|
||||||
protected void onClick() {
|
|
||||||
super.onClick();
|
|
||||||
SPDSettings.updates(checked());
|
|
||||||
Updates.clearUpdate();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
chkUpdates.checked(SPDSettings.updates());
|
|
||||||
add(chkUpdates);
|
|
||||||
|
|
||||||
if (!DeviceCompat.isDesktop()){
|
|
||||||
chkWifi = new CheckBox(Messages.get(this, "wifi")){
|
|
||||||
@Override
|
|
||||||
protected void onClick() {
|
|
||||||
super.onClick();
|
|
||||||
SPDSettings.WiFi(checked());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
chkWifi.checked(SPDSettings.WiFi());
|
|
||||||
add(chkWifi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void layout() {
|
|
||||||
if (width > 200){
|
|
||||||
chkNews.setRect(0, 0, width/2-1, BTN_HEIGHT);
|
|
||||||
chkUpdates.setRect(chkNews.right() + GAP_TINY, chkNews.top(), width/2-1, BTN_HEIGHT);
|
|
||||||
} else {
|
|
||||||
chkNews.setRect(0, 0, width, BTN_HEIGHT);
|
|
||||||
chkUpdates.setRect(0, chkNews.bottom()+GAP_TINY, width, BTN_HEIGHT);
|
|
||||||
}
|
|
||||||
|
|
||||||
float pos = chkUpdates.bottom();
|
|
||||||
if (chkWifi != null){
|
|
||||||
chkWifi.setRect(0, pos + GAP_TINY, width, BTN_HEIGHT);
|
|
||||||
pos = chkWifi.bottom();
|
|
||||||
}
|
|
||||||
|
|
||||||
height = pos;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user