mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-23 19:34:08 +01:00
DroidFish: Made the large buttons a little smaller when all three custom buttons are visible.
This commit is contained in:
parent
789c734337
commit
10c80e802c
|
@ -49,6 +49,15 @@ public class ButtonActions {
|
|||
this.menuTitle = menuTitle;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
if (mainAction != null)
|
||||
return true;
|
||||
for (UIAction a : menuActions)
|
||||
if (a != null)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Connect GUI button. */
|
||||
public void setImageButton(ImageButton button, final Activity activity) {
|
||||
this.button = button;
|
||||
|
|
|
@ -802,9 +802,22 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||
int bWidth = (int)Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 36, r.getDisplayMetrics()));
|
||||
int bHeight = (int)Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 32, r.getDisplayMetrics()));
|
||||
if (largeButtons) {
|
||||
if (custom1ButtonActions.isEnabled() &&
|
||||
custom2ButtonActions.isEnabled() &&
|
||||
custom3ButtonActions.isEnabled()) {
|
||||
Configuration config = getResources().getConfiguration();
|
||||
if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
bWidth = bWidth * 6 / 5;
|
||||
bHeight = bHeight * 6 / 5;
|
||||
} else {
|
||||
bWidth = bWidth * 5 / 4;
|
||||
bHeight = bHeight * 5 / 4;
|
||||
}
|
||||
} else {
|
||||
bWidth = bWidth * 3 / 2;
|
||||
bHeight = bHeight * 3 / 2;
|
||||
}
|
||||
}
|
||||
SVG svg = SVGParser.getSVGFromResource(getResources(), R.raw.touch);
|
||||
setButtonData(custom1Button, bWidth, bHeight, custom1ButtonActions.getIcon(), svg);
|
||||
setButtonData(custom2Button, bWidth, bHeight, custom2ButtonActions.getIcon(), svg);
|
||||
|
|
Loading…
Reference in New Issue
Block a user