932 Commits

Author SHA1 Message Date
Peter Serwylo
f099ae52bf Remove unused resources (layouts/dimens/etc)
Leaving strings to a separate commit to make it clearer when they were
removed, in case they need to be reinstated.
2017-04-07 08:34:41 +10:00
Peter Serwylo
fada693ac9 Remove AppDetails (in preference to AppDetails2).
Also removed associated layouts which are no longer required.
2017-04-07 08:34:41 +10:00
Peter Serwylo
3efb3a3043 Remove category provider stuff specific to old 3 tab layout.
We no longer prefix the list of categories with "Whats New", "Recently
Updated", and "All". The new UI doesn't require this. The only place
they were being used now were in the tests.
2017-04-07 08:34:40 +10:00
Peter Serwylo
c2d5f57fbd Remove now-unused queries from AppProvider. 2017-04-07 08:30:31 +10:00
Peter Serwylo
a8e6daadc3 Removed now-unused ArrayAdapterCompat class. 2017-04-07 08:30:31 +10:00
Peter Serwylo
d7fbd868b9 Remove app list adapters from old 3 tab layout. 2017-04-07 08:30:31 +10:00
Peter Serwylo
65afc83b16 Removed app list fragments from old 3 tab layout. 2017-04-07 08:30:31 +10:00
Peter Serwylo
6f80fbd945 Removed PreferencesActivity.
This is now a top level view inside MainActivity.
2017-04-07 08:30:31 +10:00
Peter Serwylo
4db31ef975 Removed FDroid.java, no longer used. 2017-04-07 08:30:31 +10:00
Peter Serwylo
7b9219e701 Removed TabManager
Only used in old FDroid activity which is about to be removed.
2017-04-07 08:30:30 +10:00
Peter Serwylo
4dc18f0a88 Removed AppListFragmentPageAdapter
Only used in old FDroid activity which is about to be removed.
2017-04-07 08:30:30 +10:00
Peter Serwylo
5ebe3b2420 Remove references to unused classes in AndroidManifest.xml 2017-04-07 08:30:30 +10:00
Hans-Christoph Steiner
e28e29455e Merge branch 'new-ui--feedback-from-alpha' into 'master'
Implement a handful of UX tweaks in response to alpha feedback

Closes #879

See merge request !464
2017-04-06 10:39:49 +00:00
Peter Serwylo
8faf151c90 Remove 1 second pause between installing and updating UI.
This was implemented before because the main screen of the three tab
layout needed to update in response to the list of installed apps being
installed. When we scan the list of installed apps upon starting
F-Droid, we didn't want to have to requery for the list of installed
apps every time we found a new installed app. For this reason, we
"debounced" these requests (accumulated them for 1 second, and then let
go of a notification only after 1 second of inactivity).

This is no longer a feature, and so we can afford to fire the
notification instantly.
2017-04-05 16:44:53 +10:00
Peter Serwylo
24a6e9590d Wait until installed app service is ready before updating app details.
We were jumping the gun before, and asking to refresh the app details
adapter before the installed app service was able to notify us of a
change to the apps installed version.

This should be refactored to use broadcast receivers instead of
content observers (which are tied to the implementation of a content
provider). However this is currently a straight port from app details 1
to app details 2.
2017-04-05 16:37:55 +10:00
Peter Serwylo
50044629ab Remove placeholder whatsNew text completely.
Now that we are releasing this, we need to remove the "Whats New"
placeholder text.
2017-04-05 15:50:18 +10:00
Peter Serwylo
b0afa3e2fe Using custom icon for notification rather than the launcher icon.
On newer devices, it takes the icon, removes colour, and uses that. This
looks weird because:

 * The head and body look too close together once you remove the shading
   from the launcher icon.

 * The eyes dissapear because they are white (not transparent) in the
   launcher icon.
