Commit graph

9813 commits

Author SHA1 Message Date
Eric House
930146cf11 wifi tweaks
Show net status as failing when no sockets available, and notice when
they're closed.
2016-11-17 23:22:28 -08:00
Eric House
4389c63718 wifi: fix compile; do less work on release build
The group info stuff I'm polling for is used only to log interesting
information, so drop it.
2016-11-17 22:22:08 -08:00
Eric House
14c34f3e70 wifi: get rematch working
required hooking up invitations, so the user-visible part of that should
be easy to do once device names are being communicated.
2016-11-17 22:14:36 -08:00
Eric House
9cfbb3c45b wifi: add status update on successful write 2016-11-17 20:17:13 -08:00
Eric House
822f34ac48 wifi: forward packets through group owner
Simple fix to the problem that a group owner may not be in the role of
game host: if I'm a guest and don't have a socket for the mac address to
which I need to send, slap src and dest addresses into the message and
send it to the group owner. That device can then forward it.
2016-11-17 20:03:02 -08:00
Eric House
5659fe9096 include wifi device name in status 2016-11-16 21:27:14 -08:00
Eric House
6f29b78456 wifidirect make connections much more reliable
Found a recipe for service discovery that at least in the bit of testing
I've done is much more reliable. Devices connect almost
immediately. Basically everything chains through onSuccess() handlers.
URL to recipe is in code.
2016-11-16 21:23:46 -08:00
Eric House
491432a3bb toward having debug-only component to net state for p2p 2016-11-16 20:55:32 -08:00
Eric House
93f23dd87c wifi: shorten class name 2016-11-16 08:23:25 -08:00
Eric House
1dd28855cb wifi stop service request once it's done its work
Examples kill it before calling connect(), so do the same. Seems to make
connection more reliable. (Pending: handle case where more than one
two devices are in the group!!!)
2016-11-16 08:10:51 -08:00
Eric House
d45635273d wifi start adding network status updates 2016-11-15 21:12:59 -08:00
Eric House
239beafcfa wifi: can now play a full game
Made WifiDirectService into an actual service in order to better process
incoming packets. Now works for game messages from comms, and posts
notifications when app's in background. The latter requires using the
app context from XWApp since unlike the other transports this one
doesn't involve the OS invoking us with a Context.
2016-11-15 20:50:29 -08:00
Eric House
1c4ae5fcfd wifi snapshot
Got to the point where I have an open socket for the packet I want to
send! Lots of changes to how discovery works seem to have improved
reliability though I'm still unimpressed. Much to learn.
2016-11-15 07:49:06 -08:00
Eric House
33326d38a7 wifi direct: harvest and send mac address
Grab and store the local device's mac address. Add p2p as a type of
address, represented by the mac address of the recipient. Include the
local device's address in invitations sent when specified by user. Now
the WifiDirectService class is being passed a packet and the address of
the recipient; it will next need to set up sockets with every device it
encounters and map them to their mac addresses so that it can do a send.
2016-11-14 08:06:53 -08:00
Eric House
7d8708b8fa don't crash if don't have wifi permissions
For now, -dbg version will have and non-dbg won't, so catch exception
first time we try to do wifi stuff and disable if that exception is thrown.
2016-11-13 20:48:08 -08:00
Eric House
7a1965aeaf fix Nougat-only draw bug
Starting with the release of Nougat there have been cases where the
board would not correctly redraw. It's been most evident when using the
hit feature many times in a row, with something going wrong every fifth
time or so (but not that consistently.) It's as if modifications of the
bitmap backing BoardCanvas were being done asynchronously and not
necessarily all completed when I blit the canvas to the screen via
canvas.drawBitmap(). (As evidence of this I confirmed that a tap on a
tile in the tray after a bad draw would cause the screen to correct
itself even though the only additional rendering was to the tray. So by
the time that second drawBitmap() call happened the bitmap data was
correct: all draws that hadn't completed earlier had done so by now.)

The fix is to call Bitmap.createBitmap(bitmap) and to use the copy as
the source of the canvas.drawBitmap() blit operation. I suspect that
createBitmap() waits for any pending draws into its source to complete
before making the copy. Regardless, if this hasn't fixed the problem
it's made it so rare that I'm not seeing it, and since I'm only doing
the copy on Nougat there's little risk in the change. And I can't detect
any problems coming from the considerable additional memory being used
and immediately marked available for gc.
2016-11-13 13:29:20 -08:00
Eric House
de00a6c87a fix Nougat-only draw bug
Starting with the release of Nougat there have been cases where the
board would not correctly redraw. It's been most evident when using the
hit feature many times in a row, with something going wrong every fifth
time or so (but not that consistently.) It's as if modifications of the
bitmap backing BoardCanvas were being done asynchronously and not
necessarily all completed when I blit the canvas to the screen via
canvas.drawBitmap(). (As evidence of this I confirmed that a tap on a
tile in the tray after a bad draw would cause the screen to correct
itself even though the only additional rendering was to the tray. So by
the time that second drawBitmap() call happened the bitmap data was
correct: all draws that hadn't completed earlier had done so by now.)

The fix is to call Bitmap.createBitmap(bitmap) and to use the copy as
the source of the canvas.drawBitmap() blit operation. I suspect that
createBitmap() waits for any pending draws into its source to complete
before making the copy. Regardless, if this hasn't fixed the problem
it's made it so rare that I'm not seeing it, and since I'm only doing
the copy on Nougat there's little risk in the change. And I can't detect
any problems coming from the considerable additional memory being used
and immediately marked available for gc.
2016-11-13 13:20:00 -08:00
Eric House
e6561cbcac debugging aids
commented-out logging of drawCell, with flags; debug-build checks that
static rects passed to java draw code aren't being used by multiple
threads at once.
2016-11-12 07:20:28 -08:00
Eric House
41581cbddb cleanup: remove unused variable, unnecessary final 2016-11-12 07:07:19 -08:00
Eric House
92e413fa06 make boardBegin() a no-op in C
instead of a no-op in java, which takes more work to get to.
2016-11-12 06:57:05 -08:00
Eric House
f394bcef64 use max backoff time if no relay games 2016-11-11 06:31:54 -08:00
Eric House
edcafe1c45 housekeeping
gitignore new files; try to limit projectile searches
2016-11-11 06:30:55 -08:00
Eric House
7087ae96ff cleanup: resolve diffs between AndroidManifest.xml versions 2016-11-09 08:40:17 -08:00
Eric House
6d1d4abdd5 add backoff to relay pings
Current code is hitting the relay every 60 seconds, at least on
non-google-play installs like f-droid. Switch to using a backoff timer
that maxes out at once per hour. Eventually may want to not run the
timer at all when there aren't any unfinished relay games present.
2016-11-09 07:53:24 -08:00
Eric House
9cd76d887d fix weird double-bang thing 2016-11-09 07:45:39 -08:00
Eric House
55d86d5ca2 don't try drawing snapshot in curses mode
Was crashing on game save. Add to main launchParams struct whether we're
in curses or gtk mode and only save snapshot in latter case.
2016-11-09 07:38:41 -08:00
Eric House
154e428fa8 more work on wifi direct
Now sends and receives a single packet more often than not. Disabled for
non-DEBUG devices, and new permissions that are required are commented
out so I don't accidentally ship before the sdk-23 permissions stuff
makes additions less scary.
2016-11-07 07:02:27 -08:00
Eric House
85c12d6a85 new file to wrap sockets
Untested class that wraps a bi-directional tcp socket using a
length-plus-data stream format. Just checking it in for now.
2016-11-04 20:36:11 -07:00
Eric House
1c93d908cd progress on wifi direct
group is formed and ip addresses assigned! But fragile: need to reboot
devices occasionally before things will happen again.
2016-11-03 21:20:03 -07:00
Eric House
ff01e78dee first commit on wifi direct
Disabled at compile time, and missing permissions required, but if
enabled is able to discover other devices running same app. Next: try to
open a socket.
2016-11-03 06:25:48 -07:00
Eric House
3ccdd5a6e2 fix printStack()
logi() stuff isn't showing up, so use logd().
2016-11-01 07:51:00 -07:00
Eric House
da9ee4195c re-add lollipop-friendly notification icon
This one looks better white-on-black, but still needs work! Had been
added before, in ref 885b375a55.
2016-10-31 08:00:04 -07:00
Eric House
b56c4d13b4 build with SDK version 23
Meant using NotificationCompat, dropping FloatMath, and changing a bunch
of build config stuff. Not done for gradle builds yet. Currently crashes
on a new install until you go into Apps/Crosswords/Permissions and turn
on the four "dangerous" ones it's using. Now the work is to check for
and request missing permissions on demand.
2016-10-31 07:46:04 -07:00
Eric House
832ff8e850 Merge branch 'android_branch' into android_translate 2016-10-25 20:28:05 -07:00
Eric House
579f11613f Merge branch 'android_release' into android_branch 2016-10-25 20:15:00 -07:00
Eric House
540a720fb7 up release strings 2016-10-25 20:06:10 -07:00
Eric House
1a43ab0adb fix jni crash on Nexus 9: give boolean default value
Crash occurs when creating new game: because there's no turn set yet the
jboolean has no set value (whatever was on the stack). Apparently the
java runtime accepts only 1 and 0 for jbooleans.
2016-10-25 08:35:11 -07:00
Eric House
45a6ddf8ec fix jni crash on Nexus 9: give boolean default value
Crash occurs when creating new game: because there's no turn set yet the
jboolean has no set value (whatever was on the stack). Apparently the
java runtime accepts only 1 and 0 for jbooleans.
2016-10-25 08:03:18 -07:00
naofum
3db6abba30 Translated using Weblate (Japanese)
Currently translated at 75.8% (566 of 746 strings)
2016-10-14 18:45:24 +02:00
Sylvia van Os
953ea6aa15 Translated using Weblate (Dutch)
Currently translated at 75.2% (561 of 746 strings)
2016-10-14 15:44:27 +02:00
Eric House
abf4aa4d80 switch to clang
add option, and invoke it, to build jni code with clang rather than gcc.
2016-09-30 11:13:30 -07:00
Eric House
a710bdd46e Merge remote-tracking branch 'maidu2/android_branch' into android_branch 2016-09-28 21:46:17 -07:00
Eric House
123b3007cb get rid of remaining logf calls
This completes moving to using traditional logging. At least to having
each file provide a TAG. Class rather than TAG is passed in, and format
strings are preferred to contatenation, but now adb can work with the
output.
2016-09-28 21:42:16 -07:00
Eric House
59796c59b8 loge -> logex (so loge can be reused) 2016-09-27 19:42:48 -07:00
Eric House
68650ebfea first change toward using traditional TAGs with Log class 2016-09-27 19:35:24 -07:00
Eric House
3174705d63 gtk: remove assertion failure creating new games
I think this was related to changing the order in which save operations
happen and that it's no longer valid to insist that there already be a
rowid at this point, but could be wrong....
2016-09-26 08:24:47 -07:00
Eric House
e07686491c gtk: summarize before saving
Fixes problem with list view always being a move behind, since it's
saving not summarizing that was triggering the refresh, but summarizing
that added the data from which refresh/list view drew.
2016-09-20 08:27:17 -07:00
Eric House
5742c5cb12 gtk: save game on every turn change
Idea is to have the games list stay in sync, but in fact it stays one
move behind, at least in a typical standalone human-vs-robot game. So
this is incomplete.
2016-09-19 09:12:23 -07:00
Eric House
a6992c373f fix broken notagain alert
I screwed up when converting to using builder.
2016-09-15 21:32:25 -07:00
Eric House
7994c42691 allow board cells to be wider than tall
There are some screen dimensions, especially with dual-pane mode, where
the board is just bit narrower than the screen. Rather than have narrow
white borders, allow the cells to take up the slack. The API takes an
upper bound on the ratio of width to height so things shouldn't get too
odd looking.
2016-09-15 20:37:29 -07:00
Eric House
39c49c3d8d Set AS upgrade gradle 2016-09-15 20:33:20 -07:00
Eric House
baf825e7db add gtk-3 to set of debs Makefile knows to install 2016-09-13 19:45:29 -07:00
Eric House
809e962765 tweak to intent handling
Change logic to always handle intent when it's safe to commit
transactions rather than when there aren't any pending. This still needs
work.
2016-09-09 05:46:08 -07:00
Eric House
95d147d9c3 add logging; fix NPE
Running into a case where views haven't been added to the layout yet but
I'm searching there for their associated fragments. Fix to NPE stops a
crash, but intents still aren't being handled. I need to try to handle
them later, but am unsure when to start trying.
2016-09-05 20:29:16 -07:00
Eric House
bd2fbdeb88 fix NPE reported by crittercism
Not sure why it's happening, but testing and dropping is a fine fix.
2016-09-05 14:11:06 -07:00
Eric House
5e90ed0073 put tiny bit of padding around the board container 2016-09-04 21:57:58 -07:00
Eric House
b1ce992d23 gtk: don't resize scrollbar
Mistaken option to gtk_box_pack_start() meant the scrollbar got
allocated space along with the board when the container expands, not
what you want with a scrollbar.
2016-09-04 20:46:25 -07:00
Eric House
7358c1a185 simplify intent dispatch
Too-clever double loop had an no-exit path. Now it's simpler: find a
fragment that can handle the intent, pop all fragments to its right
until it becomes top-most (there may be none), and then give it the
intent. Use of popBackStackImmediate() is required so old fragments are
gone before intent handling wants to create new ones.
2016-09-04 16:49:40 -07:00
Eric House
c0eb827b77 generated files: should have gone with prev commit 2016-09-04 09:42:00 -07:00
Eric House
cdf22ec913 remove dual-pane toast from startup 2016-09-04 09:40:46 -07:00
Eric House
c16fda23af up strings for new release 2016-09-02 21:37:37 -07:00
Eric House
575e64ed25 reverse sort order: newer listed first 2016-09-02 21:32:31 -07:00
Eric House
8a00b1ab47 reorder list when game saved
Since display is now by whose turn it is and how recently there's been a
move in the game, the order can change on every save. So in the listener
for saves, redraw the group the saved game belongs to. The best way to
do this without flicker seems to be to mimic closing then re-expanding
the group, so that's what I'm doing.
2016-09-01 08:16:21 -07:00
Eric House
5a91b2819c cleanup: pass size to constructor 2016-09-01 07:21:13 -07:00
Eric House
4b25d17dbf sort games by whose turn it is, local at top 2016-09-01 07:14:41 -07:00
Eric House
b64bf82278 postpone searching for fragment children
Getting an NPE iterating over fragment/children of dualpane view
because, I think, committing them's been postponed. So add the iteration
as a Runnable to the same postponement mechanism. This may be wrong:
needs to be run for a while to see if it fixes the NPEs I'm seeing (on
opening an intent in the morning after the device has been idle all
night.)
2016-09-01 07:12:27 -07:00
Eric House
adf71c85a5 add turnIsLocal to android db
So we can filter on it determining the display order of games in games
list.
2016-08-31 19:37:56 -07:00
Eric House
a450aceab3 keep list of fragment transactions to run later
An assertion is firing indicating that there's sometimes more than
one. So deal with that: keep an ArrayList.
2016-08-31 19:28:46 -07:00
Eric House
7dcb5f09b1 Merge branch 'android_release' into android_branch 2016-08-30 08:14:48 -07:00
Eric House
cd0de1daa7 ready for interim release
up version strings and make a toast DEBUG-only
2016-08-29 06:33:27 -07:00
Eric House
d7acdc4a93 don't commit fragment transactions until ready
Attempt to fix crashes happening when the occasional fragment
transaction happens before the OS is ready. Keep a boolean indicating
whether we're in that state, and when it's not set create a Runnable to
be run next time it is. Temporary Toast lets me know when it's working.
2016-08-29 06:19:13 -07:00
Eric House
1c9af1bcfc fix assertions: load xml widgets on demand 2016-08-29 06:18:21 -07:00
Eric House
42488232a5 don't commit fragment transactions until ready
Attempt to fix crashes happening when the occasional fragment
transaction happens before the OS is ready. Keep a boolean indicating
whether we're in that state, and when it's not set create a Runnable to
be run next time it is. Temporary Toast lets me know when it's working.
2016-08-26 21:48:52 -07:00
Eric House
c4efebad71 gtk: add localTurn column; format date 2016-08-26 07:26:33 -07:00
Eric House
1d1e971120 gtk: add initial size/position for window 2016-08-26 07:21:00 -07:00
Eric House
4c923ead08 add isLocal param to server_getCurrentTurn
I want to store this information separately in summaries tables so
e.g. games can be displayed sorted by whether it's the local player's
turn.
2016-08-26 06:58:55 -07:00
Eric House
926f069313 fix assertions: load xml widgets on demand 2016-08-25 21:34:33 -07:00
Eric House
f98d8db6ac don't default-uninstall from multiple devices
I'm tired of nuking from devices I didn't realize were attached.
2016-08-25 08:23:51 -07:00
Eric House
eb1e3f01d7 cleanup: use a local variable 2016-08-25 08:22:47 -07:00
Eric House
c7f33a7c8e cleanup: remove logging 2016-08-22 19:15:07 -07:00
Eric House
091854eee3 ignore new file 2016-08-22 19:13:49 -07:00
Eric House
bd3caf25eb re-create list when size limits change
Problem: brain-dead Android code (on 5.1.0 anyway) caches the
SectionIndexer separately from the ListAdapter that implements it, so
when you change the ListAdapter it keeps using the old one for its
SectionIndexer. Solution is to replace the ListView in the layout with a
FrameLayout into which a ListView is inserted at runtime on init and
whenever the data changes.
2016-08-20 13:37:35 -07:00
Eric House
9f2bc23b80 implement setTitle for GamesListDelegate
Was missing and so when other panes went away didn't always replace the
title.
2016-08-20 09:33:48 -07:00
Eric House
f23e44c56d cleanup: use chaining everywhere building alerts 2016-08-19 14:44:37 -07:00
Eric House
78c3d4c0e9 tweak changes text 2016-08-19 14:14:39 -07:00
Eric House
9517516ab3 tweak changes text 2016-08-19 14:11:03 -07:00
Eric House
54feb61bf4 Merge branch 'android_branch' into android_translate 2016-08-19 13:12:57 -07:00
Eric House
06b6091780 upgrade -Dbg version code too 2016-08-19 12:56:07 -07:00
Eric House
e1dbd8efc7 cleanup and add a bit of logging
I suspect curThis() is no longer needed so will log it for a while.
2016-08-19 12:49:30 -07:00
Eric House
2285502f33 offer to enable dual-pane mode only on upgrade
And do it starting with launches after the changes list has been
shown. Also change "Cancel" on negative button to "Later".
2016-08-19 12:48:15 -07:00
Eric House
495c82baa0 look for and remove '-' in locale
Some versions apparently return "en-us" as the language code when "en"
is expected. Check for and remove anything after a '-'.
2016-08-19 12:28:54 -07:00
Eric House
16b9bab719 up version strings and changes list 2016-08-19 11:58:10 -07:00
Eric House
6cc67b2347 always show toast announcing dual-pane mode
on startup, even for non-debug builds. And move the string into a
resource for localization.
2016-08-19 11:37:24 -07:00
Eric House
ba968b1e36 fix so extra game info shows in dual-pane mode too
onWindowFocusChanged() isn't called when a pane opens, and setting up
that field depended on it. So call from init() too.
2016-08-19 10:57:48 -07:00
Eric House
0bd9667163 cleanup: remove unnecessary attributes 2016-08-19 10:29:12 -07:00
Eric House
41e8df6f19 give any extra space to the board
Measure toolbar before board, and if it's narrower/shorter than we
allowed more that extra space into the rect given the board.
2016-08-19 10:05:31 -07:00
Eric House
ff6e9f0051 specify larger toolbar icons on larger devices
As it was before, and adding for xlarge too. Looks better this way. I
still can't figure out how to make the things center....
2016-08-18 17:38:57 -07:00
Eric House
43fcf21133 get rid of transparent frame around toolbar images 2016-08-18 13:44:03 -07:00
Eric House
62461d8de0 move toolbar button to left
Put it where it'll be visible/discoverable on more devices since it's a
pretty cool feature now.
2016-08-18 13:10:41 -07:00
Eric House
19a3f40d66 script to swap resources for small-device testing
Setting up an emulator that'll grab {menu,layout}-small resources is a
pain so this script exchanges them with regular resources so that a
subsequent compile will produce something that (when run) will catch
missing resources etc.
2016-08-18 12:38:41 -07:00
Eric House
c4d7626ae1 tweak toolbar layout to fit better 2016-08-18 12:00:18 -07:00
Eric House
2a8ce27ca9 make custom layout better on old android version
tweaks to BoardContainer and Toolbar to better position toolbar and
better hide/show it in tile exchange mode. The bar's still partially
offscreen sometimes on a 2.3.7 emulator but it's usable. Next I need to
try specifying the size of the bar rather than having it derive from the
size of the images it contains.
2016-08-18 11:30:32 -07:00
Eric House
9e81fb53b5 move NotAgainView into scroller for small screens 2016-08-18 10:08:27 -07:00
Eric House
9545d9c457 Merge branch 'android_branch' into android_translate 2016-08-16 11:22:01 -07:00
Eric House
bc98cdc83a don't use newer APIs in custom layout
They crash on 2.3.7 at least, and don't seem to be required anyway. I
think the only reason I need to implement onMeasure() is because
BoardView expects to be called a certain way.
2016-08-16 11:18:18 -07:00
Eric House
fbaaa4e5aa ignore new files 2016-08-16 11:18:02 -07:00
Eric House
6da7c85dbf use custom layout for board/toolbar relationship
Correct or not, this is my solution to the circular problem of how to
choose a vertical or horizontal toolbar before beginning the layout of
the board and toolbar. Adding a new custom container that holds the
board, toolbar(s) and tile exchange buttons and uses the ratio of its
own dimensions to choose which toolbar to show. Also drive toolbar
initialization from the layout process because when started from
BoardDelegate it now tries to install button listeners too early.
2016-08-16 11:01:46 -07:00
Eric House
4857ad6b26 complain when CLASSPATH isn't set for success 2016-08-15 17:29:28 -07:00
Eric House
3b24aab8c3 add new jni call board_containsPt()
for use debugging layouts/orientation changes later
2016-08-15 17:26:10 -07:00
Eric House
0a41471410 use dimen resource for toolbar button size
I need a way to have the buttons be smaller when the view's in a
fragment in dualpane mode. This probably is isn't the fix but it's worth
preserving.
2016-08-15 16:42:09 -07:00
Eric House
fd0bf23915 remove volume-keys-zoom option
Seem sit hasn't worked in a while on newer devices and nobody's
complained. We all pinch to zoom now.
2016-08-15 16:23:24 -07:00
Eric House
d15eab013d remove zoom button and menu
Everybody has multi-touch phones now.
2016-08-15 16:13:01 -07:00
Eric House
ab24140813 cleanup: constants + parallel array => enum
I didn't always know enums could have constructors
2016-08-15 16:01:30 -07:00
Eric House
71ac6062f1 don't enable delete of newly-configured game
Wasn't recording as open a game created then opened via the
configure-first option so the delete menuitem was being left enabled.
2016-08-15 14:14:14 -07:00
Eric House
8fdc2b90ea explain before exiting when dual-pane enabled 2016-08-15 14:03:01 -07:00
Eric House
232f5e1a15 do a builder for okonly alerts too
Might be getting carried away with this, but I like having all common
dialogs built the same way.
2016-08-15 13:55:11 -07:00
Eric House
1a56854d41 more cleanup using setters to replace overloading 2016-08-15 12:38:27 -07:00
Eric House
25823aec74 cleanup: "Then" implies Action 2016-08-15 12:11:17 -07:00
Eric House
c36adeebbd refactor: use builder for notAgain dialogs too 2016-08-15 12:10:36 -07:00
Eric House
7f211c6cb5 more cleanup: replace overloads with builder
There were too many versions of showConfirmThen(). Now there's one
builder with a bunch of optional parameters.
2016-08-15 10:15:35 -07:00
Eric House
ecdd453698 major cleanup: first use of ConfirmThenBuilder 2016-08-15 09:15:39 -07:00
Eric House
bf93189313 cleanup: Map.remove() does a get 2016-08-15 08:25:36 -07:00
Eric House
34b7f9de4d tweak string 2016-08-15 08:18:11 -07:00
Eric House
b17dfc91cc fix to compile! (bad commit) 2016-08-15 08:17:33 -07:00
Eric House
e6cb693c3c launch dict download pane from config as fragment
One of the last to be converted. But missing dict functionality still
needs testing.
2016-08-15 07:59:49 -07:00
Eric House
10a0e33ee4 send cancel if no dict's been chosen
Fix crash when game config opens dict download for result and nothing's
chosen. Was sending Activity.RESULT_OK in that case instead of
RESULT_CANCELED.
2016-08-15 07:19:05 -07:00
Eric House
87150c7d91 replace assertion with logging and dropping event
Until I figure out why I'm see it, as it's getting in the way of other
things.
2016-08-13 17:16:20 -07:00
Eric House
6bdfae23cb add no-args constructors to all fragments
Docs and some logcat crash statements from the OS say I need no-args
constructors for fragments. So rework initialization and use bundling so
parent name doesn't have to be passed into the constructor. Seems to
work, and fixes the crash I was seeing (happened when sending an
invitation via SMS) but requires more testing.
2016-08-13 17:02:18 -07:00
Eric House
94e5b30d94 fix long-tap rematch of open game
Needed to do the usual JNIThread.getRetained() recipe, slightly
modified.
2016-08-12 19:14:23 -07:00
Eric House
80e1f588d0 remove a delegate's alerts when it stops
Fixing a crash when a game offers both to create a rematch and to delete
itself because its opponent has been deleted. Deleting and then hitting
rematch would crash because the rematch alert referred to a dead
game. Now onStop() for delegates removes any pending alerts. In
dual-pane mode only since when there's an activity going away the alerts
go automatically.
2016-08-12 18:06:11 -07:00
Eric House
a7795dd160 remove REMATCH_SUPPORTED build-time option
It's always on now.
2016-08-12 12:25:38 -07:00
Eric House
2220db9dfa cleanup: use consistent terms even in DEBUG build 2016-08-12 12:09:23 -07:00
Eric House
4d1fc6524c cleanup: fold two methods together 2016-08-12 12:07:14 -07:00
Eric House
16d6b7cccc move use of JNIThread's lock into getSummary()
Rather than have callers of getSummary() try JNIThread for the lock, do
that check inside getSummary(), and move it to GameUtils from DBUtils
since it's using higher-level knowledge now.
2016-08-12 11:48:39 -07:00
Eric House
3baeb79a45 cleanup: "message" => either "chat" or "move" 2016-08-12 11:18:56 -07:00
Eric House
1c59f1e002 replace window title when pane goes away
Add new parameterless setTitle() method on delegates, and call it when a
fragment is removed so the new right-most pane can restore a title that
makes sense. So far only board and gameconfig delegates implement this
new method.
2016-08-12 11:00:51 -07:00
Eric House
76a7aeb93c fix dupeGame for dual-pane case
Current GameLock implementation means you can't get a lock for an open
game, so try getting one from an existing JNIThread instance
first. Which is a hack that's start to appear in lots of places.... Also
fix so just in case we are unable to lock a game we drop the rematch
process rather than crash in an assert later. The test case: rematch a
solo game that's currently open in the right pane.
2016-08-12 08:55:54 -07:00
Eric House
16a622d22c cleanup: rename method 2016-08-12 08:50:26 -07:00
Eric House
dfe79a2d97 move game loading into GameLock
Fixed race conditions revealed by dual-pane mode where GameLock could be
instantiated and then attempts made to reference its game (jni calls)
before it had been loaded. So now loading happens inside the same
synchronized methods as opening or creating a game.
2016-08-12 08:33:36 -07:00
Eric House
90e7cbd2ed cleanup: use constants 2016-08-12 08:08:53 -07:00
Eric House
8e399ef9b7 assert from java that jni code has an env
Rare crashes are happening inside the jni, in game_dispose(), when a
game's double-disposed. Adding a jni call to check if the thread about
to do a game_dispose() will fail then asserting its result in java
allows useful stack traces to come via Crittercism. Or should.
2016-08-11 16:42:18 -07:00
Eric House
5d9423f317 fix rematch crash: don't call finish()
There was a race condition between finish() and the popping of fragments
that happens inside dispatchNewIntent(). If dispatchNewIntent() won then
later finish() would pop the GamesListFragment and we'd crash. Ideally
finish() would pass a fragment to finishFragment() which would then do
nothing if that fragment wasn't on the stack. Later....
2016-08-11 16:33:12 -07:00
Eric House
457970b2d2 gtk: the tiniest bit of cleanup
Trying and failing to get just the content area of the tree view to
scroll, whether by putting it in its own container or hooking into the
scrollable interface tree view allegedly supports.
2016-08-10 14:53:44 -07:00
Eric House
06fb4ef0ee improve experience switching dualpane mode
better strings, and explain when pref changed that user must restart for
it to take effect. Actually restarting from inside prefs delegate is
hard enough I'm not doing it for what should be advanced users.
2016-08-10 11:56:05 -07:00
Eric House
01d45df3ae use WeakReference to prevent "leak" of static member 2016-08-10 11:46:38 -07:00
Eric House
bece9183f9 remove restart notification on start 2016-08-10 11:32:23 -07:00
Eric House
43b76d24cc add commented out thread assertion
I want to use ReentrantLock instead of my implementation but I'm
breaking its rule that the thread that locks a lock must be the one to
unlock it. Add commented-out assertion for some later time when I might
want to fix this. No change for now.
2016-08-10 09:42:19 -07:00
Eric House
1029bb78a0 Merge branch 'android_branch' into android_translate 2016-08-07 13:08:13 -07:00
Eric House
dddfa2e269 keep INVITE alert up for rematch game
Game created for rematch was coming up unconnected and without
explanation if recipient of invitation hadn't responded. Don't dismiss
the INVITE alert in that case.
2016-08-07 11:54:45 -07:00
Eric House
9909750605 don't show the loading view except the first time 2016-08-06 09:32:13 -07:00