Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewritten to use OkHttp and a new NWS API
- Loading branch information
1 parent
843e26d
commit 8ae3487
Showing
31 changed files
with
486 additions
and
493 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,17 +1,18 @@ | |||
apply plugin: 'com.android.application' | apply plugin: 'com.android.application' | ||
|
|
||
dependencies { | dependencies { | ||
compile 'com.android.support:support-v4:24.2.0' | compile 'com.android.support:support-compat:26.0.0' | ||
compile 'com.squareup.picasso:picasso:2.4.0' | compile 'com.squareup.picasso:picasso:2.5.2' | ||
compile 'com.squareup.okhttp3:okhttp:3.4.1' | compile 'com.squareup.retrofit2:converter-gson:2.3.0' | ||
compile 'com.squareup.okhttp3:okhttp:3.8.1' | |||
} | } | ||
|
|
||
android { | android { | ||
compileSdkVersion 24 | compileSdkVersion 26 | ||
buildToolsVersion "25.0.3" | buildToolsVersion "26.0.1" | ||
|
|
||
defaultConfig { | defaultConfig { | ||
minSdkVersion 14 | minSdkVersion 15 | ||
targetSdkVersion 24 | targetSdkVersion 26 | ||
} | } | ||
} | } |
44 changes: 13 additions & 31 deletions
44
...ommonsware/android/weather2/Forecast.java → ...nsware/android/weather2/NWSInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,45 +1,27 @@ | |||
/*** | /*** | ||
Copyright (c) 2008-2012 CommonsWare, LLC | Copyright (c) 2013-2016 CommonsWare, LLC | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not | 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 | 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 | 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 | by applicable law or agreed to in writing, software distributed under the | ||
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS | 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 | OF ANY KIND, either express or implied. See the License for the specific | ||
language governing permissions and limitations under the License. | language governing permissions and limitations under the License. | ||
Covered in detail in the book _The Busy Coder's Guide to Android Development_ | Covered in detail in the book _The Busy Coder's Guide to Android Development_ | ||
https://commonsware.com/Android | https://commonsware.com/Android | ||
*/ | */ | ||
|
|
||
package com.commonsware.android.weather2; | package com.commonsware.android.weather2; | ||
|
|
||
class Forecast { | import retrofit2.Call; | ||
String time=""; | import retrofit2.http.GET; | ||
Integer temp=null; | import retrofit2.http.Headers; | ||
String iconUrl=""; | import retrofit2.http.Path; | ||
|
|||
String getTime() { | |||
return(time); | |||
} | |||
|
|
||
void setTime(String time) { | public interface NWSInterface { | ||
this.time=time.substring(0,16).replace('T', ' '); | @Headers("Accept: application/geo+json") | ||
} | @GET("/points/{lat},{lon}/forecast") | ||
|
Call<WeatherResponse> getForecast(@Path("lat") double latitude, | ||
Integer getTemp() { | @Path("lon") double longitude); | ||
return(temp); | |||
} | |||
|
|||
void setTemp(Integer temp) { | |||
this.temp=temp; | |||
} | |||
|
|||
String getIcon() { | |||
return(iconUrl); | |||
} | |||
|
|||
void setIcon(String iconUrl) { | |||
this.iconUrl=iconUrl; | |||
} | |||
} | } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.