Commit graph

9967 commits

Author SHA1 Message Date
Eric House
c271202faa make bad phonies alert non-blocking
Continue conversion of alerts that required blocking the JNI thread. Now
board_commitTurn() takes a second boolean indicating whether phonies
found have been approved by user. Common code informs user, and if he
approves client code calls board_commitTurn() again. In case where
turn's lost there's no call to make back, but there's the undesirable
change that if a robot moves next its move will be reported on top of
the turn-lost alert. Ideally new alerts would appear under, not on top
of, those that have not yet been dismissed.
2017-02-20 07:20:19 -08:00
Eric House
42aef7b85c add UI to set phoniesAction creating new gtk games 2017-02-19 15:05:40 -08:00
Eric House
81d428a16d fix crash by adding missing param 2017-02-18 19:20:14 -08:00
Eric House
5f12d1a03b assign faces to blanks asynchronously
Next step in converting util_ methods that required blocking: blank tile
assignment. Now post a query and add a method that the client code can
call when the user's decided. Include enough state (col, row, and
playerNum) so that it's probably pretty safe.
2017-02-18 19:16:32 -08:00
Eric House
ca6edcfc9a make trade and move confirm non-blocking
Probably breaks curses build, but for gtk and Android
turn move and trade confirmation into a two-step process, making
board_commitTurn() non-interactive when called with a second
parameter. The old blocking util methods now return void and it's up to
the client code to interact (on the main thread) then re-call
board_commitTurn() if appropriate.
2017-02-17 08:58:20 -08:00
Eric House
1f2f4506c4 remove unused query option. Less to convert. 2017-02-17 06:30:54 -08:00
Eric House
2a0b21e5e8 make password fetching non-blocking
First attempt to stop blocking the jni thread: instead of returning a
password from a util_ method, have it include enough state that the UI
can return, put up a dialog, and then pass that state and the password
back and have them matched up again. I think this will work for the
remaining blocking Alerts too.
2017-02-17 06:23:44 -08:00
Eric House
4d5278704e symlink changed! 2017-02-16 19:05:34 -08:00
Eric House
c088e36113 fix crash; use params
Pass blank-picking params through rather than using instance variables.
2017-02-16 07:59:10 -08:00
Eric House
e631d57e9b convert remaining DelegateBase Alerts
Includes a hack in DBAlert that's required I think because
GameConfigDelegate is launched "for result". onCreateDialog() always
fails after a rotation the first time because GameConfigDelegate isn't
there to have its makeDialog() dispatched to. So it puts up a dummy
alert and then post()s code that is successful in calling makeDialog()
to get an alert from GameConfigDelegate that can replace the
dummy. Nothing shows on the screen on simulator anyway.

The major problem remaining is that blocking alerts in BoardDelegate are
recreated after rotation but the thread that was blocking has been freed
so nothing can be done after the new alert returns. E.g. blank tile
picker will be posted again, user will pick a tile, but the common
code's not in a state to do anything with that choice (which cannot even
be "returned.") Options are to find a way to make the JNIThread survive
the configuration change without unblocking or to rewrite all the common
code to not expect return values from util_ methods.

