3188 Commits

Author SHA1 Message Date
Hans-Christoph Steiner
3fcdfe85bb move main project files into standard gradle/Android Studio layout
This makes it a lot easier to setup all the testing stuff.  Mostly,
I'm tired of fighting Android Studio's fragility, so I want to remove
as much non-standardness as possible in the hopes of improving that
situation.

closes #534 https://gitlab.com/fdroid/fdroidclient/issues/534
2016-03-28 12:12:37 +02:00
Hans-Christoph Steiner
f9063b5058 remove Preferences check out of HttpDownloader
This is the last Android code in the whole suite of Downloader subclasses,
so now we can write JUnit tests for them all, and avoid the fragility of
tests running on the emulator.
2016-03-28 12:05:35 +02:00
Hans-Christoph Steiner
f2621dcb55 avoid android.* classes to allow for direct JUnit tests
When running tests on the host machine, android.jar contains no code at all
which is totally stupid.  We can keep android.util.Log in there because it
does not affect the logic at all.  Then just set that android.jar to return
generic values using:

 unitTests.returnDefaultValues = true
2016-03-28 12:05:35 +02:00
Hans-Christoph Steiner
a1d6917ec7 remove Context/LocalBroadcastManager from Downloader for testing
If there is no LocalBroadcastManager, then the Downloader tests can be done
with pretty plain JUnit and then do not require the Android emulator to run
2016-03-28 12:05:35 +02:00
Daniel Martí
35764b90c0 Bump to 0.100-alpha2 v0.100-alpha2 2016-03-27 19:20:55 +01:00
Hans-Christoph Steiner
ba9f32e9f4 Merge branch 'fix-409--nfc-swap-crash' into 'master'
Fix crash when returning to swap after cancelling

Fixes #409. The problem was that there was some listeners being added for broadcast events when the swap view was shown. These were never removed, and so cancelling swap, then returning to it would spin up a _new_ activity with new views, while the old listeners were still around. When the old listeners received events, they would try to talk to their associated `Activity`. This no longer existed, so a crash ensued.

While I was fixing the specific bug associated with #409, I took the opportunity to make more of the event listeners well behaved in the swap process. I don't think any of them were liable to cause crashes, but were likely to cause some weirdness at some point in time if they were not fixed.

*Note:* This swap view was an exercise in moving away from `Fragment`s towards an `Activity` with individual `View`s. I'm going to call this a bit of a failure at this point, because there is so much work that needs to be invested in implementing lifecycle stuff in our custom views. `Fragment`s naturally come with lifecycle methods that are familiar to other Android dev's looking to contribute to this project (even if they are a little difficult to understand at times). Implementing our own custom Views instead still results in similar classes of bugs (i.e. talking to an `Activity` when the view no longer is part of that activity).

A classic example of this is in my usage of the `onDetachedFromWindow` function in the `View`. I have no idea if this is the best place to unregister listeners or not. In a Fragment, it would be a matter of `onPause` or one of the more well defined lifecycle methods. Empirically, `onDetachedFromWindow` seems to be well behaved. The other alternative would be for the Activity to explicitly invoke a `onRemoved` type method each view when it knows it is transitioning from one state to the next. However at this point, we are then really into reimplementing `Fragment` land.

See merge request !232
2016-03-25 10:22:47 +00:00
Daniel Martí
5195281848 CHANGELOG: Add 0.99.1 changelog entry 2016-03-22 12:50:49 +00:00
Daniel Martí
4c83b2c0c6 Add Hindi to the languages list 2016-03-21 15:46:22 +00:00
F-Droid Translatebot
f30cea33e3 Pull translation updates from Weblate
Translators:

ageru                     French
Ajeje Brazorf             Sardinian
Mohamad Hasan Al Banna    Indonesian
Paresh Chouhan            Hindi
YFdyh000                  Simplified Chinese
YF                        Simplified Chinese
2016-03-21 15:36:35 +00:00
Daniel Martí
a61fb677bc Merge branch 'fix-603--translate-categories-crash' into 'master'
Pass through a known good `Context` to `translateCategories`

