| | |
| | | import android.app.Application; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.lifecycle.LiveData; |
| | | import androidx.lifecycle.MutableLiveData; |
| | | |
| | | import com.android.app_base.base.StateViewEnum; |
| | | import com.android.app_base.base.viewmodel.BaseViewModel; |
| | | import com.android.app_base.http.ResultData; |
| | | import com.android.app_base.utils.RxUtils; |
| | | import com.application.zhangshi_app_android.bean.FamilyAssetsBean; |
| | | import com.application.zhangshi_app_android.bean.FamilyAssetsResponseBean; |
| | | import com.application.zhangshi_app_android.bean.HomeDevicesBean; |
| | | import com.application.zhangshi_app_android.bean.HomeDevicesResponseBean; |
| | | import com.application.zhangshi_app_android.data.DataRepository; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | |
| | | } |
| | | |
| | | public void getHomeDevices(){ |
| | | List<HomeDevicesBean> list = new ArrayList<>(); |
| | | list.add(new HomeDevicesBean(1,"电视","2023-04-03","张三","夏普液晶电视","客厅","4k超高清","")); |
| | | list.add(new HomeDevicesBean(1,"电视","2023-04-02","张三","夏普液晶电视","客厅","4k超高清","")); |
| | | list.add(new HomeDevicesBean(1,"电视","2023-04-01","张三","夏普液晶电视","客厅","4k超高清","")); |
| | | if (list != null && !list.isEmpty()){ |
| | | dataListLiveData.postValue(list); |
| | | return; |
| | | } |
| | | model.getHomeDevices(new HashMap<>()) |
| | | .compose(RxUtils.schedulersTransformer()) |
| | | .subscribe(new Observer<ResultData<HomeDevicesResponseBean>>() { |
| | |
| | | Date date1 = null; |
| | | Date date2 = null; |
| | | try { |
| | | date1 = format.parse(o1.getCreateTime()); |
| | | date2 = format.parse(o2.getCreateTime()); |
| | | date1 = format.parse(o1.getCreateDate()); |
| | | date2 = format.parse(o2.getCreateDate()); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |