4063 Commits

Author SHA1 Message Date
Peter Serwylo
4f7116fcfb Add checkstyle rule to catch usage of member variables prefixed with 'm' 2016-12-05 22:56:26 +11:00
Peter Serwylo
22d9f55afb Move business logic from onBindViewHolder logic into respective ViewHolder subclasses. 2016-12-01 12:32:39 +11:00
Peter Serwylo
c50c9f2ea0 Appease pmd
Can be run via `gradle pmd`.

Mostly making fields final where appropriate.
2016-12-01 12:15:36 +11:00
Peter Serwylo
1f83cf1eca Appease checkstyle
Can be run via `gradle checkstyle`.

Mostly:
 * Removing one line if statements in favour of braces.
 * Whitespace between typecast and expression.
2016-12-01 12:15:36 +11:00
Peter Serwylo
539455bd16 Remove unnesseary class prefix 2016-12-01 12:15:36 +11:00
Peter Serwylo
0847bb6008 Inline check for 'isInstalled()'.
The adapter has its own copy of the `App`, and so can ask directly
instead of delegating to the activity.
2016-12-01 12:15:36 +11:00
Peter Serwylo
6e0ea68bab Push notifyDataSetChanged invocation into adapter.
That is probably the place most responsible for knowing if the dataset has changed
and broadcasting that fact.
2016-12-01 12:15:36 +11:00
Peter Serwylo
17c97e577e Format comments 2016-12-01 12:15:36 +11:00
Peter Serwylo
598d604ca5 Ported code for handling 'ignore this/all' from AppDetails
Allows the two menu items "Ignore All Updates" and "Ignore This Update"
to be checked and save the relevant preferences to the database in response.

The old code waited until the activity was paused before saving the
preferences to the database. This code does not, and as such incurs
a database write on the main UI thread as soon as the user checks the
menu items. However that database code has recently been refactored so
it should be much more performant. If it turns out to still be problematic
then we can revert to the old behaviour of hodling onto any state changes until
onPause then persisting to the database.
2016-12-01 12:15:36 +11:00
Peter Serwylo
9f758c4f86 Prefer Javadoc where possible 2016-12-01 12:15:36 +11:00
Peter Serwylo
003b9459da Removed need for upcast by parameterising mIntents over ResolveInfo instead of Object
Allows the type checking to be done by the compiler rather than the developer.
It was possible here because there is only two types of view, and the first type
will only have one or zero entries in the adapter. Thus, I've swapped the usage
of a `String` type for a `null` and checked for null instead of `instanceof String`.
2016-12-01 12:15:36 +11:00
Peter Serwylo
0b09d591ea Clarifying comment 2016-12-01 12:15:36 +11:00
Peter Serwylo
4e664c3d92 ints to Constants for viewtypes 2016-12-01 12:15:36 +11:00
Peter Serwylo
d0a326aa2c Lowercase stray N 2016-12-01 12:15:36 +11:00
Peter Serwylo
d2787d8d09 Add annotation as per the parent class. 2016-12-01 12:15:36 +11:00
Peter Serwylo
65f2c0eac7 Extracted string literals into constants. 2016-12-01 12:15:36 +11:00
Peter Serwylo
88661757f6 Added clarifying comment. 2016-12-01 12:15:36 +11:00
Peter Serwylo
a67ef806d2 Finalised property which is calculated once during construction 2016-12-01 12:15:36 +11:00
Peter Serwylo
ab72797a41 Added test for trailing newline stripping. Renamed method for clarity. Doccomments.
Changed the helpful comments to a Javadoc comment, as tooling such as editors
will be more likely to make use of it like that.

Renamed to emphasise that only trailing new lines are stripped.

