A lazy loading ZoneRuleProvider for ThreeTenBp.

Overview

LazyThreeTenBp

A lazy loading ZoneRuleProvider for ThreeTenBp.

Usage

You have to initialize LazyThreeTenBp as early as possible, before your code accesses any threetenbp class. Usually the best place is in your Application.onCreate() method:

@Override
public void onCreate() {
    super.onCreate();
    LazyThreeTen.init(this);
}

Afterwards you can call LazyThreeTen.cacheZones() on a background thread to cache the timezone information without blocking the startup of your app. If you decide not to do that the individual timezones will be loaded on demand when they are accessed for the first time.

Download

Add a Gradle dependency:

implementation "org.threeten:threetenbp:1.4.0:no-tzdb"
implementation "com.gabrielittner.threetenbp:lazythreetenbp:0.9.0"

Snapshots of the development version are available in Sonatype's snapshots repository.

Changes

Compiler

  • generate java code for list of all timezone ids
  • generate a separate .dat file for each zone
  • only support one timezone data version at a time (makes some things easier)

Runtime

  • custom ZoneRulesProvider
  • provides generated timezone id list
  • only reads timezone from assets/disk when that timezone was requested

Update tzdb data

  1. Check for the latest tzdb version at https://www.iana.org/time-zones
  2. Run ./gradlew processTzdb -PtzdbVersion=VERSION

License

