494 Commits

Author SHA1 Message Date
Peter Serwylo
4f4310c0ca Clean up after merging swap stuff. 2015-07-18 00:08:25 +10:00
relan
2dc689e2a1 Remove icons from dialogs titles
Dialogs should not have icons in their title bars. See the Material Design
spec:

    http://www.google.com/design/spec/components/dialogs.html
2015-07-17 09:59:34 +03:00
relan
f0f0bd09d3 Reuse existing refresh icon
Use Material-style icon instead of the old Holo-style one.
2015-07-17 09:20:47 +03:00
Peter Serwylo
0a373de7a4 Merge branch 'nathan-bluetooth-swap' into nearby-peers-with-bluetooth 2015-07-15 17:42:03 +10:00
n8fr8
2a6b514232 change BT request handling to operate directly on files
We don't want to depend on HTTP being active in case there is
no wifi that exists at all. In some cases, local 127.0.0.1 does not
exist if the Wifi is not connected. This commit takes the code
from LocalHTTPD and repurposes it for the BluetoothServer needs.
2015-07-13 16:45:53 -04:00
n8fr8
e930e03378 improvement on scan/re-scan logic to avoid failure 2015-07-13 16:05:13 -04:00
n8fr8
c399a17369 add more checks for possible NPE and simplify the UI 2015-07-13 15:04:38 -04:00
n8fr8
cc6b2736ce add logic for setting/re-setting "Fdroid" name tag for bluetooth device 2015-07-13 14:41:21 -04:00
n8fr8
99a86c4080 handle null adapter case 2015-07-13 14:40:11 -04:00
Hans-Christoph Steiner
01fce7f94f re-enable Lollipop spongycastle hack
It doesn't look like there is an easy way around this, so re-enable it in
the new structure.

#111 https://gitlab.com/fdroid/fdroidclient/issues/111
2015-07-13 10:32:08 -07:00
Hans-Christoph Steiner
2910acc906 break out TOFU so all connections also run through regular verification
This drastically simplifies the very important index.jar signature
verification process by splitting out the Trust On First Use (TOFU) part of
the process into its own method, and makes the TOFU write happen separately
from the `RepoUpdateRememberer`.  It requires all connections go through
the normal verification process.
2015-07-13 10:32:08 -07:00
Hans-Christoph Steiner
43cc017c91 Utils.closeQuietly() for closing things in finally {} blocks 2015-07-13 10:32:08 -07:00
Hans-Christoph Steiner
675151b4ef rename string status_processing_xml to prevent crashes on old translations
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.
2015-07-13 10:32:08 -07:00
Hans-Christoph Steiner
64d709c142 create ProgressBufferedInputStream to get progress info while parsing XML
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.
2015-07-13 10:32:08 -07:00
Hans-Christoph Steiner
4f2650cd47 update logic to match only parsing signed index files
Now that there is only ever the index.jar, the whole flow of RepoUpdater
has changed quite a bit.  This updates the logic for deciding when to store
the current repo's pubkey in the database for future reference.

This changes the flow to stop writing the unpacked index.xml and instead
stream it directly to the XML parser from the index.jar.  This should speed
things up some.
refs #259 https://gitlab.com/fdroid/fdroidclient/issues/259

This is also work towards running the whole thing in the background:
refs #103 https://gitlab.com/fdroid/fdroidclient/issues/103

