version:
fix: update:优化类名,准备修复闹钟问题
This commit is contained in:
@@ -18,8 +18,6 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.jeremyliao.liveeventbus.LiveEventBus;
|
||||
import com.qweather.sdk.bean.weather.WeatherDailyBean;
|
||||
import com.qweather.sdk.bean.weather.WeatherHourlyBean;
|
||||
import com.qweather.sdk.bean.weather.WeatherNowBean;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xxpatx.os.R;
|
||||
@@ -35,13 +33,9 @@ import com.xxpatx.os.config.CommonConfig;
|
||||
import com.xxpatx.os.databinding.FragmentContactHomeBinding;
|
||||
import com.xxpatx.os.dialog.EditContactDialog;
|
||||
import com.xxpatx.os.utils.DayUtils;
|
||||
import com.xxpatx.os.utils.ScreenUtils;
|
||||
import com.xxpatx.os.utils.TimeUtils;
|
||||
import com.xxpatx.os.view.EquallyDividedItemDecoration;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class ContactFragment extends BaseMvvmFragment<ContactViewModel, FragmentContactHomeBinding> {
|
||||
@@ -139,63 +133,63 @@ public class ContactFragment extends BaseMvvmFragment<ContactViewModel, Fragment
|
||||
}
|
||||
});
|
||||
|
||||
LiveEventBus
|
||||
.get("getWeather24HourlyKey", WeatherHourlyBean.HourlyBean.class)
|
||||
.observe(this, new Observer<WeatherHourlyBean.HourlyBean>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable WeatherHourlyBean.HourlyBean hourlyBean) {
|
||||
String imageName = "he" + hourlyBean.getIcon();
|
||||
Log.e(TAG, "onSuccess: " + imageName);
|
||||
if (isAdded()) {
|
||||
int resId = getResources().getIdentifier(imageName, "drawable", mContext.getPackageName());
|
||||
// Log.e(TAG, "onSuccess: " + resId);
|
||||
// if (resId == 0) {
|
||||
// mViewDataBinding.ivPic.setImageDrawable(mContext.getDrawable(R.drawable.he100));
|
||||
// } else {
|
||||
// mViewDataBinding.ivPic.setImageDrawable(mContext.getDrawable(resId));
|
||||
// }
|
||||
mViewDataBinding.tvTemp.setText(hourlyBean.getTemp() + "℃");
|
||||
}
|
||||
}
|
||||
});
|
||||
// LiveEventBus
|
||||
// .get("getWeather24HourlyKey", WeatherHourlyBean.HourlyBean.class)
|
||||
// .observe(this, new Observer<WeatherHourlyBean.HourlyBean>() {
|
||||
// @Override
|
||||
// public void onChanged(@Nullable WeatherHourlyBean.HourlyBean hourlyBean) {
|
||||
// String imageName = "he" + hourlyBean.getIcon();
|
||||
// Log.e(TAG, "onSuccess: " + imageName);
|
||||
// if (isAdded()) {
|
||||
// int resId = getResources().getIdentifier(imageName, "drawable", mContext.getPackageName());
|
||||
//// Log.e(TAG, "onSuccess: " + resId);
|
||||
//// if (resId == 0) {
|
||||
//// mViewDataBinding.ivPic.setImageDrawable(mContext.getDrawable(R.drawable.he100));
|
||||
//// } else {
|
||||
//// mViewDataBinding.ivPic.setImageDrawable(mContext.getDrawable(resId));
|
||||
//// }
|
||||
// mViewDataBinding.tvTemp.setText(hourlyBean.getTemp() + "℃");
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// LiveEventBus
|
||||
// .get("getWeather7DKey", WeatherDailyBean.DailyBean.class)
|
||||
// .observe(this, new Observer<WeatherDailyBean.DailyBean>() {
|
||||
// @Override
|
||||
// public void onChanged(@Nullable WeatherDailyBean.DailyBean dailyBean) {
|
||||
// mViewDataBinding.tvWeather.setText(dailyBean.getTempMin() + "℃ - " + dailyBean.getTempMax() + "℃");
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// LiveEventBus
|
||||
// .get("time", String.class)
|
||||
// .observe(this, new Observer<String>() {
|
||||
// @Override
|
||||
// public void onChanged(@Nullable String s) {
|
||||
// mViewDataBinding.tvTime.setText(s);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// LiveEventBus
|
||||
// .get("date", String.class)
|
||||
// .observe(this, new Observer<String>() {
|
||||
// @Override
|
||||
// public void onChanged(@Nullable String s) {
|
||||
// mViewDataBinding.tvData.setText(s);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// LiveEventBus
|
||||
// .get("week", String.class)
|
||||
// .observe(this, new Observer<String>() {
|
||||
// @Override
|
||||
// public void onChanged(@Nullable String s) {
|
||||
// mViewDataBinding.tvWeek.setText(s);
|
||||
// }
|
||||
// });
|
||||
|
||||
LiveEventBus
|
||||
.get("getWeather7DKey", WeatherDailyBean.DailyBean.class)
|
||||
.observe(this, new Observer<WeatherDailyBean.DailyBean>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable WeatherDailyBean.DailyBean dailyBean) {
|
||||
mViewDataBinding.tvWeather.setText(dailyBean.getTempMin() + "℃ - " + dailyBean.getTempMax() + "℃");
|
||||
}
|
||||
});
|
||||
|
||||
LiveEventBus
|
||||
.get("time", String.class)
|
||||
.observe(this, new Observer<String>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable String s) {
|
||||
mViewDataBinding.tvTime.setText(s);
|
||||
}
|
||||
});
|
||||
|
||||
LiveEventBus
|
||||
.get("date", String.class)
|
||||
.observe(this, new Observer<String>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable String s) {
|
||||
mViewDataBinding.tvData.setText(s);
|
||||
}
|
||||
});
|
||||
|
||||
LiveEventBus
|
||||
.get("week", String.class)
|
||||
.observe(this, new Observer<String>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable String s) {
|
||||
mViewDataBinding.tvWeek.setText(s);
|
||||
}
|
||||
});
|
||||
|
||||
mViewModel.getContactList().observe(this, new Observer<List<Contact>>() {
|
||||
mViewModel.getContactListData().observe(this, new Observer<List<Contact>>() {
|
||||
@Override
|
||||
public void onChanged(List<Contact> contacts) {
|
||||
if (contacts == null || contacts.size() == 0) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.xxpatx.os.bean.BaseResponse;
|
||||
import com.xxpatx.os.bean.Contact;
|
||||
import com.xxpatx.os.config.CommonConfig;
|
||||
import com.xxpatx.os.databinding.FragmentContactHomeBinding;
|
||||
import com.xxpatx.os.db.ContactCacheUtils;
|
||||
import com.xxpatx.os.gson.GsonUtils;
|
||||
import com.xxpatx.os.network.NetInterfaceManager;
|
||||
import com.xxpatx.os.network.UrlAddress;
|
||||
@@ -40,10 +41,10 @@ public class ContactViewModel extends BaseViewModel<FragmentContactHomeBinding,
|
||||
|
||||
}
|
||||
|
||||
private MutableLiveData<List<Contact>> mContactList = new MutableLiveData<>();
|
||||
private MutableLiveData<List<Contact>> mContactListData = new MutableLiveData<>();
|
||||
|
||||
public MutableLiveData<List<Contact>> getContactList() {
|
||||
return mContactList;
|
||||
public MutableLiveData<List<Contact>> getContactListData() {
|
||||
return mContactListData;
|
||||
}
|
||||
|
||||
public void getCacheContact() {
|
||||
@@ -54,7 +55,8 @@ public class ContactViewModel extends BaseViewModel<FragmentContactHomeBinding,
|
||||
if (!TextUtils.isEmpty(jsonString)) {
|
||||
List<Contact> contacts = gson.fromJson(jsonString, type);
|
||||
if (contacts != null) {
|
||||
mContactList.setValue(contacts);
|
||||
contacts.addAll(ContactCacheUtils.getInstance().getDatabaseContact());
|
||||
mContactListData.setValue(contacts);
|
||||
}
|
||||
}
|
||||
getContact();
|
||||
@@ -75,10 +77,10 @@ public class ContactViewModel extends BaseViewModel<FragmentContactHomeBinding,
|
||||
Log.e("getContactList", "onNext: " + listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
mMMKV.putString(UrlAddress.GET_MAIL_LIST, GsonUtils.toJSONString(listBaseResponse.data));
|
||||
mContactList.setValue(listBaseResponse.data);
|
||||
mContactListData.setValue(listBaseResponse.data);
|
||||
} else {
|
||||
mMMKV.putString(UrlAddress.GET_MAIL_LIST, "");
|
||||
mContactList.setValue(new ArrayList<>());
|
||||
mContactListData.setValue(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,9 +93,10 @@ public class ContactViewModel extends BaseViewModel<FragmentContactHomeBinding,
|
||||
}.getType();
|
||||
List<Contact> contacts = gson.fromJson(jsonString, type);
|
||||
if (contacts == null) {
|
||||
mContactList.setValue(new ArrayList<>());
|
||||
mContactListData.setValue(ContactCacheUtils.getInstance().getDatabaseContact());
|
||||
} else {
|
||||
mContactList.setValue(contacts);
|
||||
contacts.addAll(ContactCacheUtils.getInstance().getDatabaseContact());
|
||||
mContactListData.setValue(contacts);
|
||||
}
|
||||
onComplete();
|
||||
}
|
||||
@@ -112,7 +115,7 @@ public class ContactViewModel extends BaseViewModel<FragmentContactHomeBinding,
|
||||
return mDeleteData;
|
||||
}
|
||||
|
||||
public void deleteContact(String id) {
|
||||
public void deleteContact(int id) {
|
||||
NetInterfaceManager.getInstance().getMailListDeleteObservable(id)
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
|
||||
@@ -111,7 +111,7 @@ public class ContactViewModel extends BaseViewModel<FragmentContactBinding, Frag
|
||||
return mDeleteData;
|
||||
}
|
||||
|
||||
public void deleteContact(String id) {
|
||||
public void deleteContact(int id) {
|
||||
NetInterfaceManager.getInstance().getMailListDeleteObservable(id)
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.xxpatx.os.fragment.settings;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@@ -15,30 +14,18 @@ import androidx.lifecycle.Observer;
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.jeremyliao.liveeventbus.LiveEventBus;
|
||||
import com.qweather.sdk.bean.weather.WeatherDailyBean;
|
||||
import com.qweather.sdk.bean.weather.WeatherHourlyBean;
|
||||
import com.qweather.sdk.bean.weather.WeatherNowBean;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xxpatx.os.BuildConfig;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.alarm.port.PortAlarmActivity;
|
||||
import com.xxpatx.os.activity.contact.AddWechatContactActivity;
|
||||
import com.xxpatx.os.activity.alarm.list.AlarmListActivity;
|
||||
import com.xxpatx.os.activity.dailyapp.DailyAppActivity;
|
||||
import com.xxpatx.os.activity.emergency.EmergencyActivity;
|
||||
import com.xxpatx.os.activity.setting.SettingActivity;
|
||||
import com.xxpatx.os.activity.weather.WeatherActivity;
|
||||
import com.xxpatx.os.base.mvvm.fragment.BaseMvvmFragment;
|
||||
import com.xxpatx.os.bean.MapBean;
|
||||
import com.xxpatx.os.config.CommonConfig;
|
||||
import com.xxpatx.os.databinding.FragmentHomeBinding;
|
||||
import com.xxpatx.os.databinding.FragmentSettingsBinding;
|
||||
import com.xxpatx.os.manager.AmapManager;
|
||||
import com.xxpatx.os.utils.ApkUtils;
|
||||
import com.xxpatx.os.utils.DayUtils;
|
||||
import com.xxpatx.os.utils.TimeUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
@@ -163,7 +150,7 @@ public class SettingsFragment extends BaseMvvmFragment<SettingsViewModel, Fragme
|
||||
}
|
||||
|
||||
public void openAlarmClock(View view) {
|
||||
startActivity(new Intent(mContext, PortAlarmActivity.class));
|
||||
startActivity(new Intent(mContext, AlarmListActivity.class));
|
||||
}
|
||||
|
||||
public void openEmergency(View view) {
|
||||
|
||||
Reference in New Issue
Block a user