I had to pass the score into draw_trayBegin since
draw_drawPendingScore() isn't called until the first tile's placed.
Note: as long as I'm messinng with this menuitem it should be disabled
when it's not the player's turn.
util_userQuery(QUERY_ROBOT_MOVE) with new util_informMove(), into
which the number of words formed and the words themselves are passed.
The process of consing up the score explanation was already passing
over the model, so storing the words is very little effort, and will
save a call back into the model where the user actually wants to do
the lookup.
another to pick the URL. Hacky code takes us back to the first after
the second is dismissed while only showing either if there's a choice
to be made. Also add menu item to lookup all words in the game --
useful for testing when robot refuses to play multiple words but maybe
also worth shipping.
French or German in use. Disable button if I don't know how to look a
word up. Later will want to have multiple URLs available, falling
back to googling for the word if I don't know about an online
dictionary.
jni, and when it calls back with it launch the browser directly if
there's only one, otherwise put up a choice list. Currently the list
dismisses after launching the browser once: need to fix that, probably
with a custom View. And need to deal with non-English games, and
maybe add other choices for lookup than dictionary.com.
uses existing stack and undo features to run a WordNotifierInfo over
some number of scoring passes to gather the words seen. Seems to work
as tested from gtk version. Now need to try from android....
use English. (Specifically, they've been played in English until now
and played letters will be reinterpreted in the right language for the
first time.)
AndroidManifest rather than created programatically: only with this
can I get EJECT events to work. Replacement class has static
register/unregister methods which DictsActivity uses.
'commit exchange' button when there's nothing to commit, and get rid
of error message used when committing nothing since it's now
impossible (on Android).
summaries DB list of dicts in the game and a method that queries that.
Pick delete-confirmation message based on the language of dict,
whether there are others in the same language, and whether games are
using that language or that dict.
correctly with having the same dict stored in more than one place.
Added DictAndLoc with members name and loc to support this, and used
in a bunch of places in place of mere strings, including
DictsActivity. Also removed code warning when you're deleting a dict
that's not the last in its lang, which incorrectly warned that the
dict was in use when in fact I can't tell that. The warning "might be
in use" sounds dumb so it's gone for now.
local/pending changes. Fixes bug where you change language, then
choose "download more..." from a player's dict choice spinner and find
on returning to GameConfig that the language has reverted.
it; add boolean, now always passed as false, to code printing names
for game config list of players to include the dictionary. It's
useful for debugging, and I think it'd make a good optional setting,
but nobody else thinks so. Once it's checked in the change can go if
I'm not using it.
dicts passed when opening a game was based on defaults, not read in
from the game data. Oops. So now it's a two-step process: open the
data, read in the game info, generate list of dicts from that, and
open full game with list of dicts. (TODO: optimize by caching game
data across multiple reads.)
version of the list user saw when choosing the index. Fix is to use
same list. Cancel after selecting dict didn't work as the selection
listener had already copied the selected dict name over. Now the
listener leaves that for the Ok button's onclick listener.
one and changing the site that used it to use the other. Not visible
outside of common, but should make it easier to harvest a list of all
words for one move or the entire game.
error message on Android); don't block trade if pending tiles are on
board; instead undo them. There's redo now so there's no need to
confirm, no data loss.
stuff. In java, respond to util_playerScoreHeld() and
util_bonusSquareHeld() by putting up toasts with existing strings.
For util_setInTrade(), fix exchange mode. Add two buttons at bottom
that replace toolbar (and corresponding buttons on menu). Redraw
scoreboard and board with high transparency to make it clear they're
disabled. Still to do: deal with case where ability to switch which
player's tray is visible is enabled.
with ncurses. The goals to make it easier to include watch on pipes
for incoming messages to better model Android -- and to be a bit more
modern. Works for one run of test script but needs more testing to be
turned on.
scheme as the rest of DlgDelegate. I'm still using a single ivar for
all dialogs, meaning they can't stack, but except for duplicate
showNotAgainDlgThen calls (where the message can be ignored) it
doesn't seem to be happening. Asserts are still in place to tell me
if I'm wrong.
crashes internally, and googling finds lots of reports/questions and
no answers. It appears NBS is broken on Android, at least for CDMA.
Might want to revisit on a newer OS version that the 2.1 I'm running
now.
listeners. They wind up getting called with mixed DlgDelegate.this
values, including one belonging to an Activity that's long-since
stopped and so the wrong ids are getting passed back.
button! Also assert the heck out of callbackIds to see if Android is
guaranteeing that no two dialogs can be up at once. I'm counting on
that, and need to know if it's not true.
button rather than just boolean. Add onDismissListener so can tell if
whole thing was backed-out of (since that's a different choice from
the two buttons "text" and "html" used in one case.) Fix compile
error that slipped by earlier: frequent clean builds required with
java.
from AndroidManifest.xml). Problem was that managed dialogs are
recreated between onStart() and onResume() yet onResume() was where
ivars (specifically m_gi) were set. Can't just set them in onStart()
because then I'd want to save state them in onStop() which isn't
guaranteed to be called. So create a function loadGame() and call it
from both, using a flag to prevent its running twice (which flag is
cleared in onPause())
dialogs depend only on bundleable ivars -- ints and strings, not Views
-- and bundle them. Don't use onPrepareDialog, only onCreateDialog,
and so call removeDialog() every time one's dismissed. Do some
refactoring to support this.
doing anything with it yet because any scheme to survive
OS-restoration has to deal with the Runnables I'm saving that can't be
bundled. Work in progress....
generalized for multiple events and map them to multiple notification
callbacks), and use it from DictsActivity to redraw the list when the
SD card comes back online. While the default android behavior works
for the unmount case (relaunches DictsActivity which correctly draws
only those dicts still available) it needs this change to redraw after
the available set grows.
so: change loadMakeGame() to return gamePtr rather than take one in,
and to return 0 when any dict no available. Move dict-gone-missing
dialog into DlgDelegate. Remove DlgDelegate always adding onDismiss
listener that removes the dialog, and instead add one to the
dict-gone-missing dialog that, like the onClick handler, calls
finish() on the activity.
figure out how to get that so I ignore it and am killed then
relaunched if I have a dict file open on the SD. On relauch, don't
crash. Instead, check if any dicts used by the game is unreachable
and put up an alert with only one choice: Close game. Thought about
using the missing-dicts stuff from GamesList, but this is a special
case that should be seen only when user umounts while a BoardActivity
instance is frontmost.
arrays into the jni, pass the full file paths in in addition to the
byte arrays. This isn't possible with the built-in dicts, but does
work for the downloaded ones (which are usually larger). This checkin
does the mmap and uses memcmp to verify that the bytes are the same as
passed in. Next step is to not pass the bytes when the path will do
and to actually use the mmap'd ptr.
dialog is up. I'm making two fixes, either of which is enough: saving
the rowid across teardown of the activity; and changing the manifest
to not tear down the activity. The reason for the latter is that the
teardown is unnecessary and wasteful. The former's just safer coding.
allow any control over whether the initial state is expanded.)
Getting click to work is a bit of a hack, requiring a callback from
the adapter back to the activity, but it works well on emulator. Need
to test on device then try to shrink the ImageButton.
with calls using formatting -- for consistency and effeciency in the
case where logging is disabled. There should be no discernable
change, though if I got and percent-format specifiers wrong I'll get
runtime exceptions.
Bad. So test if we can post (if the handler's still available) and
drop the request, freeing the thread, if not. (Access to m_handler
should probably be synchronized now that it's getting cleared, but
that's another bug.)
rare crash where class is reloaded (e.g. after long period of non-use)
after being taken down with a dialog in mid-load. The OS tries to put
the dialog back up but the dialog title string ID, passed to
setTitle() in onCreateDialog(), is 0.
singleTop is necessary, as with singleTask we get the whole actvity
stack nuked on every launch. Open a game into BoardActivity then
background Crosswords; when you re-launch from the launcher or hold
the home key you're back to GamesList. But with singleTop incoming
invite schemes would launch a second instance because though there was
one running it wasn't in the same task as the browser firing the url
to redir.php. The solution there is to move the scheme intent from
GamesList to DispatchNotify, which is already handling notifications.
There the addition of a second launch flag means that an existing
instance will always see the launch through its onNewIntent -- under
tests I've come up with so far, anyway.
awkwardly, the case in a networked game where a player runs out of
tiles in his turn but the server hasn't responded yet to kill the
game. It remains the player's turn and he can make lots of 0-point
moves while waiting. (Making it the next player's turn would be the
right thing to do if that player were always on a different device.)
postpone running up against, a memory leak that appears to be in the
java side of things. Googling suggests lots of folks are having
problems with createBitmap (though I can put the createBitmap() call
in a 50-iteration loop and not crash -- may not be the problem after
all.) Without this change I crash the 14th time opening a game. With
it I go 30 and run out of patience. Now that the board is locked in
vertical mode there's little point in recreating the bitmap anyway.