Commit graph

5380 commits

Author SHA1 Message Date
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
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
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