This also removes the progress stuff since it will need to change a lot to
work with the streaming mode
2015-07-13 10:32:07 -07:00
Hans-Christoph Steiner
d7efc99bdb simplify RepoUpdater to remove cruft from previous code structure
Before, there was an abstract RepoUpdater class with two subclasses, one
for signed and unsigned.  Now there is just a single class, and it only
ever starts with the index.jar.  So this removes lots of code that was
there to handle that more complicated structure.  For example, there is no
longer the need to separately work on the index.xml vs index.jar.
2015-07-13 10:32:07 -07:00
Peter Serwylo
a8dedd8ac2 Removed SwapAppListActivity, implemented UI mockup for swap app list.
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.
2015-07-13 22:52:51 +10:00
Peter Serwylo
f236dc3d3e Removed ConnectSwapActivity, refactored into SwapWorkflowActivity.
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.
2015-07-12 23:18:09 +10:00
Nico Alt
53c4ba52c4 delete default value for old permission preference 2015-07-11 11:43:59 +02:00
Peter Serwylo
4e4d3ec3f9 WIP: More cleaning up of swap process, unbinding service, and investigating getting rid of ConnectSwapActivity. 2015-07-10 01:14:32 +10:00
Peter Serwylo
0b1e2732c2 Refactored SwapService + SwapManager into single SwapService 2015-07-09 11:43:34 +10:00
Peter Serwylo
a3af6b8b9f WIP: Serialize bonjour peers correctly. Refactor mini-service APIs.
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.
2015-06-30 19:04:06 +10:00
Daniel Martí
6e5468daa1 Remove unused code in TabsAdapter 2015-06-28 13:37:37 -07:00
Daniel Martí
d9c2ea6fb6 Remove unused imports 2015-06-28 13:33:19 -07:00
Daniel Martí
2b15a3c17b Make good use of TextUtils.isEmpty()
Keep a consistent style when checking for empty strings. This also adds some
missing lentgh() > 0 checks in crucial places like AppDetails.
2015-06-28 13:24:23 -07:00
Peter Serwylo
22b072962e WIP: Don't show self in Bonjour peer list. Implement UI for peer list.
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.
2015-06-27 10:12:26 +10:00
Peter Serwylo
30669f8058 WIP: Hooking up specific peers from the "nearby peers".
Touching the peers will prompt app selection for swap, then skip the
wifi and NFC screens, then show updating info, then a list of apps to
swap.
2015-06-26 00:13:52 +10:00
Peter Serwylo
5e9931fa03 WIP: Make bluetooth/bonjour peers parcelable.
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.
2015-06-24 07:16:49 +10:00
Peter Serwylo
8ae3ae3e80 WIP: Start initial swap repo instantly, with only F-Droid...
... then when the swap process is setup properly, setup a real swap
repo with all of the apps that were selected.
2015-06-23 23:17:35 +10:00
Peter Serwylo
e343918ef9 WIP: Moving from listener to broadcasts for discovered peers. 2015-06-23 23:12:57 +10:00
Peter Serwylo
ff93f96959 WIP: MOre ui stuff for "Start Swap" screen. 2015-06-23 22:46:52 +10:00
Peter Serwylo
0100415e3e WIP: Refactoring Bonjour from manage repos to swap.
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.
2015-06-22 08:59:37 +10:00
Peter Serwylo
a30ec646b2 WIP: Refactoring Bonjour from manage repos to swap.
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.
2015-06-22 08:55:46 +10:00
Peter Serwylo
593aaf3894 WIP: I18n of start swap screen, colouring of text, add header.
Styled "send fdroid" and "qr code" buttons correctly.
2015-06-22 08:54:23 +10:00
Peter Serwylo
a48deb9160 WIP: More work on UI for initial swap screen. 2015-06-21 10:05:38 +10:00
Nico Alt
5be35d1d87 Merge branch 'material-design' into 'master'
Material Design

Similar to !94, this wants to merge from the F-Droid branch.
Old MR is !84.

See merge request !95
2015-06-18 21:17:36 +00:00
Daniel Martí
a7c9be9b16 Don't read empty xml elements from the index
This fixes cases where e.g. strings would be "" instead of null. Fixes #285.
2015-06-17 20:59:27 +02:00
Daniel Martí
7e0f4bbc0e We bumped minSdk to 8, so TargetApi(8) can go 2015-06-16 17:22:57 +02:00
Peter Serwylo
b0b285bc1f Merge branch 'swap/bluetooth' into swap-demolition-material-mockups 2015-06-17 00:41:37 +10:00
Nico Alt
8bb4d9012f delete case in switch for deleted theme 2015-06-15 21:19:15 +02:00
Peter Serwylo
a345788dba Added material icons from CC licensed "Google material icons" set.
Fixes #240.

To make this easier, I added a script to aid in downloading icons.
Checkout F-Droid/tools/download-material-icon.sh for more details.

The icons are licensed under the CCv4 attribution license, which I
added a shout out to under "License" in the README.md.
2015-06-15 21:19:14 +02:00
Peter Serwylo
d94e8a4ad2 Made category Spinner style correctly.
Signed-off-by: Nico Alt <nicoalt@posteo.org>
2015-06-15 21:19:14 +02:00
Nico Alt
03c5a224de fix #91: Material Design
- use 'com.android.support:appcompat-v7:22.0.0' instead of version 20.0.0
- ActionBar color: "F-Droid Blue" (also option for "F-Droid Green")
- fix invisible swap button with Material Design
- remove "Light + dark action bar" theme (as of Action Bar is always blue/green)
2015-06-15 21:19:14 +02:00
Peter Serwylo
78b5f489ef Merge branch 'fix-263/explicitly-add-swap-repo' into 'master'
Fix #263 "cannot manually add repo that was swapped before"

