mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-04-01 09:51:00 +02:00
DroidFish: Cosmetic changes.
This commit is contained in:
parent
7fd384ac7b
commit
447e8de9c7
@ -1483,54 +1483,30 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
@Override
|
@Override
|
||||||
protected Dialog onCreateDialog(int id) {
|
protected Dialog onCreateDialog(int id) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case NEW_GAME_DIALOG:
|
case NEW_GAME_DIALOG: return newGameDialog();
|
||||||
return newGameDialog();
|
case PROMOTE_DIALOG: return promoteDialog();
|
||||||
case PROMOTE_DIALOG:
|
case BOARD_MENU_DIALOG: return boardMenuDialog();
|
||||||
return promoteDialog();
|
case FILE_MENU_DIALOG: return fileMenuDialog();
|
||||||
case BOARD_MENU_DIALOG:
|
case ABOUT_DIALOG: return aboutDialog();
|
||||||
return boardMenuDialog();
|
case SELECT_MOVE_DIALOG: return selectMoveDialog();
|
||||||
case FILE_MENU_DIALOG:
|
case SELECT_BOOK_DIALOG: return selectBookDialog();
|
||||||
return fileMenuDialog();
|
case SELECT_ENGINE_DIALOG: return selectEngineDialog();
|
||||||
case ABOUT_DIALOG:
|
case SELECT_PGN_FILE_DIALOG: return selectPgnFileDialog();
|
||||||
return aboutDialog();
|
case SELECT_PGN_FILE_SAVE_DIALOG: return selectPgnFileSaveDialog();
|
||||||
case SELECT_MOVE_DIALOG:
|
case SELECT_PGN_SAVE_NEWFILE_DIALOG: return selectPgnSaveNewFileDialog();
|
||||||
return selectMoveDialog();
|
case SET_COLOR_THEME_DIALOG: return setColorThemeDialog();
|
||||||
case SELECT_BOOK_DIALOG:
|
case GAME_MODE_DIALOG: return gameModeDialog();
|
||||||
return selectBookDialog();
|
case MOVELIST_MENU_DIALOG: return moveListMenuDialog();
|
||||||
case SELECT_ENGINE_DIALOG:
|
case THINKING_MENU_DIALOG: return thinkingMenuDialog();
|
||||||
return selectEngineDialog();
|
case GO_BACK_MENU_DIALOG: return goBackMenuDialog();
|
||||||
case SELECT_PGN_FILE_DIALOG:
|
case GO_FORWARD_MENU_DIALOG: return goForwardMenuDialog();
|
||||||
return selectPgnFileDialog();
|
case CUSTOM1_BUTTON_DIALOG: return makeButtonDialog(custom1ButtonActions);
|
||||||
case SELECT_PGN_FILE_SAVE_DIALOG:
|
case CUSTOM2_BUTTON_DIALOG: return makeButtonDialog(custom2ButtonActions);
|
||||||
return selectPgnFileSaveDialog();
|
case CUSTOM3_BUTTON_DIALOG: return makeButtonDialog(custom3ButtonActions);
|
||||||
case SELECT_PGN_SAVE_NEWFILE_DIALOG:
|
case MANAGE_ENGINES_DIALOG: return manageEnginesDialog();
|
||||||
return selectPgnSaveNewFileDialog();
|
case NETWORK_ENGINE_DIALOG: return networkEngineDialog();
|
||||||
case SET_COLOR_THEME_DIALOG:
|
case NEW_NETWORK_ENGINE_DIALOG: return newNetworkEngineDialog();
|
||||||
return setColorThemeDialog();
|
case NETWORK_ENGINE_CONFIG_DIALOG: return networkEngineConfigDialog();
|
||||||
case GAME_MODE_DIALOG:
|
|
||||||
return gameModeDialog();
|
|
||||||
case MOVELIST_MENU_DIALOG:
|
|
||||||
return moveListMenuDialog();
|
|
||||||
case THINKING_MENU_DIALOG:
|
|
||||||
return thinkingMenuDialog();
|
|
||||||
case GO_BACK_MENU_DIALOG:
|
|
||||||
return goBackMenuDialog();
|
|
||||||
case GO_FORWARD_MENU_DIALOG:
|
|
||||||
return goForwardMenuDialog();
|
|
||||||
case CUSTOM1_BUTTON_DIALOG:
|
|
||||||
return makeButtonDialog(custom1ButtonActions);
|
|
||||||
case CUSTOM2_BUTTON_DIALOG:
|
|
||||||
return makeButtonDialog(custom2ButtonActions);
|
|
||||||
case CUSTOM3_BUTTON_DIALOG:
|
|
||||||
return makeButtonDialog(custom3ButtonActions);
|
|
||||||
case MANAGE_ENGINES_DIALOG:
|
|
||||||
return manageEnginesDialog();
|
|
||||||
case NETWORK_ENGINE_DIALOG:
|
|
||||||
return networkEngineDialog();
|
|
||||||
case NEW_NETWORK_ENGINE_DIALOG:
|
|
||||||
return newNetworkEngineDialog();
|
|
||||||
case NETWORK_ENGINE_CONFIG_DIALOG:
|
|
||||||
return networkEngineConfigDialog();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -1647,6 +1623,14 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
return alert;
|
return alert;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final void shareGame() {
|
||||||
|
Intent i = new Intent(Intent.ACTION_SEND);
|
||||||
|
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||||
|
i.setType("text/plain");
|
||||||
|
i.putExtra(Intent.EXTRA_TEXT, ctrl.getPGN());
|
||||||
|
startActivity(Intent.createChooser(i, getString(R.string.share_pgn_game)));
|
||||||
|
}
|
||||||
|
|
||||||
private final Dialog fileMenuDialog() {
|
private final Dialog fileMenuDialog() {
|
||||||
final int LOAD_GAME = 0;
|
final int LOAD_GAME = 0;
|
||||||
final int SAVE_GAME = 1;
|
final int SAVE_GAME = 1;
|
||||||
@ -1795,6 +1779,11 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
return alert;
|
return alert;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final static boolean internalEngine(String name) {
|
||||||
|
return "cuckoochess".equals(name) ||
|
||||||
|
"stockfish".equals(name);
|
||||||
|
}
|
||||||
|
|
||||||
private final Dialog selectEngineDialog() {
|
private final Dialog selectEngineDialog() {
|
||||||
String[] fileNames = findFilesInDirectory(engineDir, new FileNameFilter() {
|
String[] fileNames = findFilesInDirectory(engineDir, new FileNameFilter() {
|
||||||
@Override
|
@Override
|
||||||
@ -2311,9 +2300,27 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
return alert;
|
return alert;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static boolean internalEngine(String name) {
|
private Dialog makeButtonDialog(ButtonActions buttonActions) {
|
||||||
return "cuckoochess".equals(name) ||
|
List<CharSequence> names = new ArrayList<CharSequence>();
|
||||||
"stockfish".equals(name);
|
final List<UIAction> actions = new ArrayList<UIAction>();
|
||||||
|
|
||||||
|
HashSet<String> used = new HashSet<String>();
|
||||||
|
for (UIAction a : buttonActions.getMenuActions()) {
|
||||||
|
if ((a != null) && a.enabled() && !used.contains(a.getId())) {
|
||||||
|
names.add(getString(a.getName()));
|
||||||
|
actions.add(a);
|
||||||
|
used.add(a.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setTitle(buttonActions.getMenuTitle());
|
||||||
|
builder.setItems(names.toArray(new CharSequence[names.size()]), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int item) {
|
||||||
|
UIAction a = actions.get(item);
|
||||||
|
a.run();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return builder.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Dialog manageEnginesDialog() {
|
private final Dialog manageEnginesDialog() {
|
||||||
@ -2522,37 +2529,6 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final void shareGame() {
|
|
||||||
Intent i = new Intent(Intent.ACTION_SEND);
|
|
||||||
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
|
||||||
i.setType("text/plain");
|
|
||||||
i.putExtra(Intent.EXTRA_TEXT, ctrl.getPGN());
|
|
||||||
startActivity(Intent.createChooser(i, getString(R.string.share_pgn_game)));
|
|
||||||
}
|
|
||||||
|
|
||||||
private Dialog makeButtonDialog(ButtonActions buttonActions) {
|
|
||||||
List<CharSequence> names = new ArrayList<CharSequence>();
|
|
||||||
final List<UIAction> actions = new ArrayList<UIAction>();
|
|
||||||
|
|
||||||
HashSet<String> used = new HashSet<String>();
|
|
||||||
for (UIAction a : buttonActions.getMenuActions()) {
|
|
||||||
if ((a != null) && a.enabled() && !used.contains(a.getId())) {
|
|
||||||
names.add(getString(a.getName()));
|
|
||||||
actions.add(a);
|
|
||||||
used.add(a.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
||||||
builder.setTitle(buttonActions.getMenuTitle());
|
|
||||||
builder.setItems(names.toArray(new CharSequence[names.size()]), new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int item) {
|
|
||||||
UIAction a = actions.get(item);
|
|
||||||
a.run();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return builder.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Open a load/save file dialog. Uses OI file manager if available. */
|
/** Open a load/save file dialog. Uses OI file manager if available. */
|
||||||
private void selectPgnFile(boolean save) {
|
private void selectPgnFile(boolean save) {
|
||||||
String action = "org.openintents.action.PICK_FILE";
|
String action = "org.openintents.action.PICK_FILE";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user