716 Commits

Author SHA1 Message Date
Ruben Roy
1a54c61a50 Make progressbar in notification determinate 2015-11-27 18:43:16 +05:30
Christian Morgner
0df276eefc Remove initial HEAD request in HttpDownloader.setupConnection(), just add
credentials if present, fix checkstyle error in ManageReposActivity.
2015-11-16 21:02:39 +01:00
Christian Morgner
caabec7ef9 Reverted change in RepoProvider. 2015-11-16 13:48:08 +01:00
Christian Morgner
0c0342b12f Merge remote-tracking branch 'pserwylo/cmorgner-master' 2015-11-16 12:52:30 +01:00
Christian Morgner
e82382fe94 Modified return expression on MagageReposActivity.java. 2015-11-16 12:50:47 +01:00
Peter Serwylo
ee7761e1af CR: Replace String.isEmpty() with TextUtils.isEmpty(String).
String.isEmpty() is only supported in API v9, whereas we target
API v8 for now.
2015-11-16 18:05:37 +11:00
Peter Serwylo
0b3b32dab3 CR: Add overloaded createNewRepo method which provides default arguments.
Instead of passing in `null` each time you don't have a username/password,
this change provides those as meaningful default values in an overloaded
version of the method. This takes care of Java's lack of default argument
support.
2015-11-16 18:05:31 +11:00
Peter Serwylo
3426b3bb2d CR: Better deal with the possibility of crashes during database update.
This is for an abundance of caution. If the guard condition checks
for the presence of both username _and_ password fields, then a crash
or some sort of force close during the update (after adding username
but before password) will mean that next time the app runs, this
condition will evaluate to false and the password field will never
get added.
2015-11-16 18:05:16 +11:00
Peter Serwylo
97b60d937d CR: Apply database changes in chronological order.
As with the previous commit, there is probably not any harm doing this
in the way it was done. However it helps reason about the code if
changes are applied in the order that they were introduced. Especially
because each of them does something depending on the version of the
database at that point. With this change, you always know that at the
point that the function is run, the database version will be 51 (and
hence the structure of the database will be predictable).
2015-11-16 18:05:03 +11:00
Peter Serwylo
6957721479 CR: Leave old db update code as it was.
This may not have caused any trouble, but the principle behind the old
behaviour is that at the point that that was required, the fdroid_repo
table had that particular structure. There is a small chance that it
_may_ have some unintended consequences when upgrading clients with very
old database versions. Probably not, but may as well leave it as is.
2015-11-16 18:04:54 +11:00
Christian Morgner
34838fd0dc Added username & password fields to the REPO table, increased DB version to 52.
Extended DownloaderFactory to support optional username & password parameters.

Extended HttpDownloader to check for HTTP 401 Authorization Required status code
and send a simple HTTP Basic Authentication header with all requests.

Extended ManageReposActivity to support repositories that use HTTP Basic
Authentication, added a dialog to prompt for username and password.

Extended RepoDetailsActivity to be able to display and modify the authentication
credentials.
2015-11-15 13:04:23 +01:00
Daniel Martí
31313bc9ee Specify why the DM downloader is disabled
Closes both issues since they don't affect official builds anymore, for
as long as this is disabled.

Closes #445.
Closes #459.
2015-11-14 17:18:15 +01:00
Daniel Martí
b6e2f2d691 Remove one lone Log.d in prod code 2015-11-14 14:19:29 +01:00
Daniel Martí
9fc1aba8bc Checkstyle fix 2015-11-13 20:46:52 +01:00
Daniel Martí
14a79b5577 Remove unused parameters 2015-11-13 18:50:43 +01:00
Daniel Martí
d951ccd221 Make a few declarations final 2015-11-13 18:44:08 +01:00
Daniel Martí
682cf58aa9 Merge branch 'search-widget' into 'master'
Replace search dialog with a search widget

SearchView is the recommended way to implement search UI. See https://developer.android.com/guide/topics/search/search-dialog.html#UsingSearchWidget

The UX is still far from ideal but looks much better now.

Before and after (Gingerbred):

![gingerbred-before](/uploads/f724afaf152aeef8ff9cb3e838427d22/gingerbred-before.png)
![gingerbred-after](/uploads/da67fe57d2a55e64cce7d0cba31aa181/gingerbred-after.png)

Before and after (Lollipop):

![lollipop-before](/uploads/4a50258993a8304d984450456d07e3bb/lollipop-before.png)
![lollipop-after](/uploads/4b49b2f802eca567c6713fe653b10331/lollipop-after.png)


