716 Commits

Author SHA1 Message Date
Peter Serwylo
1a5b60f654 Merge branch 'fix-323--improved-search' into 'master'
Search as the user types

Fixes #323.

This does away with the separate `SearchResult` and instead applies the search to the currently viewed tab on the main screen (Available, Installed, Updates). When filtering the Available list, it filters the currently selected category.

Note however that there are still times when the old style `SearchDialog` will be shown over the top of the action bar rather than the `SearchView` within the action bar. These times include:
 * When a user with a hardware keyboard starts typing from the main screen.
 * On older devices with a "search" hardware button.
 * Probably some other cases (I think when there is not enough screen real estate, but haven't seen that happen).

In cases where this dialog is shown, filtering the lists as you type does not seem to be an option. I tried to figure out how to do that, but failed. If someone else figures it out, that would be great. However, when the search is submitted, it will hide the `SearchDialog` and populate the `SearchView`, focus it, and apply the search appropriately.

There is a script in the `F-Droid/tools/` subdirectory which will consecutively send various intents to F-Droid relating to search. This includes Play, market, Amazon search links. For good measure, I also made it send intents to do with viewing app details. This should probably be made into a proper instrumented test at some point, but I didn't have the time to figure out how to do that. Maybe a project for future @pserwylo.

One unknown is the performance implications. There is no problems on my Nexus 4 with Android 5.0. My Chinese/ebay/$30/Android 2.3.4 device seems good enough too.

See merge request !177
2015-12-16 11:50:30 +00:00
Daniel Martí
00e832fbe3 Don't fetch language names from the system
The system's are sometimes wrong, e.g. unexpected names. This also helps
our support across different Android versions without having to worry as
much about the system's language support.

Fixes #503.
2015-12-16 12:03:32 +01:00
Peter Serwylo
35f73f3786 Also hide the coloured bar below the category spinner.
In addition, added a @Nullable constraint on the categorySpinner
and a null guard when resuming the fragment to handle possible
null cases (though I don't think there will be any).
2015-12-14 22:45:37 +11:00
Peter Serwylo
49ffe06576 Don't remove +'s from an fdroid.search intent.
As per CR comment. These don't really ressemble URIs very much, so I
don't think they will require sanitization like this at all.
2015-12-14 22:41:29 +11:00
Peter Serwylo
86fb652fc3 When searching "Available" tab, search all the things.
Removed the option to search the currently selected category, as suggested
by others on gitlab.
2015-12-14 22:41:29 +11:00
Peter Serwylo
cc759b17a4 Fixed typo in doc comments about % and sqlite.
% means wildcard, not case insensitive in sqlite3.
2015-12-14 22:41:29 +11:00
Peter Serwylo
59c6e36034 Minor formatting/lint fixes/cleanup before CR. 2015-12-14 22:41:29 +11:00
Peter Serwylo
cb0f252d74 Don't finish() activity after showing app details.
When calling `finish()` after handling an intent to show app details,
the ability to navigate "up" disappears.
2015-12-14 22:41:29 +11:00
Peter Serwylo
829e8f1058 Queue pending search until the SearchView is inflated. 2015-12-14 22:41:29 +11:00
Peter Serwylo
7b5160df47 Make the SearchView get shown when SearchDialog is submitted. 2015-12-14 22:41:29 +11:00
Peter Serwylo
bfb90ef655 Correctly search currently selected category in main app list. 2015-12-14 22:41:29 +11:00
Peter Serwylo
b1be1dffb6 Initial move of search logic to FDroid activity from SearchActivity 2015-12-14 22:41:29 +11:00
Peter Serwylo
1ae1ae7368 Add indexes to temp tables when updating.
The idnexes which are added are for those columns which
are used to calculate information such as latest upstream version.
These queries use subqueries which seemed to be adversely
impacted by the lack of indexes.

In total, reduced update time on test device from just over 100 seconds
to just over 60 seconds.
2015-12-13 18:04:02 +11:00
Peter Serwylo
c24cd89028 Only create compatibility checker once per repo.
Looks like a non-trivial amount of work is done in the constructor
interrogating the features of the current device. This only needs
to be done once.
2015-12-13 18:02:55 +11:00
Peter Serwylo
9727dc505c Rename temp tables rather than DELETE + INSERT SELECT.
This requires renaming the old app/apk tables to be deleted and
the temp ones to be renamed. This is done in a transaction to
ensure we always have at least `fdroid_app` and `fdroid_apk`.
Well, two transactions, one for renaming the `fdroid_app` table
and one for `fdroid_apk`.
2015-12-13 18:02:55 +11:00
Daniel Martí
2067f15b27 Replace some lists with counters
These objects/strings were probably useful at some point. They no longer
are.
2015-12-08 15:24:51 +01:00
Daniel Martí
637d3dddc4 Fix regression in 9a0ba186e
I was too fast to remove unused code and missed the continue.
2015-12-08 15:20:56 +01:00
Daniel Martí
62f6fd3d44 Simplify some code, mainly removing elses 2015-12-07 21:19:48 +01:00
Daniel Martí
9a0ba186e6 Remove some unused code found by Studio 2015-12-07 21:06:58 +01:00
Daniel Martí
9a9e5c8668 Make RepoXMLHandler receiver final 2015-12-07 21:06:43 +01:00
Daniel Martí
c8e69c794a Run Studio's import optimizer 2015-12-07 20:56:47 +01:00
Daniel Martí
6010a6136b Bump checkstyle to 6.13 and fix it after MR merge 2015-12-07 20:44:03 +01:00
Peter Serwylo
7c99b6ce91 Merge branch 'fix-324--memory-issue-repo-update' into 'master'
Fix 324 : Out of memory errors while updating repos.

Fixes #324, but in the process makes the updater take a lot longer. My benchmarks tell me that an update which used to take approx 30 seconds on my Nexus 4 now takes about 50-55 seconds. This is because it first inserts the apps into the database (in a temp table) and then subsequently copies that table to the actual table. This means there is a lot more disk access than before.

I'm open for discussion on whether this tradeoff is worth it - however I'll caution that there is always going to be a tradeoff between faster and more memory vs slower and less memory. This is the case with all software, and perhaps more so with memory constrained devices such as phones. Also, as the repo index grows (until perhaps we are able to extract the app descriptions in the future), this will become more of an issue.

I'd also like this to be CR'ed properly before merging, because it changes some important code around the repo updater. It is important because security, and it is also important because it is the main thing that F-Droid needs to do (get a list of apps to show the user).

See merge request !173
2015-12-07 13:57:14 +00:00
relan
88c2774692 Refresh about dialog
Now it's vertically-oriented. Mention of Aptoide is removed because
F-Droid went far away from it.
2015-12-03 13:03:41 +03:00
Daniel Martí
f67527a86e Replace _i18n with _count in tab strings
All strings are internationalized. Use a name that actually says what
they mean.
2015-12-02 18:46:01 +01:00
Daniel Martí
aff3995475 tab fragments: use string resources consistently
Also, remove unnecessary "Installed" tab title duplicate.
2015-12-02 18:45:49 +01:00
Ruben Roy
676d173cc9 Merge branch 'master' into 'master'
Add counter to "Installed" tab. Closes #497



See merge request !176
2015-12-02 00:30:23 +00:00
Ruben Roy
ab00d49737 Add counter to "Installed" tab. 2015-12-02 05:51:13 +05:30
Daniel Martí
4f8fe4e967 FileCompat: fix setExecutable signature
For some reason its first argument was "readable", while it clearly
should be "executable" as per the code below. Also see the method we
call on api 9 and newer:

https://developer.android.com/reference/java/io/File.html#setReadable(boolean, boolean)
2015-12-01 13:52:25 +01:00
Daniel Martí
30bc2cf8d5 Build fix after checkstyle changes 2015-11-30 11:36:04 +01:00
Daniel Martí
8405ba7d87 checkstyle: proper multiple empty line check
Hopefully checkstyle could catch all of these on its own one day. For
now, help it via a multiline regex.
2015-11-30 11:30:49 +01:00
Daniel Martí
098241c981 checkstyle: don't allow multiple empty lines 2015-11-30 10:40:35 +01:00
Daniel Martí
f2212e33d7 Make newer checkstyle happy
Mostly just dropping public from constructors.
2015-11-30 10:37:43 +01:00
Peter Serwylo
959fe9f2e3 Show indeterminate progress when persisting the temp apk table.
Will also appear as indeterminate if:
 * The repo being downloaded from doesn't send a Content-Length header.
 * While connecting to the HTTP server to begin downloading.
2015-11-30 18:46:10 +11:00
Peter Serwylo
77ee4296a5 Guard against divide by zero exceptions during progress events. 2015-11-30 18:19:34 +11:00
Peter Serwylo
096b9c20d1 Changed logging levels as per CR. 2015-11-30 18:16:11 +11:00
Peter Serwylo
a3c91e4eae Reformatted some annotations to be inline. 2015-11-30 18:16:11 +11:00
Peter Serwylo
ab33eccaa2 Replaced if with switch. Fixed typo in error. 2015-11-30 18:16:11 +11:00
Peter Serwylo
c5bf2a131b Remove unused imports. 2015-11-30 18:16:11 +11:00
Peter Serwylo
8a6a62833b Alert update notification when saving details to DB. 2015-11-30 18:16:11 +11:00
Peter Serwylo
6969dcb90e Change "inserting" string to not include progress for last phase of update. 2015-11-30 18:16:11 +11:00
Peter Serwylo
90290f830a Send "inserting" message to notifications while committing temp provider.
Right now it says "50%" always, will need to think whether to ditch the
percentage completely, or to have the temp app/apk providers emit progress
events some how too.
2015-11-30 18:16:11 +11:00
Peter Serwylo
71f641860a More refactoring of AppProvider to use getTableName() instead of constant.
Although not used by the temp provider, it seemed strange having some of
the code always using the `DBHelper.TABLE_APP` and other code using
`getTableName()` where all of it could have used `getTableName()`.

Also moved commiting of the temp tables to the real tables into the
`RepoPersiter` instead of in `RepoUpdater`.
2015-11-30 18:16:10 +11:00
Peter Serwylo
b22b39ea26 Fix bug with SQL generation (missing . char) from bung rebase. 2015-11-30 18:16:10 +11:00
Peter Serwylo
ad6a8e5b4e Extracted RepoPersister class from RepoUpdater to separate security and DB logic. 2015-11-30 18:16:10 +11:00
Peter Serwylo
1d951e7689 Fixed repo updater tests. Fix to temp app/apk providers.
The repo xml handler now has a different mechanism for returning
data about the parsed xml file. This is done via a callback, rather
than storing the data in member variables. The tests now deal with
this correctly.

The update/delete operations of the TempAp[pk]Provider's didn't
work, so that has now been fixed.
2015-11-30 18:16:02 +11:00
Peter Serwylo
b34853a776 Cleanup before CR. 2015-11-30 18:14:44 +11:00
Peter Serwylo
cc0adcc5ad Save app details to temp table, then flush after update verified. 2015-11-30 18:14:44 +11:00
Peter Serwylo
9a2d390279 WIP: Do repo update database work in temp table for apks, then copy at end.
At the start of a repo update, it will create a copy of the apk table.
Throughout the update, it will query the original apk table for info.
All inserts and updates happen to the temp table. After the repo has been
verified as trusted, the original apk table is emptied, and all apks are
copied from the temp table to the real one.

I realise that the work done to query the apk table for info during the update
could happen against the temp table, but it was not neccesary to move all of
the queries that are required for this task to the temp apk provider.
2015-11-30 18:14:44 +11:00
Peter Serwylo
b989ef3ecc WIP: Stream index details to database rather than waiting until end.
Refactored repo update to stream apks from network -> jar file reader ->
xml parser -> database. No longer build up large lists of app metadata
to save. Saves memory, but is MUCH slower.

Does sig verification properly, but does it at the END of the process
and DOESN'T ROLL BACK on failure.

Quick and dirty benchmarks show an increase in time from ~25 seconds
to ~30 seconds on my Nexus 4 with Android 5.0. This doesn't seem so
bad to me, for the tradeoff that people on low end devices can actually
update now.

Also, as @eighthave pointed out, if we are able to stream the download
directly from the internet, then that time will drop to essentially
the time it takes to download the index.
2015-11-30 18:14:42 +11:00