This commit is not well tested, and diffs don't allow a thorough check
of the conversion of each DlgID type.
2017-02-16 07:25:20 -08:00
Eric House
13adebdc51 support alert onDismiss listener
New way of adding onDismiss listener to DialogFragment-based alerts
required API change to DBAlert and the makeDialog() method.  Fixes
customizing default player name.
2017-02-15 07:28:39 -08:00
Eric House
f5c022bb72 move show(DialogFragment) to XWActivity
First of probably many bugs running new alert changes in
non-dualpane-mode: Activities get to show dialogs too!
2017-02-15 06:44:01 -08:00
Eric House
8e874fa45c fix dispatch of extra actions
Had left out dispatch of "negative" buttons populated from an
ActionPair. Tested for offer to remove redundant new game buttons at
bottom of games list.
2017-02-15 06:37:25 -08:00
Eric House
a526ec6529 new gradle version (recommended by AS) 2017-02-15 06:35:23 -08:00
Eric House
507f6001fa convert another to DialogFragment 2017-02-13 06:09:25 -08:00
Eric House
07da48db73 replace activity.show(dlgID) with fragment-based
For GamesListDelegate only so far, replace calling <activity>.show(int)
to launch an Alert with something producing and showing a
DialogFragment. Replaces passing and saving state inside the
DelegateBase subclass with saving it as part of the fragment's bundle,
and it looks as if a single class will work for nearly all of the alerts
managed by DelegateBase.{onCreateDialog,prepareDialog}(), which will
eventually go away. The beauty is that the implementations of
onCreateDialog and onPrepareDialog remain, but as the body of a new
makeDialog() that's called by the fragment's onCreateView. Less code
changes, but now it's all called every time an alert's created.
2017-02-12 15:33:35 -08:00
Eric House
c66764bd77 make lookup alert fragment-based 2017-02-10 08:41:28 -08:00
Eric House
b69eb30e9c use the recommended pattern for DialogFragment construction
Empty constructors only...
2017-02-10 07:17:53 -08:00
Eric House
8c92f2012e file/class name change 2017-02-10 06:40:56 -08:00
Eric House
92e150bb1e convert confirmThen alert 2017-02-10 06:00:26 -08:00
Eric House
c9bc7b6c49 convert ok-only dialog to fragments 2017-02-10 05:47:17 -08:00
Eric House
a724ef734f add forgotten file 2017-02-10 05:40:18 -08:00
Eric House
e69824ece0 remove Runnable from DlgState
Can't be serializing Runnables, so replace with an Action that's sent
via onPosButton.
2017-02-09 09:08:03 -08:00
Eric House
470ee6eaa4 rebase invite choices alert on fragments
And create a common superclass for alerts coming out of DlgDelegate
2017-02-09 08:14:44 -08:00
Eric House
7c39bf6064 call via activity in common case too 2017-02-09 06:41:38 -08:00
Eric House
939688e3cd change DlgClickNotify methods to return boolean
So dispatching over possible targets can stop when one has handled it.
2017-02-09 06:23:41 -08:00
Eric House
796192380f switch not-again alerts to being fragments
Since associated DlgDelegate instance doesn't survive a rotation, needed
to pipe results through a DlgClickNotify implementation on XWActivity
that then dispatches in the DualpaneDelegate case to all visible
fragments. I hope this turns out to work for all DlgClickNotify
implementations as I switch them over. We'll see.
2017-02-09 06:19:37 -08:00
Eric House
e863cc1a4b experimental on-device log-saving script
Add script that when copied to device and run from 'adb shell' captures
all app and OS logs to file. Next: add code to XWApp.java to copy it
from assets/ and run it on launch.
2017-02-08 07:01:38 -08:00
Eric House
b1f095b56e prevent loading of WiDirService on older android
On 2.3 anyway there's a java.lang.VerifyError trying to load that
class. So wrap the loading in a new class that catches the error and
sets a boolean so subsequent calls don't need it. There are other calls
that could load the class, but they may not be reachable. To be tested.
2017-02-08 06:33:06 -08:00
Eric House
683eb8e14b don't remove alerts in onStop()
Required to fix alerts going away now that orientations are handled by
the OS (which in turn is the preferred way to do things now since not
ALL config changes CAN be handled by the OS.) With this change some
alerts will probably cause crashes during a rotation. Those all need to
be fixed.
2017-02-07 07:04:27 -08:00
Eric House
0e23c191b5 convert About alert to DialogFragment
As a first experiment. Untested on non-dualpane and on older OS
versions.
2017-02-07 07:02:16 -08:00
Eric House
121c35b728 don't expect View to survive a rotation 2017-02-06 19:18:15 -08:00
Eric House
69eee734e2 cleanup: switch on ids rather than test views 2017-02-04 10:28:23 -08:00
Eric House
99664a8360 persist game config state across rotations
Make CurGameInfo serializable, make sure it's updated in onPause, and
then just add it to the bundle. Easy.
2017-02-04 10:12:34 -08:00
Eric House
b050ac5d62 update studylist display when words added
Add listener interface to DBUtils and hook StudyListDelegate into it so
that if a word is added while the list is being displayed the new word
shows up immediately.
2017-02-04 09:40:01 -08:00
Eric House
6eb4a9b09b preserve studylist selection across rotation
As elsewhere, convert to a serializable representation and save it in
instance state.
2017-02-04 09:00:40 -08:00
Eric House
6b565e2fa7 cleanup: remove some logging 2017-02-04 08:53:07 -08:00
Eric House
6270a81bfa config changes to build on different system 2017-02-04 08:12:40 -08:00
Eric House
b0cef99507 preserve wordlist selection and remote info
wordlist browser selection and downloaded info about downloadable
wordlists didn't survive rotation. They do now, the latter as a huge
serialized array. To make selection work I save the keySet() of a
mapping of selected names to the views that represent them. Now the
presence of a key, even if the value is (temporarily) null, signals that
something's selected.
2017-02-02 21:08:22 -08:00
Eric House
3ae2b41ae2 save selected games/groups across rotations 2017-02-01 06:08:33 -08:00
Eric House
ca4b3fd454 fix crash when starting in non-dualpane mode 2017-01-31 21:04:17 -08:00
Eric House
b874d25563 fix iterating over fragments
Old code that didn't rotate properly was meant to associate view IDs
with fragments so I could iterate over them, e.g. to dispatch
intents. To replace that the common superclass of all fragments now
keeps a set of active ones and provides a method that uses that to find
the fragment that owns a view. So I can iterate over fragments based on
the dualcontainer-contained views as before.
2017-01-31 19:46:51 -08:00
Eric House
0fedcf56ab fix remaining fragment view layouts
The layout_width="1" thing is critical!
2017-01-31 08:03:13 -08:00
Eric House
352508b852 start fixing problems with dual-pane
Remove the generated FrameLayout that was breaking restoration after a
config change. Set layout_weight=1 for all fragment root views so they
get half the screen in landscape mode. Remove some code. Problems
remain, first among them that notification intents aren't dispatched correctly.
2017-01-31 07:01:11 -08:00
Eric House
f9cc524028 remove configChanges for MainActivity
Makes it so simply rotating duplicates the grey-screen GamesList problem.
2017-01-28 11:03:33 -08:00
Eric House
afb0c1d3ee disable move when all games already there
When all selected games are starting in the same group and that group is
selected as the move destination, disable the move button.
2017-01-24 07:55:09 -08:00
Eric House
b8e8c176ed don't open group just because added game
A group that's closed stays closed even if a game's added to it. The
change flushed out a bug where the groups cache wasn't being invalided
on a game move, so fix that too.
2017-01-24 06:53:54 -08:00
Eric House
9cab7d916c fix strings update server file requires
Name file and set internal constant sent to server to use same git rev
string so that the script will correctly identify whether the version I
have is the latest it has available. Fixes server offering to replace
with what I already have.
2017-01-22 16:22:35 -08:00
Eric House
929c4c811b tweak gradle-built apk name 2017-01-22 15:55:31 -08:00
Eric House
83fed4da91 include debug keystore directly
replace symlink silliness ant required with gradle commands to sign
debug builds with the checked-in (local file) debug keystore. Make
it possible for an environment variable to override in case somebody
wants to use his own.
2017-01-22 15:35:02 -08:00
Eric House
15d0f88187 add preference to disable wifi direct
Looks like there are battery drainage issues with the current half-done
implementation, so add option to turn it off. Only takes effect on
restart, and only matters on dbg variant now since it's compile-time
disabled on the main variant.