See merge request !168
2015-11-13 17:22:19 +00:00
Daniel Martí
7581d8443e Merge branch 'lint-unused-resources' of https://gitlab.com/relan/fdroidclient
Fix some lint warnings about unused resources

No functional changes, just cleanups.
2015-11-13 18:19:13 +01:00
Daniel Martí
04a2c4b70d Fix tests by never caching a null signature
This also keeps us from future possible NPE or null signature issues, if
we ever call getPackageSig on a PackageInfo with no signatures.
2015-11-13 11:42:47 +01:00
Christian Morgner
405e411200 Enable HttpDownloader to use URL-based HTTP Basic Authentication. 2015-11-13 09:30:08 +01:00
relan
c3fd3984b8 Remove the code related to the compact layout
Compact layout preference is gone.
2015-11-13 09:25:49 +03:00
relan
e841d63ea9 Replace search dialog with a search widget
SearchView is the recommended way to implement search UI. See
https://developer.android.com/guide/topics/search/search-dialog.html#UsingSearchWidget
2015-11-13 08:27:55 +03:00
relan
f0d72a3ec4 Remove search button from the search results activity
It violates app navigation logic.
2015-11-13 08:27:55 +03:00
relan
7fdcd706fd Split tabs layouts
Use separate layouts for the three tabs. This simplifies code and improves
maintainability.
2015-11-09 15:43:09 +03:00
relan
080527bf2e Remove ThemeableListFragment
Not sure why it was added initially but now it appears to be unneeded:
the support library does everything right and the lists are themed
properly without any hacks.
2015-11-09 15:42:52 +03:00
relan
817cac3002 Remove dead code in CanUpdateAppsFragment
Remove unused layout creation code. If needed, it can be re-added later as
an XML resource which is a much more maintainable way to define layouts.
2015-11-09 15:08:53 +03:00
Peter Serwylo
1a5bd84fad Never fallback to UIL for handling image downloads, only use for displaying.
Our `IconDownloader` extended `BaseImageDownloader` from UIL. There was an
explicit check in the F-Droid `IconDownloader` which looks for
HTTP/HTTPS/Bluetooth schemes. If it wasn't one of these, it fell back
to the base class. This was what was happening for local cached image
files. As such, when the `getInputStream(...)` method was refactored
to only use F-Droids `DownloadFactory` and not delegate to the base class,
it failed on local "file://" URLs.

This change introduces a `LocalFileDownloader` and makes the `DownloaderFactory`
aware of it.

The `BaseImageDownloader` class only provides support for the following schemes:

 * HTTP
 * HTTPS
 * File
 * Android content providers
 * Android assets
 * Android drawables

F-Droid now supports HTTP, HTTPS, and File URLs. There is not currently any
need for content proiders, assets or drawables to get icons for apps in F-Droid.
If there is a need in the future (e.g. an issue currently discusses loading
icons from installed apps if possible) then that specific `Downloader` can get
introduced to solve the problem.
2015-11-08 10:30:23 +11:00
Daniel Martí
eefbee969e Store installed app signature in cache
This means we can fetch the signatures only once instead of every time we need
them. Start by using the cache in AppDetails.
2015-11-07 13:57:34 +01:00
Daniel Martí
bb9426763c Remove <p> from comments
These are written manually and mostly don't contain HTML. Some html is
fine if you want to use links or markup, but <p> elements are just
pointless and very seldom used. Be consistent in not using them.
2015-11-07 13:25:01 +01:00
Daniel Martí
40092a07dd Don't duplicate repo info in UpdateException
The exception already contains the repo object, so don't hard-code the
address in the message string again.
2015-11-07 13:19:30 +01:00
Daniel Martí
94b30a54a6 Merge branch 'test-multi-repos' into 'master'
Added tests for multiple repositories providing same apks

Right now, multi repo support works, but is kinda funky. While fixing #324, I accidentally broke this support without realising it. So in the interests of making my approach to #324 more test driven, I've written some tests for multi repo support.

Initially I wrote tests for the actual correct, desirable behaviour. Then when it became apparant that we dont' do this, I commented those tests out (but left them there for hopefully future multi-repo work) and then added tests for the current behaviour to make sure we don't introduce regressions.

Android unit testing framework is nice for testing content providers. It is nice for testing file handling. However I really struggled to get it working with both. Had to do some interesting things with instrumentation and contexts in order to get it to work.

