804 Commits

Author SHA1 Message Date
Daniel Martí
7fd3ea236e Move "appid" into AppDetails.EXTRA_APPID 2014-04-10 15:49:02 +02:00
Daniel Martí
40d873551f A bit of extra cursor safety, avoid the last missing .close() 2014-04-10 15:11:00 +02:00
Daniel Martí
f04ac83ec9 Fix build without java 1.7 compatibility 2014-04-10 15:08:29 +02:00
Peter Serwylo
fe1806b016 Merge branch 'misc_fixes' into 'master'
Localized category list
2014-04-10 03:51:58 +00:00
James Clark
09ccf3d428 Fix bug introduced in last commit 2014-04-10 04:14:55 +01:00
James Clark
87638363b3 Set listview to top item after category refresh 2014-04-10 03:45:17 +01:00
Hans-Christoph Steiner
c1d0ec43c3 fix crasher when hopping around apps and adding repos
I triggered this a few times while trying various QR Code scanning apps
with FDroid.

fixes #3222 https://dev.guardianproject.info/issues/3222
2014-04-07 21:39:50 -04:00
Hans-Christoph Steiner
407e7662e9 support QR scanners that do not respect custom URI schemes
Some QR Code scanners don't respect custom schemes like fdroidrepo://, so
this is a workaround, since the local repo URI is all uppercase in the QR
Code for sending the local repo to another device.  This way, the QR Code
can still be all uppercase and use HTTP:// and Android will still route it
to FDroid, but via the Just Once/Always chooser (fdroidrepo:// goes
directly to FDroid with no prompt, when it works)
2014-04-07 21:07:01 -04: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
Peter Serwylo
dcf3a9dae8 Fixed assumption that repo updates have all apps available.
Previously, I accidentally made the repo updater presume that it
had access to all apps in a big fat list. This meant that I was iterating
over that list, performing calculations, etc, rather than actually
querying the entire database.

The solution was to bundled all update-service related processing to one
process in AppProvider (I didn't want to have to pull every single app/apk
out of the database in order to perform the update, because that will become
more and more burdensom as the repo grows).