Also add discovery machine state to ConnState printout, stop running the
machine over and over (likely the battery problem), but add ability to
restart it triggered by the ConnState's "reconnect" button.

Also start persisting the most recently seen set of peers. If service
discovery and not connecting is the problem having these available to
try to connect to on startup might help.
2017-01-22 14:51:21 -08:00
Eric House
b96d44393a add and use boolToStr
Just to make log messages a bit more helpful. Should be no behavior
change, and no change in code generated in release builds.
2017-01-22 14:15:29 -08:00
Eric House
4a93281a2d enable wifidirect in xw4dbg variant
As it was before.... Also log rather than assert a common widir packet
forwarding error.
2017-01-20 07:56:03 -08:00
Eric House
2053b234fa print less during builds 2017-01-19 19:05:10 -08:00
Eric House
eb13ea4291 add the upside-down icons for -dbg flavor 2017-01-19 08:36:27 -08:00
Eric House
9c142dd6e7 add cleanNDK task and separate jnilib dirs
Build different jni code (into different obj and libs directories) for
the different release/debug and xw4/xw4dbg combinations. This works when
only one build is done, but when doing two some later task tries to put
both multiple same-named libraries into the .apk and so fails. I still
think it's worth adding this to keep from using the wrong binary, but
that needs to be fixed.