All the good work to make sure that `getActivity()` actually returned
a proper context, obtaining a final reference to that known good activity
object, and then using that in the background thread is thrown away.
The reason was because the `translateCategories` method would go and
call `getActivity()` all over again. This changes the `translateCategories`
helper function so that it asks for a `Context`. This way, a known
good `Context` can be passed in, rather than having to perform a check
to see if `getActivity()` is good again.

Fixes #603 (Hopefully)

See merge request !231
2016-03-21 15:08:46 +00:00
Peter Serwylo
a7d757cdb2 Remove unused code and fix some typos.
The old swap code used to delegate to the `AppDetails` activity when
touching an app in the swap view. Now it shows the install button
and download feedback inline. The code which used to exist is no
longer required.
2016-03-21 22:36:15 +11:00
Peter Serwylo
d46efb1d84 Correctly start and stop listening for repo update events during swap.
This fixes the following bugs:
 * `BroadcastReceiver` was never being created due to incorrect guard
   condition `if (pollForUpdatesReceiver != null)` (should have been
   `== null`).
 * Called `unregisterReceiver` rather than `registerReceiver`.
 * Even if it did work, it didn't make an effort to unregister the receiver.

In addition, the creation and listening with the `BroadcastReceiver is
now done in a way similar to the other swap views:
 * Create it as a `final` member variable.
 * `registerReceiver` when view is inflated.
 * `unregisterReceiver` when view is detached.
2016-03-21 22:33:18 +11:00
Peter Serwylo
cfe2f71e4d Correctly unregister receiver in "qr code" swap view.
Previously the receiver was added but never removed. The result
is that once a swap session is cancelled, the receiver still
gets broadcasts.
2016-03-21 22:23:54 +11:00
Peter Serwylo
c29aff2167 Correctly unregister receiver in "connecting" swap view (Fixes #409)
Previously the receiver was added but never removed. The result
is that once a swap session is cancelled, the receiver still
gets broadcasts.

This is what was causing the bug in #409. It was trying to access
the `Activity` once it had been closed, and another swap session started
with a new activity.
2016-03-21 22:22:57 +11:00
Peter Serwylo
b19861226a Correctly unregister receiver in "join wifi" swap view.
Previously the receiver was added but never removed. The result
is that once a swap session is cancelled, the receiver still
gets broadcasts.
2016-03-21 22:21:09 +11:00
Peter Serwylo
8e28172942 Pass through a known good Context to translateCategories
All the good work to make sure that `getActivity()` actually returned
a proper context, obtaining a final reference to that known good activity
object, and then using that in the background thread is thrown away.
The reason was because the `translateCategories` method would go and
call `getActivity()` all over again. This changes the `translateCategories`
helper function so that it asks for a `Context`. This way, a known
good `Context` can be passed in, rather than having to perform a check
to see if `getActivity()` is good again.
2016-03-21 20:42:13 +11:00
Daniel Martí
1af6dbc19e Merge branch 'support-library-23.2.1' into 'master'
Update Support Library components to 23.2.1

As far as I can see from the release notes, 23.2.1 does not fix any bugs that could affect F-Droid. Anyway, it's better to be up-to-date.

See merge request !228
2016-03-17 15:13:59 +00:00
relan
82ed44fac0 Update Support Library components to 23.2.1 2016-03-17 17:43:50 +03:00
Daniel Martí
1d44a5f2e6 Merge branch 'ci-image' into 'master'
CI: Bump docker image

Also use a specific tag instead of latest, so that pushing latest on
Docker Hub won't break older branches and tags.

See merge request !229
2016-03-17 12:05:17 +00:00
Daniel Martí
3b76db0227 tools: check-string-format is python3
This has always been python3, so it was probably a typo. Fixes CI since
we may no longer have python2 installed.
2016-03-16 16:15:07 +00:00
Daniel Martí
fded4c9f2e CI: Bump docker image
Also use a specific tag instead of latest, so that pushing latest on
Docker Hub won't break older branches and tags.
2016-03-16 16:15:07 +00:00
F-Droid Translatebot
87d73e2d01 Pull translation updates from Weblate
Translators:

Ajeje Brazorf          Sardinian
Danial Behzadi         Persian
nikos                  Greek
Olexandr Nesterenko    Ukrainian
Sérgio Marques         Portuguese (Portugal)
Svetoslav Yordanov     Bulgarian
2016-03-15 21:08:54 +00:00
Daniel Martí
5ed4977b9d Merge branch 'master' into 'master'
gitlab-ci: enable lint, log posting, and caching

Some work to improve the CI functions, and first stab at getting parts running in parallel.

See merge request !211
2016-03-15 20:33:10 +00:00
Hans-Christoph Steiner
d4992831c0 gitlab-ci: enable lint and run tools scripts in parallel
* splitting out the tools script allows less things to happen on the
  main job, and runs the tools script in parallel, which should speed
  things up.

* `gradle check` also runs lint, and anything else we might add to
  that meta-target.

* `gradle build` also runs tests, `gradle assemble` does not
2016-03-15 20:54:29 +01:00
Hans-Christoph Steiner
e18e7a7067 gitlab-ci: cache downloaded things between builds
This stores the Android SDK tarball and gradle caches between builds
to speed things up.  Since the unpacked SDK gets unpacked very time,
updating the version is just a matter of changing the variable.  Since
only the gradle caches are stored, i.e. the jars and gradle binaries,
updates there will only add more files to the cache.
2016-03-15 14:29:28 +01:00
Daniel Martí
8bba6670a0 Merge branch 'fix-repository' into 'master'
UI: disabled repo name if apk is incompatible



See merge request !226
2016-03-13 15:51:31 +00:00
Paresh Chouhan
c34ceeffe4 UI : Repository : *Repo Name* is disabled if apk is incompatible. 2016-03-13 20:10:32 +05:30
Daniel Martí
4c9012557e Merge branch 'inconsistent-code-style' into 'master'
Code Style : Changed variable names to be consistent with other variable names

variable names are inconsistent in other files as well. At some places it is `mVariableName` and in some places it is `variableName`.  

suggestion : rename all public variables to `publicVaraible` and all private variables to `mPrivateVariable` ?  

we can use http://udacity.github.io/android-nanodegree-guidelines/index.html

See merge request !225
2016-03-11 16:39:54 +00:00
Daniel Martí
d5f0a6397f Remove empty translation that slipped through v0.100-alpha1 2016-03-10 17:17:40 +00:00
Daniel Martí
0655abe3b9 Bump to 0.100-alpha1
Also update CONTRIBUTING, since we're now going to use three digits in
the version codes for the second part in each version.
2016-03-10 16:53:01 +00:00
F-Droid Translatebot
8f24759a33 Pull translation updates from Weblate
Translators:

Adrià García-Alzórriz      Catalan
Adrià García-Alzórriz      Spanish
Benedikt Volkmer           German
Irvan Kurniawan            Indonesian
Licaon Kter                Romanian
Marcelo Santana            Portuguese (Brazil)
Massimiliano Caniparoli    Italian
Mladen Pejaković           Serbian
Mohamad Hasan Al Banna     Indonesian
naofum                     Japanese
Pander                     Dutch
Phạm Nguyễn Hoàng          Vietnamese
riotism                    Chinese (Hong Kong)
Tobias Bannert             German
Verdulo                    Esperanto
Verdulo                    Polish
2016-03-10 16:48:08 +00:00
Paresh Chouhan
c5aa3f91b1 CodeStyle : Fixed inconsistent variable name, changed mctx to mCtx 2016-03-08 12:47:35 +05:30
Daniel Martí
35e791543a README: Use new CI badge url 2016-03-07 20:56:05 +00:00
Peter Serwylo
da8c0e0e16 Merge branch 'gradle-updates' into 'master'
Misc gradle, lint and markdown updates



See merge request !223
2016-03-07 14:00:27 +00:00
Daniel Martí
ea6b0340d9 Merge branch 'fix-554--content-resolver-reference' into 'master'
Ensure `getContentResolver()` is not requested from `null` object.

Should fix #554, however I couldn't reproduce this. At the very least, I fail to see how it is possible with this new change for a `null` to get passed to `AppProvider.Helper.categories`, whereas it could've before.

In the process, I also made the database query run on the background thread, then update the UI on the UI thread.

See merge request !224
2016-03-07 13:52:55 +00:00
Peter Serwylo
0f64f2c181 Clarify threading when loading categories
Previously, it was not explicit that the `onCreate` happened to be invoked
in the UI thread. Now it is, due to passing `new Handler(Looper.getMainLooper())`.
Also, the categories are now loaded in a background task, and then the UI is
updated on the UI thread.
2016-03-07 23:46:06 +11:00
Peter Serwylo
7421d33c3a Expand null check to include isAdded() check
Also, don't call `getActivity()` in the separate thread. Instead, use the
`Activity` which we have already checked and ensured is not null.
2016-03-07 23:45:58 +11:00
Daniel Martí
b8ce62e3ef README: Fix badge link
The old /ci site is gone. Link to the builds page, which at least shows
something related to CI.
2016-03-05 23:39:30 +00:00
Daniel Martí
26d60aa9ae Fix gradlew references in markdown files
Use gradlew consistently. Also, fix its calling after the cd.
2016-03-05 23:33:52 +00:00
Daniel Martí
80a3faa4d5 Explicitly set fullBackupContent to true
An F-Droid backup should contain all the app's data.
2016-03-05 23:27:18 +00:00
Daniel Martí
b534bba440 Bump targetSdkVersion to 23
compileSdkVersion in the build.gradle file was already bumped, but we
forgot about this one.
2016-03-05 23:27:00 +00:00
Daniel Martí
25a9360a58 Fix ScrollViewSize lint warnings 2016-03-05 23:21:15 +00:00
Daniel Martí
28988b9fdd Bump libsuperuser to the latest version 2016-03-05 23:15:47 +00:00
Daniel Martí
ccf858f960 CHANGELOG: Start writing upcoming release 2016-03-05 23:01:10 +00:00
Daniel Martí
3c33e55fd3 Merge branch 'add-repo-url' into 'master'
Enhancement : Repo URL added to apk's on AppDetailsActivity.

Fixes issue #527.
Adds repo URL to apk's present on AppDetails.

Samples  
![sample](/uploads/0d603cf7242f6f45348c78009f811623/sample.png)![sampl2](/uploads/31efab104bd52cecc9f2ea1e923116c6/sampl2.png)

See merge request !222
2016-03-05 21:50:48 +00:00
Paresh Chouhan
683ba8d20f Enhancement|UI : Repository URL added to APK's on AppDetails Activity.
Fixes issue #527.
Repository URL's now shown as Provided By domain.name/repo
2016-03-06 01:23:13 +05:30
Peter Serwylo
018a8231d6 Merge branch 'pmd' into 'master'
Add PMD



See merge request !221
2016-03-04 22:14:22 +00:00
F-Droid Translatebot
37ef67e1b8 Pull translation updates from Weblate
Translators:

ageru              French
Danial Behzadi     Persian
enolp              Asturian
ezjerry liao       Chinese (Taiwan)
Fr Translation     French
Hsiu-Ming Chang    Chinese (Taiwan)
Jonatan            Swedish
relan              Russian
riotism            Chinese (Hong Kong)
2016-03-04 17:04:38 +00:00
Daniel Martí
d3ca6020dc CI: Run pmd too 2016-03-01 17:46:49 +00:00
Daniel Martí
85ba537d95 PMD: Add a few rulesets that we already obey 2016-03-01 17:46:38 +00:00