3079 Commits

Author SHA1 Message Date
Daniel Martí
6b9d6b6be5 Add a py script to check for bad string formats
Lint finds these, but it's very slow and currently we're not taking lint
errors as fatal. So for now this script will be useful, as nearly every
time I pull from weblate there are at least a couple of these.
2016-02-25 13:56:01 +00:00
Daniel Martí
7e86dc5e48 Convert existing py tools to python3 2016-02-25 13:39:39 +00:00
F-Droid Translatebot
d79fccb2da Pull translation updates from Weblate
Translators:

agilob                 Polish
Hsiu-Ming Chang        Chinese (Taiwan)
Nathan Follens         Dutch
Perry Verheij          Dutch
Robin van der Vliet    Dutch
Robin van der Vliet    Esperanto
Verdulo                Esperanto
Wathiq Qajar           Arabic
2016-02-25 12:38:43 +00:00
Daniel Martí
5cca8102d7 Update commons-io test dep to 2.4
Ran the tests locally, all still pass.
2016-02-22 18:47:25 +01:00
Daniel Martí
9fe6545654 Update ACRA to 4.8.2 2016-02-22 18:45:21 +01:00
Peter Serwylo
1bae2b0132 Merge branch 'checkstyle-more' into 'master'
Checkstyle: require braces, consistent constant names



See merge request !207
2016-02-21 01:40:03 +00:00
Daniel Martí
17c731ef1d checkstyle: obey ConstantName 2016-02-17 15:59:04 +00:00
Daniel Martí
a6b804e93a checkstyle: obey NeedBraces on multi-line stmts
We still allow them in single-line statements, like:

	if (foo) bar;
	for (int i : ints) bar;

Everything else should use braces to help readability and avoid silly
human mistakes that might result in bugs.

These changes were completely automated via a python script.
2016-02-17 12:04:36 +00:00
Daniel Martí
ea31ed3079 gradlew: add zip sha256 2016-02-16 20:27:50 +00:00
F-Droid Translatebot
6d6aa98c6b Pull translation updates from Weblate
Translators:

Hsiu-Ming Chang    Chinese (Taiwan)
Verdulo            Esperanto
2016-02-16 11:58:04 +00:00
Peter Serwylo
e892d55b91 Merge branch 'search-clear-focus' into 'master'
Search: clear focus when enter/return is pressed

Fixes #572.

Assigning to @pserwylo since he wrote the current search widget stuff.

See merge request !206
2016-02-16 11:06:21 +00:00
Daniel Martí
e066ed04dc Search: clear focus when enter/return is pressed
Fixes #572.
2016-02-15 16:47:25 +00:00
Daniel Martí
5e619a8117 README: Point to gradlew 2016-02-15 16:35:39 +00:00
Daniel Martí
ddda82509c Bump gradle to 2.11 2016-02-15 16:34:41 +00:00
Daniel Martí
7471fed31c CI: Use gradlew 2016-02-15 16:34:41 +00:00
Daniel Martí
714edfb456 Add gradle wrapper 2016-02-15 16:30:40 +00:00
Daniel Martí
247dfc5ecf Run remove-unused-trans.py 2016-02-14 15:15:15 +00:00
F-Droid Translatebot
6a6a37c42e Pull translation updates from Weblate
Translators:

Coucouf           French
Danial Behzadi    Persian
Green Lunar       Hebrew
Licaon Kter       Romanian
M2ck              French
Marian Hanzel     Slovak
Verdulo           Esperanto
Verdulo           Polish
2016-02-14 15:14:22 +00:00
Daniel Martí
80d8f9f30b Sync changelog with stable branch 2016-02-14 14:56:56 +00:00
Peter Serwylo
88b4e1ff31 Merge branch 'fix-554' into 'master'
Work around dead activity issue in AppDetails

It seems like install() sometimes runs when the AppDetails activity is
finished or finishing. This results in the windows (dialogs) failing to
show, and a BadTokenException to fire:

    android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@d6e3570 is not valid; is your activity running?

This seems to be the culprit:

    at org.fdroid.fdroid.AppDetails.install(AppDetails.java:840)
    at org.fdroid.fdroid.AppDetails$AppDetailsListFragment.install(AppDetails.java:1657)
    at org.fdroid.fdroid.AppDetails$AppDetailsListFragment.onListItemClick(AppDetails.java:1721)

