128 Commits

Author SHA1 Message Date
Peter Serwylo
6b27568ac4 Correct theme applied to swappable apps list.
Took a while to figure out, but the problem was that the support
libraries ListFragment would only ever use getActivity() when
creating widgets. What we really needed was the ability to use
an alternative context, namely a ContextThemeWrapper. If this is
passed to the constructor of a widget, it is themed appropriately.

To make it work, we now create our own list view in onCreateView()
(which is really a copy of the code from the android list_content.xml
file anyway). There are also some workarounds for a bug in the
support library with regards to using your own view.
2014-10-22 18:01:24 +10:30
Peter Serwylo
3eee4f115a Make "Open QR scanner" button work for swap connect screen.
I did the same as some previous code which copied code from the zxing
library and put it in the com.google.zxing namespace (but left the license
in tact - is this okay for Apache 2.0 stuff?). The reason was that they
encourage copying the relevant two files into your project and modifying
as neccesary. In this case, it wasn't about modifying for functionalities
sake, but rather for android support libraries sake. The upstream version
doesn't support android.support.v4.app.Fragments, only android.app.Fragments.

Hooking up the intent integrator from zxing almost removes the need for
the refactoring which made FDroid.java responsible for handling "new repo"
intents. However, there is still the one case of the user not using
the QR code, but rather a web browser to connect to a swap. That is, they
will click a link on the other phones web browser, which directs them to
initiate the swap. Thus, we still need FDroid.java to be able to distinguish
between a "swap" new repo request, and a regular "add repo" new repo request.

In the process, I also commented out the "It's not working" button.
2014-10-22 18:01:24 +10:30
Peter Serwylo
b841c4b4c9 Remove public/private/hotspot icons (Fixes issue #9)
These have been temoprarily moved to an unused layout. The reason
it wasn't removed completely was because the layout still adheres
to the spec from carrie (and I couldn't be bothered looking through
the git history to find it later on when it is time to re-implement
it :)

I've also commented out the "Learn more about wifi" and "use
bluetooth instead" buttons for now.
2014-10-22 18:01:24 +10:30
Peter Serwylo
80205e94fb Implemented client connection for swap.
Listen for a new intent, show a screen to the user mentioning
they are about to start a swap. Make FDroid receive repo intents,
then dispatch to relevant Activity.

Previously manage repo always got the intents. Now FDroid does, and
chooses whether to give to ManageRepos or Client connect.
Not sure if it is required to do it this way or not, but it seems to
work.

I had a bit of an issue getting the "Welcome to F-Droid" string to
fit on one line, because it was breaking on the hyphen. That is still
not resolved in this commit.

Still need to:
 * Show error messages instead of the "connect" description
 * Jar signing seems not to work when connecting to other repo.

In order to handle returning to F-Droid after connecting (or saying no)
I tagged the intent with a "handled" extra value. That way, I can ignore
trying to connect to a repo if we've already handled that event.

Finally, I also fixed an issue regarding downloading of signed
index.jar files with an uppercase fingerprint.
The fingerprint from the jar differed from that in the swap url,
in that one was upper case and the other was lower case.
This uses an .equalsIgnoreCase check instead. It also adds an
extra guard in case the repo doesn't have a fingerprint. Although
it may not even use the signed repo updater if both the pubkey
and fingerprint are null, it is nice to have the extra assurance.

Fixes issue #19.

I also left some more TODO's around. I should put them in issues,
but I'm in a bit of a hurry.
2014-10-22 18:01:24 +10:30
Peter Serwylo
e84e9c15e2 Support "back" button navigation during swap process. Start service at end of swap.
The back button will take you back through each step of the swap
process now, and remove the swap Activity completely if you press
back from the first screen. Also, when the WiFi QR code is shown,
the local repo manager actually starts the relevant service.
2014-10-22 18:01:24 +10:30
Peter Serwylo
6d807793c2 Moved code from LocalRepo to the Swap UI to reuse it.
Along with a bunch of networking stuff, a lot of UI to do with selecting
apps to swap was also moved. The background on the list is transparent,
which allows blue to shine through. Also, the text on the list items is
white, which will not work with a white background.

I've temporarily dropped support for searching this list too, until
I get some feedback from carrie et al.

NOTE: This stuff was written before hans fixed apcompat problems with
LocalRepoActivity, but then rebased over it later. As such, it doesn't
contain his fixes. Will need to do that before a stable release. i.e.
Still has a bit of a dependency on API 11 which needs to be resolved.
2014-10-22 18:01:24 +10:30
Peter Serwylo
ae9cb5b89b Beginnings of an implementation for Swap.
The Fragments and an Activity which tie all of the swap views together
has begun. The first bit of implementation is to get the current
wifi network displayed, which worked out alright.

This commit contains a lot of theme related stuff, particularly
involving taking assets from carries mockups and making them suitable
to use as drawables. The process for doing this is a story for another
day, but I'll document it and put it on the wiki in the future. carrie
showed me a script that a mate of hers used on another project, and
I've adapted it a little to make it work nicely here (note - it isn't
in this commit).

