Previously the update silently failed, and even showed "No Repository has any package updates". The commit relays one error message per repo and adds a localized message when only a part of the repo updates failed. Also, the error message for more severe errors is made more verbose.
Also removed the "errmsg" variable.
When electing to "Swap Apps" from the main menu, and a LocalRepoService
is already running, then it jumps straight to the wifi QR fragment.
However, it didn't play nice when pressing the "back" button. This is
now fixed, by manually recreating the backstack in this situation.
It also fires up the NFC push message if NFC exists.
Added a "Cancel" button to the swap QR code screen.
Also changed how the LocalRepoService deals with onDestroy(). Previously, it
would invoke `stopNetworkServices()` on the UI thread, blocking for a
significant portion of time (enough to cause ANR messages on my devices).
Now, it does this on a new thread.
As for the QR code size, it was getting quite small on my nexus 4,
which I think has a large screen (even though there is much larger about).
As a result, it couldn't be scanned properly using barcode scanner.
This is the first major diversion from carries mockups, in that the qr
view is now in a scroller, which means the "Open QR Code Scanner" button
may well not be visible on the main screen on small devices. Not sure about
how to manage this tradeoff between biggish qr code but everything
viewable on one screen.
Previously it would direct to the LocalRepo screen, then when that code
was ported to the swap workflow, it did nothing :( Now it does as one
might expect, and actually directs the user to the swap screen.
Previously, we would redirect to the main list of apps. Now, the swap
thing will show the specific apps in the "LocalRepo" category. It also
shows the "Swap complete" message with a nice icon carrie designed.
Instead of always showing "swap", sometimes it shouldn't be shown
at all (i.e. on the first and last screen) and on the NFC screen,
it says "skip".
There is a translated string called "skip_button_label" available
in the AndroidPreferenceFragment library, but I don't want to rely
on that. Prefer to have our awesome translators be in charge of
that label.
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.
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.
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.
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.
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.
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.
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.
When the user updates the repo and all packages are recent, the update dialog exited so fast, that some users might have thought that the repo didn't update. To notify them that no new updates were found, the user now gets a toast.
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#61https://gitlab.com/fdroid/fdroidclient/issues/61
default_repo_count is not used at all, and the numbering scheme is just a
vestige of that. This switches all the variables to have clear names of
what they are representing.
Now that the Fragment is embedded in the Activity, and the menu has been
moved to the Activity in ActionBar style, most of the utility functions and
the Dialogs can be based out of the Activity, which is how they are
designed to work. This makes things work a lot easier.
fixes#3https://gitlab.com/fdroid/fdroidclient/issues/3
This allows the main menu to act like a proper ActionBar using appcompat.
It also allows for making the search happen live on the ListView, rather
than having to launch a separate Activity to show the results.
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#51https://gitlab.com/fdroid/fdroidclient/issues/51fixes#42https://gitlab.com/fdroid/fdroidclient/issues/42
Previously, it was using the native android.widget.SearchView.
Now it uses the widget from appcompat. For good measure, I also
made it so that the search button is always in the action bar,
rather than being hidden behind a menu sometimes.