Skip to content

Commit 9c1bb64

Browse files
committed
Merge remote-tracking branch 'github/master'
2 parents 6b42f08 + 17060a5 commit 9c1bb64

File tree

1 file changed

+138
-0
lines changed

1 file changed

+138
-0
lines changed

README.md

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
2+
3+
4+
Easy Weather
5+
==========
6+
----------
7+
[![Bintray](https://img.shields.io/badge/Bintray-v1.0.0-brightgreen.svg)](https://bintray.com/code-crusher/maven/EasyWeather)
8+
<a href="http://www.methodscount.com/?lib=com.github.dextorer%3Asofa%3A1.0.0"><img src="https://img.shields.io/badge/Methods and size-core: 817 | 105 KB-e91e63.svg"/></a>
9+
<a href="http://twitter.com/vatsal__bajpai"><img src="https://img.shields.io/badge/Twitter-@vatsal__bajpai-blue.svg?style=flat" alt="Twitter" data-canonical-src="https://img.shields.io/badge/Twitter-@vatsal__bajpai-blue.svg?style=flat" style="max-width:100%;"></a><br>
10+
11+
Easy and quick weather fetching from [OpenWeatherMap](openweathermap.org) API for Android.
12+
13+
#Integration
14+
-------------
15+
16+
- **EasyWeather** is available in the MavenCentral, so getting it as simple as adding it in `dependencies` of your `build.gradle`:
17+
18+
```gradle
19+
compile 'github.vatsal.easyweather:library:1.0.0'
20+
```
21+
22+
#Usage
23+
First you would need `API_KEY` from [OpenWeatherMap](openweathermap.org) and place it in your `build.gradle`
24+
```gradle
25+
buildTypes.each {
26+
it.buildConfigField 'String', 'OWM_API_KEY', "\"API_KEY\""
27+
}
28+
```
29+
First create `WeatherMap` object:
30+
```Java
31+
WeatherMap weatherMap = new WeatherMap(this, OWM_API_KEY);
32+
```
33+
To get **Current Weather** use this in `Activity`:
34+
35+
**By City Name**:
36+
```Java
37+
weatherMap.getCityWeather(city, new WeatherCallback() {
38+
@Override
39+
public void success(WeatherResponseModel response) {
40+
Weather weather[] = response.getWeather();
41+
String weatherMain = weather[0].getMain();
42+
Double temperature = TempUnitConverter.convertToCelsius(response.getMain().getTemp());
43+
String location = response.getName();
44+
45+
String humidity= response.getMain().getHumidity();
46+
String pressure = response.getMain().getPressure();
47+
String windSpeed = response.getWind().getSpeed();
48+
49+
String iconLink = weather[0].getIconLink();
50+
}
51+
```
52+
**By Location Coordinates**:
53+
```Java
54+
weatherMap.getLocationWeather(latitude, longitude, new WeatherCallback() {
55+
@Override
56+
public void success(WeatherResponseModel response) {
57+
58+
}
59+
60+
@Override
61+
public void failure(String message) {
62+
63+
}
64+
});
65+
```
66+
To get **Forecast** use this in `Activity` also you need specify `index` to get the specific hour of [3 hour Forecast](http://openweathermap.org/forecast5):
67+
68+
**By City Name:**
69+
70+
```Java
71+
weatherMap.getCityForecast(city, new ForecastCallback() {
72+
@Override
73+
public void success(ForecastResponseModel response) {
74+
75+
Weather weather[] = response.getList()[index].getWeather();
76+
}
77+
78+
@Override
79+
public void failure(String message) {
80+
81+
}
82+
});
83+
```
84+
85+
86+
**By Location Coordinates:**
87+
88+
```Java
89+
weatherMap.getLocationForecast(latitude, longitude, new ForecastCallback() {
90+
@Override
91+
public void success(ForecastResponseModel response) {
92+
93+
}
94+
95+
@Override
96+
public void failure(String message) {
97+
98+
}
99+
});
100+
```
101+
102+
Variable | Type
103+
-------- | ---
104+
city | String
105+
index | int
106+
latitude | String
107+
longitude | String
108+
109+
Issues
110+
=====
111+
Feel free to submit issues and enhancement requests.
112+
113+
Contributing
114+
==========
115+
I would love to welcome contributions and support from other developers. Please refer to each project's style guidelines and guidelines for submitting patches and additions. In general, i follow the "fork-and-pull" Git workflow.
116+
117+
1. **Fork** the repo on GitHub.
118+
2. **Clone** the project to your own machine.
119+
3. **Commit** changes to **development** branch.
120+
4. **Push** your work back up to your fork.
121+
5. Submit a **Pull request** so that i can review your changes
122+
NOTE: Be sure to merge the latest from "upstream" before making a pull request!
123+
124+
#License
125+
126+
> Copyright 2016 Vatsal Bajpai
127+
128+
>Licensed under the Apache License, Version 2.0 (the "License");
129+
you may not use this file except in compliance with the License.
130+
You may obtain a copy of the License at
131+
132+
> http://www.apache.org/licenses/LICENSE-2.0
133+
134+
>Unless required by applicable law or agreed to in writing, software
135+
distributed under the License is distributed on an "AS IS" BASIS,
136+
>WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
137+
>See the License for the specific language governing permissions and
138+
>limitations under the License.

0 commit comments

Comments
 (0)