Commit graph

1750 commits

Author SHA1 Message Date
eehouse
10cf2894b8 Don't assert comms type not NONE when copying 2010-02-14 17:37:56 +00:00
eehouse
0396041864 search TransportProcs too 2010-02-14 17:29:07 +00:00
eehouse
65fb05b29c Export remaining prefs colors; add default relay host to prefs. 2010-02-14 17:28:46 +00:00
eehouse
5e066514cb Pare from connection options transports not supported on device. 1.5
will be relay only.  1.6 adds SMS, and 2.0 Bluetooth.
2010-02-14 17:27:27 +00:00
eehouse
885c9093fb Put up Toast messages on connecting to relay. 2010-02-14 17:23:07 +00:00
eehouse
7d385e180a Don't erase bottom of board drawing tiles; figure font size based on
chars in dict (untested); get background color from prefs; etc.
2010-02-14 17:21:59 +00:00
eehouse
32acc38100 default host should be eehouse.org for on-device use 2010-02-14 17:14:41 +00:00
eehouse
d7fe6c80f8 load default preferences on boot. 2010-02-12 09:15:19 +00:00
eehouse
c6b28e9416 turned on -Wall and fixed errors/warnings it reported 2010-02-12 07:13:42 +00:00
eehouse
786a3fdc57 When drawing letters raise baseline by font's descent to avoid 'J'
etc. hanging below cell border.
2010-02-11 13:44:04 +00:00
eehouse
bd611bb6f4 implement dictChanged. And so that utf8 dicts could be opened without
their games being drawn (no BoardActivity around) break the two
android-only callbacks out of UtilCtxt and into a new JNIUtils
interface that then requires new handing in C.
2010-02-11 13:27:09 +00:00
eehouse
099cf66a79 add choice of SMS and BT as transports. SMS can't be tested on
emulator and so isn't; BT isn't implemented at all.  But SMS works as
far as the send proc.
2010-02-09 14:43:37 +00:00
eehouse
2d17649af5 add overloaded methods for opening games that will never be rendered,
where several interfaces passed in are null.
2010-02-09 14:40:31 +00:00
eehouse
117ff31e64 remove assert. doCreate can get called several times. 2010-02-09 14:36:55 +00:00
eehouse
1afbaf9c42 rename menu item 2010-02-09 14:36:09 +00:00
eehouse
5510ebc388 remove logging 2010-02-09 14:35:16 +00:00
eehouse
e013cbd79d The not-yet-working activities around SMS.... 2010-02-09 14:33:24 +00:00
eehouse
e271358307 add SMS send and receive permissions; add not-yet-working activities
around SMS.
2010-02-09 14:33:04 +00:00
eehouse
6d4c972abd menu tweaks; strings for BT and SMS connect 2010-02-09 14:30:39 +00:00
eehouse
6ccab24cbd add connect spinner 2010-02-09 14:30:14 +00:00
eehouse
385ee6a9c5 separate dialogs for sms, bt and relay config. 2010-02-09 14:28:09 +00:00
eehouse
cd63cf1424 Deal with SMS and BT-type address recs. 2010-02-09 14:26:43 +00:00
eehouse
1f7e6db585 guard against double-dispose; add unique-to-android game_hasComms() 2010-02-09 14:25:52 +00:00
eehouse
1ee94f23aa factor out and_dictionary_make_empty 2010-02-09 14:22:59 +00:00
eehouse
f7c8a2f384 Work when initialized with a null instance of DrawCtxt. (All calls
into java world come from java so no guard against that needed.)
2010-02-09 14:21:58 +00:00
eehouse
cd89ede3c5 Work (but don't call into java world) when initialized with a null
instance of CommsTransport.
2010-02-09 14:20:16 +00:00
eehouse
67cb2421c9 Work (but don't call into java world) when initialized with a null
instance of UtilCtxt; implement util_makeEmptyDict().
2010-02-09 14:19:20 +00:00
eehouse
69ce7e2ef0 Build for 1.6 instead of 1.5 for SMS APIs 2010-02-09 14:16:23 +00:00
eehouse
35352f8b6c pull bonus colors from prefs too 2010-02-09 13:14:40 +00:00
eehouse
6522f54989 fix player juggle 2010-02-09 13:14:11 +00:00
eehouse
4a12409d97 Add colors etc. to prefs dialog; wire player colors to be set from
prefs rather than hard-coded.  Remaining new prefs entries still
unused.
2010-02-07 05:54:26 +00:00
eehouse
e6871c0840 add .xml file describing prefs (forgotten before); remove file menu. 2010-02-07 05:17:38 +00:00
eehouse
4db8750ec0 do app prefs the way they're supposed to be done 2010-02-06 21:04:19 +00:00
eehouse
338a39e8b4 turn asserts/logging back on; make with -j3 2010-02-06 19:30:59 +00:00
eehouse
fb65fecebb When CommonPrefs field is changed mid-game, reflect it immediately.
Means adding board_prefsChanged() to jni and having Utils class call
it via JNIThread when prefs change.
2010-02-01 15:06:12 +00:00
eehouse
0df6bf873c close socket on thread exit -- allows to reconnect to relay after
closing and reopening a game.
2010-02-01 15:03:13 +00:00
eehouse
7e20bd1a30 add about menu to opening dialog 2010-02-01 05:45:39 +00:00
eehouse
38ed6c925b remove unneeded intents 2010-02-01 05:45:24 +00:00
eehouse
0485b6d4e6 invoke prefs from games list activity too 2010-02-01 05:45:10 +00:00
eehouse
87eae92006 turn off debugging for a release 2010-01-31 22:10:10 +00:00
eehouse
24285b5d7a include device role in game list summary 2010-01-31 21:46:04 +00:00
eehouse
9f250c99ef get rid of gameID param. This change breaks all other platforms... 2010-01-31 21:35:07 +00:00
eehouse
caa5d6a55f implement enough networking to play a game via relay (provided I don't
quit on either device.)  Uses java.nio, a single thread blocking on
select() and a single SocketChannel.  Outbound packets are queued, and
incoming packets reassembled then passed to the JNIThread to be sent
to the jni for parsing.
2010-01-31 21:26:21 +00:00
eehouse
15ce0a12da add game_receiveMessage() (see prev note) 2010-01-31 21:22:55 +00:00
eehouse
b0e88eff83 implement util_makeStreamFromAddr() and (android-only)
game_receiveMessage(), the latter combining
comms_checkIncomingStream() and server_receiveMessage() which are
always used together and require a stream be passed between which
currently can't happen across jni.
2010-01-31 21:17:21 +00:00
eehouse
69cbff63f6 Hardcode ip address of emulator's host rather than eehouse.org for
easier debugging.  Needs to be in a preference....
2010-01-31 21:14:49 +00:00
eehouse
49402ed218 Get comms info (host name, etc.) from user and pass it through to the
send proc.  Along the way, write jni code to instantiate a new object
including setting enums.  *Now* I'm ready for networking....
2010-01-30 20:06:06 +00:00
eehouse
bb90dce2c4 coalesce CMD_DO messages; fixes robot-vs-robot game. 2010-01-30 15:33:57 +00:00
eehouse
3798084dab idle via a local Runnable rather than having whole class implement it. 2010-01-30 15:33:16 +00:00
eehouse
20aad594e4 don't explain robot scores by default 2010-01-30 15:31:08 +00:00
eehouse
a01844e751 add Hex dict for help with testing. Don't ship. :-) 2010-01-30 14:56:21 +00:00
eehouse
7b0f100f27 wire in enough comms that java's send proc gets called when device is
a guest.  Networking's next....
2010-01-30 14:38:44 +00:00
eehouse
b915319178 create and pass to jni CommsTransport instance when game isn't standalone 2010-01-30 14:36:55 +00:00
eehouse
5b1a0f167e class that will implement network for comms 2010-01-30 14:35:33 +00:00
eehouse
4b9fa4d42a new "class" wraps TransportProcs 2010-01-30 14:33:28 +00:00
eehouse
333c5fc040 add makeByteArray() 2010-01-30 14:32:20 +00:00
eehouse
8def96dd59 pass params, e.g. clean, to make 2010-01-30 13:44:45 +00:00
eehouse
ee2fe9d193 get/set enums from C; preserve device role setting from ui to saved
game.
2010-01-30 13:44:12 +00:00
eehouse
c2e1e916b8 relay feature and logging on 2010-01-30 13:43:21 +00:00
eehouse
e86d656b4a substitute smaller built-in dict to save time moving bits during
development; don't hard-code name of built-in.
2010-01-30 03:31:20 +00:00
eehouse
6dfac28b13 rearrange to work with newer version of ndk and sdk just installed 2010-01-30 03:18:01 +00:00
ehouse
52b7205474 cache common java objects for reuse rather than build anew each time.
Seems to speed drawing a bit.
2010-01-27 13:51:23 +00:00
ehouse
40ac5694fd first submitted translation, for Catalan; improve string-checking
script to include locale directories
2010-01-27 05:19:59 +00:00
ehouse
5a288d3068 turn off debug for alpha drop 2010-01-26 14:52:52 +00:00
ehouse
ec085d8944 lots of little changes toward making prefs (per-game and global) work,
which they more-or-less do.  Some still not captured.
2010-01-26 14:48:37 +00:00
ehouse
c682a7caac snapshot work toward getting networking done. 2010-01-26 14:46:48 +00:00
ehouse
90f93aefa8 Add lots of widgets. List of players can no longer be a list since it
wants to scroll, so it's textview subclasses that don't show focus
correctly yet.
2010-01-26 14:43:39 +00:00
ehouse
0649597d90 Add prefs activity. 2010-01-26 14:38:31 +00:00
ehouse
4425eaa99e move showColors into CommonPrefs, removing separate storage in linux
and wince and removing setter from board and jni APIs.  Palm change
pending.
2010-01-26 04:14:18 +00:00
ehouse
73749f97a5 script to check .xml and .java files for missing string entries and to
add stubs.
2010-01-26 04:02:05 +00:00
ehouse
8a4c31b203 rename file 2010-01-25 03:05:15 +00:00
ehouse
68079d3590 Add ability to open utf8-formatted dicts and to display bitmap tiles
(though poorly.)  Both required processing in the jni that isn't
possible (e.g. because no libiconv included) so I created callbacks
into java from the dict building code.  Add ability to download dicts,
to select them, to add and remove players and make them robots or
human.  Robot-vs-robot game doesn't work well (robots trade a lot and
server_do seems not to be getting called enough) but will soon.
Coalesce penMove events.  Implement game list menuitems like delete,
copy, etc.
2010-01-25 02:49:14 +00:00
ehouse
676fd73fc0 Activity for downloading dicts with nothing but a WebView in it.
Works, but not cleanly.  Still need to get the path to
/sdcard/downloads programatically, and to exit cleanly back to parent
Activity.
2010-01-25 02:23:04 +00:00
ehouse
bf33bd4a0f ask permission to write to storage and use internet; add DictActivity;
take control of orientation changes for several activities.
2010-01-25 02:20:32 +00:00
ehouse
b3c8327db1 Players are now in a list with a view into which they can be opened for editing. 2010-01-20 06:55:45 +00:00
ehouse
960fbd0b33 Fire GameConfig activity to edit a game; use file save/open methods in
Utils.
2010-01-20 06:54:09 +00:00
ehouse
f4535f3408 2010-01-20 06:52:37 +00:00
ehouse
dd05c5b58e add constructor that names player by position in game. (Template
needs to come from strings.xml)
2010-01-20 06:50:59 +00:00
ehouse
171318156d Remove board layout to JNIThread; format scores to show remaining
tiles and whose turn it is.
2010-01-20 06:49:38 +00:00
ehouse
7f0768a4f9 do board layout here rather than in BoardView so main thread isn't
talking to jni (fixes assert in jni catching overlapping calls from
both threads); call server_writeFinalScores for BoardActivity.
2010-01-20 06:48:43 +00:00
ehouse
92d5bbbf18 more strings and menu items 2010-01-20 06:44:58 +00:00
ehouse
ad013b8cc7 add server_writeFinalScores. 2010-01-20 06:44:02 +00:00
ehouse
a62af87a61 fix bogus assert; plug leaks when makeGameFromStream can only read a
gi; implement writeFinalScores.
2010-01-20 06:43:10 +00:00
ehouse
706fe3f927 implement remSelected and notifyGameOver 2010-01-20 06:41:14 +00:00
ehouse
7eccde84e3 Add utils like juggle() to be called from GameConfig; always keep max
number of LocalPlayer instances around so they can be filled from jni
code (which is easier than making the jni construct new instances.)
2010-01-20 06:38:29 +00:00
ehouse
531ae8ea1a add file open/save functions. 2010-01-20 06:35:56 +00:00
ehouse
406a6a4a98 clean up GameConfig activity intent filter 2010-01-20 06:29:21 +00:00
ehouse
6bf9de70d5 Generate file with same name as class it contains. 2010-01-19 13:29:19 +00:00
ehouse
f7907c866d Move jni calls for Game menu items into jni thread 2010-01-19 13:28:32 +00:00
ehouse
b3cf0b41e1 Get rid of separate tile picker in favor of having existing
BlockingActivity do it.  This may not work when picking from the pool
is enabled but is cleaner for now.
2010-01-17 17:51:27 +00:00
ehouse
f509b766e9 don't log every function. 2010-01-17 17:49:13 +00:00
ehouse
69c8577dcb Back out change adding Looper. Using own queue is better because its
length can be tested and there's no race condition (between the looper
being available and the parent thread wanting to post messages) when
the constructor inits the queue.
2010-01-16 18:56:32 +00:00
ehouse
5c183acb5e Run JNIThread inside a Looper; use BlockingActivity to implement
dialogs requiring an immediate response.  The Looper change was made
in the hopes that a new Activity wouldn't be required and may not be
necessary.
2010-01-16 18:39:27 +00:00
ehouse
35943e8731 add util_userError() 2010-01-16 18:34:27 +00:00
ehouse
2d46bd60c9 Add transparent activity that can be called from a thread that will
block until the dialog it puts up gets an answer.  Calling
showDialog() from the thread I want to block didn't work.
2010-01-16 18:27:22 +00:00
ehouse
7c4198c05e implement util_getUserString and features like formatRemainingTiles
that display a bunch of text.  Started working on util_userQuery.
2010-01-16 14:16:27 +00:00
ehouse
f9c9b41b3a save and open games by file rather than one globally, and display some
info about each in games list (though all still have the same players
and dict.)
2010-01-15 13:48:26 +00:00
ehouse
3beba51b6f add jni methods, and modify common code, so a CurGameInfo struct alone
can be read from and stored to a game file.
2010-01-15 13:44:29 +00:00
ehouse
a3a313fdb4 cleanup; refresh view on regaining focus rather than using
startActivityForResult
2010-01-13 13:31:23 +00:00
ehouse
c04c6974ba turn debug back on 2010-01-13 13:29:55 +00:00
ehouse
b2f0b91a23 save phony "new game" even if names not set 2010-01-13 12:57:02 +00:00
ehouse
cf60be5082 implement board_beginTrade() 2010-01-13 12:29:11 +00:00
ehouse
7f999134d7 touch .java file that uses svn version so it'll always get picked up. 2010-01-13 12:17:26 +00:00
ehouse
de3f45044f Don't show extra file in game list. 2010-01-13 12:16:43 +00:00
ehouse
1106ddd6bb Turn off DEBUG for release and STUBBED_DICT for good. 2010-01-13 12:15:46 +00:00
ehouse
20e8ba9eb0 add draw_objFinished() 2010-01-13 12:14:12 +00:00
ehouse
fa44159823 Use clipping in scoreboard and tray; show selected tiles with thicker
border.
2010-01-13 12:13:05 +00:00
ehouse
0e160011e3 add draw_objFinished(); turn boilerplate into macros. 2010-01-13 12:11:24 +00:00
ehouse
cb57fcc0be Add target, as default, that generates svn version for about box. 2010-01-13 12:03:32 +00:00
ehouse
21b3b29eab fix typos 2010-01-12 13:47:17 +00:00
ehouse
14372216d0 implement showValues; pause engine to handle events; call srandom
during init; add menus and call notImpl() for them.
2010-01-12 13:39:19 +00:00
ehouse
839e707069 refresh list view on (some) changes; get rid of unused button. 2010-01-12 13:32:19 +00:00
ehouse
47d29d8d4d don't draw tile values < 0 2010-01-12 13:30:20 +00:00
ehouse
1a4f0e04bf add copy constructors; change starting game to two players, second a
robot.
2010-01-12 13:20:18 +00:00
ehouse
71fe75049b new menus and shortcuts; tweak formatting 2010-01-12 13:18:16 +00:00
ehouse
4db53ed176 add Toast-based temporary about box with svnversion and notImpl() function 2010-01-12 13:15:47 +00:00
ehouse
11b453d5cf fix to compile with debugging turned off 2010-01-10 23:39:54 +00:00
ehouse
8d6d22f425 fix to compile with debugging turned off 2010-01-10 23:38:49 +00:00
ehouse
e76306a543 fix drawing blank tiles 2010-01-10 18:12:48 +00:00
ehouse
da0b54273f make all columns stretchable to fix oversized second button 2010-01-10 18:08:11 +00:00
ehouse
6b5be9a276 remove logging 2010-01-10 17:35:50 +00:00
ehouse
2c3e45318d All I wanted was to implement a tile picker, but it turns out dialogs
can't be synchronous on Android: you can't block the main UI thread.
So now there's a new background thread to which all jni activity
except game opening and saving is delegated (and these happen before
and after the thread exists.)  Tile picking works because the request
comes in on the background thread which then blocks until the
BoardActivity reports that the tile picker's gone away.
2010-01-10 17:35:23 +00:00
ehouse
50991fd028 Add common head/tail macros to all jni entrypoints that save/restore
the jni env passed in so all calls happening inside will use the right
one.  Required as part of running a second thread, re. which see
longer comment to follow
2010-01-10 17:29:09 +00:00
ehouse
cc527acb49 pass in/store ptr to JNIEnv* rather than env itself 2010-01-10 17:25:46 +00:00
ehouse
148d433e81 add makeStringArray 2010-01-10 17:23:30 +00:00
ehouse
552b718738 tile picker strings and intent 2010-01-10 17:20:18 +00:00
ehouse
6a4a0a8775 include thread id in logs 2010-01-10 17:19:30 +00:00
ehouse
5c762466aa new activity/layout for picking tiles 2010-01-10 17:18:37 +00:00
ehouse
a91f662327 save and restore games (though there's a global game for now). 2010-01-09 17:19:25 +00:00
ehouse
5d9dc49bf0 formatting changes only 2010-01-09 17:18:15 +00:00
ehouse
cd5069474e don't store dict: it's in the model 2010-01-09 17:11:31 +00:00
ehouse
278b815a3e fix ntohl; allow null Strings 2010-01-09 17:10:59 +00:00
ehouse
9761596e6e add system menu to games list with "delete all" item; implement roughly 2010-01-09 14:39:34 +00:00
ehouse
35dd738c26 add onDispose call to game_dispose, and implement it such that jni
doesn't leak.
2010-01-09 13:30:23 +00:00
ehouse
c68c01a82a set focusable here not in code 2010-01-07 14:38:16 +00:00
ehouse
ef68670c0c remove claim to handle orientation changes. Now on screen turn
activity is destroyed and recreated, allowing to lay the board out
anew.  This is inefficient, but a good test for now.
2010-01-07 14:37:09 +00:00
ehouse
4b9c328d8e don't log draw; too verbose 2010-01-07 14:35:04 +00:00
ehouse
b14cf81df4 to fix board getting erased on every draw, draw to our own bitmap and
canvas and blit that to draw's canvas each time.  Requires keeping x
and y offset since board doesn't fill the view; requires erasing tiles
and score entries before drawing.
2010-01-07 14:34:07 +00:00
ehouse
f6a951f845 add yOffsetChange commented out 2010-01-07 14:30:56 +00:00
ehouse
fdce005fb0 add vertScrollBoard 2010-01-07 14:29:49 +00:00
ehouse
e1c92707e7 implement scoreBegin; add vertScrollBoard 2010-01-07 14:28:53 +00:00
ehouse
9bd51e4305 add yOffsetChange commented out (not needed for scrolling, just for UI
to show thumb.)
2010-01-07 14:27:20 +00:00
ehouse
ecd5667cf0 makeIntArray takes array of initial values 2010-01-07 14:24:53 +00:00
ehouse
da91820525 Draw 'X' icon in empty middle square; start first player as non-robot
to show it.
2010-01-04 06:03:28 +00:00
ehouse
052c99c9db remove symlinks if they're not back to us -- so that more than one
copy of the tree can be active.
2010-01-04 05:50:12 +00:00
ehouse
4a4b05f66c make backgrounds transparent 2010-01-04 05:48:42 +00:00
ehouse
7d0b30f05a icon for middle cell 2010-01-03 22:31:26 +00:00
eehouse
ef188164e2 implement drawBoardArrow, but without setting tranparency correctly. 2010-01-03 01:02:14 +00:00
eehouse
d206aef266 initial checkin of java source for android port 2010-01-02 19:30:20 +00:00
eehouse
1a5ae00777 initial checkin of jni source and build scripts for android port 2010-01-02 19:10:08 +00:00