The button is blue, and always shown with associated text in the
ActionBar. This required a custom drawable which was set as the
background in the styles.xml.
2014-10-22 18:01:24 +10:30
Hans-Christoph Steiner
bc5cf590c7 fix Compact Layout post appcompat
This restores the Compact Layout being smaller than the normal layout, and
properly centers the icon in both.  This stuff could use some refactoring
to work better with all the appcompat styles.

fixes #61 https://gitlab.com/fdroid/fdroidclient/issues/61
2014-07-30 00:07:02 -04:00
Hans-Christoph Steiner
b06792524e port everything to appcompat-v7 (#42, #51)
I went through all of the source code replacing anything that is now
possible using appcompat-v7.  appcompat-v7 is the official way to handle
backwards compatibility, and it is supported by Google and others. Using it
as much as possible should make the code more maintainable and readable by
others since they'll be used to seeing the appcompat-v7 patterns from other
projects.

fixes #51 https://gitlab.com/fdroid/fdroidclient/issues/51
fixes #42 https://gitlab.com/fdroid/fdroidclient/issues/42
2014-07-15 12:28:23 -04:00
Daniel Martí
72f238ac84 Remove useless LinearLayout that only holds a RelativeLayout 2014-06-26 13:22:05 +02:00
Peter Serwylo
1d4581a78e Reverted layout of app details to what it was before. 2014-06-24 08:30:25 +09:30
Peter Serwylo
b82be525b9 Rotation of app details with fragments implemented.
This was a bit more complex than all the other views, because it supports
rotation, and different views for when it is rotated. The end result is
that the way in which the views were constructed needed to be completely
redone.

In the process, I also moved the layout of the app summary to a Relative
Layout. This adds more flexibility, and is also the suggested layout
for complex views (as apposed to nested linear layouts). I believe this
is due to the performance of relative vs linear layotus.

It was aprticularly hard to figure out what was going on
when rotating an Activity which had a list fragment
that had another fragment as a header. I don't think fragments
were designed to work like this, but I believe it is all working
as expected now.

Conflicts:
	src/org/fdroid/fdroid/Preferences.java
2014-06-04 23:19:54 -04:00
Daniel Martí
bfb04648f8 Fix extra android namespaces in layout/about.xml 2014-05-27 17:59:19 +02:00
Hans-Christoph Steiner
f2994b0764 replace Android NSD browsing with jmdns
Android's NSD is only included in Android >= 16, and seems to be buggy. So
This replaces the NSD code entirely with jmdns, which works on all Android
versions.

fixes #2900 https://dev.guardianproject.info/issues/2900
fixes #3379 https://dev.guardianproject.info/issues/3379
2014-05-20 18:44:47 -04:00
Hans-Christoph Steiner
776ad3f540 use only android-14 items in SelectLocalApps until appcompat-v7 is added
Set android-14 as minimum for SelectLocalApps and make sure that everything
will work on >= 14.

fixes #26 https://gitlab.com/fdroid/fdroidclient/issues/26
2014-05-15 09:37:37 -04:00
Daniel Martí
96c3af5485 Add missing RTL/LTR layout attributes 2014-05-08 13:16:21 +02:00
Hans-Christoph Steiner
efacc22c10 include app icons in the SelectLocalApps view
Since we have the packageName, we can just fetch the Drawables directly.
This uses some shortcuts to try to make things run faster.  For example,
the ImageView does not have an ID, instead it is references by the index
number within the LinearLayout.
2014-05-08 00:58:42 -04:00
Hans-Christoph Steiner
7401366ac9 quick improvement of LocalRepoActivity layout
This is meant to try to make the on/off state of the webserver that serves
the local repo more apparent.
2014-05-08 00:58:42 -04:00
Hans-Christoph Steiner
08346b9b18 add Activity to choose which installed apps are in the local repo
This gets the data about which apps are installed from the ContentProvider
that pserwylo recently added for data about "Installed Apps" and presents
a list view for the user to select from by touching each line.  Then if the
user chooses "Update Repo", it will regenerate the local repo based on the
current selection.  It will always include FDroid in the local repo.

fixes #3232 https://dev.guardianproject.info/issues/3232
refs #3204 https://dev.guardianproject.info/issues/3204
2014-05-06 19:51:15 -04:00
Hans-Christoph Steiner
94dc2d019f add wizard for sending FDroid to another device via WiFi/QR
This is a little helper to direct people to get a new device to download
FDroid from another device that already has it.  It first prompts them to
join the same wifi network, and offers a QR Code to associate to the same
wifi.  The next step is a QR Code for getting the URL to the local repo.
The index.html on that local repo includes a download link for FDroid and
a repo link to the local repo.

refs #3204 https://dev.guardianproject.info/issues/3204
2014-05-06 19:51:15 -04:00
Hans-Christoph Steiner
5050605f72 Activity/Service for running a local repo via http://
This is a skeleton for the upcoming local repo (aka swap aka Kerplapp).
Right now, it just provides an Activity for controlling a Service which
manages a local webserver (nanohttpd).  Next, it will be wired up to the
local repo created via a dedicated Activity for managing the list of apps
included in the local repo.

refs #3204 https://dev.guardianproject.info/issues/3204
2014-05-06 19:28:27 -04:00
Daniel Martí
c32fb3a6b7 Add gravities beside textAlignment to fix issues in <4.2
textAlignment works well for 4.2 and later, but it is ignored in 4.1 and
earlier. Seting gravity to its textAlignment equivalent fixes this.
2014-05-01 19:23:59 +02:00
Daniel Martí
57eaad7c1b Remove RelativeLayout leftovers 2014-04-17 01:20:32 +02:00
Daniel Martí
4db53deb42 Forgot to set the icon sizes back to normal
They got added +8 since we added paddings directly to the icon layout. Since
those paddings got removed, this has to be switched back too.
2014-04-11 19:24:46 +02:00
Daniel Martí
8ed76f47ee More improvements to the app list layout
* Don't use a RelativeLayout for the whole thing
* Use more external paddings, not per-element paddings
* Center everything vertically
2014-04-10 16:33:15 +02:00
Daniel Martí
a477f421cb Greatly improve app list layout
* Don't hard-code ellipsis in the code
* Separate the two rows into two linear layouts
* Don't abuse relative layouts
* Use ellipsize with weights to achieve best results
2014-04-07 19:35:04 +02:00
Daniel Martí
a1a8c06565 Start using contentDescription on ImageView elements 2014-03-22 11:12:42 +01:00
Rene Treffer
d55fc7cd69 Fix build failure with newer toolchains.
Android somehow wants every string to be externalized on newer
toolchains, let's prepare for that.

This fixes in-tree building of f-droid.
2014-03-16 13:44:25 +01:00
Daniel Martí
6fa72607b8 Fix relative layouts on <4.2, broken while trying to add RTL support 2014-03-10 18:19:15 +01:00
Daniel Martí
0f44c5edba Fix scaling of icons on AppDetails 2014-03-10 17:56:38 +01:00
Daniel Martí
31aa3fcf30 Make titles and subtitles align properly in RTL
This is just a cosmetic fix to make the RTL layout look like the normal LTR
one. It is, effectively, making non-RTL text be aligned to the right. I
suppose that's fine, for the sake of making it readable since we don't want it
aligned to the left, breaking the layout.
2014-02-21 00:32:17 +01:00
Daniel Martí
66563d30d9 First attempt at supporting RTL
Following the Android 4.2 changes, which explain how to add native support for
RTL, I've replaced Right for End and Left for Start. Enabling RTL to see the
results.
2014-02-21 00:11:58 +01:00
Daniel Martí
44bb904ab0 Remove obsolete dbSyncModeValues array 2014-02-20 13:57:59 +01:00
Daniel Martí
231fb3dd8a Merge commit 'refs/merge-requests/65' of gitorious.org:f-droid/fdroidclient
Conflicts:
	src/org/fdroid/fdroid/views/fragments/RepoListFragment.java
2014-02-19 23:12:19 +01:00
Hans-Christoph Steiner
c7a40e9fa6 purge old, unused repo list XML layout
Its all done using getListView() in the ListFragment now :-)
2014-02-20 08:59:42 +11:00
Daniel McCarney
3223e20e33 Add support for Network Service Discovery of FDroid repos.
If the device supports API level 16 (Android 4.1) then add a menu item
on the repository management screen to "Find Local Repos". Activating
this menu item will initiate NSD service discovery with the NsdHelper
class looking for 'fdroidrepo' and 'fdroidrepos' service types on the
local network. When one is found, the service is resolved and the name
& IP are populated into a list of discovered repositories. Clicking an
NSD discovered repo will prompt the user to add the repo.
2014-02-19 15:32:44 -05:00
Daniel Martí
a3b316c4a8 Fix a couple regressions 2014-02-12 20:46:32 +01:00
Daniel Martí
4c58514152 Apply similar layout improvement to app list elements 2014-02-12 20:23:19 +01:00
Daniel Martí
f35528cd78 Fix remaining issues related to vertical length and centering 2014-02-12 20:15:43 +01:00
Daniel Martí
9bd236d66c Some much needed fixes to appdetails headers
* If the info is taller than the icon, grow larger to fit it in
* Center icon vertically
* Move padding out of the header
* Revert some font sizes to how they were some time ago, a bit smaller
2014-02-12 19:30:26 +01:00
Daniel Martí
9b2e5c2426 Don't let AppDetails header textviews overflow 2014-02-12 19:10:47 +01:00
Peter Serwylo
da8e41249b Removed DB, implemented AppProvider.
Yay!