2017-04-05 15:41:57 +10:00
Peter Serwylo
2ab5c6a1c6 Correctly update the list item in updates view after install.
Prior to this, it would still show the "Ready to update" list item.
Now it updatpes the description to say "successfully installed" and
removes the "Update" button.
2017-04-05 15:23:28 +10:00
Peter Serwylo
8a69816648 Only automatically redirect to package manager when viewing app.
If you open AppDetails, initiate a download + install, and then navigate
away, it still pops open the install dialog for you. This is because it
never deregisters the broadcast receiver.

This change maintains the behaviour of always having the broadcast
receiver. This is because it is only added when the download
completes, and would require further refactoring to change that.
Instead, we listen for the receiver, but we ask if the AppDetails view
for the apk in question is actually visible to the user. If not, we
don't try to initiate the package manager.
2017-04-05 15:09:44 +10:00
Peter Serwylo
be11a785e5 Make the "Updates" badge only show number of items needing action.
Previously it showed the number of things which were eligible for
update. This will become less and less important the more people we can
switch over to automatic updates. However, given the privext vs unknown
sources thing, we will always have a lot of users who need to be
notified that they need to take further action to complete an install.
2017-04-05 15:01:55 +10:00
Peter Serwylo
0b7dc64fb6 Show apps in name order.
Prior to this, they were in whatever order they came from the metadata.
This resulted in weidrness because the repo which was updated last will
have its apps shown last. We are trying to move away from the repo
update order being important.

In the future, this sort order should take into account better
heuristics, but for now this is at least deterministic.
2017-04-05 13:26:56 +10:00
Peter Serwylo
b5341efff9 Don't padd the left/right of the category apps
Doing so makes it appear like they scroll from somewhere which isn't
quite the edge of the screen, which is weird.
2017-04-05 13:17:21 +10:00
Peter Serwylo
89625ac355 Add selectable background to list items and cards. 2017-04-05 13:12:51 +10:00
Peter Serwylo
1aea1c9302 Updated tests to work with flipped repo priorities. 2017-04-05 09:09:51 +10:00
Peter Serwylo
c6efdbb20c Repos added later should take higher priority.
The database still treats repos with a _low_ number as _low_ priority.
This means it sounds weird when you say "Repo with priority 1 is the
least important", but other than that, everything works as expected now.

Technically we could recreate the query to update the repo metadata
within DBHelper, but that is difficult because it is sort of build into
the content providers. Unfortunately, we are unable to access content
providers from the DBHelper.

In the future if we are able to migrate away from content providers to a
more dumb data access layer, then we could reuse the query to update the
metadata priorities in the DBHelper. However that is a tomorrow problem.
2017-04-04 16:26:42 +10:00
Hans-Christoph Steiner
89e103fc23 Bump to 0.103-alpha1 2017-04-01 21:15:18 +02:00
Hans-Christoph Steiner
fb0e453fce pull weblate for v0.103-alpha1 2017-04-01 19:10:15 +00:00
Hans-Christoph Steiner
21fd522e95 only set installer to privext on versions where its required
To limit the possible oddness of having the installer package being
something different than F-Droid, only set it to priv ext on android-24
and newer, since its required there.
2017-03-31 20:07:56 +02:00
Hans-Christoph Steiner
a9a37747cb Merge branch 'uninstall' into 'master'
Set installer package name to privext if using that

See merge request !454
2017-03-31 18:00:41 +00:00
Hans-Christoph Steiner
e2ab447315 Merge branch 'privext-updates' into 'master'
InstallerFactory: Check for privext before checking if apk to be installed is privext

Closes #911