Apparently, you can check whether an activity/context is being finished:

https://stackoverflow.com/questions/7811993/error-binderproxy45d459c0-is-not-valid-is-your-activity-running

I cannot reproduce this issue, thus can't say whether this fixes it or
not. Either way, it can't hurt to try. This can be reverted if we see
ACRA reports of this in the future, and the issue reopened.

Fixes #565.

See merge request !204
2016-02-13 21:49:22 +00:00
Hans-Christoph Steiner
f3e5f2adcc Merge branch 'fix-wifistatechange-npe' into 'master'
WifiStateChangeService: Avoid DhcpInfo NPE

Fixes #569.

See merge request !205
2016-02-12 15:15:16 +00:00
Daniel Martí
f6724413b0 WifiStateChangeService: Avoid DhcpInfo NPE
Fixes #569.
2016-02-12 13:04:28 +00:00
Daniel Martí
89c53bbd5e Bump gradle plugin to 1.5.0 2016-02-11 12:39:48 +00:00
Daniel Martí
1a1ece16cf Work around dead activity issue in AppDetails
It seems like install() sometimes runs when the AppDetails activity is
finished or finishing. This results in the windows (dialogs) failing to
show, and a BadTokenException to fire:

    android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@d6e3570 is not valid; is your activity running?

This seems to be the culprit:

    at org.fdroid.fdroid.AppDetails.install(AppDetails.java:840)
    at org.fdroid.fdroid.AppDetails$AppDetailsListFragment.install(AppDetails.java:1657)
    at org.fdroid.fdroid.AppDetails$AppDetailsListFragment.onListItemClick(AppDetails.java:1721)

Apparently, you can check whether an activity/context is being finished:

https://stackoverflow.com/questions/7811993/error-binderproxy45d459c0-is-not-valid-is-your-activity-running

I cannot reproduce this issue, thus can't say whether this fixes it or
not. Either way, it can't hurt to try. This can be reverted if we see
ACRA reports of this in the future, and the issue reopened.

Fixes #565.
2016-02-09 20:48:42 +00:00
Daniel Martí
9195e3c614 Bump to 0.99-alpha1 v0.99-alpha1 2016-02-09 16:04:29 +00:00
Daniel Martí
044bf0b2f8 CHANGELOG: Update with latest fixes 2016-02-09 16:04:29 +00:00
F-Droid Translatebot
4148edeccd Pull translation updates from Weblate
Translators:

Allan Nordhøy    Norwegian Bokmål
Licaon Kter      Romanian
2016-02-09 16:00:10 +00:00
Daniel Martí
401a1d473d Drop unnecessary elses after returns 2016-02-09 15:59:47 +00:00
Daniel Martí
9997b0f448 Merge branch 'fix-555--content-provider-invalid-uri' into 'master'
Fix 555  content provider invalid uri

Was not correctly encoding "/" characters when searching. This caused the Uri used by the Content Providers to include a slash, which makes it look like a separate segment of the path which was wrong. Now correctly encodes "/" characters. Also noticed one other place incorrectly encoding characters, where they would've been double encoded when added as query parameters to a Uri.

See merge request !203
2016-02-09 15:55:38 +00:00
Peter Serwylo
c0d752cce3 Merge branch 'reactivex--swap--peer-finders' into 'master'
Refactor swap "peer finders" to use ReactiveX

*NOTE: This includes the commit specified by !197.*

In the old code, there is a _lot_ of procedual style "Is this peer finder running, if so, do this". In addition, the choice to do things on background threads or not is a little ad-hoc. Finally, the `SwapService` needs to know about both bluetooth and wifi peer finders, whereas really they are both only there to emit "Peers", regardless of the type.

As such, some improvements in this change are:
 * The choice to run peer finding on a background thread is made once, at a higher level when starting the peer finder.
 * No longer does the UI code ask "Am I searching for peers". It instead waits to be told whether it is or isn't.
 * The addition of new types of peers in the future is the job of the Peer finder itself. It quietly aggregates all of the Peer Finders it knows about into a single observable that emits different types of peers.

This code doesn't fix any particular issue, but rather it is about making the entire swap workflow easier to reason about. I plan on migrating more of this workflow to this functional style in the future, and hopefully that will have benefits in terms of stability and code understanding.