Pretends that the swap repo never existed, by deleting it before adding
the new repo, and showing the same message that is shown when a new
repo is added. This does not change behaviour for existing non-swap
repos. They are not deleted before being added again, or else we would
lose the ability to verify the fingerprint of an existing repo is the
same as a newly added one with the same URL.

Note that this has the effect that the fingerprint/pubkey of the swap
repo is nuked when adding that repo manually.

Internationalised the string "BAD FINGERPRINT" while I was at it.

To test it out, here is some instructions to make life easier:

Firstly, go into manage repos and delete the guardian project main repo (going to pretend to use this for swapping to make life easier).

Then if you run `sqlite3 /data/data/org.fdroid.fdroid/databases/fdroid` and execute the query:

`select substr(fingerprint, 0, 10), substr(pubkey, 70, 10), address, isSwap from fdroid_repo order by fingerprint desc;`

You should see:

```
B7C2EEFD8|081ad310b3|https://guardianproject.info/fdroid/archive|0
43238D512|071310b300|https://f-droid.org/archive|0
43238D512|071310b300|https://f-droid.org/repo/|0
```

Now simulate a swap session like so:

```
adb shell am start -a android.intent.action.VIEW -d 'https://guardianproject.info/fdroid/repo?swap=1'
```

Which results in the following database:

```
B7C2EEFD8|081ad310b3|https://guardianproject.info/fdroid/archive|0
B7C2EEFD8|081ad310b3|https://guardianproject.info/fdroid/repo|1
43238D512|071310b300|https://f-droid.org/archive|0
43238D512|071310b300|https://f-droid.org/repo/|0
```

Note the last column (`isSwap`) is `1` for the newly added swap repo. Now we will add the repo (without a fingerprint) to the Manage Repo activity. If you are feeling lazy, execute:

```
adb shell am start -a android.intent.action.VIEW -d https://guardianproject.info/fdroid/repo
```

The repo will be removed, then re-added as a TOFU repo:

```
B7C2EEFD8|081ad310b3|https://guardianproject.info/fdroid/archive|0
43238D512|071310b300|https://f-droid.org/archive|0
43238D512|071310b300|https://f-droid.org/repo/|0
||https://guardianproject.info/fdroid/repo/|0
```

I noticed some bugginess with sending the same intent and it being ignored, I'll have to look at this another day (not caused by this change, it already existed in master).

See merge request !90
2015-06-15 09:33:06 +00:00
Peter Serwylo
435fc27e31 Merge branch 'fix-267/nfc-swap' into 'master'
NFC swap now goes to confirm swap, not manage repos activity.

The NFC message now is handled by the FDroid activity, so it is treated
the same way as every other incoming repo URL. Because FDroid handles
incoming intents correctly, the NFC one just magically works when
the <intent-filter> is moved from ManageReposAcivity to FDroid without
further code changes.

The other change is that the two way swap only happens when both are
actually swapping. Otherwise, we will send a request for someone to
swap with us, when we are incapable of swapping with them.

Fixes #267.

See merge request !91
2015-06-15 09:28:24 +00:00
Daniel Martí
3fa5a51600 No need for TabInfo struct in TabsAdapter 2015-06-15 01:38:52 +02:00
Daniel Martí
4084cd5260 Remove redundant constructor call 2015-06-15 01:38:43 +02:00
Daniel Martí
3aa8bf4ea0 Apply some android studio fixes 2015-06-15 01:38:21 +02:00
Daniel Martí
62f9c84252 Merge branch 'fdroid-system-install' 2015-06-14 18:15:19 +02:00
Peter Serwylo
4a8ff47fce WIP: Implementing mockups from Carrie, added "Toolbar"
The Toolbar is the new thing from Google which acts as an ActionBar.
It is not a special view like the action bar is, it is
implemented and added to your layout the same as any view.

The InnerView classes of the swap workflow have the choice of what
colour to make the toolbar, so that they can distinguish themselves
as per the mockups (some deep blue, others bright blue).

Added icons for close, but they don't do anything yet.

Minor tweaks to layout so that it looks more like the latest mockups.
2015-06-12 22:45:55 +10:00