See merge request !459
2017-03-31 17:45:11 +00:00
Peter Serwylo
c3424f9ff3 Update AppDetailsAdapterTest for apps that don't have screenshots.
While here, also added a couple of new test cases to better ensure the
adapter plays nicely with its items when receiving an app with specific
states.
2017-03-31 12:12:19 +02:00
Peter Serwylo
e34f289246 Setup and teardown preferences singleton for new tests.
Depending on the order the tests are run, this may have resulted in an
exception due to the singleton being setup multiple times.
2017-03-31 12:12:16 +02:00
Hans-Christoph Steiner
b08dfdcb80 move "What's New" placeholder to where its used
There is still quite a bit to figure out in the data format of the
per-package "What's New" entries, and its breaking the tests, so move
the placeholder code to the one spot where the placeholder whatsNew
entry is used.
2017-03-31 12:11:56 +02:00
Hans-Christoph Steiner
d90c773161 do not show screenshots view in AppDetails if none are available
App.getAllScreenshots() works nicely here, but its probably a temporary
measure until we figure out how to handle the various kinds of
screenshots (TV, Wear, etc).
2017-03-31 09:09:31 +11:00
Hans-Christoph Steiner
28bcbc548a use central method to setup Jackson in locked down setup
This is based on @pserwlyo's work.  The App and Apk classes currently
need just the public instance variables auto-filled by Jackson, so
everything else is considered opt-in, via @JsonProperty declarations.
This is currently only used for setLocalized(), setUsesPermission(),
and setUsesPermissionSdk23().

# Conflicts:
#	app/src/test/java/org/fdroid/fdroid/updater/IndexV1UpdaterTest.java
2017-03-31 09:09:31 +11:00
Hans-Christoph Steiner
2a2e475bdc index-v1 future proof test for uses-permission
The parser should accept additional elements to each
uses-permission entry, in case more XML attributes is added to
<uses-permission>.  <uses-permission> has had two attributes
since the beginning.

Other changes to this JSON data structure are bad index-v1
format, and will cause crashes:

* Removing an element e.g. null from a uses-permission entry
  would be invalid index-v1 JSON, since that structure mirrors
  the uses-permission AndroidManifest.xml element, which has a
  long standing fixed definition of name/maxSdkVersion.  That
  should crash so that fdroidserver authors know they are
  generating invalid index-v1.

* setting versionCode to anything but an int is invalid index-v1
  JSON, and should crash.  versionCode has been defined as an
  32-bit signed integer value since the beginning of Android.

* <uses-permission android:name=""> has been defined as a string
  since the beginning of Android.

https://developer.android.com/guide/topics/manifest/uses-permission-element.html
2017-03-31 09:09:31 +11:00
Hans-Christoph Steiner
9d026bbdbc use string name for JacksonInject to make it easy to read
java
2017-03-31 09:09:31 +11:00
Hans-Christoph Steiner
f86b65e12a rename Apk.repo to match App.repoId and Repo.id
Somehow, the Apk class has its Repo ID variable confusingly named just
"repo", which throughout the code is used to represent an instance of
Repo.
2017-03-31 09:09:31 +11:00
Hans-Christoph Steiner
6f58c2a13d make Jackson inject repoId rather than looping later to add it
repoId is used in Repo, App, and Apk instances to point to the Repo data
in the database.  It does not come from the index files, but rather the
client database.
2017-03-31 09:09:31 +11:00
Hans-Christoph Steiner
38d21cd178 check timestamp with index-v1
An important security protection is erroring when the index-v1.jar is
older than what is currently in the database.  If the current or older
jar is allowed to be parsed, then a malicious server or
Man-In-The-Middle could replay old version of the index-v1.jar to
prevent the clients from learning about updates that fix security issues
2017-03-31 09:09:31 +11:00
Peter Serwylo
8cfe1d3584 Correctly populate FeatureImage with app.featureGraphic.
Fall back to extracting the colour from the apps icon if that
is all that is available.
2017-03-31 09:09:31 +11:00
Peter Serwylo
5aa44a4d74 Handle icon 404s without crashing. Resume settings without crashing on API > 17.
The image loading code for the app cards was presuming that the icon
returned did indeed exist. In this case, it crashed due to trying to
decode a `null` image.

