Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Replace Joda-Time by Time4A #77

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Replace Joda-Time by Time4A #77

wants to merge 12 commits into from

Conversation

MenoData
Copy link

@MenoData MenoData commented Apr 8, 2018

This first step is a library switch from Joda-Time-Android to Time4A. It enables the project to exploit the astronomical features of Time4A in order to solve the issue #46 (calculating sunrise/sunset).

Two minor optimizations had also been done:

  • A project-wide unique clock instance had been introduced (PlatformClock) which also takes into account possible adjustments of mobile device clocks (done by app users as compensation for bad timezone data on old Android versions). The new clock logically replaces the Joda-method DateTimeUtils.currentTimeMillis()
  • Some method signatures in the class TimeZoneInfo had been enhanced by an extra moment-parameter in order to avoid multiple calls of current clock time inside the same method call.

Examples for calculating sunrise or sunset can be found in the documentation of class SolarTime.

@dasbiswajit
Copy link
Contributor

will check and do act accordingly.

@dasbiswajit dasbiswajit self-assigned this Apr 8, 2018
@arminha
Copy link
Owner

arminha commented Jul 18, 2018

Does this need changes in the proguard config to build properly?

@@ -109,7 +109,7 @@ dependencies{
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
compile 'com.android.support:support-v4:19.1.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'net.danlew:android.joda:2.9.4.1'
compile group: 'net.time4j', name: 'time4j-android', version: '3.41-2018d'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version should be updated to 3.44-2018e so at least two warnings or more of the travis build would disappear.

Copy link
Author

@MenoData MenoData Jul 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build complains mainly about two unresolved references to library class members. This problem is solved by the newer version 3.44-2018e. About Proguard: There is already a special consumer-proguard-file in the library. For example, let's look at the build note

Note: net.time4j.base.ResourceLoader calls '(net.time4j.base.ResourceLoader)Class.forName(variable).newInstance()'

This should not be a problem because the delivered proguard-file already keeps the class net.time4j.android.spi.AndroidResourceLoader, see also the file content.

@MenoData
Copy link
Author

MenoData commented Nov 2, 2018

Sorry for late update of this pull request but the latest commits have now solved the travis build error as predicted in my previous commit. Based on this change, sunrise/sunset-calculations are easy to be added to your app. In case of any questions about usage, just ask a question i.e. open an issue on the issue tracker of Time4J.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants