Commit graph

5380 commits

Author SHA1 Message Date
Bernard Massot
d85733f97f Translated using Weblate (French)
Currently translated at 100.0% (746 of 746 strings)
2016-12-13 15:44:46 +01:00
PapaPedro
cc2594986f Translated using Weblate (Czech)
Currently translated at 14.7% (110 of 746 strings)
2016-12-13 03:44:23 +01:00
Eric House
c398af2ac9 perms: ask for the set needed to open a game
rewrite perms23 class to use Builder pattern, making it easier to pass
more than one required permission. Use that (with hard-coded set for
now) to check and ask for permissions a game needs to communicate. Offer
to remove the comms methods the user doesn't want to permit (but that's
not implemented yet.)
2016-12-11 20:54:24 -08:00
Eric House
dfb22c13fa make gradle's suggested config changes 2016-12-11 13:33:57 -08:00
Eric House
36a0737654 fix ant build for sdk 23
pull in new version of support library .jar
2016-12-11 13:33:06 -08:00
Bernard Massot
980ac33604 Translated using Weblate (French)
Currently translated at 100.0% (746 of 746 strings)
2016-12-11 11:33:30 +01:00
Eric House
d136dd65e6 check phone permission before putting up sms choice
First, needed to remove some state caching since though a non-SMS
phone will never become one my ability to ask changes over time. Then
changed population of communication options to first ask for the
permission needed in order to find out what's supported, then to find
out what's supported via methods that will return false without
permission. Can't think of a better way right now....
2016-12-10 16:06:18 -08:00
Eric House
3389e928cc check for phone permission on boot to avoid crash
Some permission checks won't fall back to asking if it doesn't make
sense given what the user's doing at the time.
2016-12-10 15:08:09 -08:00
Eric House
39f08bd3d3 remove verbose flag 2016-12-10 14:58:24 -08:00
Eric House
bec5ad82c0 query before loading saved games too 2016-12-10 14:03:25 -08:00
Eric House
a3ccce00fa starting requesting permissions
Before writing to storage, ask permission. This adds basic ability to
query and route the OS's callback back to the code that asked.
2016-12-10 13:49:51 -08:00
Eric House
b6194f6986 Merge remote-tracking branch 'maidu2/android_branch' into android_sdk_23_take_3 2016-12-09 22:01:48 -08:00
Eric House
a1e4d4da0e pass TAG to printStack() and logex
So they'll show up when using logcat filtering
2016-12-09 07:34:51 -08:00
Eric House
25c2fd16ef use cmd strings; log discovery running or not
Add a compile-time option to send commands in json as strings rather
than ordinals (ints) for easier reading of logs. And log/keep track of
when discovery's turned off or on in case it's useful for making all
this work.
2016-12-09 07:20:27 -08:00
Eric House
2b120959ae new debug option for games list title: connection method 2016-12-06 19:39:14 -08:00
Eric House
3d5479565e wifi: send for open game too
In handling resend for a newly available transport, if the lock can't be
obtained see if that's because the game's currently open and if so post
to its thread.
2016-12-06 09:03:33 -08:00
Eric House
2c6ce5c1a8 interface name change only 2016-12-06 08:20:58 -08:00
Eric House
dc2cd239a1 wifi: send pending messages on getting connected
Each time we get a socket to a peer, try sending all pending wifi direct
messages. It's a hack, but trying to send isn't that expensive and the
experience is much improved.
2016-12-06 08:15:09 -08:00
Eric House
6eb2a7b71b wifi: pay attention to wifi being enabled
Don't keep trying to connect if wifi's off, and start trying when it's
turned on.
2016-12-05 20:23:52 -08:00
Eric House
19bb3ef7dd check standalone before iterating on addresses
New crash deleting non-networked games: needed to test first.
2016-12-05 07:35:54 -08:00
Eric House
9c14e0e858 rename method: sendResult -> postEvent 2016-12-05 07:24:25 -08:00
Eric House
aa420ce4d1 notify remote when BT game deleted 2016-12-05 07:12:22 -08:00
Eric House
ef0eeaae2e improve dead game notification
When contacting opponents, iterate over opponent addresses rather than
information cached in the summary. Start implementing for BT, but that
needs more work. Change enum names in WiDirService state machine.  P2p
opponent notification untested because apparently an open hotspot, which
you can't prevent devices from connecting to, breaks P2P connectivity.
2016-12-03 10:28:24 -08:00
Eric House
bc9baa2e79 wifi: don't crash when don't have permissions 2016-12-03 08:15:08 -08:00
Eric House
eecae536ec add missing log levels: was dropping before 2016-12-02 20:03:44 -08:00
Eric House
f9d352cb25 wifi: notify when game deleted 2016-12-02 08:17:03 -08:00
Eric House
54ed327406 wifi: notify when game missing
Rewrite to use new XWPacket class that wraps JSONObject but could later
support a binary format, and reply with new message when packet arrives
for a game that does not exist. Code already present turns that into an
invitation to delete the game.
2016-12-01 07:48:03 -08:00
Eric House
54d02e0fb2 wifi: update status on first connect
And remove the hack pretending on lack of permission that support was
compiled out.
2016-12-01 06:11:51 -08:00
Eric House
bf83741393 track and log failure counts
Later will likely want to restart when get above some threshold
2016-11-30 07:55:25 -08:00
Eric House
0a26496e73 wifi: tweaks
fix race condition in accept thread; only call wifimgr.connect() on
guest side. Connectivity now works reliably if the guest starts, or is
restarted, when the group owner is running. If owner is restarted the
guest seems never to connect (without restart.)
2016-11-30 07:06:59 -08:00
Eric House
a686541f96 merge recent manifest changes 2016-11-30 06:58:56 -08:00
Eric House
a3bc4f0a75 fix compile error from merge 2016-11-28 20:21:40 -08:00
Eric House
0237403a26 Merge branch 'android_release' into android_branch
This will probably not compile...
2016-11-28 20:19:54 -08:00
Eric House
6171d9ce90 prep a quick-fix release, with string changes
Two crashes reported on the Google Play store in the 112 version have at
least easy work-arounds: catching exceptions and doing nothing. In both
cases that should be harmless, so assuming the causes are rare it's a
good move.
2016-11-28 20:02:38 -08:00
Eric House
f415cf22ca change strings for next release 2016-11-28 19:19:03 -08:00
Eric House
1a513e8b02 add a bit of logging 2016-11-28 07:40:09 -08:00
Eric House
2fa47f057d use TAG instead of class for logging
Moving to the traditional use of Log class, with TAG defined in every
class that logs. It's just easier to use all the facilities built into
logcat.
2016-11-27 21:24:21 -08:00
Eric House
49d75d5d91 converting to use standard TAG-based logging
First files done manually: add TAG to file and pass it rather than class
to log wrapper. Rest will be done with a script.
2016-11-27 21:22:51 -08:00
Eric House
97c1091d0c add TAG everywhere
results of running a script that adds TAG to every top-level class. It
compiles, but I'm not using them yet.
2016-11-22 22:10:05 -08:00
Eric House
927c181ccc rename variable
TAG has conventional meaning I'm about to take advantage of, so rename
the one variable that would conflict.
2016-11-22 21:46:42 -08:00
Eric House
b8844a0e2d rewrite connection logic
Make it a trivial state machine that implements Runnable and
ActionListener so it can be scheduled and notified easily. Removes a
bunch of code. Connecting still happens unreliably, but it should be
easier to tweak things now.
2016-11-22 19:28:10 -08:00
Eric House
bff03617e5 wifi: hide unused buttons
Refactoring isn't perfect. Need to hide in subclass buttons that other
subclasses assume.
2016-11-22 00:17:49 -08:00
Eric House
e0f0666b1c wifi: make invitations work
Add UI, minor thanks to recent refactoring, to allow invitations via
wifi direct. Uses a mapping of all currently known device mac addresses
to names, with only the latter shown to users. Works well, though
something I changed seems to have causes devices to start losing track
of their connections to each other.
2016-11-21 21:10:16 -08:00
Eric House
3f0bef48f6 refactor invite UI
In order that wifi direct invitation dialog isn't another near-copy of
an existing file move a bunch of stuff into the common superclass.
2016-11-21 20:54:29 -08:00
Eric House
a67f2205bb log thread starts/stops 2016-11-18 20:13:48 -08:00
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
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
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
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
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
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
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
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
Eric House
3140df2f37 wrap loading and loaded views in FrameLayout
This to prevent the game list item from resizing (and so reflowing the
whole list) when it's reloading game info. Better would be to set a
timer and only show the reloading view if it seems likely to take a
minute.
2016-08-06 09:27:11 -07:00
Eric House
c2305dafff let android studio "optimize imports" 2016-08-05 22:16:04 -07:00
Eric House
b9bb1e2684 cleanup: use new board_drawSnapshot on existing game 2016-08-05 22:04:30 -07:00
Eric House
8b142e4a56 use new board_drawSnapshot() from android
BoardCanvas wouldn't render anything without an associated dict via
dictChanged()
2016-08-05 11:51:47 -07:00
Eric House
df6c1e0d3a make beginDraw return a boolean so can abort
When a gtk3 window's shutting down it appears we can't get a cairo_t*
for it. This change makes it possible to turn that fact into aborting
the whole draw operation.
2016-08-04 15:12:05 -07:00
Eric House
33f904fa1e provide no-op implementations of new draw methods 2016-08-04 07:07:52 -07:00
Eric House
aad97c7c23 grab the GameLock in synchronized code
I'm seeing unreproducible crashes trying to double-dispose jni game
instances and think it's a race condition involving JNIThread. Forcing
it to hold the lock in the constructor, access to which is synchronized,
is an improvement and may well fix it.
2016-08-04 06:48:39 -07:00
Eric House
d2edbaff37 log more about jni thread mapping 2016-08-04 06:46:34 -07:00
Eric House
cb97ceab82 oops: don't show upgrade changelist on every boot 2016-08-03 07:24:16 -07:00
Eric House
08269c8962 offer to turn on dual-pane mode for upgraders
When a device is a tablet and not a first-time install, put up an offer
to enable dual-pane mode. Change confirm-alerts to include
do-not-show-again box, and use that. Add menu item, hidden when not in
dual-pane mode, to turn it back off. Exit app after posting a
notification and a toast on changing that preference so it'll take
effect.
2016-08-02 21:49:17 -07:00
Eric House
f56869b9ea cleanup; synchronize calling start()
Hash comparison is clearly working, so no need to keep the whole data
array any longer.
2016-08-02 11:59:57 -07:00
Eric House
98eeb60f24 move sound notification preference
It's about robot games too now so move out of network into general prefs.
2016-08-02 11:30:33 -07:00
Eric House
e1cac237ab fix gradle build: remove thumbnail stuff 2016-07-30 17:48:47 -07:00
Eric House
1addd34e95 Merge branch 'android_branch' into android_translate
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
2016-07-29 08:51:16 -07:00
Eric House
141fb29c81 fix occasional NPE
I can't reproduce it, but occasionally fail to get Loc info for a
wordlist while opening. Drop the open rather than crash.
2016-07-29 08:17:31 -07:00
Eric House
fa7de741eb fix NPE: PrefsActivity needs to delegate onStart() too 2016-07-29 08:03:14 -07:00