Clime Tool API

Weather library for Java applications

Лицензия

Лицензия

Категории

Категории

CLI Взаимодействие с пользователем
Группа

Группа

com.github.malkomich
Идентификатор

Идентификатор

climet
Последняя версия

Последняя версия

1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

Clime Tool API
Weather library for Java applications
Ссылка на сайт

Ссылка на сайт

https://github.com/malkomich/climet
Система контроля версий

Система контроля версий

https://github.com/malkomich/climet

Скачать climet

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.malkomich/climet/ -->
<dependency>
    <groupId>com.github.malkomich</groupId>
    <artifactId>climet</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.malkomich/climet/
implementation 'com.github.malkomich:climet:1.0'
// https://jarcasting.com/artifacts/com.github.malkomich/climet/
implementation ("com.github.malkomich:climet:1.0")
'com.github.malkomich:climet:jar:1.0'
<dependency org="com.github.malkomich" name="climet" rev="1.0">
  <artifact name="climet" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.malkomich', module='climet', version='1.0')
)
libraryDependencies += "com.github.malkomich" % "climet" % "1.0"
[com.github.malkomich/climet "1.0"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.json : json jar 20140107

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11

Модули Проекта

Данный проект не имеет модулей.

Clime Tool for Java

Build Status

Overview

This is a Java library wich provides a powerful tool for getting weather information and forecasts from any city you request. The weather data comes from external APIs, like Open Weather Map.

You must to be careful using this dependency in an Android application, because you have to call ClimeT methods in an Async Task in order to avoid performing networking operations in the main thread. If you don't, you will get a NetworkOnMainThreadException.

Install

Gradle

	dependencies {
	    compile 'com.github.malkomich:climet:1.0'
	}

Maven

	<dependency>
	    <groupId>com.github.malkomich</groupId>
	    <artifactId>climet</artifactId>
	    <version>1.0</version>
	</dependency>

Usage

  • Getting current weather by a city name.
	CurrentWeatherData data = ClimeT.getCurrentWeather("London");
	City city = data.getCity();
	Weather weather = data.getWeather();

	// You have all weather information in the City and Weather objects.
	String state = weather.getState().getMain();
	float temp = weather.getTemp().getCurrentTemp(Weather.CELSIUS);

	System.out.println("The current weather in " + city.getName() + " is: " + state + ", with a temperature of "
			+ temp + "\u00b0.");
  • Getting hour forecast by coordinates.
	HourForecastData data = ClimeT.getHourForecast(51.51, -0.13);
	List<Weather> forecast = data.getForecast();

	Weather weather = forecast.get(2);
	Calendar date = weather.getDateTime();
	float speed = weather.getWind().getSpeed();
	int cloudiness = weather.getClouds().getCloudiness();

	System.out.println("The day " + sdf.format(date.getTime()) + " at " + date.get(Calendar.HOUR_OF_DAY)
			+ ", the wind will have a speed of " + speed + " m/s, and the percentage of cloudiness will be "
			+ cloudiness + "%.");
  • Getting date forecast by city.
	DateForecastData data = ClimeT.getDateForecast("London");
	List<Weather> forecast = data.getForecast();

	Weather weather1 = forecast.get(2);
	Calendar date1 = weather1.getDateTime();
	float rain = weather1.getRain().getValue();
	Weather weather2 = forecast.get(5);
	Calendar date2 = weather2.getDateTime();
	float snow = weather2.getSnow().getValue();

	String rainMessage = (rain > 0) ? (" there will be rainfall with a volume of " + rain + " l/m2")
			: " there won't be rainfall";
	String snowMessage = (snow > 0) ? (" there will be snowfall with a volume of " + snow + " l/m2.")
			: " there won't be snowfall.";

	System.out.println("In the day " + sdf.format(date1.getTime()) + rainMessage + ", and in the day "
			+ sdf.format(date2.getTime()) + snowMessage);

Версии библиотеки

Версия
1.0