
Removed LocalRepoService, replaced with SwapService. Still TODO: Manage threads. Currently everything is called from the UI thread, which is a regression from the previous behaviour. I'd like to manage this so that the code interacting with the SwapManager doesn't need to bother itself with whether it is calling from the UI thread or not. The local repo service had many different methods and properties for dealing with starting and stopping various things (webserver, bonjour, in the future it will also need to know about bluetooth and Wifi AP). The SwapService handles this stuff by delegating to specific classes that are only responsible for one of these. Hopefully this will make the process of enabling and disabling swap repos easier to reason about. The local repo service was also stopped and started quite regularly. This meant it was up to the code making use of the service to know if it was running or not, and to enable it if required. The new SwapService is only started once (when the singleton SwapManager is created for the first time). It should not use any more resources, because it is a background service most the time, and it is responsible for moving itself to the foreground when required (the burden is not on the code consuming this service to know when to do this). By having the service running more often, it doesn't need to' continually figure out if it needs to register or unregister listeners for various properties (e.g. https enabled) or wifi broadcasts. The listeners can stay active, and do nothing once notified if swapping is not enabled. Moved the timeout timer (which cancels the swap service after 15 mins) into the SwapService, rather than being managed by the SwapWorkflowActivity. Seems more appropriate for the service to know to time itself out rather than the Activity, seeing as the Activity can die and get GC'ed while the service is still running. Finally, although there is nothing stopping code in F-Droid from talking to the service directly, it is now handled by the SwapManager singleton. This means that details such as using a Messenger or Handler object in order to communicate via arg1 and arg2 is no longer required, and instead methods with proper type signatures can be used. This is similar (but not exactly the same) to how Android system services work. That is, ask for a "Manager" object using getSystemService(), and then use that to perform functionality and query state via that object, which delegates to the service. Then we get the best of both worlds: * Reasonable and type safe method signatures * Services that are not tied to activity lifecycles, which persist beyond the closing of the swap activity.
F-Droid Client
Client for F-Droid, the Free Software repository system for Android.
Building from source with Gradle
Once you have checked out the version you wish to build, install gradle on your system and run:
git submodule update --init
gradle build
Android Studio
From Android Studio: File -> Import Project -> Select the cloned top folder
Building from source with Ant
The only required tools are the Android SDK and Apache Ant.
Once you have checked out the version you wish to build, run:
git submodule update --init
cd F-Droid
./ant-prepare.sh # This runs 'android update' on the libs and the main project
ant clean release
Direct download
You can download the application directly from our site or browse it in the repo.
Contributing
You are welcome to submit Merge Requests via the Gitlab web interface. You can also follow our Issue tracker and our Forums.
Translating
The res/values-*
dirs are kept up to date automatically via MediaWiki's
Translate Extension. See
our translation page if you
would like to contribute.
Running the test suite
FDroid client includes a embedded Android Test Project for running tests. It
is in the test/
subfolder. To run the tests from the command line, do:
git submodule update --init
./ant-prepare.sh # This runs 'android update' on the libs and the main project
ant clean emma debug install test
You can also run the tests in Eclipse. Here's how:
- Choose File -> Import -> Android -> Existing Android Code Into Workspace for the
fdroidclient/
directory. - Choose File -> Import -> Android -> Existing Android Code Into Workspace for the
fdroidclient/test/
directory - If fdroid-test has errors, right-click on it, select Properties, the Java Build Path, then click on the Projects tab.
- Click on the Add... button and select
fdroidclient/
- Right-click on the fdroid-test project, then Run As... -> Android JUnit Test
Troubleshooting
When building F-Droid, the following error may occur:
Invalid file: extern/UniversalImageLoader/library/build.xml
Check the output of the ./ant-prepare.sh command. This error is often accompanied by the following message:
Error: The project either has no target set or the target is invalid. Please provide a --target to the 'android update' command.
The most likely cause of this is that your installed Android SDK is missing the target version specified by one of the dependencies. For example, at the time of writing this, UniversalImageLoader uses the "android-16" target API, however the default install of the Android SDK will usually only install the latest version ("android-20" as of writing). So you will have to install missings "android-xx" targets via the SDK manager. To get a list of already installed SDK targets, run:
$ android list targets
To get a list of targets used by fdroidclient libs, run:
$ for i in $(grep "android.library.reference" project.properties | cut -f2 -d'='); do
grep ^target $i/project.properties | cut -f2 -d'=';
done | sort | uniq | paste -s -d',' -
to install missing or all needed targets, for example "android-16" and "android-7" run:
$ android update sdk -u -t "android-16,android-7"
NOTE: While it may be tempting to add "--target=android-19" to the ant-prepare.sh script, it is not the correct solution. Although it may work, it can cause strange bugs at runtime.
License
This program is Free Software: You can use, study share and improve it at your will. Specifically you can redistribute and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.