Current code already provides category suggestions as the user types, via AsyncTask with a call to the MediaWiki Commons API using the letters typed as a prefix. We intend to add Method A calls that would run in parallel with the existing prefix method.
Plan:
- Use Utils.executeAsyncTask to run method A in parallel with prefix method
- Store categories in LinkedHashSet to preserve order (method A results should be shown above prefix results) - http://docs.oracle.com/javase/6/docs/api/java/util/LinkedHashSet.html
- Display the results returned by Method A in the UI as soon as it returns. Use onPostExecute() for this purpose.
- The prefix task waits until method A is done before it shows its results, to prevent misclicks. Use CountDownLatch - http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/CountDownLatch.html
Update: Code appears to work on real device & emulator tests. Pushed release to Google Play.