As expected, a lot of the stuff in DB class is due to UpdateService
requiring it to process the downloaded indexes and insert data into
the database. Thus, this change is about removing that stuff from
the DB class and migrating to ContentProviders.

This required a bit of a change to the way that UpdateService decides
what to do with the data from indexes, but I hope it will make
understanding and changing UpdateService easier in the long term.
For example, it used to read the app details from database, then
if a repo wasn't updated (due to unchanged index) then it would take
the app details for that repo from the list of apps, and re-update
the database (or something like that).

Now, it has been refactored into the following methods:
 * updateOrInsertApps(appsToUpdate);
 * updateOrInsertApks(apksToUpdate);
 * removeApksFromRepos(disabledRepos);
 * removeApksNoLongerInRepo(appsToUpdate, updatedRepos);
 * removeAppsWithoutApks();
 * and probably some others...
Which hopefully are self-explanitory.

The recent change to implement single repo updates was re-implemented
with in light of the methods above. The interface to UpdateService for
scheduling a single repo update is the same as it was before, but
the implementation is completely different. Still works though.

Using batch content provider operations for repo updates,
but they suffer from the problem of not all being under the same
transaction, so if an insert/update stuffs up half way through, we
are left with only half of the update being complete. In the future,
if there is some way to implement notifications from the content provider's
applyBatch method, then we can do it all in the one transaction, and
still have notifications. Currently we break it into several calls
to applyBatch (and hence several transactions) to inform the user
of the progress.