See merge request !198
2016-02-07 00:08:03 +00:00
Peter Serwylo
d939e9dac9 Minor fixes due to CR. 2016-02-07 10:39:01 +11:00
Daniel Martí
416c7aff82 Update ACRA to 4.8.1
Fixes nasty crash on android-19 and earlier.
2016-02-06 23:35:43 +00:00
Daniel Martí
d063aa3a08 CHANGELOG: Add Android.mk fix
Also fix the 0.98 date to be the same as the one in the stable-v0.98
branch.
2016-02-06 13:47:07 +00:00
F-Droid Translatebot
597e9c42a2 Pull translation updates from Weblate
Translators:

fabrizio maggi     Italian
Gabriele Pau       Italian
Irvan Kurniawan    Indonesian
Karola Marky       Latvian
Patrik Kretic      Slovenian
riotism            Chinese (Hong Kong)
2016-02-06 12:09:08 +00:00
Daniel Martí
6dbcf95ae7 CHANGELOG: Add more crash fixes 2016-02-06 12:07:35 +00:00
Peter Serwylo
e57b034a62 Add test for searching for forward slashes. 2016-02-06 14:04:28 +11:00
Peter Serwylo
81b772c3fd Use appendPath(...) instead of appendEncodedPath(...).
I misread the documentation when first using the `appendEncodedPath` method,
because it expects the path to already be encoded. This causes a bug because
if you search for a '/'. The result is a malformed URI that has the path
'/search//' instead of '/search/%2F'.

Using `appendPath` will always encode the string given to it, which is desirable.

Also check for empty strings, and return a URI that gives all apps. This was
not strictly neccesary, because the code which invokes it checks for empty
strings, but if somewhere else in the future starts to use this code, they
would've had to know to check for empty strings first.

Fixes #555.
2016-02-06 14:02:54 +11:00
Peter Serwylo
46817b1893 Add tests for searching null or empty values.
Should help prevent abuse of the search API into the future.
2016-02-06 13:33:36 +11:00
Peter Serwylo
5f08181f7d Remove unused SearchResultsFragment.
This is left over from when the search functionality was updated recently.
2016-02-06 13:33:36 +11:00
Daniel Martí
0646b6473e Merge branch 'fix-286--refreshHeader-crash' into 'master'
Put null check around access of `R.id.header` fragment.

Please note I haven't reproduced the specific problem. Also, the stack
traces being reported are only marginally informative, because they are
in response to a content providers firing events, and thus don't have
any context about when or where the event was fired from.

However, my looking at the code seems to indicate that this will prevent
NPE when the Activity is no longer visible but an app is finished
installing. Also, the view should still update correctly on resuming the
Activity because the `onResumeFragments()` methods will be invoked
which invokes the `refreshHeaders()` method.

Fixes #286.

See merge request !202
2016-02-06 00:04:26 +00:00
Peter Serwylo
d9f0c86c2e Put null check around access of R.id.header fragment.
Please note I haven't reproduced the specific problem. Also, the stack
traces being reported are only marginally informative, because they are
in response to a content providers firing events, and thus don't have
any context about when or where the event was fired from.

However, my looking at the code seems to indicate that this will prevent
NPE when the Activity is no longer visible but an app is finished
installing. Also, the view should still update correctly on resuming the
Activity because the `onResumeFragments()` methods will be invoked
which invokes the `refreshHeaders()` method.

Fixes #286.
2016-02-05 22:50:11 +11:00
Daniel Martí
180179eb3a Merge branch 'reactivex--add-as-dependency' into 'master'
Add ReactiveX (rxjava + rxandroid) as dependency

This is going to be used to make the managing of async tasks in F-Droid easier to reason about. It does this by using a more functional style to performing multiple different asynchronous tasks as compared to the Android `AsyncTask` or `Service` or some other approach.

More specifically, I have some changes coming that will use this dependency.
I wanted to merge this separately so that it doesn't matter which of the changes I'm working on gets merged first.

I've never added a `dependencyVerification` to the gradle build before, and there wasn't a whole bunch of docs on the interwebs about how to do that. So I did a SHA256 sum of some other .jar files in my gradle cache and compared them to the existing dependency verification settings and they did match. So I also did a SHA256 sum of the newly added dependencies and gradle seems happy with the hashes I've chosen.