Copyright 2017 Gabriel Ittner.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • Consider using `api` dependency on ThreeTenBP

    Consider using `api` dependency on ThreeTenBP

    I'm using a library in my app which has a dependency on org.threeten:threetenbp:1.3.4. After adding LazyThreeTenBP, my build broke with:

    Error:com.android.builder.merge.DuplicateRelativeFileException: More than one file was found with OS independent path 'org/threeten/bp/format/ChronologyText.properties'

    After investigating, it seems that LazyThreeTenBP has a compile dependency on treetenbp's no-tzdb artifact, which breaks my dependency resolution and results in both artifacts being bundled. I can easily fix this by excluding that library's dependency, but it might be nicer if LazyThreeTenBP had an api dependency on ThreeTenBP instead, and relied on the app to depend on it explicitly.

    opened by chrisbanes 3
  • Implemented AndroidDateTimeTextProvider

    Implemented AndroidDateTimeTextProvider

    Implemented custom DateTimeTextProvider to use Android-specific features in SimpleDateFormat to improve Narrow and Standalone text styles of months and days of week. Uses https://github.com/ThreeTen/threetenbp/issues/69 Fixes https://github.com/ThreeTen/threetenbp/issues/55 for Android users.

    opened by pamalyshev 3
  • Update tzdb to 2022b with corresponding GeneratedZoneIdsProvider fix

    Update tzdb to 2022b with corresponding GeneratedZoneIdsProvider fix

    Hi there,

    2022b has been released 2022-08-10 and its corresponding new rule could be effective as early as September 10th, 2022. We have rough 3 weeks to get the mobile code ready to avoid the surprises.

    Hence, I am creating this diff in the hope of getting a new release to support 2022b with the following changes

    1, Ported the generated data https://github.com/TonyTangAndroid/ticktock/pull/6 by manually executing the script added in https://github.com/TonyTangAndroid/ticktock/pull/7.

    This is the major changes in this pull request.

    2, Manually updated GeneratedZoneIdsProvider to 2022b with its new zone ids. I have created an independent pull request on my forked repo. https://github.com/TonyTangAndroid/lazythreetenbp/pull/2/files

    3, Update the CHANGELOG.md to reflect the 2022b update. Hopefully, this could minimize the friction to release out a new version.

    Feel free to add any comments and I will address it within 12 hours.

    Best regards, Tony

    opened by TonyTangAndroid 2
  • Bump gradle from 3.5.3 to 3.6.3

    Bump gradle from 3.5.3 to 3.6.3

    Bumps gradle from 3.5.3 to 3.6.3.

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    Dependabot will merge this PR once CI passes on it, as requested by @gabrielittner.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 2
  • Bump gradle from 3.1.4 to 3.4.1

    Bump gradle from 3.1.4 to 3.4.1

    Bumps gradle from 3.1.4 to 3.4.1.

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Note: This repo was added to Dependabot recently, so you'll receive a maximum of 5 PRs for your first few update runs. Once an update run creates fewer than 5 PRs we'll remove that limit.

    You can always request more updates by clicking Bump now in your Dependabot dashboard.

    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot ignore this [patch|minor|major] version will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Pull request limits (per update run and/or open at any time)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)

    Finally, you can contact us by mentioning @dependabot.


    Dependabot has been acquired by GitHub  🎉

    dependencies 
    opened by dependabot-preview[bot] 2
  • Investigate performance impact of unused threetenbp ServiceLoader

    Investigate performance impact of unused threetenbp ServiceLoader

    org.threeten.bp.zone.ZoneRulesProvider tries to load available providers using ServiceLoader in a static initializer block. That's not needed on Android. From some quick measurements costs up to 20ms for doing nothing. The measurement was done by calling ZoneRulesProvider.getAvailableZoneIds() before the tz initialization (the method itself is basically a no-op in that case but triggers the block).

    https://github.com/ThreeTen/threetenbp/blob/master/src/main/java/org/threeten/bp/zone/ZoneRulesProvider.java#L84

    opened by gabrielittner 2
  • Update to latest version of tzdb

    Update to latest version of tzdb

    The 2022e tzdb version includes changes in Jordan and Syria. 2022f version includes changes to handling DST in Mexico

    The 2022e release of the tz code and data is available.
    This release reflects the following changes:
       Briefly:
         Jordan and Syria switch from +02/+03 with DST to year-round +03.
    
       Changes to future timestamps
    
         Jordan and Syria are abandoning the DST regime and are changing to
         permanent +03, so they will not fall back from +03 to +02 on
         2022-10-28.  (Thanks to Steffen Thorsen and Issam Al-Zuwairi.)
    
       Changes to past timestamps
    
         On 1922-01-01 Tijuana adopted standard time at 00:00, not 01:00.
    
       Changes to past time zone abbreviations and DST flags
    
         The temporary advancement of clocks in central Mexico in summer
         1931 is now treated as daylight saving time, instead of as two
         changes to standard time. 
    
    opened by kushalkadaba 1
  • Update 2022e

    Update 2022e

    Per the official announcement, 2022e has update certain timezone info that will be effective on 2022-10-28 for Jordan and Syria . Hence, sending this pull request to update it.

    The 2022e release of the tz code and data is available.
    This release reflects the following changes:
       Briefly:
         Jordan and Syria switch from +02/+03 with DST to year-round +03.
    
       Changes to future timestamps
    
         Jordan and Syria are abandoning the DST regime and are changing to
         permanent +03, so they will not fall back from +03 to +02 on
         2022-10-28.  (Thanks to Steffen Thorsen and Issam Al-Zuwairi.)
    
       Changes to past timestamps
    
         On 1922-01-01 Tijuana adopted standard time at 00:00, not 01:00.
    
       Changes to past time zone abbreviations and DST flags
    
         The temporary advancement of clocks in central Mexico in summer
         1931 is now treated as daylight saving time, instead of as two
         changes to standard time.
    
    opened by TonyTangAndroid 1
  • 2022b update

    2022b update

    2022b has been released 2022-08-10 and its corresponding new rule could be effective as early as September 10th, 2022. https://www.iana.org/time-zones

    opened by TonyTangAndroid 1
  • Wrong `GeneratedZoneIdsProvider` included in published artifact

    Wrong `GeneratedZoneIdsProvider` included in published artifact

    Hey 👋 I wasn't sure if the library is still maintained so I allowed myself to fork it and adjust it to my needs and I think I spotted an issue you should be aware of. It seems like the published artifact contains GeneratedZoneIdsProvider which comes from sources: https://github.com/gabrielittner/lazythreetenbp/blob/4fb246cfda99892133f0bcb154d7e75609048a27/runtime/src/main/java/com/gabrielittner/threetenbp/GeneratedZoneIdsProvider.java#L10 not the one generated by ticktock plugin under generated/ticktock 🤔

    Here's how the diff looks like: image doesn't seem significant, but it felt like worth reporting here. It isn't intended, right?

    opened by mateuszkwiecinski 1
  • Bump gradle from 4.0.1 to 4.2.2

    Bump gradle from 4.0.1 to 4.2.2

    Bumps gradle from 4.0.1 to 4.2.2.

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 1
Owner
Gabriel Ittner
Gabriel Ittner
Loading layout is a container view that manages easy switching between loading, completed and other states of your screen with a single line.

Loading layout is a container view that manages easy switching between loading, completed and other states of your screen with a single line.

ValarTech 16 Jul 5, 2022
Android loading view

Loading Loading is a poject with kinds of Android loading view. Yan can see the wiki for more detail. RotateLoading BookLoading NewtonCradleLoading Us

