Convert util/{HttpHeaderLink,PairedList,TimestampUtils,ThemeUtils} to Kotlin (#3046)

* Fix off-by-one error in HttpHeaderLink

Link headers with multiple URLs with multiple parameters were being parsed
incorrectly.

Detected by adding unit tests ahead of converting to Kotlin.

* Convert util/HttpHeaderLink from Java to Kotlin

* Convert util/ThemeUtils from Java to Kotlin

* Convert util/TimestampUtils from Java to Kotlin

* Add tests for PairedList

* Convert util/PairedList from Java to Kotlin

* Implement feedback from PR

* Relicense as GPL
This commit is contained in:
Nik Clayton 2022-12-31 13:01:35 +01:00 committed by GitHub
commit 22834431ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 624 additions and 510 deletions

View file

@ -915,11 +915,11 @@ public class NotificationsFragment extends SFragment implements
private void onFetchNotificationsSuccess(List<Notification> notifications, String linkHeader,
FetchEnd fetchEnd, int pos) {
List<HttpHeaderLink> links = HttpHeaderLink.parse(linkHeader);
HttpHeaderLink next = HttpHeaderLink.findByRelationType(links, "next");
List<HttpHeaderLink> links = HttpHeaderLink.Companion.parse(linkHeader);
HttpHeaderLink next = HttpHeaderLink.Companion.findByRelationType(links, "next");
String fromId = null;
if (next != null) {
fromId = next.uri.getQueryParameter("max_id");
fromId = next.getUri().getQueryParameter("max_id");
}
switch (fetchEnd) {