See merge request !197
2016-02-05 11:25:12 +00:00
Peter Serwylo
10ccd5c503 Reimplement "peer finder" logic using funcitonal ReactiveX style.
The benefits of this are as follows:

No longer need to worry about how many types of `Peer`s exist.
There is a single publicly accessible `PeerFinder` which aggregates
the results of both the Bluetooth and Bonjour peer finders. In the
future if another is added, the consumer of the peer finder
(i.e. `StartSwapView`) doesn't need to be aware of this. Neither does
the `SwapService` or `SwapActivity` or any other code.

Never ask "Are we searching" but instead receive push notifications
from the peer finder when it stops searching.

Don't worry about receiving the same peer multiple times, it will
automatically get filtered out.

Less concern about doing things in `AsyncTasks` (and knowing what to
do in an `AsyncTask`). The RXJava + RXAndroid libraries deal with this
by allowing the client consuming the `PeerFinder` to specify which
thread to perform the background task on, and also that the found
`Peer`s should be emitted on the UI thread.

In the future, can play with caching the results of a particular
sequence of found peers. However right now using the `Observable.cache()`
method means we can no longer unsubscribe from the peer finders
and thus they run longer than they need to when we move on from
the initial swap screen.
2016-02-05 15:39:40 +11:00
Peter Serwylo
73d24d987e Add exception for rxjava in Proguard.
The rxjava library depends on sun.misc.Unsafe, which is unavailable on Android
The rxjava team is aware of this, and mention in the docs that they only use
the unsafe functionality if the platform supports it.
 - https://github.com/ReactiveX/RxJava/issues/1415#issuecomment-48390883
 - https://github.com/ReactiveX/RxJava/blob/1.x/src/main/java/rx/internal/util/unsafe/UnsafeAccess.java#L23
2016-02-05 14:21:13 +11:00
Peter Serwylo
5c85302928 Add ReactiveX (rxjava + rxandroid) as dependency
This is going to be used to make the managing of async tasks in
F-Droid easier to reason about. It does this by using a more
functional style to performing multiple different asynchronous tasks
as compared to the Android `AsyncTask` or `Service` or some other approach.
2016-02-05 11:50:54 +11:00
Daniel Martí
23612570a8 Merge branch 'build' into 'master'
fix AOSP build integration

The build isn't done from the top-level directory so the symlink needs
to use an absolute path.

Fixes #551.

See merge request !200
2016-02-03 22:07:39 +00:00
Daniel Martí
29b6b261a2 Merge branch 'fix-560--searching-only-whitespace' into 'master'
Fix 560  (searching only whitespace)

When no keywords to search, use an empty query selection that evaluates to "1".

This means that instead of building invalid SQL such as `WHERE (() OR ())` it
will build `WHERE((1) OR (1))` which, while non-optimal, is at least valid.
In fact, I'm not even sure that it is non optimal because I'd hope the sqlite
query optimizer is able to realise that `1 OR 1` is effectively a no-op.

Fixes issue #560.

See merge request !201
2016-02-03 21:31:15 +00:00
Peter Serwylo
8060ac88c3 Don't update search query unless it has changed meaningfully.
Changing the search query is quite an expensive operation, so this does some rudimentary
checking to see if the two queries are meaningfully different. At present, it trims the
strings and does a case insensitive comparison.

The query is eventually exploded based on whitespace, so leading and trailing white
space is not important. Also, sqlite `LIKE` clauses are case insensitive, so case
is unimportant. Having said that, I'm not sure how someone will be able to change
the queries case without first deleting and then adding characters (thus inducing
meaningfull changse).
2016-02-04 07:51:41 +11:00
Peter Serwylo
bd0e9e0a3c When no keywords to search, use an empty query selection that evaluates to "1".
This means that instead of building invalid SQL such as `WHERE (() OR ())` it
will build `WHERE((1) OR (1))` which, while non-optimal, is at least valid.

Fixes issue #560.
2016-02-04 07:51:37 +11:00
Daniel Micay
71c507bbfd fix AOSP build integration
The build isn't done from the top-level directory so the symlink needs
to use an absolute path.

Fixes #551.
2016-02-03 13:33:04 -05:00