37
37
38
38
import butterknife .BindView ;
39
39
import butterknife .ButterKnife ;
40
+ import butterknife .OnClick ;
40
41
import butterknife .Unbinder ;
41
42
42
43
public class HomePageFragment extends BaseFragment implements HomePageContract .View {
@@ -168,6 +169,13 @@ public void onResume() {
168
169
presenter .subscribe ();
169
170
}
170
171
172
+ @ OnClick (R .id .cv_aqi )
173
+ void onAQIClick () {
174
+
175
+ Toast .makeText (getActivity (), "点击了控制污染指数模块" , Toast .LENGTH_SHORT ).show ();
176
+ }
177
+
178
+
171
179
@ SuppressLint ("SetTextI18n" )
172
180
@ Override
173
181
public void displayWeatherInformation (Weather weather ) {
@@ -181,7 +189,8 @@ public void displayWeatherInformation(Weather weather) {
181
189
AirQualityLive airQualityLive = weather .getAirQualityLive ();
182
190
aqiIndicatorView .setIndicatorValue (airQualityLive .getAqi ());
183
191
adviceTextView .setText (airQualityLive .getAdvice ());
184
- cityRankTextView .setText (airQualityLive .getCityRank ());
192
+ String rank = airQualityLive .getCityRank ();
193
+ cityRankTextView .setText (TextUtils .isEmpty (rank ) ? "首要污染物: " + airQualityLive .getPrimary () : rank );
185
194
186
195
weatherDetails .clear ();
187
196
weatherDetails .addAll (createDetails (weather ));
@@ -206,7 +215,6 @@ private List<WeatherDetail> createDetails(Weather weather) {
206
215
details .add (new WeatherDetail (R .drawable .ic_index_sunscreen , "降水量" , weather .getWeatherLive ().getRain () + "mm" ));
207
216
details .add (new WeatherDetail (R .drawable .ic_index_sunscreen , "降水概率" , weather .getWeatherForecasts ().get (0 ).getPop () + "%" ));
208
217
details .add (new WeatherDetail (R .drawable .ic_index_sunscreen , "能见度" , weather .getWeatherForecasts ().get (0 ).getVisibility () + "km" ));
209
- // details.add(new WeatherDetail(R.drawable.ic_index_sport, "体感温度", ""));
210
218
return details ;
211
219
}
212
220
0 commit comments