Also adding the beginnings of some tests for AppProvider. In the future, I'll
work on adding better coverage, including instrumentation to test UI features.

==========================
Below is a list of many of the minor changes that also happened along the way
==========================

Make "Can update" tab stay up to date using content observer, rather
than manually deciding when to refresh the tab label as before.

The installed app list is now cached in Utils, because it is invoked
quite a few times, especially when rendering the app lists. The cache is
invalidated when PackageReceiver is notified of new apps.

The content providers don't notify changes if we are in batch mode.
I've left the notification at the end of the batch updates as the
responsibility of the UpdateService. However, it would be nice if this
was somehow handled by the content, as they are really the ones who
should worry about it.

Made curVersion, curVercode and curApk work with providers.
This was done by removing curApk (otherwise we'd need to query the db each
time we fetched one app to get a reference to that apk (resulting in hundreds
of queries). Instead, UpdateService now calculates curVercode and curVersion
and saves them to the database. We then use these where possible. If we really
need curApk (because we want info other than its version and code) we still have
the option of ApkProvider.Helper.find(app.id, app.curVercode). I considered
putting this inside the app value object, e.g. in getCurApk() but thought
better of it as it will likely result in people invoking it all the time,
without realising it causes a DB query.

incompatibleReasons required a minor UI tweak, removing the "min sdk"
ui element from the Apk list. It is replaced by the "Requires: %s" view
(which only appears when the app is incompatible). In the process, and in
response to some feedback from mvdan, I left the min sdk in there, but
only made it show when in "expert mode", just like the architecture.

In order to make the "installed apps" query work under test conditions,
needed to change the way the InstalledApkCache be replaceable with a
mock object.

Pause UIL loading on fast scroll of list, as the list was very choppy for
some reason.

Re-added "Last repo scan" info to the Manage Repo list view.

Fixed up some misc TODO's, removed some unused/empty functions.
2014-02-08 11:29:59 +11:00
Hans-Christoph Steiner
126d96e4ba prevent soft keyboard from popping up on RepoDetails
Its quite annoying to have the URI EditText in focus and the soft keyboard
pop up when viewing the RepoDetails since the vast majority of the time,
the user will be viewing the info there, not editing the URL.

This commit just moves the focus to the frame, and prevents the soft
keyboard from showing up by default.  The user can still click on the URI
EditText to edit it and the soft keyboard will pop up.
2014-01-28 20:31:46 -05:00
Hans-Christoph Steiner
47659b5cec relabel misnamed items from "signature" to "repo fingerprint"
In the new Repo Details screen, there is some elements that are labels as
the "signature".  This is not quite right, it is actually referring to the
fingerprint of the repo signing key.  Since a repo will also usually have a
HTTPS certificate fingerprint, there will also be a fingerprint for that
certificate.
2014-01-21 18:30:02 -05:00
Daniel Martí
499c9e50c5 Move "https://" addrepo default into a string 2014-01-08 13:36:45 +01:00
Peter Serwylo
3731ed8f23 Merge remote-tracking branch 'upstream/master' into improvement/16/manage-repos
Conflicts:
	res/values/strings.xml
	src/org/fdroid/fdroid/DB.java
	src/org/fdroid/fdroid/ManageRepo.java
	src/org/fdroid/fdroid/RepoXMLHandler.java
	src/org/fdroid/fdroid/Utils.java
2014-01-04 20:45:52 +11:00
Peter Serwylo
ffa2c962dc Merge branch 'master' into improvement/16/manage-repos
Conflicts:
	res/layout/appdetails.xml
	res/values/strings.xml
	src/org/fdroid/fdroid/DB.java
	src/org/fdroid/fdroid/FDroid.java
	src/org/fdroid/fdroid/ManageRepo.java
2014-01-04 20:19:27 +11:00
Daniel Martí
8a90687867 Slightly larger margin separating minsdk 2014-01-03 04:47:42 +01:00
Daniel Martí
aee57c448b Sightly more margins in app list views 2014-01-03 02:52:12 +01:00
Daniel Martí
50f68d34b9 Support minSdk info in version list views 2014-01-03 02:44:24 +01:00