cleanNDK just nukes all the directories. Easier than invoking build-ndk
clean...
2017-01-19 08:10:16 -08:00
Eric House
43e8c3ea64 fix release script errors and that running it finds 2017-01-19 06:22:24 -08:00
Eric House
f5ebee89da fix duplicate permissions
Merging of AndroidManifest.xml files meant the dbg flavor was getting
its C2D_MESSAGE permission and the main flavor's, which on recent OS
versions meant it couldn't be installed. Use substitution from gradle to
fix.
2017-01-19 06:22:12 -08:00
Eric House
995da3a0b2 remove last from old directories 2017-01-18 19:44:17 -08:00
Eric House
ea3a8b4034 include relay hostname in debug conn status 2017-01-18 19:30:03 -08:00
Eric House
22ca219347 Merge branch 'android_json' into android_branch
Accidentally did a bunch of gradle work on the wrong branch, but it's a
trivial merge as I hadn't done anything else with it yet.
2017-01-18 19:25:58 -08:00
Eric House
8ade997e8c remove the rest of XWords4-dbg 2017-01-18 19:24:59 -08:00
Eric House
9eed2ca608 auto-update emacs compile-command to use gradle 2017-01-18 19:22:32 -08:00
Eric House
1f5ffaa712 more cleanup. Get Crittercism stuff compiling. 2017-01-18 19:03:36 -08:00
Eric House
0d1e22fc83 move wordlists and other assets over 2017-01-18 08:47:33 -08:00
Eric House
aaf153006e move and incorporate localized strings
This will require a reconfig on the weblate side!
2017-01-18 08:44:23 -08:00
Eric House
3ac0039b4d fix jni build. Full .apk now produced.
But it gets confused about downloading wordlists.
2017-01-18 08:33:49 -08:00
Eric House
0750a771c3 move java files and get them to compile 2017-01-18 08:27:48 -08:00
Eric House
f090e86e26 move res files 2017-01-18 07:34:32 -08:00
Eric House
fcdb66eb87 forgot a file 2017-01-18 07:28:19 -08:00
Eric House
49242f78cf more script fixes; move jni code 2017-01-18 07:27:23 -08:00
Eric House
ad5d451ef3 fix image generation 2017-01-18 07:15:08 -08:00
Eric House
451e9e04ab fix path in script 2017-01-18 07:05:18 -08:00
Eric House
612ff0259c move and start processing res .xml files 2017-01-18 07:01:25 -08:00
Eric House
975d114f41 move some gradle files 2017-01-18 06:33:00 -08:00
Eric House
26b4c7da8e log values showing up in the occasional crash 2017-01-09 20:55:14 -08:00
Eric House
084a45296e invalidate menu when board destroyed; shorten rematch name
GamesList menu was in a bad state after a game closed because hadn't
been rebuilt. It's simplest to invalidate it surgically, when the
BoardDelegate notifies that the board's closed, though doing in in
onWindowFocusChanged() might catch more edge cases. We'll see. I want a
low-risk impact right now.
2017-01-09 07:04:58 -08:00
Eric House
8c680b50f7 fix mystery crash on my phone
but not on emulator running same OS version (or close). And in spite of
an exception being thrown the work being done, hiding a preference,
still succeeds. Whatever.
2017-01-08 14:40:18 -08:00
Eric House
fac8c2b943 resend all pending SMS messages on getting permission
Fixes case where user has received invitations but not allowed SMS then
decides to do so. It's a hack giving Perms23 class knowledge of how to
send moves etc. Instead I should be letting interested parties register
for perms-granted events, but that can happen later, and is less
valueable while SMS is the only "dangerous" permission and the only one
that blocks message sends.
2017-01-08 14:23:23 -08:00
Eric House
f41b77b8ee fix conversion of contacts from old format
JSONObject(<string>, null) clears out any existing entry but doesn't add
a new one. So store missing names as "" instead. Not sure how this
worked when I first tested it....
2017-01-08 13:26:29 -08:00
Eric House
8349ffc126 tweak changelog 2017-01-08 13:02:44 -08:00
Eric House
a0fffb3af6 get rid of SMS enabling on Marshmallow and later
My old asking for permission to turn on/off SMS is confusing and adds no
value when the OS separates out permissions and is confusing. So get rid
of it on Marshmallow and later, always returning true from the old API
and hiding the preference in that case.
2017-01-08 12:58:57 -08:00
Eric House
b0105888d0 sort current turn games with oldest at top 2017-01-07 16:20:15 -08:00
Eric House
449860a880 make Dbg variant's icons upside down
The write-red-on-it thing doesn't work for the notify.png file used in
notifications (I think because I can't find a color Android doesn't
strip out.) So use a rotation transform instead. Users will never see
this anyway.
2017-01-07 14:48:31 -08:00
Eric House
4f30a5be71 Merge remote-tracking branch 'weblate/android_translate' into android_branch 2017-01-07 13:15:16 -08:00
Eric House
e842e1a744 use tryGetPerms to replace a bunch of Perms23 crud -- again 2 2017-01-07 12:55:45 -08:00
Eric House
734549668c use tryGetPerms to replace a bunch of Perms23 crud -- again 2017-01-07 12:45:26 -08:00
Eric House
a453676456 use tryGetPerms to replace a bunch of Perms23 crud
This one required allowing passing in a string rather than a res id.
2017-01-07 12:16:59 -08:00
Eric House
6203012db6 use the utility for contacts permission 2017-01-07 10:55:21 -08:00
Eric House
ee81e3e6cc tweak permissions again
Move connection options READ_PHONE_STATE check from ConnViaViewLayout to
GameConfigDelegate and give it a rationale. Preferences stuff can't do
permissions because it can't override onRequestPermissionsResult (base
activity is of wrong class). Should fix that at some point, either by
moving to preference fragments or with a dummy activity to go over the
top.
2017-01-07 10:21:41 -08:00
Eric House
558a20f2db more tweaks around SMS permission
Explicit "ask again" and "skip" buttons in alert showing rationale;
check/ask for permission before sending invitation via SMS; warn each
time SMS-enabled game is opened without permission but allow it to stay
open and if necessary send an invitation.
2017-01-07 08:38:48 -08:00
Eric House
b898637666 close game that has no way to connect
add "close game" button to warning about lack of comms, and do that on
dismiss too. Nothing good can come from having the thing stay open.

