Skip to content

Commit

Permalink
Merge pull request #9 from heweather/feature-niu
Browse files Browse the repository at this point in the history
#comment 替换sdk  #PR
  • Loading branch information
QWRDA committed Jan 7, 2020
2 parents c21cce3 + f8c1c97 commit 56e5cef
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 37 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.heweather.owp"
minSdkVersion 19
targetSdkVersion 28
versionCode 2
versionName "1.0.1"
versionCode 3
versionName "1.0.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
Expand Down Expand Up @@ -83,9 +83,9 @@ dependencies {
implementation 'joda-time:joda-time:2.10'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.zhy:okhttputils:2.6.2'
implementation files('libs/sdk_HeWeather_Public_Android_V2.4.jar')
implementation files('libs/android-logging-log4j-1.0.3.jar')
implementation files('libs/log4j-1.2.17.jar')
implementation 'com.google.code.gson:gson:2.8.0'
implementation files('libs/AMap_Location_V4.0.1_20180426.jar')
implementation files('libs/HeWeather_Android_Common_V3.2.jar')
}
Binary file added app/libs/HeWeather_Android_Common_V3.2.jar
Binary file not shown.
Binary file removed app/libs/sdk_HeWeather_Public_Android_V2.4.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
import com.heweather.owp.utils.ContentUtil;
import com.heweather.owp.utils.SpUtils;

import java.util.List;

import interfaces.heweather.com.interfacesmodule.bean.Code;
import interfaces.heweather.com.interfacesmodule.bean.Lang;
import interfaces.heweather.com.interfacesmodule.bean.Unit;
import interfaces.heweather.com.interfacesmodule.bean.air.now.AirNow;
import interfaces.heweather.com.interfacesmodule.bean.alarm.Alarm;
import interfaces.heweather.com.interfacesmodule.bean.alarm.AlarmList;
import interfaces.heweather.com.interfacesmodule.bean.search.Search;
import interfaces.heweather.com.interfacesmodule.bean.weather.forecast.Forecast;
import interfaces.heweather.com.interfacesmodule.bean.weather.hourly.Hourly;
Expand Down Expand Up @@ -55,9 +54,11 @@ public void onError(Throwable throwable) {
}

@Override
public void onSuccess(List<Now> list) {
weatherInterface.getWeatherNow(list.get(0));
SpUtils.saveBean(context, "weatherNow", list.get(0));
public void onSuccess(Now list) {
if (Code.OK.getCode().equalsIgnoreCase(list.getStatus())) {
weatherInterface.getWeatherNow(list);
SpUtils.saveBean(context, "weatherNow", list);
}
}
});

Expand All @@ -76,11 +77,12 @@ public void onError(Throwable throwable) {
}

@Override
public void onSuccess(List<Forecast> list) {
weatherInterface.getWeatherForecast(list.get(0));
getAirForecast(location);
SpUtils.saveBean(context, "weatherForecast", list.get(0));

public void onSuccess(Forecast list) {
if (Code.OK.getCode().equalsIgnoreCase(list.getStatus())) {
weatherInterface.getWeatherForecast(list);
getAirForecast(location);
SpUtils.saveBean(context, "weatherForecast", list);
}
}
});
}
Expand All @@ -95,10 +97,13 @@ public void onError(Throwable throwable) {
}

@Override
public void onSuccess(List<Alarm> list) {
weatherInterface.getAlarm(list.get(0));
SpUtils.saveBean(context, "alarm", list.get(0));
public void onSuccess(AlarmList alarmList) {
if (Code.OK.getCode().equalsIgnoreCase(alarmList.getStatus())) {
weatherInterface.getAlarm(alarmList.getAlarms().get(0));
SpUtils.saveBean(context, "alarm", alarmList);
}
}

});
}

Expand All @@ -112,10 +117,11 @@ public void onError(Throwable throwable) {
}

@Override
public void onSuccess(List<AirNow> list) {
AirNow airNow = list.get(0);
weatherInterface.getAirNow(airNow);
SpUtils.saveBean(context, "airNow", airNow);
public void onSuccess(AirNow list) {
if (Code.OK.getCode().equalsIgnoreCase(list.getStatus())) {
weatherInterface.getAirNow(list);
SpUtils.saveBean(context, "airNow", list);
}
}
});
}
Expand All @@ -140,9 +146,10 @@ public void onError(Throwable throwable) {
}

@Override
public void onSuccess(List<AirNow> list) {
AirNow airNow = list.get(0);
weatherInterface.getAirNow(airNow);
public void onSuccess(AirNow airNow) {
if (Code.OK.getCode().equalsIgnoreCase(airNow.getStatus())) {
weatherInterface.getAirNow(airNow);
}
}
});
}
Expand Down Expand Up @@ -178,9 +185,11 @@ public void onError(Throwable throwable) {
}

@Override
public void onSuccess(List<Hourly> list) {
weatherInterface.getWeatherHourly(list.get(0));
SpUtils.saveBean(context, "weatherHourly", list.get(0));
public void onSuccess(Hourly list) {
if (Code.OK.getCode().equalsIgnoreCase(list.getStatus())) {
weatherInterface.getWeatherHourly(list);
SpUtils.saveBean(context, "weatherHourly", list);
}
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.ArrayList;
import java.util.List;

import interfaces.heweather.com.interfacesmodule.bean.Code;
import interfaces.heweather.com.interfacesmodule.bean.Lang;
import interfaces.heweather.com.interfacesmodule.bean.basic.Basic;
import interfaces.heweather.com.interfacesmodule.bean.search.Search;
Expand Down Expand Up @@ -260,15 +261,17 @@ public void onError(Throwable throwable) {
}

@Override
public void onSuccess(List<Now> list) {
NowBase now = list.get(0).getNow();
condCode = now.getCond_code();
DateTime nowTime = DateTime.now();
int hourOfDay = nowTime.getHourOfDay();
if (hourOfDay > 6 && hourOfDay < 19) {
ivBack.setImageResource(IconUtils.getDayBack(condCode));
} else {
ivBack.setImageResource(IconUtils.getNightBack(condCode));
public void onSuccess(Now list) {
if (Code.OK.getCode().equalsIgnoreCase(list.getStatus())) {
NowBase now = list.getNow();
condCode = now.getCond_code();
DateTime nowTime = DateTime.now();
int hourOfDay = nowTime.getHourOfDay();
if (hourOfDay > 6 && hourOfDay < 19) {
ivBack.setImageResource(IconUtils.getDayBack(condCode));
} else {
ivBack.setImageResource(IconUtils.getNightBack(condCode));
}
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import android.view.ViewGroup;
import android.widget.GridLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

Expand Down

0 comments on commit 56e5cef

Please sign in to comment.