There is a method calcDetailsFromIndex() in the AppProvider.Helper class.
It now does three things:
 * updates compatibility flag.
 * updates suggested version (outstanding issue is documented in gitlab issue #1)
 * updates iconsUrl (fixed in this commit)

Icons from old repos will just have icons in an "icons" dir
in the same folder as the index.jar. New repos have density
specific icon dirs (e.g. "icons-240") which depend on the
device F-Droid is running on.
2014-04-06 12:34:47 +00:00
AlexanderR
04ea93cce8 Category list i18n 2014-04-05 17:08:29 +11:00
AlexanderR
c1daa99617 Use managedQuery to let Search Activity automatically dispose of it's Cursor.
Should be somehow done via Loaders someday.
2014-04-05 10:32:58 +11:00
AlexanderR
793bd618ac Fixed weird crash on emulator 2014-04-04 18:06:03 +11:00
Peter Serwylo
eded748ab8 Fixed the suggestedVersion calculation, now done via SQL.
The archive repo was getting updated after the regular repo.
In these situations, we didn't have every single app/apk in
memory in order to calculate the suggested version. As a
result, F-Droid ended up choosing a suggested version from
the archived versions, when terhere was actually a newer version
in the database.

This change does all of the calculations in two database queries
now. Although the implementation of the query is not hackey,
they way I get to the code in order to execute the query
is a bit hacky, so most of the implementation is private.
2014-04-03 00:32:56 +11:00
Peter Serwylo
468b6717ee After downloading index, remove apks no longer in the index.
It adds an extra 600ms on my Nexus 4 with ~2000 apks from the
F-Droid index. But I think it is the only way, as we really need
to iterate over every single installed apk, to see if it is still
wanted. The up side is that we can query for a large amount of
them, rather than quering individually for each apk.

NOTE: I haven't added a new status message yet, because we are
about to do a stable release. After the stable release, I'll
add a new status message to cover for this > half a second
(on my relatively fast device). This will probably be part of
an overhaul of the update process in general, including a
proper progress dialog.
2014-04-01 21:19:27 +11:00
Daniel Martí
abdd2fbb8e Bring back "Update repos" to the main menu
This can later be removed again if the user still has a way to easily update
repos manually without having to enter "Manage Repos" and exit again. A good
option would be a pull-to-refresh action.
2014-03-28 17:59:07 +01:00
Peter Serwylo
8efa9d609a Apps were not getting a current version when upstreamVersioncode not specified.
The problem was that they defaulted to 0 if not specified, however
the code checking for current version was looking for -1 for a "no upstream version".
2014-03-27 22:22:54 +11:00
Peter Serwylo
3ebad383d6 Refactored the recent MR for dynamicly adding default repos.
The idea was good: reduce the amount of copied/pasted code
where ContentValues were initialized, populated, then inserted.
I've kept the idea, by putting it in its own method which is
called twice. But the resources are not loaded dynamically any
more. This is so that the compiler will be able to pick up if
we reference a missing resource. Also, I took the opportunity
to replace the field name string literals with references to
RepoProvider.DataColumns.* constants.

Finally, changed the tests around because now we need to
have the "getInteger()" call mocked in resources correctly
(for priority/inUse).
2014-03-23 22:31:06 +11:00
Peter Serwylo
9703350f41 Update tab refreshes correctly now.
Before it was listening for changes, but we weren't notifying
of changes correctly. Now we use ContentResolver.notifyChange().
2014-03-23 21:20:03 +11:00
Peter Serwylo
bfdfb6d5ef Removed unused code from FDroidApp.
From before content providers, where we rolled our own update notification
system for when data changed in the database. I also removed the property
"ctx", because it is availble in getApplicationContext(). As a general rule,
it is usually safer to not use a member field if not neccesary. That way,
there doesn't need to be any assumptions about when it is set and what value
it has. In this case, it was only set half way through onCreate, and therefore
usage before then would break.
2014-03-23 21:20:03 +11:00
Daniel Martí
9f2de0abd7 Get rid of EXTRA_NOT_UNKNOWN_SOURCE target api warning 2014-03-22 11:22:03 +01:00
Daniel Martí
2cd17a904e Placed the TargetApis wrong 2014-03-22 11:18:42 +01:00
Daniel Martí
4f065492ef Unify the usage of cursors
Safer and less error-prone because:

* Always checks for null
* Checks for sizes
* Inits App/Apk lists at known capacity
* Properly closes all cursors

There are still one or two cursors that are not closed correctly and show
things like these:

W/CursorWrapperInner(19973): Cursor finalized without prior close()
2014-03-22 00:11:56 +01:00
Daniel Martí
fc4a96acd8 Don't break when updating the Apk table on devices before 3.0 2014-03-21 23:22:23 +01:00
Peter Serwylo
9c9ecc5140 Fixed issue 472, NPE on android 3.1 (and 3.0).
The Activity.getActionBar() method can only be called after
setContentView() has been invoked, as described here:

  http://blog.perpetumdesign.com/2011/08/strange-case-of-dr-action-and-mr-bar.html

I couldn't think of any way to enforce this safely
(i.e. make the compiler kick up a stink if we didn't do it). As such,
I just put a comment above each usage of the ActionBarCompat class.

Another outstanding issue is a duplicate of 474, where it crashes when you
press the "Up" button from ManageRepos, but I'll create a different issue
for that.
2014-03-22 08:29:13 +11:00
Daniel Martí
0e47ac6900 Slightly speed up getAndroidVersionName by using a static array 2014-03-21 18:18:12 +01:00
Daniel Martí
ee38ff3eea Merge commit 'refs/merge-requests/69' of gitorious.org:f-droid/fdroidclient 2014-03-20 00:03:47 +01:00
Daniel McCarney
7dd216d212 Apply Google CSRNG fixes.
The cryptographically secure random number generator exposed to Android
through the Java Cryptography Architecture is not properly initialized
on some older unpatched versions of Android. Google provides
a PRNGFixes.java class to force secure seeding of the CSRNG on all
platform versions. This comment adds the PRNGFixes class & and a call to
invoke the fixes from the FDroidApp class.

More detail is available from the Google Android Developers blogpost on
the subject:
  http://android-developers.blogspot.ca/2013/08/some-securerandom-thoughts.html
2014-03-19 18:56:42 -04:00
Daniel Martí
ddb1cfd659 Only set NOT_UNKNOWN_SOURCE if available 2014-03-19 12:46:17 +01:00
Peter Serwylo
94300592d9 Fix missing resource issue.
When adding "default_repo_priority", it was copy/pasted from
"default_repo_pubkey" without changing the name, and so
tried to cast the string value into an int and failed.
2014-03-19 07:02:00 +11:00
Peter Serwylo
fa8052611e Don't reset "transient" tables from now on.
Instead, use:

if (oldVersion < ... && !columnExists(...))
	db.execSQL("ALTER TABLE ...")

to add/modify columns as required.
2014-03-19 06:22:09 +11:00
Daniel Martí
5e30d0d218 Remove "Android App:" when sharing an application
Reasons to do so:
* Redundant
* Often noisy
* Not properly translated
2014-03-18 08:15:04 +01:00
Daniel Martí
a184ce7268 Make priorities configurable too 2014-03-17 09:38:11 +01:00
Daniel Martí
6284811fec Merge commit 'refs/merge-requests/68' of gitorious.org:f-droid/fdroidclient 2014-03-17 09:29:13 +01:00
Peter Serwylo
0ec4e3756d Don't show update option in list if ignored.
Related to the last bug with the update notify count. This one is
also due to the fact we didn't ask for the right data from the
provider. If these bugs keep coming in over time, I will seriously
consider guarding access to each variable with a check, and throwing
an exception if the variable hasn't been initialized. For now I'll
see if it was a once off. Hopefullly tests will catch these issues
in the future.
2014-03-17 17:43:45 +11:00
Rene Treffer
67e1020684 Add missed occurance of old repo address R.string 2014-03-16 14:20:44 +01:00
Rene Treffer
1f799d1ef1 Say that f-droid is not an unknown source.
This property will be ignored if f-droid is not installed as priv-app,
but it _will_ skip the "you have to enable unknown sources" dialog if
f-droid is installed as priv-app.

There is thus no gain in keeping it as is (false).
2014-03-16 13:52:05 +01:00
Rene Treffer
61bbbf442d Make the list of default repos dynamic
This patch iterates over the configured list of repos and adds them to
the db on create. This means that the initial list of repositories is
now fully configurable. Added the guardian project repo (disabled) as a
testcase.
2014-03-16 13:50:17 +01:00
Daniel Martí
49a3c3370f Don't finish the whole Repositores activity when cancelling "New Repository" 2014-03-10 18:36:35 +01:00
Daniel Martí
54d7849191 Get rid of lint TargetApi warnings 2014-03-10 18:30:42 +01:00
Daniel Martí
4454c0d261 No need to reset views in the app lists 2014-03-10 17:56:49 +01:00
Peter Serwylo
9fd8da42a1 Adding test coverage for "AppProvider.Helper.findIgnored()"
Also added tests for canAndWantToUpdate() while I was at it.
2014-03-06 23:31:26 +11:00
Peter Serwylo
81fcd44b66 Fixed update notification count
The update notification was not taking ignored apps into account.
This is the first manifestation of a class of bug I feared whereby
the properties of an App object are not initialized, but no error
is thrown. It occured because we were iterating over apps that were
created from the index file, rather than our database. Hence, they
had no knowledge about whether they should be ignored or not.

Also took the chance to perform a minor refactor of UpdateService
class. The onHandleIntent method was getting huge, so I extracted
two methods: verifyIsTimeForScheduledRun() and
performUpdateNotification(), as well as removing the unused "success"
flag.

The two methods should theoretically make the class more testable
later, as we can test the scheduled run code, and the update notification
code in separate tests, but we'll wait and see if that eventuates.
2014-03-06 23:31:26 +11:00
Peter Serwylo
aa9bfefd55 Fixed bug with only one apk being added from index for each app. 2014-02-28 10:32:32 +11:00
Peter Serwylo
4004b6251f Fixed issue 474 - crash on "Up" button from ManageRepos.
Not sure that the "parent" activity of ManageRepos is required in
the manifest any more, due to the fact that the main use seems
to be to direct the "NavUtils.navigateUpSameTask" method uses it,
but this change switches to "NavUtils.navigateUpTo" and specifies
the activity explicitly.
2014-02-27 22:56:16 +11:00
Peter Serwylo
45d046b445 Fix unique key violation in update service.
When two repos both add an apk with same version and id, then
it would break.
2014-02-24 11:01:56 +11:00
Peter Serwylo
87f2da7e2f Fix 'Number of apps' sql exception in repo details. 2014-02-24 10:45:25 +11:00
Peter Serwylo
568224ba78 s/curVersion/upstreamVersion/g, added suggestedVersion. Refactored QueryBuilder.
In order to support suggested version, I didn't want to have both
suggested version + versionCode in the App table. Rather, just the
code, and then use that (and the apps id) to join onto the apk table.
This is something we wanted to do elsewhere, so I refactored the
QueryBuilder class from the ApkProvider so that it can also be used
by the AppProvider.
2014-02-24 10:45:13 +11:00
Daniel Martí
2a03c51207 Use LayoutCompat in RepoAdapter 2014-02-21 00:11:58 +01:00
Daniel Martí
5d0074d821 Add ALIGN_PARENT_* to LayoutCompat.RelativeLayout 2014-02-21 00:11:58 +01:00