I noticed that when returning to the settings fragment (e.g. by closing
then reopening F-Droid while viewing), it will attempt to re-remove the
priviledged preference. This causes a crash, so we check to see that we
still have the preference before deciding to remove it.
2017-03-31 09:09:31 +11:00
Peter Serwylo
517321356d the database does not support null Description
index-v1 does not send empty values.  The description was historically
set to "No description available" on the server side, and in
index.xml.  The database then inherited this behavior, and does not
support no description.  In the long run, it would be good to sync up
the database with the index-v1 metadata, but perhasp then we'd have to
add a million null guards, which wouldn't be worth it.
2017-03-31 09:09:31 +11:00
Hans-Christoph Steiner
40643855c4 do not let Jackson set instance vars that never come from index
Tell the Jackson JSON parser to ignore App/Apk fields that should never
come from the index, but instead are set locally to keep track of the
current state of things on the device.

There are two forms of tests to enforce that the proper things get
ignored.  It is not possible to do this with decorators alone, so I
chose to use @JsonIgnore and leave the variables we want filled in
undecorated.  Also, all of the instance variables in Apk/App/Repo
should come directly from the index metadata so that they are pure
data classes.  Currently some state info is stored in them, those are
decorated with @JsonIgnore.

The tests then include lists of accepted and ignored properties, and
anything that is not in those lists will cause the tests to fail.  So
if someone is adding a new instance variable, they will get a fail
until the tests are updated.  One set of tests actually writes blank
instances out as JSON since that's the easiest test to write, and
Jackson treats @JsonIgnore the same in both directions.  Then there is
another test that reads a JSON file with added, unsupported values to
make sure that they are properly ignored.
2017-03-31 09:09:31 +11:00
Hans-Christoph Steiner
281dd435e7 ignore unknown fields in index-v1 JSON data
Having Jackson set to ignore unknown fields in the incoming JSON data,
instead of throwing an Exception, means that we can add any fields to the
JSON without having to rev the index version, and older clients will still
parse it fine.  This is basically the same as in index.xml.
2017-03-31 09:09:31 +11:00
Hans-Christoph Steiner
9d97546c4f support localized text and graphics in index-v1 metadata
This sets the App instance variables using the localized index-v1 fields.
It trys to fill as many fields as possible, falling back to locales of the
same language, then finally English.

This is based on the Jackson JSON parser's ability to map a JSON key to a
method, e.g. @JsonProperty("localized")
2017-03-31 09:09:31 +11:00
Hans-Christoph Steiner
d769dcfc60 support new index-v1 format using Jackson parser
This adds support for parsing the new index-v1.json data as defined in
fdroidserver!221.  This new index metadata format is required to
support localization, graphics, screenshots, etc.

refs #15
2017-03-31 09:09:31 +11:00
Hans-Christoph Steiner
7e0ae10e84 uses-permission fields as Apk instance vars
This adds support for the index fields: uses-permission and
uses-permission-sdk-23.  For most index fields, Jackson handles directly
mapping the incoming data to the instance vars based on the matching
field/var names.  For uses-permission*, methods are declared for
handling those properties in the incoming index.

These fields will be ignored when using the v0 index.xml format.
2017-03-31 09:09:31 +11:00
Chirayu Desai
0bce5cebe6 InstallerFactory: Check for privext before checking if apk to be installed is privext
* Move the privileged extension installed check above
  the check whether the apk to be installed is privext.
* This lets privext updates work when it is already installed.
2017-03-29 15:11:28 +05:30
Chirayu Desai
2be79c35e7 Set installer package name to privext if using that
* The new PackageInstaller APIs, being used by the privext on Android
  7.0 and above aren't happy with uninstall being done by an app
  other than the original installer.
* Set it to the privileged extension if that is enabled and being used,
  to make uninstalling work
2017-03-27 19:28:11 +05:30