version:1.0.2

update:
bugfixes:取消天气背景显示
This commit is contained in:
2024-07-15 09:26:10 +08:00
parent b4fc904734
commit c815636e5e
9 changed files with 61 additions and 51 deletions

View File

@@ -118,19 +118,19 @@ public class ContactFragment extends BaseMvvmFragment<ContactViewModel, Fragment
public void onChanged(@Nullable WeatherNowBean.NowBaseBean nowBaseBean) {
mViewDataBinding.tvTemp.setText(nowBaseBean.getTemp() + "");
if (DayUtils.isNight()) {
mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather_night));
// mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather_night));
} else {
switch (nowBaseBean.getIcon()) {
default:
case "100":
case "150":
//晴
mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather));
// mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather));
break;
case "102":
case "152":
//少云
mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather_rain));
// mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather_rain));
break;
}
}
@@ -189,10 +189,10 @@ public class ContactFragment extends BaseMvvmFragment<ContactViewModel, Fragment
@Override
public void onChanged(List<Contact> contacts) {
if (contacts == null || contacts.size() == 0) {
mViewDataBinding.tvNoContact.setVisibility(View.VISIBLE);
mViewDataBinding.clNodata.setVisibility(View.VISIBLE);
mViewDataBinding.rvContact.setVisibility(View.GONE);
} else {
mViewDataBinding.tvNoContact.setVisibility(View.GONE);
mViewDataBinding.clNodata.setVisibility(View.GONE);
mViewDataBinding.rvContact.setVisibility(View.VISIBLE);
}
mContactAdapter.setContactList(contacts);

View File

@@ -818,13 +818,13 @@ public class CustomFragment extends BaseMvvmFragment<CustomViewModel, FragmentCu
case "102":
case "152":
if (DayUtils.isNight()) {
mViewDataBinding.clWeather.setBackground(ContextCompat.getDrawable(mContext, R.drawable.background_weather_sun));
// mViewDataBinding.clWeather.setBackground(ContextCompat.getDrawable(mContext, R.drawable.background_weather_sun));
} else {
mViewDataBinding.clWeather.setBackground(ContextCompat.getDrawable(mContext, R.drawable.background_weather_sun_night));
// mViewDataBinding.clWeather.setBackground(ContextCompat.getDrawable(mContext, R.drawable.background_weather_sun_night));
}
break;
default:
mViewDataBinding.clWeather.setBackground(ContextCompat.getDrawable(mContext, R.drawable.background_weather_rain));
// mViewDataBinding.clWeather.setBackground(ContextCompat.getDrawable(mContext, R.drawable.background_weather_rain));
}
} else {
//在此查看返回数据失败的原因

View File

@@ -230,19 +230,19 @@ public class HomeFragment extends BaseMvvmFragment<HomeViewModel, FragmentHomeBi
public void onChanged(@Nullable WeatherNowBean.NowBaseBean nowBaseBean) {
mViewDataBinding.tvTemp.setText(nowBaseBean.getTemp() + "");
if (DayUtils.isNight()) {
mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather_night));
// mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather_night));
} else {
switch (nowBaseBean.getIcon()) {
default:
case "100":
case "150":
//晴
mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather));
// mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather));
break;
case "102":
case "152":
//少云
mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather_rain));
// mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather_rain));
break;
}
}

View File

@@ -110,19 +110,19 @@ public class SettingsFragment extends BaseMvvmFragment<SettingsViewModel, Fragme
public void onChanged(@Nullable WeatherNowBean.NowBaseBean nowBaseBean) {
mViewDataBinding.tvTemp.setText(nowBaseBean.getTemp() + "");
if (DayUtils.isNight()) {
mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather_night));
// mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather_night));
} else {
switch (nowBaseBean.getIcon()) {
default:
case "100":
case "150":
//晴
mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather));
// mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather));
break;
case "102":
case "152":
//少云
mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather_rain));
// mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather_rain));
break;
}
}