Added a basic test for this function to ensure it only strips trailing,
and also that it does actually strip trailing slashes.
2016-12-01 12:15:36 +11:00
Peter Serwylo
ab917b6272 Remove need for setTag and (String) getTag()
Can use the argument passed to addLinkItemView() instead. Requires making
it final so that the anonymous inner class can read it.
2016-12-01 12:15:35 +11:00
Peter Serwylo
2709d00b70 Point to R.id.information, not R.id.text
Although the `textView` in `DonateViewHolder is currently not used, it was
pointing to an id which was not in the layout. This has been fixed in case
future devs choose to use this text view. Alternatively, we could remove it
completely if we don't think it is going to be used in this upcoming UI work.
2016-12-01 12:15:35 +11:00
Peter Serwylo
5f09c80914 Make constants static.
Not any need at this point for them to be object properties.
2016-12-01 12:15:35 +11:00
Peter Serwylo
2e1484bcb2 Correctly check whether mailto: links can be handled
Similar to the litecoin/bitcoin/flattr stuff, we need to check that a
proper URI can be handled via an intent. This previously just checked
whether the email address could be handled without the mailto: prefix.
2016-12-01 12:15:35 +11:00
Peter Serwylo
a0c40bcaae Remove some commented out code 2016-12-01 12:15:35 +11:00
Peter Serwylo
920e6499ab Minor formatting 2016-12-01 12:15:35 +11:00
Peter Serwylo
4a92a37df2 Use TextUtils.isEmpty instead of null and length check 2016-12-01 12:15:35 +11:00
Peter Serwylo
46eb6ee3b4 Added initial test for AppDetailsRecyclerViewAdapter.
Doesn't do anything except create an app with no versions,
no donate links, anything like that, and ensure that the adapter
is able to create the view holders for each resulting item.

In the future we can beef this up to check more exotic conditions,
such as calling `updateItems(App)` with different apps, each
with different combinations of versions, donation links, permissions,
etc.
2016-12-01 12:15:31 +11:00
Peter Serwylo
774ca02d22 Use correct URIs when attempting to show donate links.
This extracts the functionality from the old AppDetails which prefixes
donation links with the relevant scheme (bitcoin: or litecoin:) or URL
(https://flattr.com/thing/) into the App class.
2016-12-01 12:15:31 +11:00
Peter Serwylo
190cf40ff9 Make assumption that app is non-null explicit
The adapter has a hard coded assumption that mApp is never null.
This documents it as such by making the member variable @NonNull.
This is not perfect, because the consumer of this class doesn't quite
seem to check this constraing properly, however at least within the
class it adds some explicit documentation that is understood by editors
and lint that this is a non-nullable field.
2016-12-01 12:15:31 +11:00
Peter Serwylo
1eb7d389f2 Refactor setProgress code for the header view.
Each call site of the `getHeaderView()` method needed to do a null
check and then it would call `setProgress()`. This has been replaced
with two methods `setProgress()` and `clearProgress()` to make it a
bit less repetative and harder to accidentally get a NPE in the future
by invoking `getHeaderView()` incorrectly.
2016-12-01 12:15:31 +11:00
Peter Serwylo
7d2d22cf96 Extracted variable, made code fit on single lines. 2016-12-01 12:15:31 +11:00
Peter Serwylo
4c42e73243 Removed unused imports 2016-12-01 12:15:31 +11:00
mvp76
3b23ea019b Reset build files to release 2016-11-25 10:07:56 +01:00
mvp76
e1af82c5f8 Adjust margins 2016-11-25 09:46:35 +01:00
mvp76
05f13df17a Separate adapter from rest of activity 2016-11-23 12:37:26 +01:00
mvp76
b36e581480 Fix snap helper 2016-11-23 12:37:06 +01:00
mvp76
d02ea05865 Add the download/install progress bar 2016-11-21 17:01:03 +01:00
mvp76
b2d363b947 Add new Nearby icon to share dialog 2016-11-21 14:39:15 +01:00
mvp76
4a25df8461 Add version items directly to RecyclerView 2016-11-21 10:48:51 +01:00
mvp76
0855c0affe Change icon for versions (and add string!) 2016-11-18 16:07:18 +01:00
mvp76
f3e88535f9 Load feature graphic (currently large icon) 2016-11-18 15:55:44 +01:00
mvp76
30bcad963e Move from ListView to LinearLayout temporarily
These need to go into t he recyclerview instead.
2016-11-18 15:39:53 +01:00
mvp76
7061e47a8c Fix toolbar icons 2016-11-18 15:39:53 +01:00
mvp76
5a0b625dc0 Add Nearby to share (if applicable) 2016-11-18 15:39:53 +01:00
mvp76
46308dcbde Added share to details view
TODO: still need to add Nearby
2016-11-18 15:39:53 +01:00
mvp76
d90cb040b1 Move some files and add donate section 2016-11-18 15:39:53 +01:00
mvp76
d3247b9cfd Post update, so all receivers have run 2016-11-18 15:39:53 +01:00
mvp76
be16137553 Install/Uninstall
Does not work yet, race condition on the listeners I guess.
2016-11-18 15:39:53 +01:00
mvp76
7469a1cdab Some layout and color fixes 2016-11-18 15:39:53 +01:00
mvp76
88c60b98f9 Added permissions section 2016-11-18 15:39:53 +01:00