Add Start/Finish date support for MAL (#2672)

* Started working on MAL support

* Added date picker UI

* Replaced Date with Calendar

* Added MAL remote update functionality

* Join url methods listEntryUrl and editUrl

* Removed unused methods

* Renamed mangaEditPayload to mangaEditPostBody

* Moved code to separate method

* Uniformed code to project conventions

* Removed wildcard import

* Moved MyAnimeListTrack to private class

* Improved MyAnimeListTrack name

* Removed redundant code

* Add start/finish date in local database

* Fixed format and improved codestyle

* Fixed typo and fixed TrackHolder's format

* Improved code style

* Ran linter

* Add database updating methods

* Change date format to fit new layout

* Review Commits

* Improve SetTrackReadingDatesDialog readability

* Move private methods after public ones

* Fixed SQL error

* Fixed remove date button

* Updated MaterialDesign methods to latest version

* Replaced dismissDialog() with dialog.Dismiss()

* Fixed wrong string resource usage.
This commit is contained in:
Hawk of the Death
2020-04-23 03:23:23 +02:00
committed by GitHub
parent c967308859
commit f7c139030f
18 changed files with 550 additions and 18 deletions

View File

@@ -29,3 +29,16 @@ fun Long.toDateKey(): Date {
cal[Calendar.MILLISECOND] = 0
return cal.time
}
/**
* Convert epoch long to Calendar instance
*
* @return Calendar instance at supplied epoch time. Null if epoch was 0.
*/
fun Long.toCalendar(): Calendar? {
if (this == 0L)
return null
val cal = Calendar.getInstance()
cal.timeInMillis = this
return cal
}