I'm sure Android has nice `Service` testing capabilities too. But given the trouble with instrumentation/contexts/files/providers/etc, it was easier for me to refactor the parts of `UpdateService` that I needed to test into a separate, testable class. 

See merge request !163
2015-11-07 11:45:47 +00:00
Peter Serwylo
12d5c5c7b4 Format to make checkstyle happy. Remove unused code. 2015-11-07 09:40:44 +11:00
Peter Serwylo
94410c5dbc Code formatting to pass checkStyle. 2015-11-07 08:39:23 +11:00
Peter Serwylo
3ad429aa6b Guard against null activity.
Came across this whibluetooth swap.
I think it is reasonable to guard against null activities here, because
we are likely not releasing observers correctly, and thus the observer
may receieve a notification when the activity is not attached.
2015-11-07 08:39:23 +11:00
Peter Serwylo
f388f32fcf Don't use download manager for Bluetooth downloads.
The F-Droid Bluetooth downloader must be used for these, as it is a
custom protocol and Android download manager only understands HTTP
and HTTPS.
2015-11-07 08:39:23 +11:00
Peter Serwylo
012cdce37b Make closing of Downloaders more concise.
The base `Downloader` class now wraps the `InputStream` returned by
any child classes, in order to notify the child class when that stream
is closed. This prevents each child class having to figure out a way
to be notified of this.

Also removed some dead code which was unused.
2015-11-07 08:36:17 +11:00
Peter Serwylo
0685c16efe More work on multi-repo tests, currently broken due to F-Droid being broken.
(One of) the problems with F-Droid's multiple support is that there is
a primary key on the fdroid_apk table which is a composite of:

 * id
 * vercode

Which means that two repos providing the same version means one will
update the other, rather than ending up with two different versions.

Instead, there should be some other way to differentiate apks from
different sources. Firstly, it should take into account the signing
cert. Secondly, it may taken into account the hash, because two people
could sign different apks with the same cert and then we are back at
square one.
2015-11-07 08:05:13 +11:00
Peter Serwylo
b6218c6d05 Refactored code which inserts apps into database to make testable.
Putting it in the UpdateService made it a little tricky to test, so
I moved it out to a separate class called `RepoPersister`.
2015-11-07 08:05:13 +11:00
Daniel Martí
d242440fe3 Fix all InlinedApi lint warnings 2015-11-01 20:16:31 +01:00
Daniel Martí
81db276f8d Avoid showAsAction=always whenever possible
In AppDetails, work around it by using ifRoom and placing that button
first so that it gets preference. The rest aren't affected at all.
2015-11-01 20:06:17 +01:00
Daniel Martí
7c2b7ef280 checkstyle fix 2015-10-31 10:09:23 +01:00
Daniel Martí
b4560fc217 Merge branch 'materialize-category-filter' into 'master'
Make category filter look Material

Get rid of Gingerbred legacy.

Before and after (note the glitch below the spinner):

![before](/uploads/b0ed14216dcd772a78e3efc8ea8295f0/before.png)
![after](/uploads/0fba2177b33a2061ab67534a73de3f90/after.png)


See merge request !159
2015-10-29 15:41:58 +00:00
relan
9170e2af91 Make category filter look Material
Get rid of Gingerbred legacy.
2015-10-29 18:15:01 +03:00
Daniel Martí
2c1b13620f Disable DownloadManager usage for stable
Since it's unstable and introduces regressions. See #445 and #459, for
example.
2015-10-29 16:11:08 +01:00
Daniel Martí
6c8e726aad Revert netcipher to fix SNI regression
Fixes #431.
2015-10-29 16:08:17 +01:00
Daniel Martí
42b6176cff AppSecurityPermissions: cleanup
Mostly removing obsolete comment from the original source. Also removing some
unnecessary C-style for loops.
2015-10-23 16:40:48 +02:00
Daniel Martí
e085e0392b PackageReceiver: Only fetch the one PackageInfo
We were fetching information on all installed packages and doing a linear
search. Which is silly and inefficient since we can directly fetch information
on a single installed package by id.
2015-10-23 13:21:56 +02:00
Daniel Martí
1a4c2ca408 Remove unnecessary variable initializations 2015-10-23 13:11:18 +02:00
Daniel Martí
927e05ba8d Take some final declaration suggestions from AS 2015-10-23 13:08:24 +02:00
Daniel Martí
7f2efc7267 Take some declaration access suggestions from AS 2015-10-23 13:06:23 +02:00