Skip to content

Commit

Permalink
Merge pull request #54 from CaptainHuangsh/26-fix-one-modoule
Browse files Browse the repository at this point in the history
暂时更改了时间的显示,准备发布更新
  • Loading branch information
CaptainHuangsh authored May 11, 2017
2 parents 122d358 + e2356a3 commit cae9967
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,19 @@ public HourlyWeatherHolder(View itemView, ArrayList<HourlyForecast> hourlyForeca
public void bind(ArrayList<HourlyForecast> hourlyForecastList) {
try {
for (int i = 0; i < hourlyForecastList.size(); i++) {
String mDate = hourlyForecastList.get(i).getDate();
hourlyClock[i].setText(mDate.substring(mDate.length() - 5
,mDate.length()));//截取时间,不需要日期
hourlyTemp[i].setText(String.format("%s℃",hourlyForecastList.get(i).getTmp()));
hourlyHumidity[i].setText(String.format("%s%%",hourlyForecastList.get(i).getHum()));
hourlyWind[i].setText(String.format("%sKm/h",hourlyForecastList.get(i).getSpd()));
if (i == 0) {
hourlyClock[i].setText("时间");
hourlyTemp[i].setText("温度");
hourlyHumidity[i].setText("湿度");
hourlyWind[i].setText("风力");
} else {
String mDate = hourlyForecastList.get(i).getDate();
hourlyClock[i].setText(mDate.substring(mDate.length() - 5
, mDate.length()));//截取时间,不需要日期
hourlyTemp[i].setText(String.format("%s℃", hourlyForecastList.get(i).getTmp()));
hourlyHumidity[i].setText(String.format("%s%%", hourlyForecastList.get(i).getHum()));
hourlyWind[i].setText(String.format("%sKm/h", hourlyForecastList.get(i).getSpd()));
}
}
} catch (Exception e) {

Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/layout/items_hour_forecasts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
android:paddingBottom="16dp"
android:paddingTop="16dp">
<TextView
android:layout_marginLeft="16dp"
android:id="@+id/hourly_clock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand All @@ -17,6 +18,7 @@
tools:text="16:00" />
<!--android:drawableStart="@drawable/icon_time"-->
<TextView
android:layout_marginLeft="16dp"
android:id="@+id/hourly_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand All @@ -26,6 +28,7 @@
tools:text="16°" />
<!--android:drawableStart="@drawable/icon_temp"-->
<TextView
android:layout_marginLeft="16dp"
android:id="@+id/hourly_humidity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand All @@ -35,6 +38,7 @@
tools:text="81%" />
<!--android:drawableStart="@drawable/icon_humidity"-->
<TextView
android:layout_marginLeft="16dp"
android:id="@+id/hourly_wind"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down

0 comments on commit cae9967

Please sign in to comment.