Seems to work pretty-alright even when installing multiple apps.
Shows a progress (indeterminent at this stage) bar for each downloading
item, and hides the install button.
InnerView.getToolbarColour() was expecting a @ColorRes, except all views
were returning integers which were the colour value, not a pointer to
the resource as they should have been. Now only one place requires a
call to getResources().getColor() whereas before it was in each view.
Notifications on pre 4.1 devices require a pending intent to work. This
is so that when you touch the intent, it takes you somewhere meaningfull.
Without it, the update process crashes.
That makes that repo automatically ready for use based on user actions like
adding a new repo, switching an existing repo on, etc.
This also lowers the priority of the "update" menu item since it shouldn't
be needed any more. But leave it for now, just in case.
Since the repo updates are happening in an IntentService, they are already
running in a separate thread. Ironically, the dialog was showing in spite
of that. This removes the dialog entirely and instead puts up a
Notification with the same messages. Ultimately, the "refresh" button
should go away, the repos should be updated whenever someone goes to
install an app, and all APK downloads should also show up in the same
Notification.
This removes UpdateReceiver entirely and replaces it with local broadcasts,
since that is a common pattern in FDroid and Android. It also reduces the
amount of code here.
refs #103https://gitlab.com/fdroid/fdroidclient/issues/103
No need for a reusable Fragment here, its only used in one place. This
changes the structure to be a regular Activity, with all View and Menu
setup in XML files loaded in onCreate().
This also converts the URL to a TextView. Having it editable in this
Activity makes for a confusing user experience. Instead, the "Add Repo"
input should validate the URL and not allow creating repos that don't work.
This also purges the use of UpdateService.UpdateReceiver, it will be going
away in the upcoming commits.
Replaced `Switch` with `SwitchCompat`. In the future, should completely remove
F-Droid's `SwitchCompat` class. Fixed paddingLeft/paddingStart, except for some
places where lint complained. Apparantly that is for some Samsung tablets on
Android-16. Will have to create a layout-v17 version in the end for these.
Fixed lots of (minor) conflicts. Some due to earlier rebasing of
material stuff that was subsequently merged into master with a
different commit hash (I guess, that's what it looked like anyway).
It is very hacky, and I did it through the non-swap interface, and it
only works once then the state stuffs up and it no longer accepts incomming
connections, but it worked! Now to smooth out all the things.
Apply the accent color to EditTextPreference and ListPreference. They
use android.app.AlertDialog.Builder, not
android.support.v7.app.AlertDialog.Builder, so the theme has to be
specified using "android:alertDialogTheme" attribute in addition to
AppCompat's "alertDialogTheme". For the same reason those dialogs won't
be tinted on pre-Lollipop Android versions.
Apply the accent color to alert dialog buttons. Note that without
"android:windowMinWidthMajor" and "android:windowMinWidthMinor" attributes
dialog width is calculated incorrectly resulting in visual artifacts.
Before, you could "Enable swapping" without specifying which type
of protocol to enable. Now, the two switches are clearly delimited
between bluetooth and wifi.
From the Material Design spec:
> DP unit grid
> System icons are displayed at 24dp.
See http://www.google.com/design/spec/style/icons.html#icons-system-icons
Script used to update the icons:
function download {
F-Droid/tools/download-material-icon.sh F-Droid/res $1 $2
}
download content add
download device bluetooth
download action delete
download notification do_not_disturb
download image edit
download action help
download device nfc
download av play_arrow
download navigation refresh
download action search
download action settings
download social share
download action view_headline
Thanks to @mvdan for catching that. Turns out Java's String formatting is
not as tolerant as C's printf(). Java crashes when the format is wrong,
while C just ignores extras.
Might as well tap into the stream to get the byte counts, that's best
progress info I can think of when parsing a file.
This is a step towards a single progress bar for the whole process, instead
of showing one progress for downloading, another for parsing XML, then a
third for processing the new app info.
Still need to hook up the buttons in the app list, but this change
shows the correct status and/or buttons for installable/upgradable/
incompatible/installed apps in the swap list. This change also hooks
up UIL to download icons for apps and thus display them in the list.
Involved creating another view/state for which the swap workflow can
be in. It is not explicitly stated by setting the state of the SwapService,
as is the case with other views. Rather, it is inferred based on the
presence of a `NewRepoConfig` crafted from the incoming intent in
`onResume()`.
Also gave me an idea of how to move more logic out of individual views,
and into the SwapWorkflowActivity. That is, inflateInnerView should
return the inflated view, to be cast into the specific subclass. From
there, the activity can call methods directly on the view to set it
up, rather than having the view do that stuff itself. In the future,
may consider doing this with other views too.
The reference to mini-services above are not full blown Android
services. Rather, they are utility classes which can be started,
stopped, and send broadcasts about their status.
Made the list of apps to install better, with buttons for install
or upgrade, and statuses for incompatible and installed.
Peers are shown as proper list items now, subject to feedback from Carrie.
TODO: Need to figure out how to combine bluetooth and bonjour with same
fingerprint.
The Bluetooth peer need only parcel up the BluetoothDevice, which
itself is parcelable. The wifi peer requires the JmDNS ServiceInfo
class to be parcelled. For this, I took the most full on looking
constructor, and parcelled up each individual property of the service
info object which is required by that constructor.
Also made the scan qr button hooked up to the swap process, and fixed
minor bugs with the "visible via wifi" TextView setup.
Implementing the bare bones of a generic "peer finder" framework. This
may or may not eventuate to something which can live in its own library
and be used by other projects. Might go hand in hand with Carries idea
of having a common UI to be shared among projects.
Got Bluetooth and Bonjour kinda working, but the UI is crud,
and it doesn't remove items and ends up with duplicates. Otherwise,
on our way to a proper "nearby peers" screen.
Implementing the bare bones of a generic "peer finder" framework. This
may or may not eventuate to something which can live in its own library
and be used by other projects. Might go hand in hand with Carries idea
of having a common UI to be shared among projects.