null 1.2k Jan 1, 2023
An animated circle loading view

Animated Circle Loading View A determiante/indetermiante loading view animation. Based on android-watch-loading-animation by Nils Banner. How it looks

José Luis Martín 1.2k Dec 7, 2022
Customizable bouncing dots for smooth loading effect. Mostly used in chat bubbles to indicate the other person is typing.

LoadingDots for Android Customizable bouncing dots view for smooth loading effect. Mostly used in chat bubbles to indicate the other person is typing.

Eyal Biran 162 Dec 2, 2022
An Android library providing to realize wave loading effect.

WaveLoadingView WaveLoadingView - An Android library that provides a realistic wave-loading effect. Sample Usage For a working implementation of this

Tang 1.7k Jan 2, 2023
A wave-like loading drawable

#WaveLoading This library provides a wave loading animation as a Drawable. How to use Add dependency: compile 'com.race604.waveloading:library:1.1.1'

吴晶 1.4k Dec 5, 2022
A loading animation based on Floating Action Button

FAB-Loading A loading animation based on Floating Action Button. Usage Include the LoadingView widget in your view: <io.saeid.fabloading.LoadingView

Saeed Masoumi 689 Oct 14, 2022
Some loading GIF .

Android GifLoadingView This project idea is from Link . Thanks for the idea. I like all the animation in that webpage , but it's so hard to develop al

Roger 1.3k Dec 12, 2022
MaterialLoadingProgressBar provide a styled ProgressBar which looks like SwipeRefreshLayout's loading indicator(support-v4 v21+)

MaterialLoadingProgressBar MaterialLoadingProgressBar provide a styled ProgressBar which looks like SwipeRefreshLayout's loading indicator(support-v4

lsjwzh 1.1k Nov 19, 2022
A highly configurable library to do loading progress with animated balls

Loading Balls A highly configurable library to do loading progress with animated balls for Android How to use Custom attributes lib:path="triangle" Th

Adrián Lomas 930 Dec 7, 2022
Cool bezier loading view

What's BezierLoadingView ? A cool loading view with Bezier and a smooth circular motion, Demo Features Bezier Circular motion ##Attributes name format

巴掌 828 Oct 10, 2022
ColoringLoading 4.7 0.0 Java This project provide Coloring Loading View for Android. And this project is not using the image file!

ColoringLoading ![Release](https://img.shields.io/github/release/recruit-lifestyle/ColoringLoading.svg?label=maven version) This project provide Color

Recruit Lifestyle Co. Ltd. 379 Jul 25, 2022
:seedling: A custom loading view for android, just like alipay.

#SmileyLoadingView A custom loading view, just like alipay. Usage Edit your layout XML: <cn.refactor.smileyloadingview.lib.SmileyLoadingView

null 411 Apr 24, 2022
Android loading animations

Android-SpinKit Android loading animations(I wrote a android edition according SpinKit) Demo Apk Preview Gradle Dependency dependencies { implement

ybq 8.4k Jan 5, 2023
KdLoadingView - A Custom Loading View for Android

KdLoadingView This is a circular loading view for android. Motivation In default progress view, its hard to change drawable, color and animation. So t

Saurabh kumar 1 Oct 26, 2022
Lazy load of images in Android

LazyList A simple library to display images in Android ListView. Images are being downloaded asynchronously in the background. Images are being cached

Fedor Vlasov 1.2k Nov 15, 2022
😴 Lazy and fluent syntactic sugar of Kotlin for initializing Android lifecycle-aware property.

?? Lazy and fluent syntactic sugar of Kotlin for initializing Android lifecycle-aware property.

Jaewoong Eum 347 Dec 9, 2022
Some beautiful android loading drawable, can be combined with any view as the LoadingView or the ProgressBar. Besides, some Drawable can customize the loading progress too.

LoadingDrawable: Android cool animation collection 前言 CircleRotate源码解析 Fish源码解析 LoadingDrawable is some android animations implement of drawable: a li

dinus_developer 4.1k Dec 27, 2022
Android loading or progress dialog widget library, provide efficient way to implement iOS like loading dialog and progress wheel

ACProgressLite English Version / 中文版本 An Android loading widget library. Lite and easy to use, strong customizability. Can be used to implement 'iOS'

Cloudist Technology Co., Ltd. 234 Nov 24, 2022
Loading layout is a container view that manages easy switching between loading, completed and other states of your screen with a single line.

Loading layout is a container view that manages easy switching between loading, completed and other states of your screen with a single line.

ValarTech 16 Jul 5, 2022