Eventually the "close" should turn into "edit" and launch GameConfig on
the game with the comms selector up, but that's hard, as currently the
launch only happens from GamesList and is via
startActivityForResult. Might be easiest to close and send an intent to
GamesList to cause it to launch GameConfig that way. Not for this release.
2017-01-07 07:44:53 -08:00
Eric House
8bf65622b5 fix crash duplicating no-address network game
An edge case, but: doing "new from" on a game without any connection
types crashed because of an assertion in comms that assumed
addr_setType() was being called on zero-initialized flags, which
shouldn't have been a requirement. Pulled that as well as java code that
added RELAY-type connectivity to any game that had none. If a game has
none, leave it that way.
2017-01-07 07:41:38 -08:00
Eric House
86e7142687 split DlgDelegate interface in three
replace dlgButtonClicked() with separate methods for positive and
negative buttons and alert dismissal. I was making too many mistakes
because the old method was getting called twice (e.g. for negative and
then dismissal) and I hadn't needed to differentiate until adding that
new Action. There should be no behavior change with this, but it's
pervasive and replaces some spaghetti.
2017-01-06 07:07:17 -08:00
Andreas Kleinert
6bce7ea64d Translated using Weblate (German)
Currently translated at 8.5% (64 of 746 strings)
2017-01-05 21:44:57 +01:00
Eric House
dc7ed9bfb2 use new utility method 2017-01-05 07:42:21 -08:00
Eric House
46f69607c5 log class in XWFragment lifecycle methods 2017-01-05 07:39:06 -08:00
Eric House
d661f1d050 add another perms request/rationale 2017-01-04 07:10:45 -08:00
Eric House
7c033ccdf1 warn when unpermitted choice made
Let OS ask for STORAGE when user chooses Downloads dict storage option,
but do nothing if it's not granted. Existing code asks again when the
actual move is to done.
2017-01-04 06:46:44 -08:00
Eric House
2eaa3b82e7 inval dicts availability cache when permission changes
Along with cacheing what dicts are where cache the state of STORAGE
permission when the cache was made. If it's changed, invalidate the
cache.
2017-01-03 21:24:42 -08:00